on master help sign in
Prelude.Nat: add decision procedure for IsSucc

In case it's ever necessary.

commit42783ae62ed9d344a6a06fac58b93ffd761178b2 authorMichael Morgan <morgan.michael@me.com> dateSat 7 Oct 2017, 15:42 (9 years ago) parent92ed2d7
1 file changed+8
libs/prelude/Prelude/Nat.idr+8
libs/prelude/Prelude/Nat.idr+8
@@ -43,6 +43,14 @@ isSucc (S n) = True
4343data IsSucc : (n : Nat) -> Type where
4444 ItIsSucc : IsSucc (S n)
4545
46+Uninhabited (IsSucc Z) where
47+ uninhabited ItIsSucc impossible
48+
49+||| A decision procedure for `IsSucc`
50+isItSucc : (n : Nat) -> Dec (IsSucc n)
51+isItSucc Z = No absurd
52+isItSucc (S n) = Yes ItIsSucc
53+
4654--------------------------------------------------------------------------------
4755-- Basic arithmetic functions
4856--------------------------------------------------------------------------------