Similarly, a ground formula is a formula that does not contain any free variables. In first-order logic with identity, the sentence x (x=x) is a ground formula.
A ground expression is a ground term or ground formula.
Consider the following expressions from first order logic over a signature containing a constant symbol 0 for the number 0, a unary function symbol s for the successor function and a binary function symbol + for addition.
- s(0), s(s(0)), s(s(s(0))) ... are ground terms;
- 0+1, 0+1+1, ... are ground terms.
- x+s(1) and s(x) are terms, but not ground terms;
- s(0)=1 and 0+0=0 are ground formulae;
- s(1) and ∀x: (s(x)+1=s(s(x))) are ground expressions.
What follows is a formal definition for first-order languages. Let a first-order language be given, with the set of constant symbols, the set of (individual) variables, the set of functional operators, and the set of predicate symbols.
Ground terms are terms that contain no variables. They may be defined by logical recursion (formula-recursion):
- elements of C are ground terms;
- If f∈F is an n-ary function symbol and α1, α2, ..., αn are ground terms, then f(α1, α2, ..., αn) is a ground term.
- Every ground term can be given by a finite application of the above two rules (there are no other ground terms; in particular, predicates cannot be ground terms).
Roughly speaking, the Herbrand universe is the set of all ground terms.
A ground predicate or ground atom or ground literal is an atomic formula all of whose argument terms are ground terms.
If p∈P is an n-ary predicate symbol and α1, α2, ..., αn are ground terms, then p(α1, α2, ..., αn) is a ground predicate or ground atom.
A ground formula or ground clause is a formula without free variables.
Formulas with free variables may be defined by syntactic recursion as follows:
- The free variables of an unground atom are all variables occurring in it.
- The free variables of ¬p are the same as those of p. The free variables of p∨q, p∧q, p→q are those free variables of p or free variables of q.
- The free variables of x p and x p are the free variables of p except x.