---
layout: default
file: "src/Setoid/Varieties/Invariance.lagda.md"
title: "Setoid.Varieties.Invariance module"
date: "2026-06-12"
author: "the agda-algebras development team"
---
### Reduct-invariance of satisfaction
This is the [Setoid.Varieties.Invariance][] module of the [Agda Universal Algebra Library][].
This module proves the *reduct-invariance of satisfaction*, which is the primary
pay-off of expressing the reduct as a functor.
For a signature morphism `Ο : πβ β πβ`, an `πβ`-algebra `π¨`, and
`πβ`-terms `s , t`, we have
reduct Ο π¨ β§ s β t if and only if π¨ β§ Ο βΆ s β Ο βΆ t.
In words: to check an equation against the *poorer* view of `π¨` (the reduct, which
sees only the `πβ`-operations) is the same as checking the *translated* equation
against `π¨` itself.
Model theorists know this as (the equational case of) the **satisfaction condition**
of institutions,[^1] and universal algebraists use it tacitly every time we say
"a monoid satisfies the semigroup laws."
##### Why this is naturality of the fold
Nothing about the theorem is specific to satisfaction; the satisfaction statement is
the shadow of one commuting triangle of interpretation maps. Fix an environment
`Ξ· : X β π[ π¨ ]` (note `π¨` and `reduct Ο π¨` have the *same* carrier, so one
environment serves both, and `Ο βΆ_` fixes variables, so no translation of `Ξ·` is
needed).
Evaluation of `πβ`-terms in the reduct, and of `πβ`-terms in `π¨`, fit around the term
translation.
```text
Ο βΆ_
Termβ X βββββββββ Termβ X
β² β β¦_β§ in π¨
β¦_β§ in β² β (the πβ-fold)
reduct Ο π¨ β² β
β² |
β² |
β² |
β β
π[ π¨ ]
```
`reduct-interp` below proves this triangle commutes, by structural induction on the
term. Both routes are *folds* β unique homomorphic extensions out of term algebras
β and the triangle is precisely the naturality of the fold with respect to the
natural transformation `β¦ Ο β§ : β¨ πβ β© βΉ β¨ πβ β©` induced by `Ο` (M4-5b,
[Setoid.Signatures.Functor][]): unwinding the `node` case of the proof, the
inductive step is exactly "precompose with `β¦ Ο β§`'s component, then interpret" β
which is the defining clause of [`reduct`][Setoid.Algebras.Reduct]. Once the
triangle commutes, both invariance directions are two-line equational
rearrangements: an equation `β¦sβ§ β β¦tβ§` holds on one side of the triangle iff it
holds on the other.
The companion naturality in the *algebra* argument β fix the signature, vary the
algebra along a homomorphism β is `free-lift-natural` / `comm-hom-term`
([Setoid.Terms.Properties][], [Setoid.Terms.Operations][]). The two naturalities
together say the interpretation pairing `(π¨ , t) β¦ β¦ t β§α΄¬` is functorial in both
coordinates, which is the full content of "`β¦_β§` is the unique fold."
##### What this absorbs, and the M3-5 measurement
M3-6 discharged theory obligations for reduct-derived forgetfuls by hand: the
`Th-Semigroup` obligation inside `monoidβsemigroup`
([Classical.Structures.Monoid][]) pivots through curried associativity using
per-signature `interp-node` bridges, each paying the `Fin n` Ξ·-gap (ADR-002 Β§1, the
M3-5 finding) once. `β§-reduct` replaces that pattern: the general lemma is proved
*once*, by structural induction over abstract positions, and β this is the
measurement the issue asks to record β **the M3-5 binary-node-bridge obstruction
does not appear at the functorial level**. No clause here matches `refl` against a
neutral `ArityOf π f β‘ Fin 2`, no `interp-node` family is needed, and no `Fin`
Ξ·-bridge is paid: the induction never compares a concrete `Fin`-pattern lambda
against an abstract tuple. What residue remains is per-*theory*, not per-signature:
a concrete theory written with `pair`-style `Fin`-lambdas must be aligned with its
translation up to the term equality `_β_` (a finite, mechanical pattern-match; see
the demonstration in [Classical.Categories.Forgetful][]) β and that alignment is
`β`-provable where a propositional `β‘` would be funext-blocked. Conclusion: the
obstruction dissolves functorially; only its benign, provable shadow survives, in
the concrete theories themselves.
This module lives in `Setoid.Varieties`: reduct-invariance of satisfaction is general
universal algebra, and its object map [`reduct`][Setoid.Algebras.Reduct] is itself a
`Setoid/` construction (both relocated from `Classical/` by
[ADR-006](../../docs/adr/006-signature-morphism-category.md), M4-16). It opens the
two-signature `Setoid/Varieties/` area that M4-5g (reduct classes of varieties) extends.
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module Setoid.Varieties.Invariance where
open import Agda.Primitive using () renaming ( Set to Type )
open import Data.Product using ( _,_ )
open import Function using ( Func )
open import Level using ( Level )
open import Relation.Binary using ( Setoid )
open import Relation.Binary.PropositionalEquality using (refl)
open import Overture.Signatures using ( π ; π₯ ; Signature )
open import Overture.Signatures.Morphisms using ( SigMorphism ; ΞΊ )
open import Overture.Terms using ( Term ; β ; node )
open import Overture.Terms.Translation using ( _βΆ_ )
open import Setoid.Algebras.Basic using ( Algebra ; π»[_] ; π[_] )
open import Setoid.Algebras.Reduct using ( reduct )
open import Setoid.Terms.Basic using (module Environment)
import Setoid.Varieties.EquationalLogic as EqLogic
open Algebra using ( Interp )
open Func using ( cong ) renaming ( to to _β¨$β©_ )
private variable
Ξ± Ο Ο : Level
X : Type Ο
```
-->
#### Naturality of the fold along a signature morphism
Everything below is parameterized by the morphism `Ο` and the `πβ`-algebra `π¨`. The
two `Environment` instances interpret `πβ`-terms in `reduct Ο π¨` and `πβ`-terms in
`π¨`; the two `_β§_β_` instances are the corresponding satisfaction relations.
```agda
module _ {πβ πβ : Signature π π₯} (Ο : SigMorphism πβ πβ) (π¨ : Algebra {π = πβ} Ξ± Ο) where
open Environment {π = πβ} (reduct Ο π¨) using () renaming ( β¦_β§ to β¦_β§β )
open Environment {π = πβ} π¨ using () renaming ( β¦_β§ to β¦_β§β )
open Setoid π»[ π¨ ] using ( _β_ ) renaming (refl to βrefl; sym to βsym ; trans to βtrans )
open EqLogic {π = πβ} using () renaming ( _β§_β_ to _β§β_β_ )
open EqLogic {π = πβ} using () renaming ( _β§_β_ to _β§β_β_ )
```
The commuting triangle: interpreting an `πβ`-term in the reduct is interpreting its
translation in `π¨`, under any environment. At a leaf both sides look up the
variable. At a node, the reduct's interpretation *is* "apply the interpretation
in `π¨` of `ΞΉ Ο f` to the `ΞΊ Ο f`-reindexed arguments" β definitionally, by the defining
clause of `reduct` β and the translation's `node` clause performs the same
reindexing syntactically, so the two sides agree position by position, by the
inductive hypothesis at the reindexed subterms. Note what does *not* happen: no
arity is ever compared to a concrete `Fin n`, so the without-K unifier is never
asked to invert anything.
```agda
reduct-interp : (t : Term X) (Ξ· : X β π[ π¨ ]) β β¦ t β§β β¨$β© Ξ· β β¦ Ο βΆ t β§β β¨$β© Ξ·
reduct-interp (β x) Ξ· = βrefl
reduct-interp (node f ts) Ξ· =
cong (Interp π¨) (refl , Ξ» j β reduct-interp (ts (ΞΊ Ο f j)) Ξ·)
```
#### The satisfaction condition
Satisfaction is the interpretation triangle quantified over environments, so each
direction of the invariance is a `trans`-sandwich of the triangle around the given
satisfaction proof. Recall `π¨ β§ p β q` unfolds to "for every environment `Ξ·`,
`β¦ p β§ Ξ· β β¦ q β§ Ξ·`"; environments transfer across the two sides on the nose
because the carrier of the reduct *is* the carrier of `π¨` and translation fixes
variables.
`β§-reduct` is the direction that discharges theory obligations of reduct-derived
forgetful functors (a monoid's associativity, translated, *is* the semigroup
associativity its reduct must satisfy); `β§-expand` is the converse, the direction
used when transporting equational facts from a reduct up to its expansion.
```agda
β§-reduct : {s t : Term X} β π¨ β§β (Ο βΆ s) β (Ο βΆ t) β reduct Ο π¨ β§β s β t
β§-reduct {s = s} {t} Aβ§ Ξ· =
βtrans (reduct-interp s Ξ·) (βtrans (Aβ§ Ξ·) (βsym (reduct-interp t Ξ·)))
β§-expand : {s t : Term X} β reduct Ο π¨ β§β s β t β π¨ β§β Ο βΆ s β Ο βΆ t
β§-expand {s = s} {t} Rβ§ Ξ· =
βtrans (βsym (reduct-interp s Ξ·)) (βtrans (Rβ§ Ξ·) (reduct-interp t Ξ·))
```
Together the two directions are the biconditional promised at the top. They are
deliberately kept as two one-directional lemmas rather than packaged into a single
`iff` record: every consumer uses exactly one direction, and the unpacked forms
compose directly with the satisfaction proofs the `Classical` theories carry.
--------------------------------------
[^1]: Goguen and Burstall's slogan is, "Truth is invariant under change of notation."