on master help sign in
Merge pull request #3941 from ruippeixotog/if-not-lt-then-gte
b352960Ahmad Salim Al-Sibahi
libs/prelude/Prelude/Nat.idr+5
@@ -160,6 +160,11 @@ lteAddRight : (n : Nat) -> LTE n (plus n m)
160lteAddRight Z = LTEZero
160lteAddRight Z = LTEZero
161lteAddRight (S k) = LTESucc (lteAddRight k)
161lteAddRight (S k) = LTESucc (lteAddRight k)
162
162
163+||| If a number is not less than another, it is greater than or equal to it
164+notLTImpliesGTE : Not (LT a b) -> GTE a b
165+notLTImpliesGTE {b = Z} _ = LTEZero
166+notLTImpliesGTE {a = Z} {b = S k} notLt = absurd (notLt (LTESucc LTEZero))
167+notLTImpliesGTE {a = S k} {b = S j} notLt = LTESucc (notLTImpliesGTE (notLt . LTESucc))
163
168
164||| Boolean test than one Nat is less than or equal to another
169||| Boolean test than one Nat is less than or equal to another
165total lte : Nat -> Nat -> Bool
170total lte : Nat -> Nat -> Bool