Part 3 : Algebra 1
3.1. Morphisms of relational systems and concrete
categories
For simplicity, let us focus the study on systems with only one type.
For
any number n and any set E, let E^{n}
abbreviate the product E^{Vn} = E×...×E
(n times), that is the set of ntuples of elements of E.
The sets of all nary relations and of all nary operations in E are defined as
 Rel_{E }^{(n)} = ℘(E^{n})
 Op_{E}^{(n)}
= E^{En}
Languages. A language is a set L of "symbols", with
the data of the intended arity n_{s}∈ℕ of each
symbol s∈L. It may be
 A relational language if its symbols aim to represent relations
 An algebraic language if its symbols aim to represent operations.
For any language L and any set E, let L⋆E = ∐_{s∈L}
E^{ns}
A relational language L, aims to be interpreted in a set E as a family
of relations, which belongs to
∏_{s∈L} ℘(E^{ns})
≅ ℘(L⋆E)
Let us now conceive an Lsystem as a pair (E,E) made of a
set E with an Lstructure E⊂L⋆E.
Most often, we shall only use one Lstructure on each set, so that E
can be treated as implicit, determined by E. Precisely, let us take a class of
Lsystems where each E is the intersection of L⋆E
with a fixed class of (s,x), denoted as s(x) because the
n_{s}ary relation s_{E} interpreting each symbol
s∈L in each system E is somehow independent of E:
E={(s,x)∈L⋆E  s(x)}.
s_{E} =
{x∈E^{ns}  s(x)}
= ⃗E(s)
E=∐_{s∈L} s_{E}.
Morphism. Between any 2 Lsystems E,F,
we define the set of Lmorphisms from E to F as
Mor_{L}(E,F) = {f
∈F^{E}∀s∈L,∀x∈E^{ns},
s(x)⇒ s(f০x)}
= {f ∈F^{E}∀(s,x)∈E,
(r,f০x)∈F}.
For any function f, let f_{L}
= (L⋆Domf ∋(s,x) ↦ (s,f০x)).
This gives shorter definitions for sets of morphisms
Mor_{L}(E,F) = {f
∈F^{E} f_{L}[E]⊂F} =
{f ∈F^{E} E⊂f_{L}*F}.
Concrete categories
The concept of concrete category is what remains of a kind of
systems with their morphisms, when we forget which are the
structures that the morphisms are preserving (as we saw that this
structures list can be extended without affecting the sets of
morphisms). Let us introduce a slightly different (more concrete)
version of this concept than the one usually found elsewhere: here,
a concrete category will be the data of
 A class of sets called objects
 A class of functions called morphisms. For any objects
E,F, the set Mor(E,F)⊂F^{E}
of all morphisms from E to F, is the set of all
functions from E to F which are morphisms.
satisfying the following axioms
 Every morphism belongs to some Mor(E,F), i.e.
its domain is an object and its image is included in an object
(in practice, images of morphisms will be objects too);
 For any object E, Id_{E} ∈ Mor(E,E)
;
 Any composite of morphisms is a morphism: for any 3 objects E,F,G
, ∀f ∈ Mor(E,F), ∀g∈Mor(F,G),
g০f ∈Mor(E,G).
The last condition is easily verified for Lmorphisms : ∀(s,x)∈E, (s,f০x)∈F ∴
(s,g০f০x)∈G.
A relational symbol interpreted in a given concrete category is said to be preserved
if all morphisms of the category are also morphisms for this symbol. According to definitions,
each symbol in a language L is preserved in any category of Lsystems.
A category is small if its class of objects
is a set.
Rebuilding structures in a concrete category.
Starting now with any concrete category, its possible preserved families of relations (one relation
in each object) can be produced from some sorts of "smallest building blocks" as follows.
Proposition. In any concrete category, for any choice of tuple t of elements
of some object K, the relation defined in each object E as s_{E}
= {f০t  f∈ Mor(K,E)} is preserved.
Proof : ∀g∈Mor(E,F), ∀x∈s_{E},
∃f∈ Mor(K,E), (x = f০t ∧ g০f∈ Mor(K,F)) ∴
g০x = g০f০t
∈ s_{F}.∎
In a small concrete category, the preserved families of relations are precisely all choices of
unions of those : each preserved s equals the union of those with t
running over s (with variable K).
This can be easily deduced from the fact that any union of preserved structures in a
concrete category is a preserved structure (not only finite unions but unions of families
indexed by any set). Any intersection of a family of preserved structures
is also a preserved structure.
However, even if we could
take "all these structures" to turn these objects into relational systems (a possibility only ensured
in small categories because of K ranging over all objects),
the resulting category of relational systems may admit more morphisms than those we started
with (like a closure).
Preservation of some defined structures
In any given category of Lsystems, any further invariant structure
whose defining formula only uses symbols in L and logical symbols
∧,∨,0,1,=,∃ is preserved (where 0, 1, ∨ and ∧ are particular
cases of unions and intersections we just mentioned).
Indeed, for any Lmorphism
f∈Mor_{L}(E,F),
 Substituting arguments of a s∈L by a map σ to n' other variables
(∀E,∀x∈E^{n'}, s'(x)⇔s(x০σ)),
works :
s'(x) ⇒ s(x০σ) ⇒
s(f০x০σ) ⇒ s'(f০x).
 ∀s,s'∈L,n_{s}=n_{s'} ⇒
