Classical.Signatures.Magma¶
The signature of magmas¶
This is the Classical.Signatures.Magma module of the Agda Universal Algebra Library.
A magma is, traditionally, a carrier equipped with a single binary operation โ
the most minimal of the classical algebraic structures, and the right starting
point for the Classical/ tree because its equational theory is
empty. This module fixes the signature of magmas as a one-symbol algebraic
signature with that symbol assigned arity Fin 2.
Per ADR-002 v2 ยง5, every concrete
classical structure X is characterized by a pair (Sig-X , Th-X) โ its own
signature and its own complete equational theory in that signature. For Magma the
theory is empty; the signature carries the whole content.
The conventions for naming established here are normative for every subsequent
structure (Semigroup in M3-4, Monoid and Group in M3-6, Lattice in M3-7, Ring in
M3-8); each follows the same Op-X/<symbol>-Op/ar-X/Sig-X pattern,
extending or reusing as appropriate.
- Operation symbols are introduced via a one-or-more-constructor data type
Op-<Structure>, with each constructor named<symbol>-Op(hyphen-separated, capitalO). Reserving the bare symbol โโ,ฮต,โปยน,+,0,ยท,1,โง,โจโ for user-facing curried sugar avoids a name clash between the syntactic operation-symbol-of-the-signature and the semantic curried operation on a fixed algebra. - Arity functions are named
ar-<Structure>and defined by direct pattern matching on operation-symbol constructors (ar-Magma โ-Op = Fin 2). Direct pattern matching is required, not optional: theClassical.Equationsbuilders demand definitional reduction ofArityOf ๐ fto a concreteFin nat use sites, which fails for indirect definitions (table lookups, conditionals). - Signature values are named
Sig-<Structure>and assembled as a ฮฃ-pair of the operation-symbol type and the arity function. The hyphenated long form is preferred over subscripted alternatives (๐โโ,๐_Magma) per ADR-002 v2 ยง7; the long form survives grep, copy/paste, and rendering across plain-text channels.
The operation-symbol type¶
A magma has a single binary operation symbol. The constructor is named โ-Op
following the <symbol>-Op convention; the bare โ is reserved for the curried
user-facing accessor introduced in Classical.Structures.Magma.
data Op-Magma : Type where โ-Op : Op-Magma
The arity function¶
โ-Op is binary, so its arity is Fin 2. Direct pattern matching on the single
constructor lets ArityOf Sig-Magma โ-Op reduce definitionally to Fin 2 โ
this is what makes the arity-conformance evidence refl of type
ArityOf Sig-Magma โ-Op โก Fin 2 typecheck in Th-Semigroup (M3-4) and every
subsequent theory.
ar-Magma : Op-Magma โ Type ar-Magma โ-Op = Fin 2
The signature value¶
Sig-Magma : Signature 0โ 0โ Sig-Magma = Op-Magma , ar-Magma