mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-03 20:42:13 +03:00
Merge pull request #905 from alebahn/master
Add public export to types/functions in Data.Fin.Order
This commit is contained in:
commit
3478297557
@ -10,23 +10,29 @@ import Decidable.Decidable
|
||||
import Decidable.Order
|
||||
|
||||
using (k : Nat)
|
||||
|
||||
public export
|
||||
data FinLTE : Fin k -> Fin k -> Type where
|
||||
FromNatPrf : {m, n : Fin k} -> LTE (finToNat m) (finToNat n) -> FinLTE m n
|
||||
|
||||
public export
|
||||
implementation Preorder (Fin k) FinLTE where
|
||||
transitive m n o (FromNatPrf p1) (FromNatPrf p2) =
|
||||
FromNatPrf (LTEIsTransitive (finToNat m) (finToNat n) (finToNat o) p1 p2)
|
||||
reflexive n = FromNatPrf (LTEIsReflexive (finToNat n))
|
||||
|
||||
public export
|
||||
implementation Poset (Fin k) FinLTE where
|
||||
antisymmetric m n (FromNatPrf p1) (FromNatPrf p2) =
|
||||
finToNatInjective m n (LTEIsAntisymmetric (finToNat m) (finToNat n) p1 p2)
|
||||
|
||||
public export
|
||||
implementation Decidable 2 [Fin k, Fin k] FinLTE where
|
||||
decide m n with (decideLTE (finToNat m) (finToNat n))
|
||||
decide m n | Yes prf = Yes (FromNatPrf prf)
|
||||
decide m n | No disprf = No (\ (FromNatPrf prf) => disprf prf)
|
||||
|
||||
public export
|
||||
implementation Ordered (Fin k) FinLTE where
|
||||
order m n =
|
||||
either (Left . FromNatPrf)
|
||||
|
Loading…
Reference in New Issue
Block a user