An expression formed from symbols for functions, constants, and variables. An example is
Terms are defined recursively as follows: a term is either a variable symbol, a constant symbol, or else has the form ϕ(τ
1,…,τ
k), where ϕ is a function symbol and each of τ
1,…,τ
k is itself a term. The example above thus has the overall form
f(τ
1,τ
2): in this case ϕ =
f and
k = 2. Another constraint is that different occurrences of the same symbol ϕ cannot occur with different values of
k, i.e. each ϕ must have a fixed
arity (number of arguments). Thus
would not be a term since the first
f has arity 2 while the second has arity 3; neither would
since the first
h has arity 1 while the second has arity 0.
Terms are often built using signatures. A Σ-term is a term in which each constant and function symbol used is in a signature Σ, and has the arity associated with it by Σ and, if Σ is a many-sorted signature, all the sorts match properly. A Σ-term is also called a term over signature Σ. Often a Σ-term is allowed to contain variables (of arity 0) in addition to symbols in Σ. Terms containing variables are called open terms; terms containing only symbols of the signature are called closed or ground terms. Terms can also be viewed as trees (see tree language). Terms (whether as expressions or as trees) are important in the construction of virtually all syntactic concepts. Terms as defined here are sometimes called first-order terms, to distinguish them from the higher-order terms (such as those involved in lambda calculus). See also equation, initial algebra, predicate calculus.