Functors between the category of tuples of types, and the category Type #
Features:
MvFunctor n
: the type class of multivariate functorsf <$$> x
: notation for map
Multivariate functors, i.e. functor between the category of type vectors and the category of Type
- map : {α β : TypeVec.{u_2} n} → α.Arrow β → F α → F β
Multivariate map, if
f : α ⟹ β
andx : F α
thenf <$$> x : F β
.
Instances
Multivariate map, if f : α ⟹ β
and x : F α
then f <$$> x : F β
Equations
- MvFunctor.«term_<$$>_» = Lean.ParserDescr.trailingNode `MvFunctor.«term_<$$>_» 100 101 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " <$$> ") (Lean.ParserDescr.cat `term 100))
Instances For
def
MvFunctor.LiftP
{n : ℕ}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
{α : TypeVec.{u} n}
(P : (i : Fin2 n) → α i → Prop)
(x : F α)
:
predicate lifting over multivariate functors
Equations
- MvFunctor.LiftP P x = ∃ (u : F fun (i : Fin2 n) => Subtype (P i)), MvFunctor.map (fun (i : Fin2 n) => Subtype.val) u = x
Instances For
def
MvFunctor.LiftR
{n : ℕ}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
{α : TypeVec.{u} n}
(R : {i : Fin2 n} → α i → α i → Prop)
(x y : F α)
:
relational lifting over multivariate functors
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
MvFunctor.supp
{n : ℕ}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
{α : TypeVec.{u} n}
(x : F α)
(i : Fin2 n)
:
Set (α i)
given x : F α
and a projection i
of type vector α
, supp x i
is the set
of α.i
contained in x
Equations
- MvFunctor.supp x i = {y : α i | ∀ ⦃P : (i : Fin2 n) → α i → Prop⦄, MvFunctor.LiftP P x → P i y}
Instances For
theorem
MvFunctor.of_mem_supp
{n : ℕ}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
{α : TypeVec.{u} n}
{x : F α}
{P : ⦃i : Fin2 n⦄ → α i → Prop}
(h : MvFunctor.LiftP P x)
(i : Fin2 n)
(y : α i)
:
y ∈ MvFunctor.supp x i → P y
laws for MvFunctor
- id_map : ∀ {α : TypeVec.{u_2} n} (x : F α), MvFunctor.map TypeVec.id x = x
map
preserved identities, i.e., maps identity onα
to identity onF α
- comp_map : ∀ {α β γ : TypeVec.{u_2} n} (g : α.Arrow β) (h : β.Arrow γ) (x : F α), MvFunctor.map (TypeVec.comp h g) x = MvFunctor.map h (MvFunctor.map g x)
map
preserves compositions
Instances
def
MvFunctor.LiftP'
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
(P : α.Arrow (TypeVec.repeat n Prop))
:
F α → Prop
adapt MvFunctor.LiftP
to accept predicates as arrows
Equations
- MvFunctor.LiftP' P = MvFunctor.LiftP fun (i : Fin2 n) (x : α i) => TypeVec.ofRepeat (P i x)
Instances For
def
MvFunctor.LiftR'
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
(R : (α.prod α).Arrow (TypeVec.repeat n Prop))
:
F α → F α → Prop
adapt MvFunctor.LiftR
to accept relations as arrows
Equations
- MvFunctor.LiftR' R = MvFunctor.LiftR fun (i : Fin2 n) (x y : α i) => TypeVec.ofRepeat (R i (TypeVec.prod.mk i x y))
Instances For
@[simp]
theorem
MvFunctor.id_map
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
[LawfulMvFunctor F]
(x : F α)
:
MvFunctor.map TypeVec.id x = x
@[simp]
theorem
MvFunctor.id_map'
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
[LawfulMvFunctor F]
(x : F α)
:
MvFunctor.map (fun (_i : Fin2 n) (a : α _i) => a) x = x
theorem
MvFunctor.map_map
{n : ℕ}
{α β γ : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
[LawfulMvFunctor F]
(g : α.Arrow β)
(h : β.Arrow γ)
(x : F α)
:
MvFunctor.map h (MvFunctor.map g x) = MvFunctor.map (TypeVec.comp h g) x
theorem
MvFunctor.exists_iff_exists_of_mono
{n : ℕ}
{α β : TypeVec.{u} n}
(F : TypeVec.{u} n → Type v)
[MvFunctor F]
[LawfulMvFunctor F]
{P : F α → Prop}
{q : F β → Prop}
(f : α.Arrow β)
(g : β.Arrow α)
(h₀ : TypeVec.comp f g = TypeVec.id)
(h₁ : ∀ (u : F α), P u ↔ q (MvFunctor.map f u))
:
(∃ (u : F α), P u) ↔ ∃ (u : F β), q u
theorem
MvFunctor.LiftP_def
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
(P : α.Arrow (TypeVec.repeat n Prop))
[LawfulMvFunctor F]
(x : F α)
:
MvFunctor.LiftP' P x ↔ ∃ (u : F (TypeVec.Subtype_ P)), MvFunctor.map (TypeVec.subtypeVal P) u = x
theorem
MvFunctor.LiftR_def
{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
(R : (α.prod α).Arrow (TypeVec.repeat n Prop))
[LawfulMvFunctor F]
(x y : F α)
:
MvFunctor.LiftR' R x y ↔ ∃ (u : F (TypeVec.Subtype_ R)),
MvFunctor.map (TypeVec.comp TypeVec.prod.fst (TypeVec.subtypeVal R)) u = x ∧ MvFunctor.map (TypeVec.comp TypeVec.prod.snd (TypeVec.subtypeVal R)) u = y
theorem
MvFunctor.LiftP_PredLast_iff
{n : ℕ}
{F : TypeVec.{u} (n + 1) → Type u_1}
[MvFunctor F]
[LawfulMvFunctor F]
{α : TypeVec.{u} n}
{β : Type u}
(P : β → Prop)
(x : F (α ::: β))
:
MvFunctor.LiftP' (α.PredLast' P) x ↔ MvFunctor.LiftP (α.PredLast P) x
theorem
MvFunctor.LiftR_RelLast_iff
{n : ℕ}
{F : TypeVec.{u} (n + 1) → Type u_1}
[MvFunctor F]
[LawfulMvFunctor F]
{α : TypeVec.{u} n}
{β : Type u}
(rr : β → β → Prop)
(x y : F (α ::: β))
:
MvFunctor.LiftR' (α.RelLast' rr) x y ↔ MvFunctor.LiftR (fun {i : Fin2 (n + 1)} => α.RelLast rr) x y
def
MvFunctor.ofEquiv
{n : ℕ}
{F : TypeVec.{u} n → Type u_1}
{F' : TypeVec.{u} n → Type u_2}
[MvFunctor F']
(eqv : (α : TypeVec.{u} n) → F α ≃ F' α)
:
Any type function that is (extensionally) equivalent to a functor, is itself a functor
Equations
- MvFunctor.ofEquiv eqv = { map := fun {α β : TypeVec.{?u.41} n} (f : α.Arrow β) (x : F α) => (eqv β).symm (MvFunctor.map f ((eqv α) x)) }