lean4-htt/tests/lean/run/def_brec1.lean
Leonardo de Moura 87932f1c56 feat(frontends/lean): change notation for inaccessible patterns
The following are accepted
 .(t)
 ._

We don't accept .t anymore because it will conflict with the field
access notation.
2017-03-28 16:09:15 -07:00

23 lines
415 B
Text

inductive foo : bool → Type
| Z : foo ff
| O : foo ff → foo tt
| E : foo tt → foo ff
open foo
definition to_nat : ∀ {b}, foo b → nat
| .(ff) Z := 0
| .(tt) (O n) := to_nat n + 1
| .(ff) (E n) := to_nat n + 1
example : to_nat (E (O Z)) = 2 :=
rfl
example : to_nat Z = 0 :=
rfl
example (a : foo ff) : to_nat (O a) = to_nat a + 1 :=
rfl
example (a : foo tt) : to_nat (E a) = to_nat a + 1 :=
rfl