Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

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

Open
LeifW wants to merge 2 commits intoidris-lang:masterfrom
LeifW:nat_gte
Open

Add not LTE implies GT, and LTE implies maximum.#4428
LeifW wants to merge 2 commits intoidris-lang:masterfrom
LeifW:nat_gte

Conversation

@LeifW
Copy link
Copy Markdown
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
Copy link
Copy Markdown

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.
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants