test(tests/lean/run): show that nat has decidable equality using recursive equations
This commit is contained in:
parent
fd332e411d
commit
0d84943d52
1 changed files with 13 additions and 0 deletions
13
tests/lean/run/eq14.lean
Normal file
13
tests/lean/run/eq14.lean
Normal 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
|
Loading…
Reference in a new issue