Troubles by understanding arity of terms in A Course in Universal Algebra.

I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.


Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.

Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^V\rightarrow A$. Note that the translation $(p,V)\mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.

  • Note that there's no requirement here that $V$ be finite!

In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).


Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:

Let $X$ be a set of symbols, called variables, and let $\mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $\mathrm{ar}(f)$, that is a non-negative integer. The set $\mathrm{T}(X)$ of all terms in $X$ is defined recursively:

  1. every variable $x$ or operation symbol $c$ with $\mathrm{ar}(c)=0$ is in $\mathrm{T}(X)$,
  2. if $t_1,\dots,t_k$ are terms and $f$ is an operation symbol with $\mathrm{ar}(f)=n$, then $f(t_1,\dots,t_n)$ is in $\mathrm{T}(X)$.

Now, let $X_k=\{x_1,\dots,x_k\}$ and let $\mathbf{A}$ be an algebra of type $\mathcal{F}$. To every term $t$ in $\mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:

  1. if $t=x_i$ or $t=c$ with $\mathrm{ar}(c)=0$, then $t^A:A^k\to A$ is defined by $t^A(a_1,\dots,a_k)=a_i$ or $t^A(a_1,\dots,a_k)=c^A$, respectively.
  2. if $t=f(t_1,\dots,t_n)$, then $t^A(a_1,\dots,a_k)=f^A(t_1^A(a_1,\dots,a_k),\dots,t_n^A(a_1,\dots,a_k))$.

The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:

Let $\mathcal{F}=\{+,-,0\}$. Then $t=(x_1+(-x_2))+x_3$ is in $\mathrm{T}(X_3)$, but it is also in $\mathrm{T}(X_k)$ for any $k\geq 3$. So, given an algebra $\mathbf{A}$ of type $\mathcal{F}$, we can define the term operation $t^A:A^3\to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^k\to A$ for any $k\geq 3$ by $t(a_1,\dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.