Skip to content

Conversation

LeifW
Copy link
Contributor

@LeifW LeifW commented Apr 25, 2018

On the existing notLTImpliesGTE - wasn't sure if there was a way I could use it (besides cribbing from its implementation), so I just implemented notLTEImpliesGT, so I could apply it to the disproof returned by isLTE, as in:

eitherLTEorGT : (i, j : Nat) -> Either (i `LTE` j) (i `GT` j)
eitherLTEorGT i j = case isLTE i j of
                         Yes lte => Left lte
                         No notLte => Right (notLTEImpliesGT notLte)

As for lteImpliesMax, I figure knowing which number is greater should enable you to say something about the maximum, or at least they should be related, somehow. I needed it for something I was working on.

isLTE (S k) (S j) with (isLTE k j)
isLTE (S k) (S j) | (Yes prf) = Yes (LTESucc prf)
isLTE (S k) (S j) | (No contra) = No (contra . fromLteSucc)
isLTE (S k) (S j) = case isLTE k j of

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for the change here? 😄

sucMinR Z = Refl
sucMinR (S l) = cong (sucMinR l)

||| If one number is biggre than another, you know what the maximum is.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a small typo biggre -> bigger

sucMinR (S l) = cong (sucMinR l)

||| If one number is biggre than another, you know what the maximum is.
total lteImpliesMax : i `LTE` j -> maximum i j = j

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be added to contrib instead of prelude?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants