Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add not LTE implies GT, and LTE implies maximum. #4428

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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? 😄

@@ -840,3 +846,9 @@ sucMinL (S l) = cong (sucMinL l)
total sucMinR : (l : Nat) -> minimum l (S l) = l
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

@@ -840,3 +846,9 @@ sucMinL (S l) = cong (sucMinL l)
total sucMinR : (l : Nat) -> minimum l (S l) = l
sucMinR Z = Refl
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