lean4-htt/tests/lean/run/lcnf1.lean
Leonardo de Moura 5dbb907b56 feat: new toLCNF
2022-08-11 18:40:13 -07:00

49 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
open Lean
#eval Compiler.compile #[``List.map]
#eval Compiler.compile #[``Lean.Elab.Term.synthesizeInstMVarCore]
#eval Compiler.compile #[``Eq.ndrec]
def g1 (x : Nat) (h : Nat = Int) : Int :=
(h ▸ x) + 1
#eval Compiler.compile #[``g1]
def f (h : False) (x : Nat) : Nat :=
(h.rec : Nat → Nat) x
#eval Compiler.compile #[``f]
def g (as : Array (Nat → Nat)) (h : i < as.size ∧ q) : Nat :=
h.casesOn (fun _ _ => as[i]) i
#eval Compiler.compile #[``g]
def f2 {r : Nat → Nat → Prop} (q : Quot r) : Nat :=
(q.lift (·+·) sorry : Nat → Nat) 2
#eval Compiler.compile #[``f2]
inductive Vec (α : Type u) : Nat → Type u
| nil : Vec α 0
| cons : α → Vec α n → Vec α (n+1)
def Vec.zip : Vec α n → Vec β n → Vec (α × β) n
| .cons a as, .cons b bs => .cons (a, b) (zip as bs)
| .nil, .nil => .nil
def Vec.head : Vec α (n+1) → α
| .cons a _ => a
#eval Compiler.compile #[``Vec.zip]
#eval Compiler.compile #[``Vec.zip.match_1]
#eval Compiler.compile #[``Lean.Elab.Term.reportStuckSyntheticMVar]
set_option trace.Meta.debug true
#eval Compiler.compile #[``Lean.Elab.Term.synthesizeSyntheticMVars]