lean4-htt/tests/lean/run/macroid.lean
Leonardo de Moura f9194737f0 chore: fix tests
2020-10-31 19:19:18 -07:00

19 lines
567 B
Text

syntax "[" ident "↦" term "]" : term
macro_rules `([$x ↦ $v]) => `(fun $x => $v)
#check [x ↦ x + 1]
syntax "case!" ident ":" term "with" term "," term : term
macro_rules `(case! $h : $c with $t, $e) => `((fun $h => cond $h $t $e) $c)
#check case! h : 0 == 0 with h, not h
syntax "case2!" ident ":" term "with" term "," term : term
macro_rules `(case2! $h : $c with $t, $e) => `(let $h := $c; cond $h $t $e)
#check case2! h : 0 == 0 with h, not h
syntax "test" term : term
macro_rules `(test $x:ident) => `(let $x := 0; $x)
#check fun (x : Nat) => test x