ADR-006: Signature morphisms and the self-contained Sig category¶
Status¶
Accepted — 2026-06-07 (M4-5a).
Amended — 2026-06-14 (M4-16, #403): the reduct development relocates from Classical/ to Setoid/ (reduct is universal algebra, not classical, and depends on nothing in Classical/). See the Amendment section below; it supersedes the placement clause of Decision 3.
Context¶
M4-5 (#338) builds out the category-theoretic layer the foundation already implicitly is: Signature is a container, ⟨ 𝑆 ⟩ is its polynomial functor, Interp is the structure map, and Term is the initial algebra. M4-5a (#339) is the first link: package the pair (ι , κ) that reduct consumes today (then Classical.Structures.Reduct, relocated to Setoid.Algebras.Reduct by the Amendment below) as a first-class SigMorphism 𝑆₁ 𝑆₂ — a container morphism with ι covariant on operation symbols and κ contravariant on positions — and assemble signatures and these morphisms into a category Sig.
Two decisions are forced before any of M4-5 can proceed, because they fix the shape of everything downstream.
- Morphism equality. Under
--safewithout funext, two morphisms agreeing pointwise need not be propositionally equal — the sameFin nη-gap that forces pointwise round-trips at the stdlib bundle bridges (ADR-002 §6). Issue #339 flagged that the category laws might therefore have to be stated against a hom-setoid rather than_≡_. Settling this is half the value of the issue. - Realization. Build the category on the
agda-categorieslibrary (as aCategoryinstance) or stay self-contained?agda-categoriesis not a dependency of the flake, which pins only Agda 2.8.0 and standard-library 2.3.
Decision¶
-
The signature category uses propositional
_≡_for morphism equality; no hom-setoid. The moduleOverture.Signatures.Morphismsconfirms that all three category laws (left identity, right identity, associativity) hold byrefl. The reason:ιandκare plain functions, so the identity morphism isidon both components and composition is ordinary function composition; function η reducesf ∘ id,id ∘ f, and(f ∘ g) ∘ hdefinitionally, and record η lifts the componentwise equalities to theSigMorphismrecord. TheFin nη-gap does not arise, because the laws compose abstract position maps and never normalize aFin-pattern lambda. This conclusion is specific to the signature category, where morphisms are bare functions; it does not transfer to the category of algebras (M4-5c), where homomorphism equality is pointwise and a hom-setoid is required. -
Realize the M4-5 category layer self-contained; do not add an
agda-categoriesdependency. Because the laws arerefl/cong, the realization costagda-categorieswould save is small, and the dependency cost is real (a flake change, a version pin, CI surface, and unverified compatibility with the pinned Agda 2.8.0). The shared category vocabulary the layer introduces — built where M4-5c first needs it, not here — is a minimalCategoryrecord carrying a hom-equality field_≈_, instantiated to_≈_ = _≡_forSigand to a pointwise setoid for the algebra category. -
The signature-morphism layer is setoid-free and lives in
Overture. Objects are Σ-typed signatures, morphisms are functions, and equality is_≡_— noSetoidmachinery is involved — so the module isOverture.Signatures.Morphisms, co-located withOverture.Signatures. The algebra-level category material (M4-5c onward) lives higher up, in theSetoid/layer.reduct, which acts on algebras, stays in its current home and merely imports the morphism type (acyclically:Overtureis belowSetoidandClassical). (The placement ofreductis amended by M4-16 — see the Amendment below:reductand its dependent modules move down intoSetoid/, which is both the principled home and cycle-free, since they import nothing fromClassical/.) -
Sig 𝓞 𝓥fixes a common level pair. Its objects areSignature 𝓞 𝓥at fixed(𝓞 , 𝓥); the morphism record shares those levels. A level-heterogeneous (large or displayed) category of signatures is out of scope for M4-5a. -
reductis re-expressed to consume aSigMorphism, keeping the(ι , κ)-pair form as a thin wrapper (reductBy). Each of the six call sites routes its existing per-structure position map —∙-κ,mo-κ,∧-κ,∨-κ,+-κ,·-κ, each defined by pattern-matching on the operation symbol and returningid— throughreductBy, a one-line change per site. A single genericembedwithκ = λ _ → idis not definable under--safe: for an abstract symbolo, the aritiesArityOf 𝑆₂ (ι o)andArityOf 𝑆₁ oare not definitionally equal, soiddoes not type-check there; the position map must pattern-match on the symbol, which is exactly what the per-structure maps already do.
Consequences¶
Sigis the cheapest possible category to certify. The laws arerefl, so the functor and naturality results of M4-5b sit on a strict base, and anything that stays at the signature level gets congruence and rewriting directly, with no setoid-reasoning overhead.- No new toolchain dependency. The flake's minimal, carefully-pinned surface is preserved, and the cubical port (ADR-003) stays under our control rather than gated on
agda-categories' cubical compatibility. - We forgo
agda-categories' library of constructions (negative). Functor categories, (co)limits, and adjunction combinators are not handed to us; M4-5d (theF ⊣ reductadjunction) and later issues may have to build scaffoldingagda-categorieswould have supplied. Revisit decision 2 if the self-contained vocabulary grows unwieldy. - The signature and algebra categories use different hom-equalities (negative).
Siguses_≡_; the algebra category will use a pointwise setoid. The sharedCategoryrecord must therefore be general (carry_≈_) even thoughSigonly ever needs_≡_, so a reader meetingSigfirst sees a_≈_field that is trivially_≡_. - Placement in
Overturekeeps the signature category dependency-light. It is importable by the whole library without pulling inSetoidmachinery. reduct's call sites migrate uniformly.lattice→meetMagma,lattice→joinMagma,monoid→magma,group→monoidAlg,ring→abelianGroupAlg, andring→monoidAlgeach route their existing pattern-matched position map through thereductBywrapper — a one-line change per site, no flag-day rewrite.
Alternatives considered¶
- A hom-setoid for
Sigfrom the start. Rejected: the spike shows_≡_suffices withrefllaws, so a hom-setoid would be unjustified overhead at the signature level. It remains the right choice for the algebra category, for the different reason that homomorphism equality is pointwise; that is recorded when M4-5c lands. - Build on
agda-categories. Rejected as the default: it is not a flake dependency, so adopting it is a toolchain change with a version pin, CI surface, and unverified Agda-2.8.0 compatibility (it has historically lagged Agda releases), in exchange for realization savings that are small when the laws arerefl/cong. The option stays open as a later, separately-decided spike if the self-contained vocabulary proves insufficient. - Place the signature category under
Setoid/. Rejected: the signature category needs no setoids, soOvertureis its natural, lower home and keeps it usable withoutSetoidimports. - A level-heterogeneous (large) category of signatures. Deferred: useful for morphisms across differing operation/arity levels, but not needed for reduct-packaging goal of M4-5a; the fixed-level
Sig 𝓞 𝓥is the clean first cut.
Amendment (2026-06-14, M4-16): the reduct development moves to Setoid/¶
Decision 3 placed reduct in Classical.Structures.Reduct, and the reduct functor and reduct-invariance results were realized in Classical/ too, on the rule that "anything whose object map is reduct must live in Classical/ — a Setoid.* → Classical.* import would be a cycle." M4-16 (#403) reverses the placement, for two reasons.
-
Conceptual. Reducts, signature morphisms, and varieties are universal algebra — they range over arbitrary signatures.
Classical/is the tradition of specific structures (groups, rings, fields), each studied over one fixed signature, where reducts play little role. So the reduct development belongs in theSetoid/foundation. -
Technical — the cycle rule was circular.
reductimports onlyOverture.*andSetoid.Algebras.Basic; it depends on nothing inClassical/. The "Setoid → Classicalcycle" existed only becausereductwas parked inClassical/. Moving the root down removes the obstruction entirely, and reunifies the M4-5 functorial layer — most of which (Overture.Signatures.Morphisms,Setoid.Signatures.Functor, theSetoid.Categories.*vocabulary,Overture.Terms.Translation,Setoid.Terms.*) already lives inSetoid//Overture/; only the reduct-touching modules were stranded inClassical/.
The relocations:
Classical.Structures.Reduct→Setoid.Algebras.Reduct.Classical.Categories.Reduct→Setoid.Categories.Reduct.Classical.Varieties.Invariance→Setoid.Varieties.Invariance, andClassical.Varieties.Reducts→Setoid.Varieties.Reducts(the M4-5g module, #402), retiring theClassical/Varieties/subtree.
What stays in Classical/: Classical.Categories.AdjoinUnit and Classical.Categories.Forgetful, which are structure-specific (adjoin-a-unit to a semigroup; monoid→semigroup) and now import reductF / ⊧-reduct from their Setoid/ homes. The classical forgetful projections (monoid→semigroup, group→monoid, …) continue to consume reduct / reductBy, now imported from Setoid.Algebras.Reduct.
Because the moved modules are inherently two-signature (φ : 𝑆₁ → 𝑆₂), they do not fit the single-{𝑆} umbrella aggregators Setoid.Algebras and Setoid.Varieties; they remain directory-resident and are imported directly, as they already were. Decision 2 (self-contained, no agda-categories) and the equality decisions (1, 4) are unaffected; only the tree placement of the reduct modules changes.
References¶
- Issue M4-5 — Signatures as functors: reducts, expansions, and interpretability.
- Issue M4-16 — Relocate the reduct development from
Classical/toSetoid/(this amendment). - Issue M4-5a — Category of signature morphisms.
src/Overture/Signatures/Morphisms.lagda.md— theSigMorphismrecord, identity and composition, and therefl-proved category laws (the spike this ADR records).docs/notes/milestone-signature-functors.md— the M4-5 design note.- ADR-002 §6 — pointwise equivalence and the
Fin nη-gap at the bundle bridges (the obstruction that does not recur at the signature level). - ADR-003 — Cubical Agda as the long-term target (the portability the self-contained choice keeps under our control).
- ADR-005 — the
𝓞/𝓥convention the new module follows (imports the levels, never re-declares them). - M. Abbott, T. Altenkirch, N. Ghani, Containers: constructing strictly positive types, Theoret. Comput. Sci. 342 (2005) 3–27.