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} → TypeVec.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
- One or more equations did not get rendered due to their size.
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 : F α)
(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 : TypeVec.Arrow α β) (h : TypeVec.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 : TypeVec.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 : TypeVec.Arrow (TypeVec.prod α α) (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}
{β : TypeVec.{u} n}
{γ : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
[LawfulMvFunctor F]
(g : TypeVec.Arrow α β)
(h : TypeVec.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}
{β : TypeVec.{u} n}
(F : TypeVec.{u} n → Type v)
[MvFunctor F]
[LawfulMvFunctor F]
{P : F α → Prop}
{q : F β → Prop}
(f : TypeVec.Arrow α β)
(g : TypeVec.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 : TypeVec.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 : TypeVec.Arrow (TypeVec.prod α α) (TypeVec.repeat n Prop))
[LawfulMvFunctor F]
(x : F α)
(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' (TypeVec.PredLast' α P) x ↔ MvFunctor.LiftP (TypeVec.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 : F (α ::: β))
(y : F (α ::: β))
:
MvFunctor.LiftR' (TypeVec.RelLast' α rr) x y ↔ MvFunctor.LiftR (fun {i : Fin2 (n + 1)} => TypeVec.RelLast α rr) x y