test(tests/lean/run): show that nat has decidable equality using recursive equations

This commit is contained in:
Leonardo de Moura 2015-01-05 12:40:23 -08:00
parent fd332e411d
commit 0d84943d52

13
tests/lean/run/eq14.lean Normal file
View file

@ -0,0 +1,13 @@
open nat decidable
definition has_decidable_eq : ∀ a b : nat, decidable (a = b),
has_decidable_eq 0 0 := inl rfl,
has_decidable_eq (a+1) 0 := inr (λ h, nat.no_confusion h),
has_decidable_eq 0 (b+1) := inr (λ h, nat.no_confusion h),
has_decidable_eq (a+1) (b+1) :=
if H : a = b
then inl (eq.rec_on H rfl)
else inr (λ h : a+1 = b+1, nat.no_confusion h (λ e : a = b, absurd e H))
check has_decidable_eq
print definition has_decidable_eq