A presentation of a Monoid consists of a set of generators and a set of relations , pairs of words . The presented monoid is
the Free Monoid modulo the Equivalence Relation generated by for all words (relations may be applied inside longer words); the unit is the empty word and multiplication is concatenation of representatives. “Lists of generators provide all the possible ways to write elements of ; the relations allow two such ways to denote the same element.” A free monoid is the presented monoid with no relations; a monoid with a finite presentation is finitely presented. Presentations are to monoids what presentations are to categories: a finite description of a possibly infinite structure.
Sources: CTfS §3.1.1.9 (Definitions 3.1.1.10–3.1.1.14, Remark 3.1.1.15, Example 3.1.1.16, Application 3.1.1.17, Exercises 3.1.1.18–3.1.1.19), §3.1.1.20 (Definition 3.1.1.21, Example 3.1.1.22, Exercise 3.1.1.23), Example 3.1.2.9, Exercise 3.2.1.8, Slogan 4.2.2.1; 7 Sketches Examples 3.13, 3.18, Exercise 3.19 (the same idea for one-object categories); Presentation of a Prop for the monoidal version.
Buttons (CTfS Example 3.1.1.16)
Think of as buttons; is the set of all ways of pressing them. Suppose you notice that pressing always has the same effect as , and that does nothing. With relations and :
Everyday presented monoids
- A buffer (CTfS Application 3.1.1.17): strings of at most 32 characters, where typing beyond 32 either overwrites the last character, , or is discarded, — both finitely presented ( relations for 26 letters). With a buffer of size 3, under and under (CTfS Exercise 3.1.1.18).
- A keyboard with backspace (CTfS Exercise 3.1.1.19): generators with relations for every letter , so . Note that in this monoid — a backspace at the start of the text is remembered and will delete the next character typed before it. To make backspace on an empty line do nothing one needs a Monoid Action on texts rather than a monoid of keystrokes.
- A character in a video game (CTfS Example 3.1.2.9): generators up, down, right with , , — the monoid of moves.
- Groups: the symmetries of a square are presented by with and (CTfS Example 3.2.1.4, Group).
Cyclic monoids (CTfS §3.1.1.20)
A monoid is cyclic if it has a presentation with a single generator . Examples: no relations gives (CTfS Example 3.1.1.22); gives the trivial monoid; gives the clock .
Classification (CTfS Exercise 3.1.1.23). Every cyclic monoid is isomorphic to exactly one of
- (infinite), or
- for some tail and cycle length , with the elements — “rho-shaped”: a tail of length running into a cycle of length .
(CTfS’s hint — “classified by ” — is on the right track but one number is not enough: the tail and the cycle can vary independently.) Proof sketch. If the powers are all distinct the monoid is . Otherwise let be the least exponent such that for some , and the least such; then iff or and . The cyclic groups are those with : (and , which as a monoid needs two generators) (CTfS Exercise 3.2.1.8). The same monoids appear as the one-object schema with the PED (a finite hierarchy with management levels is ), and 7 Sketches Exercise 3.19’s is .
Universal property
Monoid homomorphisms out of into are the functions that send both sides of each relation to equal elements — freeness plus “check the equations”. This is exactly how functors out of a presented category and prop functors out of a presented prop are defined, and it makes “a database schema is a category presentation” precise (CTfS Slogan 4.2.2.1).
Docs: ThCategory (GATlab) · Theories & presentations
using Catlab
# A presented monoid is a presented category with one object. CTfS Example 3.1.2.9:
# up, down, right with [u,d] = [d,u] = [], [u,r] = [r,u], [d,r] = [r,d]
@present Moves(FreeCategory) begin
Pos::Ob
(u, d, r)::Hom(Pos, Pos)
u ⋅ d == id(Pos); d ⋅ u == id(Pos)
u ⋅ r == r ⋅ u; d ⋅ r == r ⋅ d
end
# cyclic monoids C_{n,k} = ⟨Q | Q^(n+k) = Q^n⟩ computed by brute force: the powers of Q
function cyclic(n, k)
normal(i) = i < n ? i : n + mod(i - n, k) # the normal form of Qⁱ
sort(unique(normal.(0:(n + 3k))))
end
cyclic(0, 12) # 0:11, the clock ℤ/12
cyclic(2, 2) # [0, 1, 2, 3]: 7 Sketches' s⁴ = s²import Mathlib
#check @PresentedMonoid -- the monoid FreeMonoid α ⧸ (congruence generated by rels)
#check @PresentedMonoid.toMonoid -- universal property: a map respecting the relations
#check @PresentedGroup -- the group version
#check @FreeMonoid.lift -- the free case-- the backspace monoid by normal forms: a word is (number of pending backspaces, text)
data Key = BS | Chr Char deriving (Eq, Show)
newtype Typed = Typed (Int, String) deriving (Eq, Show) -- BS^k followed by letters
press :: Typed -> Key -> Typed
press (Typed (k, s)) BS | null s = Typed (k + 1, s) -- nothing to delete: remember it
| otherwise = Typed (k, init s) -- [x, BS] = []
press (Typed (k, s)) (Chr c) = Typed (k, s ++ [c])
typeWord :: [Key] -> Typed
typeWord = foldl press (Typed (0, ""))
-- typeWord [Chr 'a', Chr 'b', Chr 'd', BS] == typeWord [Chr 'a', Chr 'b']
-- typeWord [BS] /= typeWord []