lean4-htt/tests/lean/run/vm_eval1.lean
Sebastian Ullrich fd2c42a8bf chore(library, tests): switch to new attribute declaration syntax
sed -Ei 's/^(\s*)((private |protected )?(noncomputable )?(abbreviation|definition|meta_definition|theorem|lemma|proposition|corollary)\s+\S+\s*)((\s*\[(\S+(\s+[0-9]+)*|priority.*)\])+)\s*/\1attribute \6\n\1\2/' library/**/*.lean tests/**/*.lean
sed -Ei 's/\s+$//' library/**/*.lean  # remove trailing whitespace
2016-08-12 15:36:12 -07:00

34 lines
772 B
Text

open bool nat
-- set_option trace.compiler.code_gen true
attribute [reducible]
definition foo (b : bool) : Type₁ :=
cond b nat (nat → nat)
definition bla (b : bool) : foo b → nat :=
bool.cases_on b (λ f, f 100) (λ n, n)
definition of_dec (p : Prop) [h : decidable p] : bool :=
decidable.cases_on h (λ h, ff) (λ h, tt)
definition boo (n : nat) := bla (of_dec (n > 10))
definition x : nat := 20
definition tst (b : bool) (a : nat) : foo b :=
bool.cases_on b (λ n : nat, n * a) a
eval bla ff (λ n : nat, n+10)
eval bla tt x
eval boo 11 x
eval boo 9 (λ n : nat, n+20)
eval tst ff 4 10
eval tst tt 3
print "---------"
vm_eval bla ff (λ n : nat, n+10)
vm_eval bla tt x
vm_eval boo 11 x
vm_eval boo 9 (λ n : nat, n+20)
vm_eval tst ff 4 10
vm_eval tst tt 3