---
layout: default
file: "src/Setoid/Varieties/Interpretation.lagda.md"
title: "Setoid.Varieties.Interpretation module"
date: "2026-06-15"
author: "the agda-algebras development team"
---
### Theory interpretations and the interpretability quasi-order
This is the [Setoid.Varieties.Interpretation][] module of the [Agda Universal Algebra Library][].
This module is to a theory interpretation what [Setoid.Varieties.Invariance][] is to
a signature morphism. Where the latter packages a `SigMorphism` as a `reduct` with
respect to which satisfaction is an invariant, here we package an *interpretation*
([Overture.Terms.Interpretation][]) as a `reductα΄΅`{.AgdaFunction} and prove the
generalized satisfaction condition; we then use it to define the
**interpretability quasi-order** on equational theories and to record its reflexivity
and transitivity.
#### The interpretation reduct
For an interpretation `I : πβ β πβ` and an `πβ`-algebra `π©`, the
*interpretation reduct* `reductα΄΅ I π©` is the `πβ`-algebra on the same carrier in
which each operation symbol `o` of `πβ` is interpreted by the **derived operation**
`I o` β that is, by evaluating the `πβ`-term `I o` in `π©`, reading the arguments as
the values of the argument positions of `o`.
When `I = β¨ Ο β©α΄΅` comes from a signature morphism, `reductα΄΅ I π©` is the ordinary
`reduct Ο π©` (`reductα΄΅-β¨β©`{.AgdaFunction} below, by `refl`), so this is the
term-valued generalization of [`reduct`][Setoid.Algebras.Reduct].
#### The satisfaction condition
The pay-off is the generalized satisfaction condition: for `πβ`-terms `s , t`,
reductα΄΅ I π© β§ s β t if and only if π© β§ (I β¦ s) β (I β¦ t).
To check an `πβ`-equation against the derived view of `π©` is to check the
*interpreted* equation against `π©` itself. It is the shadow of one commuting
triangle of interpretation maps β naturality of the fold along the interpretation β
exactly as in [Setoid.Varieties.Invariance][], only now the node step
*grafts a derived term* rather than relabelling a symbol, and the proof leans on the
heterogeneous evaluation lemma `graft-eval`{.AgdaFunction} (evaluation commutes with
`graft`) in place of the definitional `reduct` step. (As there, no clause matches a
concrete `Fin n`, so the without-K unifier is never asked to invert anything.)
#### The quasi-order
An equational theory `β°β` of `πβ` is *interpretable in* a theory `β°β` of `πβ`,
written `β°β βΌ β°β`, when some interpretation carries every model of `β°β` (via its
reduct) to a model of `β°β`. By the satisfaction condition this is the same as asking
that every `β°β`-equation, *interpreted*, be a consequence of `β°β`.
This is the universal algebraist's notion of one variety interpreting another, whose
order-reflection is the GarciaβTaylor lattice of interpretability types.[^1]
Reflexivity is the identity interpretation and transitivity is composition `_βα΄΅_`;
the proofs are short *because* `β¦-id` and `β¦-β` ([Setoid.Terms.Interpretation][])
already did the work, fed through the satisfaction condition.
This connects forward to planned formalizing work related to the BodirskyβPinsker
program, where interpretability between (infinite-domain) clones is the governing
relation.[^2]
A worked Maltsev-term instance is in [Classical.Interpretations.Maltsev][].
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module Setoid.Varieties.Interpretation where
open import Agda.Primitive using () renaming ( Set to Type )
open import Data.Product using ( _,_ ; _Γ_ ; Ξ£-syntax ; projβ ; projβ )
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
; OperationSymbolsOf )
open import Overture.Signatures.Morphisms using ( SigMorphism )
open import Overture.Terms using ( Term ; β ; node )
open import Overture.Terms.Interpretation using ( Interpretation ; graft ; _β¦_
; idα΄΅ ; _βα΄΅_ ; β¨_β©α΄΅ )
open import Setoid.Algebras.Basic using ( Algebra ; _^_ ; π»[_] ; π[_] )
open import Setoid.Algebras.Reduct using ( reduct )
open import Setoid.Terms.Basic using ( _β_ ; β-isSym ; module Environment )
open import Setoid.Terms.Interpretation using ( β¦-id ; β¦-β )
import Setoid.Varieties.EquationalLogic as EqLogic
open Func using ( cong ) renaming ( to to _β¨$β©_ )
private variable
Ξ± Ο Ο ΞΉ : Level
X : Type Ο
π πβ πβ πβ : Signature π π₯
Οβ Οβ Οβ ΞΉβ ΞΉβ ΞΉβ : Level
```
-->
#### Two single-algebra lemmas
Everything in this block fixes one algebra `π¨`. First, satisfaction respects the
term equality `_β_` on both sides. (This is the convenience lemma we anticipated
consumers would want; the interpretability proofs are that consumer.)
```agda
module _ {π : Signature π π₯} (π¨ : Algebra {π = π} Ξ± Ο) where
open Environment π¨ using ( β¦_β§ ; ββEqual )
open Setoid π»[ π¨ ] using ( _β_ ) renaming ( refl to βrefl ; sym to βsym ; trans to βtrans )
open EqLogic {π = π} using ( _β§_β_ )
β§-β : {s sβ² t tβ² : Term {π = π} X}
β s β sβ² β t β tβ² β π¨ β§ s β t β π¨ β§ sβ² β tβ²
β§-β {s = s} {sβ²} {t} {tβ²} sβsβ² tβtβ² Aβ§ Ξ· =
βtrans (βsym (ββEqual s sβ² sβsβ² Ξ·)) (βtrans (Aβ§ Ξ·) (ββEqual t tβ² tβtβ² Ξ·))
```
Second, term evaluation commutes with `graft`: evaluating a grafted term is
evaluating the host term in the environment that first evaluates each grafted
subtree. This is the heterogeneous-level analogue of the `substitution` lemma of
[Setoid.Terms.Basic][], and it is the node step of the interpretation triangle below.
```agda
graft-eval : {ΞΎ : Level} {U : Type ΞΎ}
(u : Term {π = π} U) (Ο : U β Term {π = π} X) (Ξ· : X β π[ π¨ ])
β β¦ graft u Ο β§ β¨$β© Ξ· β β¦ u β§ β¨$β© (Ξ» y β β¦ Ο y β§ β¨$β© Ξ·)
graft-eval (β y) Ο Ξ· = βrefl
graft-eval (node f us) Ο Ξ· = cong (Algebra.Interp π¨) (refl , Ξ» i β graft-eval (us i) Ο Ξ·)
```
#### The interpretation reduct and the satisfaction condition
Now fix an interpretation `I` and an `πβ`-algebra `π©`. The reduct keeps the carrier
and interprets each `πβ`-symbol `o` by evaluating `I o` (a derived operation), so its
`cong` is the congruence of that evaluation.
```agda
module _
{πβ πβ : Signature π π₯}
(π© : Algebra {π = πβ} Ξ± Ο)
where
module _
(I : Interpretation πβ πβ)
where
private module EnvB = Environment π©
open EnvB using () renaming ( β¦_β§ to β¦_β§β )
open Algebra using (Domain ; Interp)
reductα΄΅ : Algebra {π = πβ} Ξ± Ο
reductα΄΅ .Domain = π»[ π© ]
reductα΄΅ .Interp β¨$β© (o , args) = β¦ I o β§β β¨$β© args
reductα΄΅ .Interp .cong {o , u} {.o , v} (refl , uβv) = cong β¦ I o β§β uβv
open Environment {π = πβ} reductα΄΅ 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 interpretation triangle: evaluating an `πβ`-term in the reduct equals evaluating its
interpretation in `π©`. At a leaf both sides look up the variable. At a node, the
reduct's interpretation *is* "evaluate the derived term `I f`", and the translation's
node clause grafts the interpreted subterms into `I f`; `graft-eval` says those agree,
and the inductive hypotheses match the arguments through `cong`.
```agda
reductα΄΅-interp : (t : Term {π = πβ} X) (Ξ· : X β π[ π© ]) β β¦ t β§β β¨$β© Ξ· β β¦ I β¦ t β§β β¨$β© Ξ·
reductα΄΅-interp (β x) Ξ· = βrefl
reductα΄΅-interp (node f ts) Ξ· =
βtrans (cong β¦ I f β§β (Ξ» i β reductα΄΅-interp (ts i) Ξ·))
(βsym (graft-eval π© (I f) (Ξ» i β I β¦ ts i) Ξ·))
```
Satisfaction is the triangle quantified over environments, so each direction is a
`trans`-sandwich around the given satisfaction proof β verbatim the shape of
`β§-reduct` / `β§-expand`. The equation sides are pinned (`{s}`/`{t}`), as the handoff
records, since `s` is not recoverable from `I β¦ s`.
```agda
β§-interp : {s t : Term {π = πβ} X} β π© β§β (I β¦ s) β (I β¦ t) β reductα΄΅ β§β s β t
β§-interp {s = s} {t} Bβ§ Ξ· =
βtrans (reductα΄΅-interp s Ξ·) (βtrans (Bβ§ Ξ·) (βsym (reductα΄΅-interp t Ξ·)))
β§-uninterp : {s t : Term {π = πβ} X} β reductα΄΅ β§β s β t β π© β§β (I β¦ s) β (I β¦ t)
β§-uninterp {s = s} {t} Rβ§ Ξ· =
βtrans (βsym (reductα΄΅-interp s Ξ·)) (βtrans (Rβ§ Ξ·) (reductα΄΅-interp t Ξ·))
```
#### `reductα΄΅` generalizes `reduct`
When the interpretation is the one induced by a signature morphism, its reduct *is*
the ordinary signature reduct, operation by operation, by `refl` β the algebra-level
witness that `_β¦_` (and hence this whole development) extends to derived operations.
```agda
reductα΄΅-β¨β© : {Ο : SigMorphism πβ πβ} {o : OperationSymbolsOf πβ}
β o ^ reductα΄΅ β¨ Ο β©α΄΅ β‘ o ^ reduct Ο π©
reductα΄΅-β¨β© = refl
```
#### The interpretability quasi-order
A *theory* is an indexed family of equations. `π¨ β¨β β°` is the assertion that `π¨`
models every equation in `β°`.
```agda
module _ {π : Signature π π₯} where
open EqLogic {π = π} using ( _β§_β_ )
infix 4 _β¨β_
_β¨β_ : {Idx : Type ΞΉ} β Algebra Ξ± Ο β (Idx β Term X Γ Term X) β Type _
π¨ β¨β β° = β k β π¨ β§ projβ (β° k) β projβ (β° k)
```
Composition of interpretations carries through satisfaction. This is the
reduct-level shadow of `β¦-β`: a `(J βα΄΅ I)`-reduct satisfies exactly what the iterated
reduct `reductα΄΅ I (reductα΄΅ J πͺ)` satisfies, by two applications of the satisfaction
condition and one `β¦-β` rewrite. It is the engine of transitivity below.
```agda
module _
{πβ πβ πβ : Signature π π₯}
(I : Interpretation πβ πβ)
(J : Interpretation πβ πβ)
(πͺ : Algebra {π = πβ} Ξ± Ο)
where
open EqLogic {π = πβ} using ( _β§_β_ )
reductα΄΅-β-β§ : {s t : Term {π = πβ} X}
β reductα΄΅ (reductα΄΅ πͺ J) I β§ s β t β reductα΄΅ πͺ (J βα΄΅ I) β§ s β t
reductα΄΅-β-β§ {s = s} {t} hyp =
β§-interp πͺ (J βα΄΅ I) {s = s} {t}
(β§-β πͺ (β-isSym (β¦-β s)) (β-isSym (β¦-β t))
(β§-uninterp πͺ J {s = I β¦ s} {t = I β¦ t}
(β§-uninterp (reductα΄΅ πͺ J) I {s = s} {t = t} hyp)))
```
`β°β βΌ β°β` says `β°β` (a theory of `πβ`) is interpretable in `β°β` (a theory of `πβ`):
some interpretation's reduct sends every `β°β`-model to an `β°β`-model. The relation is
indexed by the algebra-level pair `(Ξ± , Ο)` at which models are tested, exactly as the
satisfaction relations are.
```agda
module Interpret (Ξ± Ο : Level) where
_βΌ_ : {πβ πβ : Signature π π₯}
{Xβ : Type Οβ} {Xβ : Type Οβ} {Idxβ : Type ΞΉβ} {Idxβ : Type ΞΉβ}
β (Idxβ β Term {π = πβ} Xβ Γ Term {π = πβ} Xβ)
β (Idxβ β Term {π = πβ} Xβ Γ Term {π = πβ} Xβ) β Type _
_βΌ_ {πβ = πβ} {πβ = πβ} β°β β°β =
Ξ£[ I β Interpretation πβ πβ ]
((π© : Algebra {π = πβ} Ξ± Ο) β π© β¨β β°β β reductα΄΅ π© I β¨β β°β)
infix 4 _βΌ_
```
Reflexivity: the identity interpretation works, because `idα΄΅ β¦_` is the identity up
to `_β_` (`β¦-id`) and satisfaction respects `_β_`.
```agda
module _ Ξ± Ο where
open Interpret Ξ± Ο
βΌ-refl : {π : Signature π π₯} {X : Type Ο} {Idx : Type ΞΉ}
(β° : Idx β Term X Γ Term X) β β° βΌ β°
βΌ-refl {π = π} β° = idα΄΅ , red
where
red : (π© : Algebra {π = π} Ξ± Ο) β π© β¨β β° β reductα΄΅ π© idα΄΅ β¨β β°
red π© Bβ¨ k =
β§-interp π© idα΄΅ {s = projβ (β° k)} {t = projβ (β° k)}
(β§-β π© (β-isSym (β¦-id (β° k .projβ))) (β-isSym (β¦-id (β° k .projβ))) (Bβ¨ k))
```
Transitivity: compose the interpretations with `_βα΄΅_`, chain the two reduct
implications, and re-fold the iterated reduct into the composite reduct with
`reductα΄΅-β-β§`.
```agda
βΌ-trans : {πβ πβ πβ : Signature π π₯}
{Xβ : Type Οβ} {Xβ : Type Οβ} {Xβ : Type Οβ}
{Idxβ : Type ΞΉβ} {Idxβ : Type ΞΉβ} {Idxβ : Type ΞΉβ}
(β°β : Idxβ β Term {π = πβ} Xβ Γ Term {π = πβ} Xβ)
(β°β : Idxβ β Term {π = πβ} Xβ Γ Term {π = πβ} Xβ)
(β°β : Idxβ β Term {π = πβ} Xβ Γ Term {π = πβ} Xβ)
β β°β βΌ β°β β β°β βΌ β°β β β°β βΌ β°β
βΌ-trans {πβ = πβ} β°β β°β β°β (I , Ihyp) (J , Jhyp) = J βα΄΅ I , red
where
red : (πͺ : Algebra {π = πβ} Ξ± Ο) β πͺ β¨β β°β β reductα΄΅ πͺ (J βα΄΅ I) β¨β β°β
red πͺ Cβ¨ k =
reductα΄΅-β-β§ I J πͺ {s = projβ (β°β k)} {t = projβ (β°β k)}
(Ihyp (reductα΄΅ πͺ J) (Jhyp πͺ Cβ¨) k)
```
--------------------------------------
[^1]: O. C. GarcΓa and W. Taylor, *The Lattice of Interpretability Types of Varieties*, Mem. Amer. Math. Soc. **50** (1984), no. 305.
[^2]: Infinitary CSP over Ο-categorical templates.