Lecture
Term — an expression of a formal language (system) of a special kind. By analogy with natural language, where a noun phrase refers to an object and a whole sentence refers to a fact, in mathematical logic a term denotes a mathematical object, while a formula denotes a mathematical fact. In particular, terms appear as components of a formula.
A first-order term is recursively defined from constant, variable, and function symbols . An expression obtained by applying a predicate symbol to the corresponding number of terms is called a logical atom, whose value in two-valued logic based on a logical interpretation is evaluated as «true» or «false ». For example, — this is a term built from the constant 1, the variable x and the binary function symbols + and ∗ ; it is part of the atomic formula
, which takes the value «true» for any real x.
Besides logic, terms play an important role in universal algebra and rewriting systems.
The set of terms of signature
, where R — the set of predicates, F — the set of functions, and μ — the arity mapping for Σ , is defined inductively:
The notation when n=0
denotes Θ
. In particular, from item 2 we obtain that the symbol
of a constant of signature Σ is a term of signature Σ.

Left to right: tree structure of the term ( n ⋅( n +1))/2 and n ⋅(( n +1)/2)
Given a set V of variable symbols, a set C of constant symbols, and sets F n of n -ary functions, also called operator symbols, for each natural number n ≥ 1, the set (of unsorted first-order terms) T is recursively defined as the smallest set with the following properties: [ 1 ]
Using an intuitive pseudo-grammar notation, this is sometimes written as:
t ::= x | c | f ( t 1 , ..., t n ).
The signature "language" of a term describes which sets of function symbols F n are used . Well-known examples are the unary function symbols sin , cos ∈ F 1 and the binary function symbols +, −, ⋅, / ∈ F 2 . Ternary operations and functions of higher arity are possible, but are rarely encountered in practice. Many authors treat constant symbols as 0-ary function symbols F 0 , so no special syntactic class is required for them.
A term denotes a mathematical object from the domain of discourse. The constant c denotes a named object from this domain, the variable x ranges over objects in this domain, and the n -ary function f maps n -tuples of objects to objects. For example, if n ∈ V is a variable symbol, 1 ∈ C is a constant symbol, and add ∈ F 2 is a binary function symbol, then n ∈ T , 1 ∈ T , and (consequently) add ( n , 1) ∈ T by the first, second, and third term construction rules respectively. The last term is usually written as n + 1 , using infix notation and the more common operator symbol + for convenience.
Originally, logicians defined a term as a string of symbols, obeying certain rules of formation. [ 2 ] However, since the concept of a tree became popular in computer science, it turned out to be more convenient to represent a term as a tree. For example, several different strings of symbols, such as «, denote the same term and correspond to the same tree, namely the left tree in the figure above. By separating the tree structure of a term from its graphical representation on paper, it is easy to account for parentheses (which are only a matter of representation, not structure) and invisible multiplication operators (which exist only in the structure, not in the representation).
Two terms are considered structurally , literally or syntactically equal if they correspond to the same tree. For example, the left and right trees in the figure above are structurally unequal terms, although they can be considered « semantically equal », since they always give the same value in rational arithmetic. While structural equality can be checked without knowing the meaning of the symbols, semantic equality cannot. If the function / is interpreted, for example, not as rational division but as truncating integer division, then for n = 2 the left and right terms will have the values 3 and 2 respectively. Structurally equal terms must agree in their variable names.
In contrast, a term t is called a renaming or variant of a term u , if the latter resulted from the consistent renaming of all the variables of the former, i.e. if u = tσ for some renaming substitution σ. In this case u is also a renaming of t , since the renaming substitution σ has an inverse σ −1 , and t = uσ −1 . Both terms are then also called equal modulo renaming . In many contexts, the specific variable names in a term have no significance; for example, the commutativity axiom for addition can be formulated as x + y = y + x or as a + b = b + a ; in such cases the entire formula can be renamed, whereas an arbitrary subterm generally cannot, for example, x + y = b + a is not a valid version of the commutativity axiom.
The set of variables of a term t is denoted as vars ( t ). A term containing no variables is called a ground term ; a term containing no multiple occurrences of a single variable is called a linear term . For example, 2+2 is a ground term and hence also a linear term, x ⋅( n +1) — is a linear term, n ⋅( n +1) — is a non-linear term. These properties are important, for example, in term rewriting.
Given a signature for function symbols, the set of all terms forms the algebra of free terms . The set of all ground terms forms the initial term algebra .
Abbreviating the number of constants as f 0 , and the number of i- -ary function symbols as f i , the number θ h of distinct ground terms of height up to h can be computed using the following recursive formula:
Given a set of R n -ary relation symbols for each natural number n ≥ 1, then a (unsorted) first-order atomic formula is obtained by applying an n -ary relation symbol to n terms. As with function symbols, the set of relation symbols R n is usually non-empty only for small n . In mathematical logic, more complex formulas are built from atomic formulas using logical connectives and quantifiers. For example, let denote the set of real numbers, ∀ x : x ∈
⇒ ( x +1)⋅( x +1) ≥ 0 — is a mathematical formula that takes the value «true» in the algebra of complex numbers. An atomic formula is called ground if it is built entirely from ground terms; all ground atomic formulas that can be formed from a given set of function and predicate symbols make up the Herbrand base for those sets of symbols.

