---
layout: default
title : "Setoid.Homomorphisms.Products module (The Agda Universal Algebra Library)"
date : "2021-09-21"
author: "agda-algebras development team"
---
#### Products of Homomorphisms of Algebras
This is the [Setoid.Homomorphisms.Products][] module of the [Agda Universal Algebra Library][].
This module defines some of the homomorphisms associated with a product.
+ `β¨
-hom-co`{.AgdaFunction} is the induced map into a product: a family of homomorphisms out
of a single algebra `π¨`, one for each index, assembles into a single homomorphism
from `π¨` to the product;
+ `β¨
-hom`{.AgdaFunction} takes a family of homomorphisms `π i β β¬ i` to their
product, `β¨
π β β¨
β¬`;
+ `β¨
-proj`{.AgdaFunction} is the coordinate projection `β¨
π β π i`.
All three are defined coordinatewise, and their compatibility proofs are inherited
coordinatewise from the factors, because that is how `β¨
`{.AgdaFunction} of
[Setoid.Algebras.Products][] interprets the operations in the first place.[^1]
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module Setoid.Homomorphisms.Products where
open import Agda.Primitive using () renaming ( Set to Type )
open import Function using () renaming ( Func to _βΆ_ )
open import Data.Product using ( _,_ )
open import Level using ( Level )
open import Relation.Binary using ( Setoid )
open import Overture using ( projβ ; projβ ; π ; π₯ ; Signature)
open import Setoid.Algebras using ( Algebra ; β¨
; π»[_] )
open import Setoid.Homomorphisms.Basic using ( hom ; IsHom )
open _βΆ_ using ( cong ) renaming ( to to _β¨$β©_ )
open IsHom
private variable Ξ± Ο Ξ² Οα΅ π : Level
```
-->
Suppose we have an algebra `π¨`, a type `I : Type π`, and a family
`β¬ : I β Algebra Ξ² π` of algebras. We sometimes refer to the inhabitants of `I`
as *indices*, and call `β¬` an *indexed family of algebras*.
If in addition we have a family `π½ : (i : I) β hom π¨ (β¬ i)` of homomorphisms, then
we can construct a homomorphism from `π¨` to the product `β¨
β¬` in the natural way.
```agda
module _ {π : Signature π π₯} {π¨ : Algebra {π = π} Ξ± Ο } {I : Type π} (β¬ : I β Algebra Ξ² Οα΅) where
β¨
-hom-co : (β(i : I) β hom π¨ (β¬ i)) β hom π¨ (β¨
β¬)
β¨
-hom-co π½ = h , hhom
where
h : π»[ π¨ ] βΆ π»[ β¨
β¬ ]
h β¨$β© a = Ξ» i β π½ i .projβ β¨$β© a
h .cong xy = Ξ» i β π½ i .projβ .cong xy
hhom : IsHom π¨ (β¨
β¬) h
hhom .compatible = Ξ» i β π½ i .projβ .compatible
```
If we are given `π : I β Algebra Ξ± π` and `β¬ : I β Algebra Ξ² π`
(two families of `π`-algebras), then a family `π½` of homomorphisms inhabits the
dependent type `β (i : I) β hom (π i) (β¬ i)`, from which we construct a homomorphism
from `β¨
π` to `β¨
β¬` in the following natural way.
```agda
module _ {π : Signature π π₯} {I : Type π} (π : I β Algebra {π = π} Ξ± Ο) where
β¨
-hom : (β¬ : I β Algebra Ξ² Οα΅) β (β (i : I) β hom (π i) (β¬ i)) β hom (β¨
π)(β¨
β¬)
β¨
-hom β¬ π½ = F , isHom
where
F : π»[ β¨
π ] βΆ π»[ β¨
β¬ ]
F β¨$β© x = Ξ» i β π½ i .projβ β¨$β© x i
F .cong xy = Ξ» i β π½ i .projβ .cong (xy i)
isHom : IsHom (β¨
π) (β¨
β¬) F
isHom .compatible = Ξ» i β π½ i .projβ .compatible
```
#### Projection out of products
The projection of a product algebra onto its `i`-th factor is a homomorphism.
```agda
β¨
-proj : (i : I) β hom (β¨
π) (π i)
β¨
-proj i = F , isHom
where
F : π»[ β¨
π ] βΆ π»[ π i ]
F β¨$β© x = x i
F .cong xy = xy i
isHom : IsHom (β¨
π) (π i) F
isHom .compatible = Setoid.refl π»[ π i ]
```
We could prove a more general result involving projections onto multiple factors, but
so far the single-factor result has sufficed.
---
[^1]: `β¨
-hom-co`{.AgdaFunction} does real work later: the proof of Birkhoff's theorem
in [Setoid.Varieties.HSP][] uses it to build the homomorphism `homβ` from the
term algebra into the product `β` that the whole argument turns on.