∀x∈E^{ns}, (s(x)∧s'(x)) ⇒
(s(f০x)∧s'(f০x))
 ∀s,s'∈L,n_{s}=n_{s'}⇒∀x∈E^{ns}
, (s(x)∨s'(x)) ⇒ (s(f০x)∨s'(f০x))
 For 0 and 1 it is trivial
 ∀x,y∈E, x=y ⇒ f(x)=f(y)
 ∀x∈E^{ns},(∃y∈E,
s(x,y)) ⇒ (∃z=f(y)∈F,
s(f০x, z))
Thus, for any f ∈Mor_{L}(E,F),
if a ground formula with language L using the only
logical symbols (=,∧,∨,0,1,∃), is true in E, then it is also
true in F.
However morphisms may no more preserve structures defined with other
symbols (¬,⇒,∀).
Morphisms between systems with several types
While we introduced the notion of morphism in the case of systems
with a single type, it may be extended to systems with several types as
well. Between systems E,F with a common list τ of types (and
interpretations of a common list of structure symbols), morphisms
can equivalently be conceived in the following 2 ways,
apart from having to preserve all structures:
 A tuple (or family) of functions (f_{t})_{t}_{∈}_{τ},
where ∀t∈τ, f_{t}:E_{t}→ F_{t}
where E_{t}⊂E, F_{t} ⊂F
are the interpretations of type t in E anf F
 A function f:E→ F that is a morphism
when regarding τ as a list of unary relation symbols (by the
same idea as the use of classes
instead of types in set theory); or equivalently, such
that h_{F}০f=h_{E}
where h_{E}:E→τ, h_{F}
:F→τ are the functions giving the type of each object.
3.2. Notion of algebra
Algebras. Given an algebraic language L, an Lalgebra
is a set E with an interpretation of each s∈L as an
n_{s}ary operation in E.
Again, let us assume a fixed class of Lalgebras E where each s
is interpreted as the restriction s_{E}
of an n_{s}ary operator s independent of E,
s_{E} = (E^{ns}
∋ x↦ s(x)).
These can be packed as one function
φ_{E} = ∐_{s∈L}
s_{E} = ((s,x) ↦
s(x)) : L⋆E → E.
Such a class of algebras
forms a concrete category with the following concept of morphism.
Morphisms of algebras. For any Lalgebras E,
F,
Mor_{L}(E,F) = {f∈F^{E} 
∀(s,x)∈L⋆E, s_{F}(f০x) =
f(s_{E}(x))} = {f∈F^{E}
φ_{F}০f_{L} = f০φ_{E}}.
When c∈L is a constant (i.e. n_{c}
=0), this condition on f says f(c_{E})=c_{F}.
Such categories can be seen as particular categories
of relational systems, as follows.
Let the relational language L' be a copy of L where to
each s∈L corresponds s'∈L' with increased arity
n_{s'} = n_{s}+1, so that
L'⋆E ≡ ∐_{s∈L}
E^{ns}×E ≡
(L⋆E)×E also expressible as the set of triples
(s,x,y) such that s∈L, x∈
E^{ns} and y∈E.
Each n_{s}ary
operation s_{E} defines an n_{s'}ary
relation s'_{E} ≡ Gr s_{E}.
These are packed as an L'structure
E = Gr φ_{E} ≡ ∐_{s∈L}
s'_{E}.
The resulting condition for an f ∈ F^{E} to be a
morphism is equivalent : (∀(x,y)∈E,
(f_{L}(x),f(y))∈F) ⇔
(∀x∈L⋆E, φ_{F}(f_{L}(x))=
f(φ_{E}(x))).
Subalgebras. A subset A⊂E of an Lalgebra
E will be called an Lsubalgebra of E, if
φ_{E}[L⋆A]⊂A.
Then the restriction φ_{A} of φ_{E}
to L⋆A gives it a structure of Lalgebra.
The set of all Lsubalgebras of E
will be denoted Sub_{L} E. It is nonempty
as E ∈ Sub_{L} E.
For any formula of the form (∀(variables), some formula without
any binder), its truth in E implies its truth in each A∈Sub_{L}
E.
Images of algebras. For any two Lalgebras E,F,
∀f ∈Mor_{L}(E,F), Im f ∈ Sub_{L}F.
The proof uses the finite choice theorem
with (AC 1)⇒(6):
∀(s,y)∈ L⋆Im f,
∃x∈E^{ns},
f০x = y ∴ s_{F}(y)
= f(s_{E}(x))
∈ Im f ∎
Thus trying to exend this result to algebras with infinitary operations, would
require the axiom of choice, otherwise it anyway still holds for injective morphisms.
Let us generalize the concept of algebra, to any L'systems
(E,E), where E ⊂ (L⋆E)×E
needs not be functional. They form the same kind of categories previously
defined, with a different notation (through the canonical bijection depending on the choice of
distinguished argument) by which more concepts can be introduced.
Stable subsets. The concept of subalgebra is generalized as that of stability
of a subset A of E by L :
A ∈ Sub_{L} E ⇔ (E_{*}(L⋆A)
⊂A) ⇔ (∀(s,x,y)∈E,
Im x⊂A ⇒ y∈A).
Stability is no more preserved by direct images by morphisms, but is still preserved by preimages:
Preimages of stable subsets. ∀f∈Mor_{L}(E,F),
∀B∈Sub_{L}F, f *(B) ∈ Sub_{L}
E.
Let A=f *B. Proof for Lalgebras:
∀(s,x)∈L⋆A, f০x
∈ B^{ns}∴ f(s_{E}(x))
= s_{F}(f০x) ∈B ∴
s_{E}(x)∈A.
Proof for L'systems:
∀(x,y)∈E, (f_{L}(x),f(y))∈F∴
(x∈L⋆A ⇒ f_{L}(x)∈L⋆B
⇒ f(y)∈B ⇒ y∈A).∎
Proposition. For any L'system E and any
Lalgebra F,
∀f,g∈Mor_{L}(E,F),
{x∈Ef(x)=g(x)}∈ Sub_{L}E.
Proof : ∀(s,x,y)∈E, f০x=g০x
⇒ f(y) = s(f০x) = g(y). ∎
Intersections of stable subsets. ∀X ⊂ Sub_{L}E,
∩X ∈ Sub_{L} E where ∩X ≝
{x∈E∀B∈X, x∈B}.
Proof:
∀(x,y)∈E, x∈L⋆∩X ⇒ (∀B∈X,
x∈L⋆B ∴ y∈B) ⇒ y∈∩X. ∎
Other way:
E_{*}(L⋆∩X) =
E_{*}(∩_{B∈X} L⋆B)
⊂∩_{B∈X}
E_{*}(L⋆B) ⊂∩X.
Subalgebra generated by a subset. ∀A ⊂ E, the
Lsubalgebra of E generated by A, written
〈A〉_{L,E} or more simply 〈A〉_{L},
is the smallest Lsubalgebra of E including A:
〈A〉_{L}=
∩{B∈Sub_{L}EA⊂B}=
{x∈E∀B∈Sub_{L} E, A⊂B
⇒ x∈B}∈ Sub_{L}E.
For fixed E and L, this function of A is a
closure with
image Sub_{L}E.
We say that A generates E if 〈A〉_{L}=E.
Minimal subalgebra. For any Lalgebra (or other L'system) E,
its minimal subalgebra (or minimal stable subset) is
Min_{L}E =〈⌀〉_{L,E}
= ∩Sub_{L}E ∈Sub_{L}E.
An Lalgebra E is minimal when E = Min_{L}
E, or equivalently Sub_{L}E
= {E}.
Proposition. For any Lalgebra E, ∀A∈Sub_{L}E,
 ∀B⊂A, B∈Sub_{L}E ⇔
B∈Sub_{L}A
 Min_{L}A=Min_{L}E
 A=Min_{L}E ⇔ A is minimal.
Proof: Min_{L}E ⊂ Min_{L}A because
Sub_{L} A ⊂ Sub_{L} E.
Min_{L} A ⊂ Min_{L} E
because ∀B∈Sub_{L}E,
A⋂B∈Sub_{L}A.
∎
(Among subsets of E, other minimal L'systems are included
in Min_{L} E but are not stable).
We can redefine generated subalgebras in terms of minimal
subalgebra with a different language: 〈A〉_{L,E}=
Min_{L∪A} E where A is seen as
a set of constants.
Injective, surjective algebras. An Lalgebra (E,φ_{E})
will be called injective if φ_{E} is injective, and surjective if
Im φ_{E} = E.
Proposition. For any Lalgebras E, F,
 ∀A⊂E, Im φ_{E}⊂A ⇒
A∈Sub_{L}E.
 Any minimal Lalgebra is surjective.
 Min_{L}E =
φ_{E}[L⋆Min_{L}E] ⊂ Im φ_{E}
 ∀A⊂E, 〈A〉_{L} =
A∪φ_{E}[L⋆〈A〉_{L}] ⊂
A∪Im φ_{E}.

∀f ∈Mor_{L}(E,F),
f [Min_{L}E] = Min_{L}F ; more generally
∀A⊂E, f [〈A〉_{L}] =
〈f [A]〉_{L}
Proofs:  φ_{E}[L⋆A] ⊂
Im φ_{E}⊂A ⇒ A∈Sub_{L}E
 Im φ_{E} ∈ Sub_{L}E
 Min_{L}E is surjective
 A∪φ_{E}[L⋆〈A〉_{L}] ∈ Sub_{L} 〈A〉_{L}
 ∀B ∈ Sub_{L}F, f
*(B)∈Sub_{L} E ∴ Min_{L}E
⊂ f*(B) ∴ f [Min_{L}E]⊂B.∎
Proposition. If E is a surjective algebra and
F is an injective one then ∀f ∈Mor_{L}(E,F),
 A= {x∈E  ∀y∈E, f(x) =
f(y) ⇒ x=y}
∈ Sub_{L}E.
 For each uniqueness quantifier Q (either ∃! or !),
B = {y∈F  Qx∈E, y =
f(x)} ∈ Sub_{L}F
They are essentially the same but let us write separate proofs:
 ∀(s,x)∈L⋆A, ∀y∈E,
f(s_{E}(x)) = f(y) ⇒
(∃(t,z)∈φ_{E}^{•}(y),
s_{F}(f০x)
= f(s_{E}(x)) = f(y) = f(t_{E}(z))
= t_{F}(f০z) ∴ (s=t
∧f০x=f০z) ∴ x=z)
⇒ s_{E}(x)=y.
 As φ_{F} is injective,
∀y∈φ_{F}[L⋆B],
∃!: φ_{F}^{•}(y) ⊂ L⋆B ∴
Qz∈ L⋆E, φ_{F}(f_{L}(z)) = y.
As φ_{F}০f_{L} = f০φ_{E} and
φ_{E} is surjective, we conclude Qx∈E,
y = f(x). ∎
Schröder–Bernstein theorem.
If there exist injections f: E → F and
g: F→ E then there exists a bijection between E and F.
Replacing F by the bijectively related set Im g, simplifies things to
the case F⊂E ∧ g=Id_{F}.
Then a bijection from E to F can be defined as x ↦
(x∈〈E\F〉_{{f}} ? f(x) : x).
3.3. Special morphisms
Let us introduce diverse possible qualifications for morphisms of
relational systems.
Isomorphism.
In any concrete category, an isomorphism between objects E and F, is a morphism f ∈Mor(E,F)
such that f
: E ↔ F and f^{ 1}∈Mor(F,E).
Or equivalently,
∃g∈Mor(F,E), g০f= Id_{E} ∧
f০g= Id_{F}, which will serve as definition in more
general categories.
Two objects E, F are said to be isomorphic
if there exists an isomorphism between them.
Endomorphisms. An endomorphism of an object E
in a category, is a morphism from E to itself. Their set
is written End(E)=Mor(E,E).
For any set E, ∀f∈E^{E}, ∀A⊂E,
A ∈ Sub_{{f}} E ⇔ f ∈ End_{{A}}E.
Automorphisms. An automorphism of an object E is an isomorphism
of E to itself.
So we have: Automorphism ⇔ (Endomorphism ∧ Isomorphism)
However an endomorphism of E which is an isomorphism to a strict
subset of E, is not an automorphism.
Strong preservation. A function f ∈ F^{E} is said to
strongly preserve a relation symbol or formula r interpreted in each of E
and F, if it preserves both r and ¬r :
∀x∈
E^{nr}, x∈r_{E}
⇔ f০x∈r_{F}.
Embeddings. An f ∈Mor_{L}(E,F)
is called an Lembedding if it strongly preserves all structures :
∀r∈L,∀x∈
E^{nr}, x∈r_{E}
⇔ f০x∈r_{F}.
Every injective morphism f between algebras is an embedding
:
∀(s,x,y)∈L'⋆E, f(y)
= s_{F}(f০x) = f(s_{E}(x))
⇒ y=s_{E}(x).
Any embedding between algebras f ∈ Mor_{L}(E,F),
is injective whenever Im φ_{E} = E or some
s_{E} is injective for one of its arguments.
Bijective morphisms of algebras are isomorphisms. This can be deduced
from the fact they are embeddings, or by
f_{L}^{1} = (f^{1})_{L}
∴ φ_{E}০f_{L}^{1} = f
^{1}০f০φ_{E}০f_{L}^{1} = f
^{1}০φ_{F}০f_{L}০f_{L}^{1}
= f ^{1}০φ_{F}.
More generally for relational systems, injectivity is usually added to the definition of the
concept of embedding, as it means strongly preserving the equality relation.
Things can come down to this case by replacing equality in the concept of injectivity by a
properly defined equivalence relation, or replacing systems by their quotient by this relation,
where the canonical surjections would be noninjective embeddings.
Injective embeddings are isomorphisms to their images.
Embeddings still strongly preserve structures defined using the
symbols in L and the logical symbols ∧,∨,0,1,¬, and also = in
the case of injective embeddings.
Thus, they also preserve invariant structures defined
using symbols of L and ∧,∨,¬,0,1,∃ where any
occurrence of ¬ comes after (inside) any occurrence of ∃.
Now the full use of firstorder logic comes by removing this restriction on the order of use of logical symbols:
Elementary embedding. An f ∈
Mor_{L}(E,F) is called an elementary embedding
(or elementary Lembedding) if it (strongly) preserves all
invariant structures (defined
by firstorder formulas with language L).
Every isomorphism is an elementary embedding.
Isomorphism ⇒ Elementary embedding ⇒ Embedding ⇒ Injective morphism
If f∈ End(E) is an invariant elementary embedding then it is an automorphism:
Im f is also invariant (defined by
∃y∈ E, f(y)=x)
∀x∈ E,
x∈Im f ⇔ f(x)∈Im f
Im f = E. ∎
Elementary equivalence. Different systems are said to be
elementarily equivalent, if they have all the same true ground firstorder formulas. The existence
of an elementary embedding between systems implies that they are elementarily equivalent.
The most usual practice of mathematics ignores the diversity of elementarily
equivalent but nonisomorphic systems, as well as nonsurjective elementary
embeddings. However, they exist and play a special role in the foundations of
mathematics, as we shall see with Skolem's paradox and
nonstandard
models of arithmetic.
For any relational language L, any Lsystem (E,E) and any
equivalence relation R on E, the quotient set E/R has a natural
Lstructure defined as ⃗R_{L}[E].
It is the smallest Lstructure on E/R such that
⃗R∈ Mor(E, E/R).
3.4. Monoids
Transformations monoids
A transformation of a set E, is a function from E
to itself. The full transformation monoid of E is the set E^{E}
of all transformations of E, seen as an {Id, ০}algebra,
with two operation symbols: the constant Id, and the binary
operation ০ of composition.
More generally, a transformation monoid G of E is an {Id, ০}algebra
G∈Sub_{{Id, ০}}E^{E}, of transformations of E:
 Id_{E} ∈ G
 ∀f,g∈G, g০f ∈ G.
These axioms were those directly subjecting the set of endomorphisms
of a fixed object in a concrete category. In particular, they are
the exact axioms subjecting (defining the concept of) a concrete
category with only one object E.
Permutation groups
A permutation of a set E is a bijective
transformation of E.
The set ⤹E ={f ∈ E^{E} Inj f ∧ Im
f=E} = {f ∈ E^{E}f:E↔E}
of all permutations of E, is a transformation monoid of E called the
symmetric group of E.
A permutation group G of a set E, is a transformation monoid of
E such that G ⊂
⤹E ∧ ∀f∈G, f^{ 1}∈ G.
It will be seen as an algebra with one more operation : the inversion function f↦f^{ 1}. So
it is a {Id,०, ^{1}}subalgebra of ⤹E.
Unlike full transformation monoids and symmetric groups, the concepts of
transformation monoid and permutation group make sense independently of the powerset, as sets of transformations
satisfying the above firstorder stability axioms, ignoring the containing sets E^{E}
or ⤹E.
Trajectories
For any set of transformations L ⊂ E^{E}, seen
as a set of function symbols interpreted in E, ∀x∈E,
〈{x}〉_{L} = {f(x)f∈〈L〉_{{Id, ০}}}.
Intuitively, this is because they mean the same : the set of all composites
of any number of functions in L, applied to x. This will be formalized later.
But here is a simple proof, denoting K={f(x)f∈〈L〉_{{Id, ০}}}:
Proof of 〈{x}〉_{L} ⊂ K
Id_{E}∈〈L〉_{{Id, ০}} ∴ x∈K
(∀f∈〈L〉_{{Id, ০}},∀g∈L, g০f∈〈L〉_{{Id, ০}} ∴
g(f(x))∈K) ∴ K∈Sub_{L}E
Proof of K ⊂ 〈{x}〉_{L}
L ⊂ {f∈E^{E} 〈{x}〉_{L} ∈ Sub_{{f}} E}
= End_{{〈{x}〉L}}E ∈ Sub_{{Id, ০}}E^{E} ∴
∀f∈ 〈L〉_{{Id, ০}}, 〈{x}〉_{L} ∈ Sub_{{f}} E
∴ f(x)∈〈{x}〉_{L}. ∎
The trajectory of an element x∈E by a transformation monoid
G of E, is the set it generates
(usually called its orbit when G is a permutation group):
〈{x}〉_{G} = {f(x)f∈G} ⊂ E
As noted in the example in 2.7,
the binary relation on E defined by (y∈〈{x}〉_{G})
is a preorder; it is an equivalence relation if G is a permutation group.
Monoids
A monoid is an algebra behaving like a transformation
monoid, but without specifying a set which its elements may
transform, by which both symbols Id and ০ got their
interpretation. This abstractness can be formalized by renaming
these symbols, respectively as e and •.
Namely, the concept of monoid is the theory made of
 One type
 Two
operation symbols
 a constant symbol e of "identity";
 a binary operation • of "composition"
 Axioms
 Associativity : ∀x,y,z, x • (y • z)
= (x • y) • z so that either term can be more simply
written x • y • z.
 Identity : ∀x, x • e = x
= e • x
Both equalities in the last axiom may be considered separately,
forming two different concepts
 a left identity of a binary
operation • is an element e such that ∀x,
e • x = x
 a right identity of • is an element e' such that ∀x,
x • e' = x
If both a left identity and a right identity exist then they are
equal : e = e • e' = e' which makes
it the identity of • (the unique element satisfying both
identity conditions). The existence of a right identity implies the
uniqueness of the left identity, but without right identity, several
left identities may coexist (and similarly switching left and
right).
From any associative operation on a set E we can form a
monoid by adding the identity e as an extra element, E'
= E⊔{e} (its identity property defines how composition
extends to it, preserving associativity). Any identity element in E
loses its status of identity in E'.
Cancellativity
An operation • is called cancellative if all
transformations defined by currying it
on any side are injective:
∀x,y,z,
(x•y=x•z ⇒ y=z) ∧
(x•z=y•z ⇒ x=y).
Cancellative operations cannot have several identities on one side.
Not all monoids are cancellative. For example the monoid of addition
in the set of 3 elements {0,1, several} is not cancellative as 1+several = several+several.
Submonoids and morphisms of monoids
Any {e, •}subalgebra of a monoid is a monoid, thus called a
submonoid.
From the concept of monoid, replacing the use of e as a constant by ∃e in the axiom, would weaken or generalize the concepts of submonoids and morphism
as follows.
For any monoid (M, e, •) and any set with a binary operation
(X, ▪), if a function preserves composition f ∈
Mor_{•}(M,X) then its image is a monoid (A, a, ▪)
where A = Im f
and a = f(e)
 f is a morphism of monoid from M to this monoid A.
If the target forms a monoid (X,▪, e') then (by uniqueness of the identity in A)
f(e)=e' ⇔
e'∈ A ⇔ A ∈ Sub_{{e, ▪}} X
but these equivalent formulas may still be false, unless X is cancellative
(a▪a = a = a▪e' ⇒ a = e').
3.5. Actions of monoids
Left and right actions
Now let us give back to monoids their role as sets of transformations.
A left action of a monoid (M,e, •) on a set X, is an operation ⋅ from
M×X to X satisfying the axioms:
 ∀x∈X, e ⋅ x = x;
 ∀a,b∈M, ∀x∈X,
(a • b) ⋅ x = a ⋅ (b ⋅ x).
This turns X into an Malgebra (where M
is seen as a set of function symbols), called an Mset.
Equivalently by currying, a left action of M on X is a
{e, •}morphism from M to
X^{X}.
A left action is said effective if this morphism is
injective:∀a, b ∈ M, (∀x∈ X,
a·x = b·x) ⇒ a=b
letting
the axioms of action be usable as definitions of e and • from the action, in the same
way the definitions of Id and ০ are reexpressible (from their initial
expressions via the axioms for function) as
determined by the function evaluator.
An element x∈X of an Mset, is free if the function it defines from M to X
is injective. The existence of a free element implies that the
action is effective:
(∃x∈X,
∀a≠b∈M, a·x≠b·x)
⇒ (∀a≠b∈M, ∃x∈X,
a·x≠b·x)
General example.
The monoid of endomorphisms of any typed system E=
∐_{i∈I} E_{i},
acts on every type E_{i} it contains, by
the morphism of monoid from End(E) to
E_{i}^{Ei}
defined by restricting to E_{i} each endomorphism
of E.
Remark. Let M, X be given structures of Malgebras by any
operations • : M×M → M and ⋅ : M×X → X. Then for
any x∈X, the map h_{x} = (M∋a ↦ a ⋅ x)
satisfies by definition the following equivalences
h_{x}(e) = x ⇔ e ⋅ x = x
h_{x} ∈ Mor_{M}(M,X) ⇔ ∀a,b∈M,
(a • b) ⋅ x = a ⋅ (b ⋅ x).
As the concept of monoid is formally symmetric between left and
right, transposing
"composition" (switching positions of arguments), leads to the
similar concept of right action of a monoid M on a
set X: it is an operation ⋅ : X × M → X
such that
 ∀x∈ X, x ⋅ e = x;
 ∀a,b ∈ M, ∀ x ∈ X,
(x ⋅ a) ⋅ b = x ⋅ (a
• b)
It defines a function f : M → X^{X} that is not
exactly a morphism of monoid but let us call it an antimorphism,
which means a morphism where one monoid is replaced by its opposite,
i.e. seen with its composition transposed :
f(e)=Id_{X}
∀a,b∈M, f(a • b) =
f(b) ০ f(a)
Commutants
The commutant of any subset A⊂E for a binary operation # in E,
is defined as
C(A) = {x∈E∀y∈A,
x#y = y#x}.
This is a Galois connection:
∀A,B⊂E, B⊂C(A) ⇔ A⊂C(B).
A binary operation # in a set E, is called
commutative when C(E) = E, i.e.
∀x,y∈E, x#y
= y#x.
Proposition. For any associative
operation # on a set E, ∀A⊂E,
 C(A) ∈ Sub_{#}F
 If A⊂C(A) then # is commutative in 〈A〉_{#}
Proof:
 ∀x,y∈C(A), (∀z∈A, (x#y)#z
= x#z#y = z#(x#y)) ∴ x#y∈C(A)
 A⊂C(A)∈ Sub_{#}F
⇒〈A〉_{#}⊂C(A)
⇒ A⊂C(〈A〉_{#})∈ Sub_{#}F ⇒
〈A〉_{#}⊂C(〈A〉_{#}).
Centralizers
As e commutes with all elements, the commutant of a subset
of a monoid, is a submonoid. In this case the word "centralizer"
is used instead of "commutant".
By definitions, the centralizer of any G ⊂ E^{E}, is its monoid
of endomorphisms End_{G} E. The concept of centralizer will be later
generalized from this unary case (sets of transformations) to clones
of operations with all arities.
When 2 actions of monoids on the same set X commute with each
other, it can be formally convenient to see them acting on a
different side: the commutation
between a∈M acting on the left and b∈N acting on the right
on X is written
∀x∈X, (ax)b
= a(xb)
which formally looks like an associativity law.
Representation theorem
Let us verify that both axioms of monoid suffice to gather all
properties of transformation monoids, and even all properties of
monoids of endomorphisms.
Theorem. For any monoid M there exists a language
L of function symbols and an Lalgebra X
such that the monoid End_{L} X is
isomorphic to M.
Proof:
Let L and X be two copies of M.
Give L the right action on X copied from the
composition in M (whose axioms of monoid give those of
action).
Let f ∈ Mor(M, X^{X})
represent the left action of M on X also copied
from the composition in M.
Im f ⊂ End_{L} X by associativity
of the operation from which both actions on opposite sides are
copied.
f is injective because the copy k of e in X
is a free element.
End_{L} X ⊂ Im f because
∀g∈End_{L}X, ∃u∈M, g(k)=uk
∴ (∀x∈X, ∃s∈L,
ks=x∴ g(x)=g(ks)=g(k)s=uks=ux)
∴ g=f(u) ∎
The bijections identifying L and X as copies of M,
finally do not play any special role: while they are definable from
k, this k itself may be not unique in the role its
plays here.
3.6. Categories
Categories (also called abstract categories for insistence) differ from concrete
categories, by forgetting that objects
are sets (ordered by inclusion) and that morphisms are functions. The concept of monoid
was the particular case of an abstract category with only one object. The general
case of categories is similarly
formalized as the data of:
 A class of "objects" of that category, regarded as pure elements (ignoring any inclusion order); the category is
called small if this class is a set;
 Between any two objects A,B is given a set Mor(A,B); these are regarded
as pairwise disjoint sets of pure elements;
 To any object A is given an element 1_{A}∈Mor(A,A)
 To any 3 objects A,B,C is given a
composition operation we shall abusively denote by the same
symbol • : Mor(B,C)×Mor(A,B)→Mor(A,C)
satisfying the axioms
 For any objects A,B, ∀x ∈Mor(A,B),
x •1_{A} = x = 1_{B}•x
 For any objects A,B,C,D, ∀x∈Mor(A,B),∀y∈Mor(B,C),∀z
∈Mor(C,D), (z•y)•x = z•(y•x)
Representation theorem. Any small category can be interpreted
as that of all morphisms in some given list of typed algebras.
Let us fix the set of types as a copy of the set of
objects : from each object X we make a type X'
(not giving to this bijective correspondence any special status).
Each object M is interpreted as a system where each type X' is
interpreted as the set Mor(X',M).
As a language, let us take all morphisms between types: the set of
function symbols from type X' to type Y' is defined as
Mor(Y',X') (with reverse order, as symbols act on the right).
The proof goes on just like with monoids.∎
Functions defined by composition
In any category, any f ∈ Mor(E,F) defines functions
by currying composition with other morphisms to or from another object X:
let us denote (almost following wikipedia but adapted to our concept of concrete category)
 Hom(X, f) = (Mor(X, Dom
f)∋g↦ f০g),
with target Mor(X,F) for any target F of f.
 Hom_{F}(f, X) = (Mor(F,
X)∋g↦ g০f), with target
Mor(E, X). Simplified as Hom(f,X) in abstract
categories where f determines F.
The former respects composition, while the latter reverses
it: for any 4 objects E,F,G,X , ∀f
∈Mor(E, F), ∀g∈Mor(F,G),
Hom(X, g) ০ Hom(X, f) =
Hom(X, g০f)
Hom_{F}(f, X) ০
Hom_{G}(g, X) =
Hom_{G}(g০f, X)
Monomorphism. In a category, a morphism
f∈Mor(E,F)
is called monic, or a monomorphism, if Hom(X,f)
is injective for all objects X.
Epimorphism. In an abstract category, a morphism f∈Mor(E,F)
is called epic, or an epimorphism, if Hom(f,X)
is injective for all objects X:
∀g,h∈Mor(F,X),
g০f=h০f ⇒ g=h.
In our concept of concrete category, we must specify F: we say that
f∈Mor(E,F) is Fepic, or an Fepimorphism,
if all Hom_{F}(f,X) are injective.
In any concrete category, all injective morphisms are monic, and
any morphism with image F is Fepic.
However, the converses may not hold, and exceptions may be uneasy
to classify, especially as the condition depends on the whole
category.
The following 2 concepts may be considered cleaner as they admit
a local characterization:
Sections, retractions. When g০f=Id_{E} we say that f
is a section of g, and that g is a retraction of f.
 A morphism f∈Mor(E,F) is a section
(or section in F if the category is concrete), if
Id_{E}∈Im(Hom_{F}(f,E)),
i.e. ∃g∈Mor(F,E), g০f=Id_{E}.
Then f is monic and for all objects X we have
Im(Hom_{F}(f,X)) = Mor(E,X). 
A morphism g∈Mor(F,E)
is a retraction (or retraction on E if the
category is concrete), if Id_{E}∈Im(Hom(E,g)),
i.e. ∃f∈Mor(E,F), g০f=Id_{E}.
Then g is epic and for all objects X we have
Im(Hom(X, g)) = Mor(X, F).
Proof: if g০f=Id_{E} then for all objects X,
Hom_{F}(f,X) ০ Hom_{E}(g,X)
= Hom_{E}(Id_{E},X)
= Id_{Mor(E,X)}, thus
 Hom_{E}(g,X) is injective (g is epic)
 ∀h∈Mor(E,X), h =
h০g০f
= Hom_{F}(f,X)(h০g).
Similarly, Hom(X,g) ০ Hom(X,f) =
Hom(X,Id_{E}) = Id_{Mor(X,}_{E)} thus
f is monic and Im(Hom(X,g)) = Mor(X,F).∎
If f is an isomorphism then Hom(X,f) and Hom(X,g)
are bijections, inverse of each other, between Mor(X,E) and Mor(X,F).
Any epic section f∈Mor(E,F) is an isomorphism
: g০f=Id_{E} ⇒ f০g০f
= Id_{F}০f ⇒ f০g=Id_{F}
Similarly, any monic retraction is an isomorphism.
These dependencies between qualities of morphisms, can be mapped as follows:
Isomorphism ⇔ (Retraction ∧ Monomorphism) ⇔ (Section ∧ Epimorphism)
Retraction ⇒ Surjective morphism ⇒ Epimorphism
Section ⇒ Embedding ⇒ Injective morphism ⇒ Monomorphism
In any category, an object X is called an initial
object (resp. a final object) if for all objects Y
the set Mor(X,Y) (resp. Mor(Y,X)) is a
singleton.
Such objects have this remarkable property: when they exist, all such objects are
isomorphic, by a unique isomorphism between any two of them.
Proof: For any initial objects X and Y, ∃f∈Mor(X,Y),
∃g∈Mor(Y,X), g০f ∈Mor(X,X)
∧ f০g ∈Mor(Y,Y).
But Id_{X} ∈ Mor(X,X) which is a
singleton, thus g০f= Id_{X}.
Similarly, f০g=Id_{Y}.
Thus f is an isomorphism, unique because Mor(X,Y)
is a singleton.∎
By this isomorphism X and Y may be treated as identical to
each other. We may say that an initial object is essentially unique.
Such objects exist in many categories, but are not always interesting. For
example, in any category of relational systems containing representatives
(copies) of all possible ones with a given language:
 Singletons are final objects (where all relations are
constantly true); and also in any category of algebras
with a fixed language where they are admitted as objects. In the case of multitype systems, final
objects are made of one singleton per type.
 The only initial object is the empty set (where any nullary
relation, i.e. boolean constant, is false).
Exercise. Given two fixed sets X and Y, consider the
category whose objects are all (E,φ) where E is a set and
φ: E×X→Y, and the morphisms from (E,φ) to (E',φ')
are all f : E→E' such that ∀a∈E,∀x∈X,
φ(a,x) = φ'(f(a),x).
Does it have an initial object ? a final object ?
3.7. Algebraic terms and term algebras
Algebraic drafts
As the concept of term was only intuitively
introduced in 1.5, let us now formalize the case of terms using
a purely algebraic language (without logical symbols), called
algebraic terms, as mathematical systems in
a set theoretical framework.
For convenience, let us work with only one type (the generalization to many types is easy)
and introduce a class of systems more general than terms, that we shall call drafts.
Variables will have a special treatment, without adding them as constants
in the language.
Given an algebraic language L, an Ldraft will be an
L'system
(D,D) where D⊂ (L⋆D)×D, such that:
 The transpose ^{t}D of D is the
graph of a function Ψ_{D}: O_{D}
→ L⋆D, whose domain O_{D} = Im D
⊂D is called the set of occurrences in D, and
its complement V_{D}=D\O_{D}
is called the set of variables of D;
 〈V_{D}〉_{L}= D (wellfoundedness condition).
Let us denote ∀x∈O_{D},
Ψ_{D}(x)=(σ(x), l_{x})
∈ L⋆D where s(x)∈L and
l_{x}∈D^{nσ}^{(x)}.
We can also denote σ_{D}(x)=σ(x)
to let σ_{D} be a function with domain O_{D}.
Wellfoundedness can be equivalently written in any of these forms
∀A⊂O_{D}, (∀x∈O_{D},
Im l_{x} ⊂ A∪V_{D} ⇒ x∈A)
⇒ A=O_{D}
∀A⊂D, (V_{D}⊂A ∧
D_{*}(L⋆A) ⊂A) ⇒
A = D
∀A⊂D, V_{D}⊂A≠D
⇒ ∃x∈O_{D}\A, Im l_{x}⊂A
∀A⊂O_{D}, A≠∅ ⇒ ∃x∈A,
A⋂ Im l_{x} = ∅
The set of used variables of (D,D), those which effectively occur,
is V_{D}⋂⋃_{x∈OD}
Im l_{x}. Unused variables can be added or removed
in D while keeping D fixed (by changing
D⊃O_{D}∪(⋃_{x∈OD}
Im l_{x})), so that their presence may be irrelevant.
A ground draft is a draft with no variable, i.e. V_{D}=∅. Thus,
Ψ_{D}: D→ L⋆D and Sub_{L}D
= {D}.
More generally a draft is groundlike if it has no used variable (Dom D⊂ L⋆O_{D}).
Subdrafts and terms
Drafts do not have interesting stable subsets (by wellfoundedness), but let us introduce
another stability concept for them.
A subset A⊂D is a subdraft of D
(or a costable subset of D) if, denoting O_{A}
= A⋂O_{D} and Ψ_{A}= Ψ_{DOA},
we have (Im Ψ_{A}⊂ L⋆A), i.e. ∀x∈O_{A},
Im l_{x}⊂A.
Indeed, it remains wellfounded, as can be seen on the last formulation of wellfoundedness.
Like with stable subsets, any intersection of subdrafts is also a subdraft; the subdraft
cogenerated by a subset is the intersection of all subdrafts that include it.
A term is a draft cogenerated by a single element
which is its root.
Moreover, any union of subdrafts is also a subdraft (which was
not the case for subalgebras because an operation with arity
>1 whose arguments take values in different subalgebras may
give a result outside their union).
There is a natural order relation on each draft D defined by x
≤ y ⇔ x∈ (the term with root y). It is obviously
a preorder. Its antisymmetry is less obvious; a proof for integers will be given
in 3.6, while the general case will come from properties of wellfounded relations
in the study of Galois connections.
Categories of drafts
As particular relational systems, classes of Ldrafts form concrete categories.
Between two Ldrafts D,E,
f ∈Mor_{L}(D,E) ⇔
(f[O_{D}]⊂O_{E} ∧
Ψ_{E} ০ f_{OD}=
f_{L}০Ψ_{D})
where the equality condition can be split as
σ_{E}০f_{OD}
= σ_{D}
∀x∈O_{D},
l_{f(x)}=f০l_{x}
Another kind of category of drafts can be considered, with objects also Ldrafts
but with a common set of variables (V_{D}=V_{E}=V)
and taking smaller sets of morphisms: the variablespreserving morphisms,
i.e. moreover satisfying f_{V} = Id_{V}.
But for any element t in any draft, the term T cogenerated
by {t} has as set of variables T⋂V (which is the set of used variables of
T unless T={t}⊂V) generally smaller than V,
so the admission of terms defined as subsets cogenerated by singletons in
such a category requires this loosening of the condition. This naturally
simplifies when reformulating such categories as those of ground
(L∪V)drafts: in each draft, variable symbols are replaced (reinterpreted) by
constant symbols added to the language, so Ψ_{E} is extended by
Id_{V}, to form a ground (L∪V)draft.
Intepretations of drafts in algebras
For any Ldraft D and any Lalgebra E, an interpretation of
D in E is a morphism f∈Mor_{L}(D,E),
i.e. f_{OD}=
φ_{E}০f_{L}০Ψ_{D},
which can also be written
∀x∈O_{D}, f(x) =
σ(x)_{E}(f০l_{x})
Theorem. For any Ldraft D with set of variables V and
any Lalgebra E, any v∈E^{V}
is uniquely extensible to an interpretation of D:
∃!h∈Mor_{L}(D,E), h_{V}
= v, equivalently ∃!h∈E^{OD}, v∪h
∈Mor_{L}(D,E).
The uniqueness comes from a previous proposition.
Proof of existence.
S = {A⊂D  V⊂A∧ Im Ψ_{A}⊂
L⋆A}
v ∈ K = ⋃_{A∈}_{S}
{f∈Mor_{L}(A,E) 
f_{V} =v}
∀f,g ∈K, B = Dom f ⋂ Dom g
⇒ (f_{B}∈K ∧
g_{B}∈K)
⇒ f_{B}=g_{B}
⋃_{f∈K} Gr f = Gr h
C= Dom h = ⋃_{f∈K} Dom f
∈ S
h ∈ K
(C∪D_{*}(L⋆C) ∋ x↦ (x∈C
? h(x) : φ_{E}(h_{L}(Ψ_{D}(x)))))
∈ K (see conditional operator)
D_{*}(L⋆C) ⊂ C
C=D ∎
Operations defined by terms
A new operation symbol can be defined by any element t of an Ldraft D :
it is the Vary operation defined by the Lterm with root t, that is
cogenerated by t in D.
Its interpretation in each E is defined by ∀v∈E^{V},
t_{E}(v) = h(t)
for the unique h∈Mor_{L}(T,E)
such that h_{T⋂V}=v.
As a particular case of a relation defined by a tuple,
here (Id_{V},t), these operations are preserved by all morphisms between
Lalgebras, and can thus be added to L without changing the sets of morphisms.
Another way to see it is as a particular case of conservation
of relations defined by formulas in categories of relational systems, since any term defining an operation
can be reexpressed as a formula defining the graph of this operation, using logical symbols ∃ and ∧.
The advantage now that it is established for the general case of abstractly conceived terms no
matter their size, instead of concretely written terms on which the conservation property
must be repeatedly used for each occurrence of symbol it contains.
Term algebras
An Lalgebra (E,φ_{E}) is called a term algebra
if it is injective and 〈E\Im φ_{E}〉_{L}
= E. Thus it is also an Ldraft with Ψ_{E}
= φ_{E}^{1}. As such, it is ground if
moreover E=Im φ_{E}.
So, a ground term algebra is an algebra both minimal and injective,
and thus also bijective. If L does not contain any constant then
⌀ is a ground term Lalgebra.
If L only contains constants, then ground term Lalgebras
are the copies of L.
The existence of term algebras in other cases will be discussed in
the next section; let us
admit it for now.
Whenever present as object,
any ground term Lalgebra is a final object in any category of ground
Ldrafts, and an initial object in any category of Lalgebras.
In any variablespreserving category of Ldrafts with a fixed set V of variables
(category of ground (L∪V)drafts), any term Lalgebra
F, when present, is a final object.
Proposition. For any ground term Lalgebra K
and any injective Lalgebra M, the unique
f∈Mor_{L}(K,M) is injective.
Proof 1. By a previous result,
{x∈K  ∀y∈K,
f(x) = f(y) ⇒ x=y}
∈ Sub_{L}K, thus = K.
Proof 2. The subalgebra Im f of M is both injective and
minimal,
thus a ground term Lalgebra, so the morphism f between initial Lalgebras
K and Im f is an isomorphism.
Role of term algebras as sets of all terms
Any term algebra F plays the role of the "set of all terms"
with its list V of variable symbols, for the following reason:
Each element of F bijectively defines a term in F as the subdraft of
F it cogenerates, thus where it is the root.
For any
Lterm T with root t and variables ⊂V,
the unique f∈Mor(T,F) such that
f_{T⋂V} = Id_{T⋂V}
represents it in F as the term Imf with root f(t).
Then its interpretation in any Lalgebra E extending any
v∈E^{V}, is determined by the unique
g∈Mor_{L}(F,E) extending v,
as g০f∈Mor(T,E), with result g(f(t)).
The same for terms whose set of variables V' is interpreted in E by the
composite of a function from V' to V, with one from
V to E (instead of having V'⊂V).
For any subset A of an Lalgebra E, any term algebra
F_{A} whose set of variables is a copy of A,
represents the set of all Lterms with variables interpreted in A.
Then, the Lsubalgebra 〈A〉_{L} of E is the
image of the interpretation of F_{A} in E, i.e. the set of
all values of these terms.
The monoid of unary terms
Let M be a unary term Lalgebra (unary = with one variable; this
algebra is essentially unique for each L). Then its elements play the roles of the function
symbols defined by all possible unary Lterms, and
preserved by morphisms across all Lalgebras, including M itself. Therefore,
thanks to a previous remark,
M is natually a monoid acting on all Lalgebras.
If L is only made of function symbols then for any Lalgebra
E, the image of M in E^{E} is
the transformation monoid generated by the image of L.
3.8. Integers and recursion
The set ℕ
Any theory that aims to describe the system ℕ of natural numbers is
called an Arithmetic. In details, there are several such formal theories,
depending on the language (list of basic structures), and the
logical framework (affecting the expressibility of axioms).
Our first "definition" of ℕ will characterize it in a set theoretical framework.
This way of starting to formalize ℕ now may look circular, as we already used
natural numbers as arities of operation symbols of algebras, of which arithmetic
is a particular case. But this case only uses operation symbols with arity
0, 1 or 2, for which previous definitions might as well be
specially rewritten without any general reference to integers.
Definition. The set ℕ of natural numbers is a ground term algebra with
a language of two symbols: one constant symbol 0 ("zero"), and
one unary symbol S.
The interpretation of S there is called the successor, understood as adding one
unit (Sn=n+1).
This concept of ground term algebra can be expanded as the following 3 axioms on this
{0,S}algebra :
∀n∈ℕ, Sn ≠ 0

(H0), i.e. 0 ∉ Im S

∀n,p∈ℕ, Sn =
Sp ⇒ n = p 
(Inj), i.e. S is injective 
∀A⊂ℕ, (0∈A ∧ ∀n∈A,Sn∈A)
⇒ A=ℕ 
(Ind) : induction axiom (ℕ is a minimal (0,S)algebra). 
We can define 1=S0, 2=SS0...
This insertion of
arithmetic into set theory, adding to set theory the constant symbol ℕ with some basic
structure symbols interpreted in this ℕ, is the natural way to complete set theory (as we
progressively introduced from the beginning
to 2.5, + eventually the axiom of choice), to
form the standard foundation of mathematics as practiced by most mathematicians.
Its implicit choice of a fixed ℕ in the class of ground term
{0,S}algebras, does not introduce any arbritrariness, since, as an initial {0,S}algebra, it
is essentially unique (any two systems in this class are identifiable
by an isomorphism which is unique inside the same universe).
Recursively defined sequences
A sequence of elements of a set E, is a function from ℕ to E
(a family of elements of E indexed by ℕ).
In particular, a recursive sequence in E is a sequence defined as the
only u ∈ E^{ℕ} such that u ∈ Mor(ℕ,(E,a,f)),
where (E,a,f) is the {0,S}algebra E
interpreting 0 as a∈E and S as f∈ E^{E} :
u_{0}=a
∀n∈ℕ, u_{Sn} = f(u_{n}).
As u_{n} also depends on a and f, let us write it as f^{ n}(a).
This notation is motivated as follows.
As an element of a ground term {0,S}algebra, each integer n represents a term with symbols 0 and
S respectively interpreted in E as a and f. So, f^{ n}(a) abbreviates
the term with shape n using symbols a and f:
f^{ 0}(a) = a
f^{ 1}(a) = f(a)
f^{ 2}(a) = f(f(a)) 
In another curried view of this map from E×E^{E}×ℕ
to E we can reinterpret 0 as a variable instead of a constant symbol.
Then each integer n becomes a term
S^{n} with n occurrences of the function symbol S
and one variable, interpreted in each {S}algebra (E,f) as the
function f^{ n}∈ E^{E}
recursively defined by
f^{ 0} = Id_{E}
∀n∈ℕ, f^{ Sn} = f০f^{ n}
In particular, f^{1}=f.
More generally, for any functions f∈ E^{E},
g∈E^{X}, the sequence of functions recursively
defined by
h_{0}=g
∀n∈ℕ, h_{Sn} = f০h_{n}
is h_{n}=f^{ n}০g.
Addition
The operation of addition in ℕ can be defined as n+p =
S^{p}(n), i.e. by the recursive definition
n + 0 = n
∀p∈ℕ, n+S(p) = S(n+p).
Thus,
n+1 = n+S0 =
S(n+0) = Sn
As ∀a∈E ,∀f∈ E^{E}, (p↦f^{
n+p}(a))∈Mor(ℕ,(E,f^{n}(a),f)),
i.e. f^{n+0}=f^{n} and ∀p∈ℕ,
f^{n+Sp} = f^{S(n+p)
} = f০f^{n+p}
we have
∀n,p∈ℕ , f^{ n+p} = f^{
p}০f^{ n}.
Addition is associative: (a+b)+n = S^{n}(S^{b}(a)) =
S^{b}^{+}^{n}(a) =
a+(b+n).
Recursive sequences are actions of this monoid of natural numbers (ℕ, 0 +),
particular case of monoid of unary terms.
Multiplication
Multiplication in ℕ can be defined as x⋅y =
(S^{x})^{y}(0), so that
∀x∈ℕ, x⋅0 = 0
∀x,y∈ℕ, x⋅(Sy) = (x⋅y)+x
More generally, for any a∈E and f∈ E^{E},
we have f^{x}^{⋅}^{y}(a)
= (f^{x})^{y}(a).
A more general form of recursion
Some useful sequences need recursive definitions where the term defining
u_{Sn} uses not only u_{n} but also n
itself. Somehow it would work all the same, but trying to directly adapt to this case
the proof we gave would require to define some special generalizations of previous
concepts, and specify their resulting properties. To simplify, let us proceed another
way, similar to the
argument in Halmos's Naive Set Theory, but generalized.
For any algebraic language L, let us introduce a general concept of "recursive condition"
for functions u : E → F, where, instead of a draft, E is first
assumed to be an Lalgebra (then a ground term algebra to conclude).
The version we saw was formalized by giving the term in the recursive definition as an
Lalgebra structure on F, φ_{F}: L⋆F → F,
then expressing the request for u to satisfy this condition as u∈Mor(E,F),
namely ∀(s,x)∈L⋆E,
u(s_{E}(x)) = φ_{F}(s,u০x).
Let us generalize this as u(s_{E}(x))
= φ(s,x,u০x) which by the canonical bijection
Dom φ ≡ ∐_{s∈L} E^{ns
}×F^{ns} ≡ ∐_{s∈L}
(E×F)^{ns} =
L⋆(E×F) can be written using h : L⋆(E×F)
→ F such that ∀(s,x,y)∈ Dom φ,
φ(s,x,y) = h(s,x×y), asu(s_{E}(x))
= h(s,x×(u০x)).
As ∀u∈F^{E}, x×(u০x)
= (Id_{E}×u)০x, this becomes
the second component of the formula Id_{E}×u ∈ Mor(E, E×F)
when giving E×F the structure φ_{E×F} =
(φ_{E}০π_{L})×h.
The first component (φ_{E}০π_{L}) we give to φ_{E×F},
makes π∈ Mor(E×F, E) and makes tautological the first component
of the formula Id_{E}×u
∈ Mor(E, E×F), namely
Id_{E}(s_{E}(x)) = φ_{E}(s,x)
= (φ_{E}০π_{L})(s,x×(u০x)).
It is then possible to conclude by reusing the previous result of existence of interpretations:
If E is a closed term Lalgebra then
∃!f ∈ Mor(E, E×F), which is
of the form Id_{E}×u because
π০f ∈ Mor(E, E) ∴ π০f = Id_{E}.
But one can do without it, based on the following property of this Lalgebra E×F:
∀u∈F^{E}, Id_{E}×u
∈ Mor_{L}(E, E×F) ⇔ Gr u ∈ Sub_{L}(E×F)
The ⇒ is a case of image of an algebra by a morphism, Gr u = Im (Id_{E}×u).
For the converse, the inverse of the bijective morphism π_{Gr u}
∈ Mor_{L}(Gr u, E)
is a morphism Id_{E}×u ∈ Mor_{L}(E, Gr u)
⊂ Mor_{L}(E, E×F).
This reduces the issue to the search of subalgebras of E×F which are graphs of functions from E to F.
Now if E is a ground term Lalgebra then M =
Min_{L}(E×F) is one of them because
π_{M}∈ Mor_{L}(M, E) from a surjective algebra to a ground term algebra
must be bijective.
Any other subalgebra of E×F must include M, thus to stay functional it must equal M. ∎
Interpretation of firstorder formulas
Trying to extend the formal definitions of terms interpreted in algebras, to formalize the
general concept of formula interpreted in systems, the difficulty is to cope with the
interpretation of quantifiers (or generally binders, if we wish to still generalize).
A possible solution, is to treat all variables as bound throughout the formula.
Binding all variables modifies the view on the above concept of interpretation of a term
T with set of variables V in an algebra E by recurrying the
family (h_{v}) of functions from T to E where v
runs over E^{V}, into a function from T to
E^{EV}. So, a firstorder formula interpreted in
a system E can be understood as a term interpreted in an algebra
whose base set is the set Op_{E} ∪ Rel_{E } of all operations and all relations in E
where Op_{E} = ⋃_{n∈ℕ} Op_{E}^{(n)}
and Rel_{E } = ⋃_{n∈ℕ} ℘(E^{n}).
We might not need the full sets of these, but at least, an algebra of these (a subset stable
by all needed logical operations).
We took ℕ for the case we would need to see "all possible formulas" as terms
interpreted in one same algebra.
3.9. Arithmetic with addition
Firstorder theories of arithmetic
Our first formalization of ℕ
was based on the framework of set theory, where it used the powerset to characterize ℕ in an
"essentially unique" way (specify its isomorphism class). It allowed recursion,
from which we could define addition and multiplication.
Let us now consider formalizations in the framework of firstorder logic, thus
called firstorder arithmetic. As firstorder logic cannot fully express the powerset,
the (∀A⊂ℕ) in the
induction axiom must be replaced by a weaker version : it can only be expressed with
A ranging over all classes
of the theory, that is, the only subsets of ℕ defined by firstorder formulas in the given
language, with bound variables and parameters in ℕ. For this, it must take the form of
a schema of axioms, one for each formula that can define a class.
But without the set theoretical framework we used to express and justify the definiteness
of recursive definitions, the successor function no more suffices to define addition and
multiplication. This leaves us with several nonequivalent versions of firstorder arithmetic
depending on the choice of the primitive language, thus nonequivalent versions of the
axiom schema of induction whose range of expressible classes depends on this language:

Bare arithmetic, with the mere symbols 0 and S, is very poor.

Presburger
arithmetic, with addition, starts to be interesting, but still cannot define multiplication.
 Full arithmetic, with addition and multiplication, is finally
able to express all recursive definitions.
Presburger arithmetic
Presburger arithmetic has been proven by experts to be a decidable theory, i.e.
all its ground formulas are either provable or refutable from its axioms. Let us
present its shortest equivalent formalization, describing the set ℕ* of nonzero natural
numbers, with 2 primitive symbols: the constant 1 and the operation +. Axioms will be
∀x,y∈ℕ*, x + (y+1)
= (x+y)+1 
(A1) : + is associative on 1 
∀A⊂ℕ*,(1∈A ∧ ∀x,y∈A,
x+y∈A) ⇒A=ℕ* 
(Min) 
∀x,y∈ℕ*, x + y
≠ y 
(F) 
In set theory, (Min) would make ℕ* a minimal {1,+}algebra. But let us regard our present
use of set theoretical notations as mere abusive abbreviations of works in firstorder logic,
as long as we only consider subsets of ℕ* defined by firstorder formulas in this arithmetical
language. In particular, (Min) will be meant as abbreviating a schema of axioms with A
ranging over all classes in this theory.
(A1) is a particular case of
∀x,y,z∈ℕ*, x + (y+z)
= (x+y)+z 
(As) : + is associative 
Conversely, (A1 ∧ Min) ⇒ (As) :
Let A={a∈ℕ* ∀x,y ∈ℕ*,
x+(y+a) = (x+y)+a}. ∀a,b∈A,
∀x,y ∈ℕ*, x + (y+(a+b))
= x + ((y+a)+b) = (x + (y+a))+b
= ((x + y)+a)+b = (x+y)+(a+b)
∴ a+b ∈ A.
(A1) ⇔ 1∈A.
(A1 ∧ Min) ⇒ A=ℕ* ∎
(As ∧ Min) ⇒ (+ is commutative), as deduced from 1∈C({1}).
Now take ℕ = ℕ*∪{0} where 0∉ℕ*, to which + is extended as ∀n∈ℕ,
0+n = n+0 = n. This extension preserves its properties
of commutativity and associativity.
Define S as ℕ∋x↦ x+1.
These definitions directly imply (H0).
(Ind) ⇒ (Min) :
∀A⊂ℕ*, the set A_{0}= A∪{0}
satisfies 0∈A_{0} and
(1∈A ∧ (∀x,y∈A, x+y ∈A))
⇒ (S0∈A_{0} ∧ (∀x∈A, Sx=x+1
∈A⊂A_{0})) ⇒ A_{0}=ℕ.∎
(As ∧ Min) ⇒ (Ind) in set theory (ignoring our previous definition of ℕ)
Let M=Min_{{0,S}}ℕ.
∀x∈M, M∈Sub(ℕ,x,S) ∧ f_{x}=(M∋y↦x+y)∈Mor((M,0,S),(ℕ,x,S)).
Images of minimal algebras by morphisms are included in any subalgebras: Im f_{x}⊂M.
As M is stable by + and contains 1, it equals ℕ.∎
(As ∧ Min) ⇒ (Ind) in firstorder logic
Let A∈Sub_{{0,S}}ℕ, and B
= {y∈ℕ* ∀x∈A, x+y∈A}.
∀y,z∈B, (∀x∈A, x+y∈A ∴
x+y+z∈A) ∴ y+z ∈B.
(∀x∈A, x+1 ∈A) ⇔ 1∈B ⇒ ((Min)⇒
B=ℕ*).
0∈A ⇒ (∀y∈B, 0+y∈A) ⇒ B⊂A.∎
(F) ⇔ (∀x∈ℕ*, ∀y∈ℕ, x+y ≠ y)
because x+0 = x ≠ 0.
(Inj ∧ Ind ∧ A1) ⇒ (F) : ∀x∈ℕ*,
x+0 ≠ 0
∀y∈ℕ, x+y ≠ y ⇒ x+y+1
≠ y+1.∎
For the converse, we need to use the order relation.
The order relation
From the operation of addition in Presburger arithmetic, let us define binary relations ≤ and < on ℕ and
show that they form an order and its strict order (it coincides with the order
between terms in the common particular case of the set theoretical ℕ, thanks to the properties
of generated preorders) :x<y ⇔ ∃z∈ℕ*, y =
x+z
x≤y ⇔ ∃z∈ℕ, y = x+z
For this, here are successive consequences of (Ind ∧ A1) :
 < is transitive
 x≤y ⇔ (x<y ∨ x=y)
 x<y ⇔ x+1≤y
 ∀A⊂ℕ, A≠∅ ⇒ ∃x∈A, ∀y∈A,
x≤y (to be interpreted as a schema of formulas if we study Presburger arithmetic)
 ∀x,y∈ℕ, x≤y ∨ y≤x
 x<y ⇒ x+z < y+z
Proofs :
 using (As), x < y < z
⇒ (∃n,p∈ℕ*, z = y+p = x+n+p)
⇒ x <z.
 obvious from definitions;
 thanks to (Ind), ℕ is a bijective
{0,S}algebra;
 x≤y ⇒ (x+1≤y ∨ x=y)
0∈{x∈ℕ ∀y∈A, x≤y}=B
∀x∈B, x+1∈B ∨ x∈A
A⋂B=∅ ⇒ (B=ℕ ∴ A=∅)
 from 4. with A={x,y}
 y = x+n ⇒ y+z = x+z+n
∎
(for 5. it is also possible to more directly prove for A={x∈ℕ
∀y∈ℕ, x<y ∨ x=y ∨ y<x}
that 0∈A and ∀x∈A, x+1∈A)
Now, (F) means that < is irreflexive, thus a strict total order
thanks to 1. and 5.
Moreover it implies ∀x,y,z∈ℕ, (x<y
⇔ x+z < y+z) and (x =
y ⇔ x+z = y+z). The last formula
gives (Inj) as a particular case, and means cancellativity, as
sides can be switched thanks to commutativity (deduced from the same
assumptions as shown above).
Proof: the direct implications were shown above; the converses are deduced from there as
< is a strict total order : one of the 3 formulas (x<y), (x
= y), ( y<x) must be true while only one of
(x+z<y+z),
(x+z=y+z), (y+z<x+z)
can.∎
Finally, ≤ is a total order with strict order < and
every nonempty subset of ℕ has a smallest element, which is unique by antisymmetry.
Arithmetic with order
It is possible to express a firstorder arithmetic with language {0,S, ≤}, stronger than {0,S}
but weaker than Presburger arithmetic, in the sense that addition cannot be defined from ≤.
Namely, it can be based on the characteristion of the order by the property:
For all n ∈ℕ, the set {x∈ℕ  n ≤ x}
is the unique A⊂ℕ such that
∀x∈ℕ, x∈A ⇔ (x = n
∨∃y∈A, Sy=x).
Its existence in ℘(ℕ) can be
deduced by induction on n; its uniqueness for a fixed n
is deduced by induction on x.
Set theory and foundations
of mathematics
1. First foundations of
mathematics
2. Set theory (continued)
3. Algebra 1
4. Model Theory