---
layout: default
file: "src/Overture/Signatures/Morphisms.lagda.md"
title: "Overture.Signatures.Morphisms module"
date: "2026-06-07"
author: "the agda-algebras development team"
---
### Signature morphisms and the category of signatures
This is the [Overture.Signatures.Morphisms][] module of the [Agda Universal Algebra Library][].
A *signature morphism* `πβ β πβ` is the AbbottβAltenkirchβGhani[^1] *container morphism*,
specialized to the container `Signature = (OperationSymbolsOf β· ArityOf)`. It is a pair
`(ΞΉ , ΞΊ)`: a map `ΞΉ` sending each operation symbol of `πβ` to one of `πβ` (covariant on
symbols), together with a family `ΞΊ` sending the arity of `ΞΉ o` back to the arity of `o`
(contravariant on positions). These are exactly the two arguments that
[`reduct`][Setoid.Algebras.Reduct] consumes today; this module packages them as a
first-class record and assembles signatures and their morphisms into a category.
Morphism equality here is *propositional* (`_β‘_`), not a hom-setoid. Because `ΞΉ` and `ΞΊ`
are plain functions, the identity morphism is `id` on both components and composition is
ordinary function composition, so the three category laws hold *definitionally* and are
proved by `refl`: function Ξ· reduces `f β id`, `id β f`, and `(f β g) β h` to `f`, `f`,
and `f β (g β h)`, and record Ξ· lifts those field equalities to the morphism record. The
`Fin n` Ξ·-gap that forces pointwise reasoning at the stdlib bundle bridges (ADR-002 Β§6)
does **not** arise here, because the laws compose abstract position maps rather than
normalizing `Fin`-pattern lambdas. See ADR-006 for the decision and its rationale.
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module Overture.Signatures.Morphisms where
open import Agda.Primitive using () renaming ( Set to Type )
open import Function using ( id ; _β_ )
open import Level using ( _β_ )
open import Relation.Binary.PropositionalEquality using ( _β‘_ ; refl )
open import Overture.Signatures
using ( π ; π₯ ; Signature ; OperationSymbolsOf ; ArityOf )
private variable
π πβ πβ πβ πβ : Signature π π₯
```
-->
#### Signature morphisms
A `SigMorphism πβ πβ` is a container morphism between the signatures-as-containers: the
operation-symbol map `ΞΉ` runs forwards, while for each symbol `o` the position map `ΞΊ o`
runs backwards, from the arity of `ΞΉ o` in `πβ` to the arity of `o` in `πβ`. The two
signatures are fixed at a common pair of levels `(π , π₯)`.
```agda
record SigMorphism (πβ πβ : Signature π π₯) : Type (π β π₯) where
constructor mkSigMorphism
field
ΞΉ : OperationSymbolsOf πβ β OperationSymbolsOf πβ
ΞΊ : (o : OperationSymbolsOf πβ) β ArityOf πβ (ΞΉ o) β ArityOf πβ o
open SigMorphism public
```
#### Identity and composition
The identity morphism is the identity on symbols and, for each symbol, the identity on
positions. Composition runs `ΞΉ` forwards (covariantly) and `ΞΊ` backwards (contravariantly):
to reindex a position of the composite at `o`, first pull it back through `Ο` at `ΞΉ Ο o`,
then through `Ο` at `o`.
```agda
id-morphism : SigMorphism π π
id-morphism = record { ΞΉ = id ; ΞΊ = Ξ» _ β id }
infixr 9 _ββ_
_ββ_ : SigMorphism πβ πβ β SigMorphism πβ πβ β SigMorphism πβ πβ
Ο ββ Ο = record { ΞΉ = ΞΉ Ο β ΞΉ Ο ; ΞΊ = Ξ» o β ΞΊ Ο o β ΞΊ Ο (ΞΉ Ο o) }
```
#### The category laws
The left and right identity laws and associativity each hold by `refl`: the relevant
function compositions reduce away by Ξ·, and record Ξ· lifts the componentwise equalities to
the morphism record. No hom-setoid and no funext are needed.[^2]
```agda
ββ-identityΛ‘ : (Ο : SigMorphism πβ πβ) β id-morphism ββ Ο β‘ Ο
ββ-identityΛ‘ _ = refl
ββ-identityΚ³ : (Ο : SigMorphism πβ πβ) β Ο ββ id-morphism β‘ Ο
ββ-identityΚ³ _ = refl
ββ-assoc : (Ο : SigMorphism πβ πβ) (Ο : SigMorphism πβ πβ) (Ο : SigMorphism πβ πβ)
β (Ο ββ Ο) ββ Ο β‘ Ο ββ (Ο ββ Ο)
ββ-assoc _ _ _ = refl
```
These four pieces β `SigMorphism`, `id-morphism`, `_ββ_`, and the three laws β are exactly
the data of a category `Sig π π₯` whose objects are signatures at levels `(π , π₯)`,
and whose realization is self-contained (no `agda-categories` dependency for now; see ADR-006).
Bundling them into a reusable `Category` record β shared with the category of algebras β is
postponed for follow-up work.
--------------------------------------
[^1]: M. Abbott, T. Altenkirch, N. Ghani, *Containers: constructing strictly positive types*, Theoret. Comput. Sci. **342** (2005) 3β27.
[^2]: This is the result that ADR-006 records.