A type for VM-erased data #
This file defines a type Erased α
which is classically isomorphic to α
,
but erased in the VM. That is, at runtime every value of Erased α
is
represented as 0
, just like types and proofs.
Extracts the erased value, noncomputably.
Equations
- Erased.out x = match x with | { fst := fst, snd := h } => Classical.choose h
Instances For
@[reducible]
Extracts the erased value, if it is a type.
Note: (mk a).OutType
is not definitionally equal to a
.
Equations
Instances For
Extracts the erased value, if it is a proof.
theorem
Erased.out_inj
{α : Sort u_1}
(a : Erased α)
(b : Erased α)
(h : Erased.out a = Erased.out b)
:
a = b
Equivalence between Erased α
and α
.
Equations
- Erased.equiv α = { toFun := Erased.out, invFun := Erased.mk, left_inv := (_ : ∀ (a : Erased α), Erased.mk (Erased.out a) = a), right_inv := (_ : ∀ (a : α), Erased.out (Erased.mk a) = a) }
Instances For
Equations
- Erased.instReprErased α = { reprPrec := fun (x : Erased α) (x : ℕ) => Std.Format.text "Erased" }
Equations
- Erased.instToStringErased α = { toString := fun (x : Erased α) => "Erased" }
Computably produce an erased value from a proof of nonemptiness.
Equations
Instances For
Equations
- Erased.instInhabitedErased = { default := Erased.choice h }
(>>=)
operation on Erased
.
This is a separate definition because α
and β
can live in different
universes (the universe is fixed in Monad
).
Equations
- Erased.bind a f = { fst := fun (b : β) => (f (Erased.out a)).fst b, snd := (_ : ∃ (a_1 : β), (fun (b : β) => a_1 = b) = (f (Erased.out a)).fst) }
Instances For
@[simp]
theorem
Erased.bind_eq_out
{α : Sort u_1}
{β : Sort u_2}
(a : Erased α)
(f : α → Erased β)
:
Erased.bind a f = f (Erased.out a)
@[simp]
(<$>)
operation on Erased
.
This is a separate definition because α
and β
can live in different
universes (the universe is fixed in Functor
).
Equations
- Erased.map f a = Erased.bind a (Erased.mk ∘ f)
Instances For
@[simp]
theorem
Erased.map_out
{α : Sort u_1}
{β : Sort u_2}
{f : α → β}
(a : Erased α)
:
Erased.out (Erased.map f a) = f (Erased.out a)
Equations
- Erased.LawfulMonad = (_ : LawfulMonad Erased)