2020-10-06 15:09:02 +03:00
|
|
|
||| Implementing `Decidable.Order.Strict` for `Data.Nat.LT`
|
|
|
|
module Data.Nat.Order.Strict
|
|
|
|
|
2021-07-09 11:06:27 +03:00
|
|
|
import Data.Nat
|
2020-10-06 15:09:02 +03:00
|
|
|
import Decidable.Order.Strict
|
|
|
|
import Decidable.Equality
|
|
|
|
import Data.Nat.Order
|
|
|
|
|
2021-07-09 11:06:27 +03:00
|
|
|
%default total
|
|
|
|
|
|
|
|
public export
|
|
|
|
Irreflexive Nat LT where
|
|
|
|
irreflexive {x = 0} _ impossible
|
|
|
|
irreflexive {x = S _} (LTESucc prf) =
|
|
|
|
irreflexive {rel = Nat.LT} prf
|
2020-10-06 15:09:02 +03:00
|
|
|
|
2021-07-09 11:06:27 +03:00
|
|
|
public export
|
|
|
|
Transitive Nat LT where
|
|
|
|
transitive {x} {y} xy yz =
|
|
|
|
transitive {rel = LTE} (lteSuccRight xy) yz
|
|
|
|
|
|
|
|
public export
|
2020-10-06 15:09:02 +03:00
|
|
|
StrictPreorder Nat LT where
|
|
|
|
|
|
|
|
public export
|
|
|
|
decLT : (a, b : Nat) -> DecOrdering {lt = LT} a b
|
|
|
|
decLT 0 0 = DecEQ Refl
|
|
|
|
decLT 0 (S b) = DecLT (LTESucc LTEZero)
|
|
|
|
decLT (S a) 0 = DecGT (LTESucc LTEZero)
|
|
|
|
decLT (S a) (S b) = case decLT a b of
|
|
|
|
DecLT a_lt_b => DecLT (LTESucc a_lt_b)
|
|
|
|
DecEQ Refl => DecEQ Refl
|
|
|
|
DecGT b_lt_a => DecGT (LTESucc b_lt_a)
|
|
|
|
|
|
|
|
public export
|
|
|
|
StrictOrdered Nat LT where
|
|
|
|
order = decLT
|