blob: 4a80a1a13233d82f437b59ee3dbd220b40e219fd [file] [edit]
namespace MWE
universe u v w
inductive Id {A : Type u} : A โ†’ A โ†’ Type u
| refl {a : A} : Id a a
attribute [induction_eliminator] Id.casesOn
infix:50 (priority := high) " = " => Id
inductive Unit : Type u
| star : Unit
attribute [induction_eliminator] Unit.casesOn
notation "๐Ÿ" => Unit
notation "โ˜…" => Unit.star
notation "โ„•" => Nat
def vect (A : Type u) : โ„• โ†’ Type u
| Nat.zero => ๐Ÿ
| Nat.succ n => A ร— vect A n
def vect.const {A : Type u} (a : A) : โˆ€ n, vect A n
| Nat.zero => โ˜…
| Nat.succ n => (a, const a n)
def vect.map {A : Type u} {B : Type v} (f : A โ†’ B) :
โˆ€ {n : โ„•}, vect A n โ†’ vect B n
| Nat.zero => ฮป _ => โ˜…
| Nat.succ n => ฮป v => (f v.1, map f v.2)
def transport {A : Type u} (B : A โ†’ Type v) {a b : A} (p : a = b) : B a โ†’ B b :=
by { induction p; apply id }
def vect.subst {A B : Type u} (p : A = B) (f : B โ†’ A) {n : โ„•} (v : vect A n) :
vect.map f (transport (vect ยท n) p v) = vect.map (f โˆ˜ transport id p) v :=
by { induction p; apply Id.refl }