Tuples of types, and their categorical structure. #
Features #
TypeVec n
- n-tuples of typesα ⟹ β
- n-tuples of mapsf ⊚ g
- composition
Also, support functions for operating with n-tuples of types, such as:
append1 α β
- append typeβ
to n-tupleα
to obtain an (n+1)-tupledrop α
- drops the last element of an (n+1)-tuplelast α
- returns the last element of an (n+1)-tupleappendFun f g
- appends a function g to an n-tuple of functionsdropFun f
- drops the last function from an n+1-tuplelastFun f
- returns the last function of a tuple.
Since e.g. append1 α.drop α.last
is propositionally equal to α
but not definitionally equal
to it, we need support functions and lemmas to mediate between constructions.
Equations
- instInhabitedTypeVec = { default := fun (x : Fin2 n) => PUnit.{u + 1} }
arrow in the category of TypeVec
Equations
- TypeVec.Arrow α β = ((i : Fin2 n) → α i → β i)
Instances For
arrow in the category of TypeVec
Equations
- MvFunctor.«term_⟹_» = Lean.ParserDescr.trailingNode `MvFunctor.term_⟹_ 40 40 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⟹ ") (Lean.ParserDescr.cat `term 41))
Instances For
Extensionality for arrows
Equations
- TypeVec.Arrow.inhabited α β = { default := fun (x : Fin2 n) (x_1 : α x) => default }
arrow composition in the category of TypeVec
Equations
- TypeVec.comp g f i x = g i (f i x)
Instances For
arrow composition in the category of TypeVec
Equations
- MvFunctor.«term_⊚_» = Lean.ParserDescr.trailingNode `MvFunctor.term_⊚_ 80 81 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊚ ") (Lean.ParserDescr.cat `term 80))
Instances For
Support for extending a TypeVec
by one element.
Instances For
Support for extending a TypeVec
by one element.
Equations
- TypeVec.«term_:::_» = Lean.ParserDescr.trailingNode `TypeVec.term_:::_ 67 67 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ::: ") (Lean.ParserDescr.cat `term 68))
Instances For
Equations
- TypeVec.last.inhabited α = { default := let_fun this := default; this }
cases on (n+1)-length
vectors
Equations
- TypeVec.append1Cases H γ = Eq.mpr (_ : C γ = C (TypeVec.drop γ ::: TypeVec.last γ)) (H (TypeVec.drop γ) (TypeVec.last γ))
Instances For
append an arrow and a function for arbitrary source and target type vectors
Equations
- TypeVec.splitFun f g x = match (motive := (x : Fin2 (n + 1)) → α x → α' x) x with | Fin2.fs i => f i | Fin2.fz => g
Instances For
append an arrow and a function as well as their respective source and target types / typevecs
Equations
- (f ::: g) = TypeVec.splitFun f g
Instances For
append an arrow and a function as well as their respective source and target types / typevecs
Equations
- TypeVec.«term_:::__1» = Lean.ParserDescr.trailingNode `TypeVec.term_:::__1 0 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ::: ") (Lean.ParserDescr.cat `term 1))
Instances For
split off the prefix of an arrow
Equations
- TypeVec.dropFun f i = f (Fin2.fs i)
Instances For
split off the last function of an arrow
Equations
- TypeVec.lastFun f = f Fin2.fz
Instances For
arrow in the category of 0-length
vectors
Equations
Instances For
turn an equality into an arrow
Equations
- TypeVec.Arrow.mp h x = match (motive := (x : Fin2 n) → α x → β x) x with | x => Eq.mp (_ : α x = β x)
Instances For
turn an equality into an arrow, with reverse direction
Equations
- TypeVec.Arrow.mpr h x = match (motive := (x : Fin2 n) → β x → α x) x with | x => Eq.mpr (_ : α x = β x)
Instances For
decompose a vector into its prefix appended with its last element
Equations
- TypeVec.toAppend1DropLast = TypeVec.Arrow.mpr (_ : TypeVec.drop α ::: TypeVec.last α = α)
Instances For
stitch two bits of a vector back together
Equations
- TypeVec.fromAppend1DropLast = TypeVec.Arrow.mp (_ : TypeVec.drop α ::: TypeVec.last α = α)
Instances For
Equations
- TypeVec.subsingleton0 = (_ : Subsingleton (TypeVec.{u_1} 0))
cases distinction for 0-length type vector
Equations
- TypeVec.casesNil f v = cast (_ : β Fin2.elim0 = β v) f
Instances For
cases distinction for (n+1)-length type vector
Equations
- TypeVec.casesCons n f v = cast (_ : β (TypeVec.drop v ::: TypeVec.last v) = β v) (f (TypeVec.last v) (TypeVec.drop v))
Instances For
cases distinction for an arrow in the category of 0-length type vectors
Equations
- TypeVec.typevecCasesNil₃ f v v' fs = cast (_ : β Fin2.elim0 Fin2.elim0 TypeVec.nilFun = β v v' fs) f
Instances For
cases distinction for an arrow in the category of (n+1)-length type vectors
Equations
- One or more equations did not get rendered due to their size.
Instances For
specialized cases distinction for an arrow in the category of 0-length type vectors
Equations
- TypeVec.typevecCasesNil₂ f g = let_fun this := (_ : g = TypeVec.nilFun); Eq.mpr (_ : β g = β TypeVec.nilFun) f
Instances For
specialized cases distinction for an arrow in the category of (n+1)-length type vectors
Equations
- TypeVec.typevecCasesCons₂ n t t' v v' F fs = Eq.mpr (_ : β fs = β (TypeVec.splitFun (TypeVec.dropFun fs) (TypeVec.lastFun fs))) (F (TypeVec.lastFun fs) (TypeVec.dropFun fs))
Instances For
PredLast α p x
predicates p
of the last element of x : α.append1 β
.
Equations
Instances For
RelLast α r x y
says that p
the last elements of x y : α.append1 β
are related by r
and
all the other elements are equal.
Equations
Instances For
repeat n t
is a n-length
type vector that contains n
occurrences of t
Equations
- TypeVec.repeat 0 x = Fin2.elim0
- TypeVec.repeat (Nat.succ i) x = TypeVec.repeat i x ::: x
Instances For
prod α β
is the pointwise product of the components of α
and β
Equations
- TypeVec.prod x_3 x_4 = Fin2.elim0
- TypeVec.prod α β = TypeVec.prod (TypeVec.drop α) (TypeVec.drop β) ::: (TypeVec.last α × TypeVec.last β)
Instances For
prod α β
is the pointwise product of the components of α
and β
Equations
- MvFunctor.«term_⊗_» = Lean.ParserDescr.trailingNode `MvFunctor.term_⊗_ 45 45 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊗ ") (Lean.ParserDescr.cat `term 46))
Instances For
const x α
is an arrow that ignores its source and constructs a TypeVec
that
contains nothing but x
Equations
- TypeVec.const x α (Fin2.fs a) = TypeVec.const x (TypeVec.drop α) a
- TypeVec.const x x_4 Fin2.fz = fun (x_1 : x_4 Fin2.fz) => x
Instances For
vector of equality on a product of vectors
Equations
- TypeVec.repeatEq x_2 = TypeVec.nilFun
- TypeVec.repeatEq α = (TypeVec.repeatEq (TypeVec.drop α) ::: Function.uncurry Eq)
Instances For
predicate on a type vector to constrain only the last object
Equations
- TypeVec.PredLast' α p = TypeVec.splitFun (TypeVec.const True α) p
Instances For
predicate on the product of two type vectors to constrain only their last object
Equations
Instances For
given F : TypeVec.{u} (n+1) → Type u
, curry F : Type u → TypeVec.{u} → Type u
,
i.e. its first argument can be fed in separately from the rest of the vector of arguments
Equations
- TypeVec.Curry F α β = F (β ::: α)
Instances For
Equations
- TypeVec.Curry.inhabited F α β = I
arrow to remove one element of a repeat
vector
Equations
- TypeVec.dropRepeat α (Fin2.fs i) = TypeVec.dropRepeat α i
- TypeVec.dropRepeat α Fin2.fz = fun (a : α) => a
Instances For
projection for a repeat vector
Instances For
left projection of a prod
vector
Equations
- TypeVec.prod.fst (Fin2.fs i) = TypeVec.prod.fst i
- TypeVec.prod.fst Fin2.fz = Prod.fst
Instances For
right projection of a prod
vector
Equations
- TypeVec.prod.snd (Fin2.fs i) = TypeVec.prod.snd i
- TypeVec.prod.snd Fin2.fz = Prod.snd
Instances For
introduce a product where both components are the same
Equations
- TypeVec.prod.diag (Fin2.fs a) x_4 = TypeVec.prod.diag a x_4
- TypeVec.prod.diag Fin2.fz x_5 = (x_5, x_5)
Instances For
constructor for prod
Equations
- TypeVec.prod.mk (Fin2.fs i) = TypeVec.prod.mk i
- TypeVec.prod.mk Fin2.fz = Prod.mk
Instances For
prod
is functorial
Equations
- TypeVec.prod.map x_9 y (Fin2.fs a) a_1 = TypeVec.prod.map (TypeVec.dropFun x_9) (TypeVec.dropFun y) a a_1
- TypeVec.prod.map x_13 y Fin2.fz a = (x_13 Fin2.fz a.fst, y Fin2.fz a.snd)
Instances For
prod
is functorial
Equations
- MvFunctor.«term_⊗'_» = Lean.ParserDescr.trailingNode `MvFunctor.term_⊗'_ 45 45 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊗' ") (Lean.ParserDescr.cat `term 46))
Instances For
given a predicate vector p
over vector α
, Subtype_ p
is the type of vectors
that contain an α
that satisfies p
Equations
- TypeVec.Subtype_ p Fin2.fz = { x : x_4 Fin2.fz // p Fin2.fz x }
- TypeVec.Subtype_ p (Fin2.fs i) = TypeVec.Subtype_ (TypeVec.dropFun p) i
Instances For
projection on Subtype_
Equations
- TypeVec.subtypeVal x_5 (Fin2.fs i) = TypeVec.subtypeVal (TypeVec.dropFun x_5) i
- TypeVec.subtypeVal x_5 Fin2.fz = Subtype.val
Instances For
arrow that rearranges the type of Subtype_
to turn a subtype of vector into
a vector of subtypes
Equations
- TypeVec.toSubtype p (Fin2.fs i) x_6 = TypeVec.toSubtype (TypeVec.dropFun p) i x_6
- TypeVec.toSubtype x_6 Fin2.fz x_7 = x_7
Instances For
arrow that rearranges the type of Subtype_
to turn a vector of subtypes
into a subtype of vector
Equations
- TypeVec.ofSubtype p_2 (Fin2.fs i) x_2 = TypeVec.ofSubtype (TypeVec.dropFun p_2) i x_2
- TypeVec.ofSubtype p_2 Fin2.fz x_2 = x_2
Instances For
similar to toSubtype
adapted to relations (i.e. predicate on product)
Equations
- TypeVec.toSubtype' p_2 (Fin2.fs i) x_2 = TypeVec.toSubtype' (TypeVec.dropFun p_2) i x_2
- TypeVec.toSubtype' p_2 Fin2.fz x_2 = { val := ↑x_2, property := (_ : p_2 Fin2.fz ↑x_2) }
Instances For
similar to of_subtype
adapted to relations (i.e. predicate on product)
Equations
- TypeVec.ofSubtype' p_2 (Fin2.fs i) x_2 = TypeVec.ofSubtype' (TypeVec.dropFun p_2) i x_2
- TypeVec.ofSubtype' p_2 Fin2.fz x_2 = { val := ↑x_2, property := (_ : TypeVec.ofRepeat (p_2 Fin2.fz (TypeVec.prod.mk Fin2.fz (↑x_2).fst (↑x_2).snd))) }
Instances For
similar to diag
but the target vector is a Subtype_
guaranteeing the equality of the components
Equations
- TypeVec.diagSub (Fin2.fs a) x_2 = TypeVec.diagSub a x_2
- TypeVec.diagSub Fin2.fz x_2 = { val := (x_2, x_2), property := (_ : (x_2, x_2).fst = (x_2, x_2).fst) }