Tree structure of the example black term , with the blue redex
When the domain of discourse contains elements of fundamentally different kinds, it is useful to partition the set of all terms accordingly. To do this, each variable and each constant symbol is assigned a sort (sometimes also called a type), and each function symbol is assigned a declaration of domain sorts and a range sort. A sorted term f ( t 1 ,..., t n ) can be composed of sorted subterms t 1 ,..., t n , only if the sort of the i -th subterm matches the declared sort of the i-th domain f . Such a term is also called well-sorted ; any other term (i.e. obeying only the unsorted rules) is called ill-sorted .
For example, a vector space has an associated field of scalar numbers. Let W and N denote the type of vectors and numbers respectively, V W and V N — the sets of vector and numeric variables respectively, and C W and C N — the sets of vector and numeric constants respectively. Then, for example, and 0 ∈ C N , and vector addition, scalar multiplication, and the dot product are declared as
, and
, respectively. Assuming the variable symbols
and a , b ∈ V N , the term
is well-sorted, whereasv→+a
is not (since + does not accept a term of type N as its second argument). To make
a well-sorted term, an additional declaration
is required. Function symbols having several declarations are called overloaded .
For more information, see the section «Many-sorted logic» , including extensions of the many-sorted framework, described there.
Example notation |
Bound variables |
Free variables |
Written as lambda term |
|---|---|---|---|
| lim n →∞ x / n | n | x | limit (λ n . div ( x , n )) |
| i | n | sum (1, n ,λ i . power ( i ,2)) | |
| t | a , b , k | integral ( a , b ,λ t . sin ( k ⋅ t )) |
The mathematical notations shown in the table do not fit into the first-order term scheme defined above, since they all introduce their own local or bound variable, which cannot appear outside the scope of the notation, for example does not make sense. In contrast, other variables, called free , behave like ordinary first-order variables, for example,
makes sense.
All these operators can be viewed as taking a function as an argument, rather than a value. For example, the operator lim is applied to a sequence, that is, to a mapping from a positive integer to a real number. Another example: the C function implementing the second example from the table, Σ, will have a function-pointer argument (see the box below).
Lambda terms can be used to denote anonymous functions that will be supplied as arguments to lim , Σ, ∫ etc.
For example, the square function from the C program below can be written anonymously as the lambda term λ i . i 2 . Then the general sum operator Σ can be regarded as a ternary function symbol, taking the lower bound value, the upper bound value, and the function to be summed. Because of its last argument, the Σ operator is called a second-order function symbol . As another example, the lambda term λ n . x / n denotes a function that maps 1, 2, 3, ... to x / 1, x / 2, x / 3, ..., respectively, that is, it denotes the sequence ( x / 1, x / 2, x / 3, ...). The operator lim takes such a sequence and returns its limit (if defined).
The rightmost column of the table shows how each example of mathematical notation can be represented by a lambda term, and how common infix operators are converted to prefix form.

Given a set of V variable symbols, the set of lambda terms is recursively defined as follows:
The motivating examples above also used some constants, such as div, power, etc., which, however, are not allowed in pure lambda calculus.
Intuitively, the abstraction λ x . t denotes a unary function that returns t given x , whereas the application ( t 1 t 2 ) denotes the result of calling the function t 1 with the input t 2 . For example, the abstraction λ x . x denotes the identity function, and λ x . y denotes a constant function that always returns y . The lambda term λ x .( x x ) takes a function x and returns the result of applying x to itself.
Comments