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;
this is 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.
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.1 For Magma the theory is empty; the signature carries the whole
content.
The conventions for naming established here are normative for every subsequent
structure; 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);2 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 and every subsequent
theory.
ar-Magma : Op-Magma โ Type ar-Magma โ-Op = Fin 2
The signature value¶
Sig-Magma pairs Op-Magma with ar-Magma, and is the signature every โ-based
structure in the Classical/ tree builds on: Semigroup and its equation-only
extensions reuse it unchanged, and richer signatures such as Sig-Monoid embed it
by the inclusion that the forgetful functors ride.
Sig-Magma : Signature 0โ 0โ Sig-Magma = Op-Magma , ar-Magma