blob: a330550b04ff89be97b56a04ef4fbc73ba208949 [file] [edit]
import Lean
/-- `erased α` is the same as `α`, except that the elements
of `erased α` are erased in the VM in the same way as types
and proofs. This can be used to track data without storing it
literally. -/
def Erased (α : Sort u) : Sort max 1 u :=
Σ's : α → Prop, ∃ a, (fun b => a = b) = s
namespace Erased
/-- Erase a value. -/
@[inline]
def mk {α} (a : α) : Erased α :=
⟨fun b => a = b, a, rfl⟩
open Lean.Compiler
set_option pp.explicit true
set_option pp.funBinderTypes true
set_option pp.letVarTypes true
set_option trace.Compiler.saveMono true
/--
trace: [Compiler.saveMono] size: 1
def Erased.mk (α : lcErased) (a : lcAny) : PSigma lcErased lcAny :=
let _x.1 : PSigma lcErased lcAny := PSigma.mk ◾ ◾ ◾ ◾;
return _x.1
---
trace: [Compiler.saveMono] size: 5
def _private.elab.erased.0._eval._lam_0 (_x.1 : Array
Lean.Name) (_x.2 : PUnit) (_y.3 : Lean.Elab.Term.Context) (_y.4 : @&lcAny) (_y.5 : @&Lean.Meta.Context) (_y.6 : @&lcAny) (_y.7 : @&Lean.Core.Context) (_y.8 : @&lcAny) (_y.9 : lcVoid) : EST.Out
Lean.Exception lcAny PUnit :=
let _x.10 : EST.Out Lean.Exception lcAny PUnit := compile _x.1 _y.7 _y.8 _y.9;
cases _x.10 : EST.Out Lean.Exception lcAny PUnit
| EST.Out.ok (a.11 : PUnit) (a.12 : lcVoid) =>
let _x.13 : EST.Out Lean.Exception lcAny PUnit := @EST.Out.ok ◾ ◾ ◾ _x.2 a.12;
return _x.13
| EST.Out.error (a.14 : Lean.Exception) (a.15 : lcVoid) =>
return _x.10
[Compiler.saveMono] size: 9
def _private.elab.erased.0._eval (a : @&Lean.Elab.Command.Context) (a : @&lcAny) (a.1 : lcVoid) : EST.Out
Lean.Exception lcAny PUnit :=
let _x.2 : String := "Erased";
let _x.3 : String := "mk";
let _x.4 : Lean.Name := Lean.Name.mkStr2 _x.2 _x.3;
let _x.5 : Nat := 1;
let _x.6 : Array Lean.Name := Array.mkEmpty ◾ _x.5;
let _x.7 : Array Lean.Name := Array.push ◾ _x.6 _x.4;
let _x.8 : PUnit := PUnit.unit;
let _f.9 : Lean.Elab.Term.Context →
lcAny →
Lean.Meta.Context →
lcAny → Lean.Core.Context → lcAny → lcVoid → EST.Out Lean.Exception lcAny PUnit := _eval._lam_0 _x.7 _x.8;
let _x.10 : EST.Out Lean.Exception lcAny PUnit := Lean.Elab.Command.liftTermElabM._redArg _f.9 a a a.1;
return _x.10
-/
#guard_msgs in
run_meta Lean.Compiler.compile #[``Erased.mk]