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.11 + 1} }
arrow in the category of TypeVec
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 γ = ⋯.mpr (H γ.drop γ.last)
Instances For
append an arrow and a function for arbitrary source and target type vectors
Equations
- TypeVec.splitFun f g i.fs = f i
- TypeVec.splitFun f g 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 i.fs
Instances For
split off the last function of an arrow
Equations
- TypeVec.lastFun f = f Fin2.fz
Instances For
turn an equality into an arrow, with reverse direction
Equations
- TypeVec.Arrow.mpr h x = ⋯.mpr
Instances For
decompose a vector into its prefix appended with its last element
Equations
- TypeVec.toAppend1DropLast = TypeVec.Arrow.mpr ⋯
Instances For
stitch two bits of a vector back together
Equations
- TypeVec.fromAppend1DropLast = TypeVec.Arrow.mp ⋯
Instances For
Equations
cases distinction for (n+1)-length type vector
Equations
- TypeVec.casesCons n f v = cast ⋯ (f v.last v.drop)
Instances For
cases distinction for an arrow in the category of 0-length type vectors
Equations
- TypeVec.typevecCasesNil₃ f v v' fs = cast ⋯ 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 = ⋯.mpr 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 = ⋯.mpr (F (TypeVec.lastFun fs) (TypeVec.dropFun fs))
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.
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 i.succ x = TypeVec.repeat i x ::: x
Instances For
prod α β
is the pointwise product of the components of α
and β
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 α a.fs = TypeVec.const x α.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
- x_2.repeatEq = TypeVec.nilFun
- α.repeatEq = (α.drop.repeatEq ::: Function.uncurry Eq)
Instances For
predicate on a type vector to constrain only the last object
Equations
- α.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
- α.RelLast' p = TypeVec.splitFun α.repeatEq (Function.uncurry p)
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 α i.fs = 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 i.fs = TypeVec.prod.fst i
- TypeVec.prod.fst Fin2.fz = Prod.fst
Instances For
right projection of a prod
vector
Equations
- TypeVec.prod.snd i.fs = 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 a.fs 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 i.fs = TypeVec.prod.mk i
- TypeVec.prod.mk Fin2.fz = Prod.mk
Instances For
prod
is functorial
Equations
- TypeVec.prod.map x_9 y a.fs 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.1, y Fin2.fz a.2)
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 i.fs = TypeVec.Subtype_ (TypeVec.dropFun p) i
Instances For
projection on Subtype_
Equations
- TypeVec.subtypeVal x_5 i.fs = 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 i.fs 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 i.fs 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 i.fs x_2 = TypeVec.toSubtype' (TypeVec.dropFun p_2) i x_2
- TypeVec.toSubtype' p_2 Fin2.fz x_2 = ⟨↑x_2, ⋯⟩
Instances For
similar to of_subtype
adapted to relations (i.e. predicate on product)
Equations
- TypeVec.ofSubtype' p_2 i.fs 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 diag
but the target vector is a Subtype_
guaranteeing the equality of the components
Equations
- TypeVec.diagSub a.fs x_2 = TypeVec.diagSub a x_2
- TypeVec.diagSub Fin2.fz x_2 = ⟨(x_2, x_2), ⋯⟩