# Morphisms of spans on families of types
```agda
module foundation.morphisms-spans-families-of-types where
```
<details><summary>Imports</summary>
```agda
open import foundation.commuting-triangles-of-homotopies
open import foundation.dependent-pair-types
open import foundation.equality-dependent-function-types
open import foundation.fundamental-theorem-of-identity-types
open import foundation.homotopy-induction
open import foundation.spans-families-of-types
open import foundation.structure-identity-principle
open import foundation.universe-levels
open import foundation.whiskering-homotopies-composition
open import foundation-core.commuting-triangles-of-maps
open import foundation-core.equivalences
open import foundation-core.homotopies
open import foundation-core.identity-types
open import foundation-core.torsorial-type-families
```
</details>
## Idea
Consider two [spans](foundation.spans-families-of-types.md) `๐ฎ := (S , f)` and
`๐ฏ := (T , g)` on a family of types `A : I โ ๐ฐ`. A
{{#concept "morphism" Disambiguation="span on a family of types" Agda=hom-span-type-family}}
from `๐ฎ` to `๐ฏ` consists of a map `h : S โ T` and a
[homotopy](foundation-core.homotopies.md) witnessing that the triangle
```text
h
S ----> T
\ /
f i \ / g i
โจ โจ
A i
```
[commutes](foundation-core.commuting-triangles-of-maps.md) for every `i : I`.
## Definitions
### Morphisms of spans on families of types
```agda
module _
{l1 l2 l3 l4 : Level} {I : UU l1} {A : I โ UU l2}
(๐ฎ : span-type-family l3 A) (๐ฏ : span-type-family l4 A)
where
hom-span-type-family : UU (l1 โ l2 โ l3 โ l4)
hom-span-type-family =
ฮฃ ( spanning-type-span-type-family ๐ฎ โ
spanning-type-span-type-family ๐ฏ)
( ฮป h โ
(i : I) โ
coherence-triangle-maps
( map-span-type-family ๐ฎ i)
( map-span-type-family ๐ฏ i)
( h))
module _
{l1 l2 l3 l4 : Level} {I : UU l1} {A : I โ UU l2}
(๐ฎ : span-type-family l3 A) (๐ฏ : span-type-family l4 A)
(h : hom-span-type-family ๐ฎ ๐ฏ)
where
map-hom-span-type-family :
spanning-type-span-type-family ๐ฎ โ
spanning-type-span-type-family ๐ฏ
map-hom-span-type-family = pr1 h
coherence-triangle-hom-span-type-family :
(i : I) โ
coherence-triangle-maps
( map-span-type-family ๐ฎ i)
( map-span-type-family ๐ฏ i)
( map-hom-span-type-family)
coherence-triangle-hom-span-type-family =
pr2 h
```
### Homotopies of morphisms of spans on families of types
Consider two spans `๐ฎ := (S , f)` and `๐ฏ := (T , g)` on a family of types
`A : I โ ๐ฐ`, and consider two morphisms `(h , H)` and `(k , K)` between them. A
{{#concept "homotopy" Disambiguation="morphism between spans on families of types" Agda=htpy-hom-span-type-family}}
is a pair `(ฮฑ , ฮฒ)` consisting of a homotopy
```text
ฮฑ : h ~ k
```
and a family `ฮฒ` of homotopies witnessing that the triangle
```text
f i
/ \
H i / ฮฒ i \ K i
โจ โจ
(g i โ h) ------> (g i โ k)
g i ยท ฮฑ
```
commutes for each `i : I`.
```agda
module _
{l1 l2 l3 l4 : Level} {I : UU l1} {A : I โ UU l2}
(๐ฎ : span-type-family l3 A) (๐ฏ : span-type-family l4 A)
(h k : hom-span-type-family ๐ฎ ๐ฏ)
where
coherence-htpy-hom-span-type-family :
map-hom-span-type-family ๐ฎ ๐ฏ h ~ map-hom-span-type-family ๐ฎ ๐ฏ k โ
UU (l1 โ l2 โ l3)
coherence-htpy-hom-span-type-family ฮฑ =
(i : I) โ
coherence-triangle-homotopies'
( coherence-triangle-hom-span-type-family ๐ฎ ๐ฏ k i)
( map-span-type-family ๐ฏ i ยทl ฮฑ)
( coherence-triangle-hom-span-type-family ๐ฎ ๐ฏ h i)
htpy-hom-span-type-family : UU (l1 โ l2 โ l3 โ l4)
htpy-hom-span-type-family =
ฮฃ ( map-hom-span-type-family ๐ฎ ๐ฏ h ~ map-hom-span-type-family ๐ฎ ๐ฏ k)
( coherence-htpy-hom-span-type-family)
module _
(ฮฑ : htpy-hom-span-type-family)
where
htpy-htpy-hom-span-type-family :
map-hom-span-type-family ๐ฎ ๐ฏ h ~ map-hom-span-type-family ๐ฎ ๐ฏ k
htpy-htpy-hom-span-type-family = pr1 ฮฑ
coh-htpy-hom-span-type-family :
coherence-htpy-hom-span-type-family htpy-htpy-hom-span-type-family
coh-htpy-hom-span-type-family = pr2 ฮฑ
```
### The reflexivity homotopy on a morphism of spans on families of types
```agda
module _
{l1 l2 l3 l4 : Level} {I : UU l1} {A : I โ UU l2}
(๐ฎ : span-type-family l3 A) (๐ฏ : span-type-family l4 A)
(h : hom-span-type-family ๐ฎ ๐ฏ)
where
refl-htpy-hom-span-type-family :
htpy-hom-span-type-family ๐ฎ ๐ฏ h h
pr1 refl-htpy-hom-span-type-family = refl-htpy
pr2 refl-htpy-hom-span-type-family i = right-unit-htpy
```
## Properties
### Characterization of identifications of morphisms of spans on families of types
```agda
module _
{l1 l2 l3 l4 : Level} {I : UU l1} {A : I โ UU l2}
(๐ฎ : span-type-family l3 A) (๐ฏ : span-type-family l4 A)
(h : hom-span-type-family ๐ฎ ๐ฏ)
where
htpy-eq-hom-span-type-family :
(k : hom-span-type-family ๐ฎ ๐ฏ) โ
h ๏ผ k โ htpy-hom-span-type-family ๐ฎ ๐ฏ h k
htpy-eq-hom-span-type-family .h refl =
refl-htpy-hom-span-type-family ๐ฎ ๐ฏ h
is-torsorial-htpy-hom-span-type-family :
is-torsorial (htpy-hom-span-type-family ๐ฎ ๐ฏ h)
is-torsorial-htpy-hom-span-type-family =
is-torsorial-Eq-structure
( is-torsorial-htpy _)
( map-hom-span-type-family ๐ฎ ๐ฏ h , refl-htpy)
( is-torsorial-Eq-ฮ (ฮป i โ is-torsorial-htpy _))
is-equiv-htpy-eq-hom-span-type-family :
(k : hom-span-type-family ๐ฎ ๐ฏ) โ
is-equiv (htpy-eq-hom-span-type-family k)
is-equiv-htpy-eq-hom-span-type-family =
fundamental-theorem-id
( is-torsorial-htpy-hom-span-type-family)
( htpy-eq-hom-span-type-family)
extensionality-hom-span-type-family :
(k : hom-span-type-family ๐ฎ ๐ฏ) โ
(h ๏ผ k) โ htpy-hom-span-type-family ๐ฎ ๐ฏ h k
pr1 (extensionality-hom-span-type-family k) =
htpy-eq-hom-span-type-family k
pr2 (extensionality-hom-span-type-family k) =
is-equiv-htpy-eq-hom-span-type-family k
eq-htpy-hom-span-type-family :
(k : hom-span-type-family ๐ฎ ๐ฏ) โ
htpy-hom-span-type-family ๐ฎ ๐ฏ h k โ h ๏ผ k
eq-htpy-hom-span-type-family k =
map-inv-equiv (extensionality-hom-span-type-family k)
```