| 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 } |