---
tag: V288YS2F5W
kind: definition
name: Term algebra
msc: [08B20, 08A40]
defines: 3YYKGWJJND
uses: [6D3WA7N2W4, WDVVEYD6AT, KBXSZC6BV1, DH30WTA26T]
sources:
  - url: https://en.wikipedia.org/wiki/Term_algebra
---

## Definition

Let $\sigma$ be a [[signature|WDVVEYD6AT]] with only function symbols and let $X$ be a set of variables.
Let $T_\sigma(X)$ be the set of [[terms|6D3WA7N2W4]] over $\sigma$ and $X$.
Assume that $T_\sigma(X)$ is nonempty, that is, $X$ is nonempty or $\sigma$ has a constant symbol.
The *term algebra* $\mathbf{T}_\sigma(X)$ is the algebra of signature $\sigma$ with universe $T_\sigma(X)$.
Its operations are
$$f^{\mathbf{T}}(t_1, \ldots, t_n) = f(t_1, \ldots, t_n)$$
for each function symbol $f$ of arity $n$ and all terms $t_1, \ldots, t_n$.

## Remarks

The term algebra is absolutely free over $X$.
For every algebra $A$ of signature $\sigma$ and every map $\alpha \colon X \to A$, there is a unique [[homomorphism|KBXSZC6BV1]] $\bar\alpha \colon \mathbf{T}_\sigma(X) \to A$ extending $\alpha$, namely $\bar\alpha(t) = t^A[\alpha]$, the [[value|DH30WTA26T]] of $t$.
When $X$ is empty, it is the algebra of closed terms, also called the Herbrand universe.

Example: let $\sigma$ have one binary symbol $\cdot$ and let $X = \set{x}$.
The elements $x$, $x \cdot x$, $(x \cdot x) \cdot x$, $x \cdot (x \cdot x)$, … are pairwise distinct, and the operation sends $(s, t)$ to the term $s \cdot t$.
This is the free magma on one generator.

Non-example: the positive integers with $\cdot$ read as addition are not isomorphic to this term algebra, even though they are generated by $1$.
In the term algebra, $s \cdot t = s' \cdot t'$ implies $s = s'$ and $t = t'$, because terms have a unique reading.
In the positive integers $1 + 2 = 2 + 1$ while $1 \ne 2$, so this property fails.
