Idris-dev/test/tutorial004/tutorial004.idr

58 lines
1.1 KiB
Idris
Raw Normal View History

2014-03-23 19:21:28 +04:00
fiveIsFive : 5 = 5
2014-09-23 11:45:24 +04:00
fiveIsFive = Refl
2014-03-23 19:21:28 +04:00
twoPlusTwo : 2 + 2 = 4
2014-09-23 11:45:24 +04:00
twoPlusTwo = Refl
2014-03-23 19:21:28 +04:00
total disjoint : (n : Nat) -> Z = S n -> Void
2014-03-23 19:21:28 +04:00
disjoint n p = replace {P = disjointTy} p ()
where
disjointTy : Nat -> Type
disjointTy Z = ()
disjointTy (S k) = Void
2014-03-23 19:21:28 +04:00
total acyclic : (n : Nat) -> n = S n -> Void
2014-03-23 19:21:28 +04:00
acyclic Z p = disjoint _ p
acyclic (S k) p = acyclic k (succInjective _ _ p)
empty1 : Void
2014-03-23 19:21:28 +04:00
empty1 = hd [] where
hd : List a -> a
hd (x :: xs) = x
empty2 : Void
2014-03-23 19:21:28 +04:00
empty2 = empty2
plusReduces : (n:Nat) -> plus Z n = n
2014-09-23 11:45:24 +04:00
plusReduces n = Refl
2014-03-23 19:21:28 +04:00
plusReducesZ : (n:Nat) -> n = plus n Z
2014-09-23 11:45:24 +04:00
plusReducesZ Z = Refl
2014-03-23 19:21:28 +04:00
plusReducesZ (S k) = cong (plusReducesZ k)
plusReducesS : (n:Nat) -> (m:Nat) -> S (plus n m) = plus n (S m)
2014-09-23 11:45:24 +04:00
plusReducesS Z m = Refl
2014-03-23 19:21:28 +04:00
plusReducesS (S k) m = cong (plusReducesS k m)
plusReducesZ' : (n:Nat) -> n = plus n Z
plusReducesZ' Z = ?plusredZ_Z
plusReducesZ' (S k) = let ih = plusReducesZ' k in
?plusredZ_S
---------- Proofs ----------
plusredZ_S = proof {
intro;
intro;
rewrite ih;
trivial;
}
plusredZ_Z = proof {
compute;
trivial;
}