module Cat.Diagram.Product.Indexed {o ℓ} (C : Precategory o ℓ) where
Indexed products🔗
If a category admits a terminal object and binary products, then it admits products of any finite cardinality: iterate the binary product, and use the terminal object when there aren’t any objects. However, these two classes of limit do not let us speak of products of arbitrary cardinality, or, in the univalent context, indexed by types which are not sets.
That’s where products come in: Rather than having a functor giving the objects to take the limit over, we have an arbitrary map from to the space of objects of An indexed product for this “diagram” is then an object admitting an universal family of maps
record is-indexed-product (F : Idx → C.Ob) (π : ∀ i → C.Hom P (F i))
: Type (o ⊔ ℓ ⊔ level-of Idx) where
no-eta-equality
field
: ∀ {Y} → (∀ i → C.Hom Y (F i)) → C.Hom Y P
tuple : ∀ {i} {Y} {f : ∀ i → C.Hom Y (F i)} → π i C.∘ tuple f ≡ f i
commute : ∀ {Y} {h : C.Hom Y P} (f : ∀ i → C.Hom Y (F i))
unique → (∀ i → π i C.∘ h ≡ f i)
→ h ≡ tuple f
: ∀ {Y} (h : C.Hom Y P) → h ≡ tuple λ i → π i C.∘ h
eta = unique _ λ _ → refl
eta h
: ∀ {Y} {g h : C.Hom Y P} → (∀ i → π i C.∘ g ≡ π i C.∘ h) → g ≡ h
unique₂ {g = g} {h} eq = eta g ∙ ap tuple (funext eq) ∙ sym (eta h)
unique₂
: ∀ {Y} → C.Hom Y P ≃ (∀ i → C.Hom Y (F i))
hom-iso = (λ f i → π i C.∘ f) , is-iso→is-equiv λ where
hom-iso .is-iso.inv → tuple
.is-iso.rinv x → funext λ i → commute
.is-iso.linv x → sym (unique _ λ _ → refl)
A category admits indexed products (of level if, for any type and family there is an indexed product of
record Indexed-product (F : Idx → C.Ob) : Type (o ⊔ ℓ ⊔ level-of Idx) where
no-eta-equality
field
{ΠF} : C.Ob
: ∀ i → C.Hom ΠF (F i)
π : is-indexed-product F π
has-is-ip open is-indexed-product has-is-ip public
Uniqueness🔗
As is traditional with universal constructions, “having an indexed product for a diagram” is property of a category, not structure: Put another way, for any particular diagram, in a univalent category, there is (at most) a contractible space of indexed products of that diagram. And again as is traditional with universal constructions, the proof is surprisingly straightforward!
First, a general result: if two objects are both indexed products over the same family of objects, then those objects are isomorphic. This isomorphism is induced by the universal properties, and is readily seen to commute with both projections:
is-indexed-product→iso: ∀ {ℓ'} {Idx : Type ℓ'} {F : Idx → C.Ob}
→ {ΠF ΠF' : C.Ob}
→ {π : ∀ i → C.Hom ΠF (F i)} {π' : ∀ i → C.Hom ΠF' (F i)}
→ is-indexed-product F π
→ is-indexed-product F π'
→ ΠF C.≅ ΠF'
{π = π} {π' = π'} ΠF-prod ΠF'-prod =
is-indexed-product→iso .make-iso (ΠF'.tuple π) (ΠF.tuple π')
C(ΠF'.unique₂ (λ i → C.pulll ΠF'.commute ∙ ΠF.commute ∙ sym (C.idr _)))
(ΠF.unique₂ λ i → C.pulll ΠF.commute ∙ ΠF'.commute ∙ sym (C.idr _))
where
module ΠF = is-indexed-product ΠF-prod
module ΠF' = is-indexed-product ΠF'-prod
With that out of the way, we can proceed to show our original result! First, note that paths between indexed products are determined by a path between apices, and a corresponding path-over between projections. We can upgrade the iso from our previous lemma into a path, so all that remains is to construct the path-over.
Indexed-product-unique: ∀ {ℓ'} {I : Type ℓ'} (F : I → C.Ob)
→ is-category C → is-prop (Indexed-product F)
{I = I} F c-cat x y =
Indexed-product-unique
Indexed-product-path(c-cat .to-path apices)
preswhere
module x = Indexed-product x
module y = Indexed-product y
: x.ΠF C.≅ y.ΠF
apices = Indexed-product→iso x y apices
By the characterisation of paths-over in Hom-sets, we get paths-over between the projection maps and the product maps:
module apices = C._≅_ apices
abstract
: ∀ j → PathP (λ i → C.Hom (c-cat .to-path apices i) (F j)) (x.π j) (y.π j)
pres = Univalent.Hom-pathp-refll-iso c-cat x.commute pres j
We can also prove the converse direction: if indexed products in are unique, then is univalent. In fact, we only need limits of one-object diagrams to be unique.
unique-products→is-category: ({x : C.Ob} → is-prop (Indexed-product {Idx = ⊤} (λ _ → x)))
→ is-category C
= cat where unique-products→is-category prop
Given an isomorphism we build two products for the one-object diagram one with apex itself and identity as projection, and one with apex and the given isomorphism as projection.
module _ {a b : C.Ob} (is : a C.≅ b) where
open Indexed-product
open is-indexed-product
: Indexed-product {Idx = ⊤} (λ _ → a)
Pa .ΠF = a
Pa .π _ = C.id
Pa .has-is-ip .tuple f = f _
Pa .has-is-ip .commute = C.idl _
Pa .has-is-ip .unique f p = sym (C.idl _) ∙ p _
Pa
: Indexed-product {Idx = ⊤} (λ _ → a)
Pb .ΠF = b
Pb .π _ = is .C.from
Pb .has-is-ip .tuple f = is .C.to C.∘ f _
Pb .has-is-ip .commute = C.cancell (is .C.invr)
Pb .has-is-ip .unique f p = sym (C.lswizzle (sym (p _)) (is .C.invl)) Pb
By uniqueness, the two products are equal, which gives us an equality lying over our isomorphism.
: a ≡ b
path = ap ΠF (prop Pa Pb)
path
: PathP (λ i → a C.≅ path i) C.id-iso is
path-over = C.≅-pathp-from _ _ (ap (λ p → p .π _) (prop Pa Pb))
path-over
: is-category C
cat .to-path = path
cat .to-path-over = path-over cat
Properties🔗
Let be a family of objects in If the the indexed products and exists, then they are isomorphic.
is-indexed-product-assoc: ∀ {κ κ'} {A : Type κ} {B : A → Type κ'}
→ {X : Σ A B → C.Ob}
→ {ΠᵃᵇX : C.Ob} {ΠᵃΠᵇX : C.Ob} {ΠᵇX : A → C.Ob}
→ {πᵃᵇ : (ab : Σ A B) → C.Hom ΠᵃᵇX (X ab)}
→ {πᵃ : ∀ a → C.Hom ΠᵃΠᵇX (ΠᵇX a)}
→ {πᵇ : ∀ a → (b : B a) → C.Hom (ΠᵇX a) (X (a , b))}
→ is-indexed-product X πᵃᵇ
→ is-indexed-product ΠᵇX πᵃ
→ (∀ a → is-indexed-product (λ b → X (a , b)) (πᵇ a))
→ ΠᵃᵇX C.≅ ΠᵃΠᵇX
The proof is surprisingly straightforward: as indexed products are unique up to iso, it suffices to show that is an indexed product over
{A = A} {B} {X} {ΠᵃΠᵇX = ΠᵃΠᵇX} {πᵃ = πᵃ} {πᵇ} Πᵃᵇ ΠᵃΠᵇ Πᵇ =
is-indexed-product-assoc
is-indexed-product→iso Πᵃᵇ Πᵃᵇ'where
open is-indexed-product
We can construct projections by composing the projections out of each successive product.
: ∀ (ab : Σ A B) → C.Hom ΠᵃΠᵇX (X ab)
πᵃᵇ' (a , b) = πᵇ a b C.∘ πᵃ a πᵃᵇ'
The rest of the structure follows a similar pattern.
: is-indexed-product X πᵃᵇ'
Πᵃᵇ' .tuple f = ΠᵃΠᵇ .tuple λ a → Πᵇ a .tuple λ b → f (a , b)
Πᵃᵇ' .commute = C.pullr (ΠᵃΠᵇ .commute) ∙ Πᵇ _ .commute
Πᵃᵇ' .unique {h = h} f p =
Πᵃᵇ' .unique _ λ a →
ΠᵃΠᵇ _ .unique _ λ b →
Πᵇ .assoc _ _ _ ∙ p (a , b) C
Categories with all indexed products🔗
: ∀ {ℓ} (I : Type ℓ) → Type _
has-products-indexed-by = ∀ (F : I → C.Ob) → Indexed-product F
has-products-indexed-by I
: ∀ ℓ → Type _
has-indexed-products = ∀ {I : Type ℓ} → has-products-indexed-by I
has-indexed-products ℓ
module Indexed-products
{κ : Level}
(has-ip : has-indexed-products κ)
where
module ∏ {Idx : Type κ} (F : Idx → C.Ob) = Indexed-product (has-ip F)
open ∏ renaming (commute to π-commute; unique to tuple-unique) public