Term vs. Formula
In logic, the expressions of a formal language, which are the well-formed strings of symbols, come in two kinds. A term, such as $x^2 + 1$, names an object, so a term has a value, such as a number. A formula, such as $x^2 + 1 > 3$, makes a claim about objects, so a formula has a truth value. Applying a relation symbol, such as $>$ or $=$, to terms gives a formula.
Definitions
Consider a first-order language, with variables, constant symbols, and function symbols. A term is a string of symbols built by the rules of the language that names an object, such as $x$, $3$, or $x^2 + 1$. Terms are built in two steps:
- every variable and every constant symbol is a term, and
- if $f$ is a function symbol with $n$ inputs and $t_1, \dots, t_n$ are terms, then $f(t_1, \dots, t_n)$ is a term.
Examples
-
$x^2 + 1$ is a term, because $x^2 + 1$ is built from the variable $x$ and the constants $2$ and $1$ with the function symbols for squaring and addition, and $x^2 + 1$ names a number once $x$ is given a value.
Non-examplesThings that may be mistaken for examples of this term.
-
“$x > 3$” is not a term, because “$x > 3$” makes a claim about $x$ instead of naming an object.
-
$\forall x \, (x^2 \geq 0)$ is not a term, because $\forall x \, (x^2 \geq 0)$ makes a claim, which is true, instead of naming an object.
Properties
- A term has a value, such as a number, once its variables are given values, but a term has no truth value.
- A relation symbol applied to terms, such as $x^2 + 1 > 3$, is a formula, not a term.
Consider a first-order language, with variables, symbols for functions and relations, logical connectives, and the quantifiers $\forall$ and $\exists$. A formula is a string of symbols built by the rules of the language that makes a claim about objects, such as $x > 3$, $x^2 + 1 = y$, or $\forall x \, (x^2 \geq 0)$. Formulas are built in three steps:
- a relation symbol applied to terms, such as $x > 3$, is a formula,
- if $\varphi$ and $\psi$ are formulas, then so are $\neg \varphi$, $\varphi \land \psi$, $\varphi \lor \psi$, and $\varphi \implies \psi$, and
- if $\varphi$ is a formula and $x$ is a variable, then $\forall x \, \varphi$ and $\exists x \, \varphi$ are formulas.
Examples
-
“$x > 3$” is a formula, because “$x > 3$” applies the relation symbol $>$ to the terms $x$ and $3$.
-
$\exists x \, (x^2 = 2)$ is a formula, because $\exists x \, (x^2 = 2)$ applies the quantifier $\exists x$ to the formula $x^2 = 2$.
-
$\exists y \, (y > x)$ is a formula, because $\exists y \, (y > x)$ applies the quantifier $\exists y$ to the formula $y > x$.
-
$\forall x \, (x^2 \geq 0)$ is a formula, because $\forall x \, (x^2 \geq 0)$ applies the quantifier $\forall x$ to the formula $x^2 \geq 0$.
-
$\forall x \, (x^2 \geq 0) \land \neg \exists x \, (x^2 < 0)$ is a formula of first-order logic, because $\forall x \, (x^2 \geq 0) \land \neg \exists x \, (x^2 < 0)$ combines two quantified formulas about the number $x$ with $\land$ and $\neg$.
Non-examplesThings that may be mistaken for examples of this term.
-
$x^2 + 1$ is not a formula, because $x^2 + 1$ is a term that names a number and makes no claim that could be true or false.
-
$p \land \neg q$ is not a formula of first-order logic, because its variables $p$ and $q$ stand for whole statements, and a first-order formula is built from relation symbols applied to terms that name objects.
Properties
- An occurrence of a variable in a formula is bound if the occurrence is inside a quantifier for that variable, and free otherwise. A formula with no free variables is a sentence.
- A formula with free variables expresses a predicate: the formula is true or false only once its free variables are given values.
- A term, such as $x^2 + 1$, names an object and is not a formula, because a term makes no claim.
Examples
| Example | term | formula | Why |
|---|---|---|---|
| $x^2 + 1$ | ✓ | ✗ | term: $x^2 + 1$ is a term, because $x^2 + 1$ is built from the variable $x$ and the constants $2$ and $1$ with the function symbols for squaring and addition, and $x^2 + 1$ names a number once $x$ is given a value.
formula: $x^2 + 1$ is not a formula, because $x^2 + 1$ is a term that names a number and makes no claim that could be true or false.
|
| “$x > 3$” | ✗ | ✓ | term: “$x > 3$” is not a term, because “$x > 3$” makes a claim about $x$ instead of naming an object.
formula: “$x > 3$” is a formula, because “$x > 3$” applies the relation symbol $>$ to the terms $x$ and $3$.
|
| $\forall x \, (x^2 \geq 0)$, with $x$ ranging over $\reals$ | ✗ | ✓ | term: $\forall x \, (x^2 \geq 0)$ is not a term, because $\forall x \, (x^2 \geq 0)$ makes a claim, which is true, instead of naming an object.
formula: $\forall x \, (x^2 \geq 0)$ is a formula, because $\forall x \, (x^2 \geq 0)$ applies the quantifier $\forall x$ to the formula $x^2 \geq 0$.
|
Notes
- The algebraic distinction between an expression and an equation is close to the distinction between a term and a formula: $3x + 2$ is a term, and the equation $3x + 2 = 8$ is a formula.