lean4-htt/tests/lean/run/def4.lean
2021-08-31 17:09:00 -07:00

23 lines
434 B
Text

inductive Foo : Bool → Type where
| Z : Foo false
| O : Foo false → Foo true
| E : Foo true → Foo false
open Foo
def toNat : {b : Bool} → Foo b → Nat
| _, Z => 0
| _, O n => toNat n + 1
| _, E n => toNat n + 1
example : toNat (E (O Z)) = 2 :=
rfl
example : toNat Z = 0 :=
rfl
example (a : Foo false) : toNat (O a) = toNat a + 1 :=
rfl
example (a : Foo true) : toNat (E a) = toNat a + 1 :=
rfl