Formula vs. Sentence
In first-order logic, statements about objects are written as strings of symbols with variables and quantifiers. A formula is every such string that is built by the rules of the language, such as $x > 3$ or $\forall x \, (x^2 \geq 0)$, and the variables in a formula can be free or bound by quantifiers. A sentence is a formula in which a quantifier binds every variable, so a sentence is true or false once its symbols are interpreted, without assigning values to variables.
sentence ⊂ formula
Definitions
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.
Consider a formula of first-order logic, such as $\forall x \, (x^2 \geq 0)$ or $x > 3$. The formula is a sentence if it has no free variables: every variable in it is bound by a quantifier.
Examples
-
$\exists x \, (x^2 = 2)$ is a sentence, because the quantifier $\exists x$ binds the only variable $x$.
-
$\forall x \, (x^2 \geq 0)$ is a sentence, because the quantifier binds its only variable $x$.
-
$\forall x \, (x^2 \geq 0) \land \neg \exists x \, (x^2 < 0)$ is a sentence, because the quantifiers $\forall x$ and $\exists x$ bind every occurrence of $x$.
Non-examplesThings that may be mistaken for examples of this term.
-
“$7$ is prime” is not a sentence of first-order logic, because “$7$ is prime” is written in English, not as a string of symbols of a formal language.
-
“$x > 3$” is not a sentence, because $x$ is a free variable.
-
$x^2 + 1$ is not a sentence, because every sentence is a formula and $x^2 + 1$ is a term, which names a number instead of making a claim.
-
$\exists y \, (y > x)$ is not a sentence, although $\exists y \, (y > x)$ has a quantifier: the quantifier binds $y$, but $x$ is free, so the truth of $\exists y \, (y > x)$ depends on the value of $x$ (for example, if $x$ and $y$ range over the natural numbers, then the formula is true for every $x$, and if $x$ and $y$ range over $\setdef{1, 2, 3}$, then the formula is false for $x = 3$).
-
$p \land \neg q$ is not a sentence of first-order logic, because the variables $p$ and $q$ stand for whole statements, not for objects such as numbers, and $p \land \neg q$ has no quantifiers; a sentence such as $\forall x \, (x^2 \geq 0)$ has variables that stand for objects, and a quantifier binds each of those variables.
Properties
- Once its symbols are interpreted in a structure (such as $\reals$ with its usual operations), a sentence is true or false, so it expresses a proposition.
- A formula with free variables, such as $x > 3$, expresses a predicate. Quantifying every free variable turns it into a sentence.
Examples
| Example | formula | sentence | Why |
|---|---|---|---|
| “$x > 3$” | ✓ | ✗ | “$x > 3$” is a formula but not a sentence, because its variable $x$ is free. |
| $\exists y \, (y > x)$ | ✓ | ✗ | $\exists y \, (y > x)$ shows that a formula with a quantifier can still fail to be a sentence: the quantifier binds $y$ but leaves $x$ free. |
| $\forall x \, (x^2 \geq 0)$, with $x$ ranging over $\reals$ | ✓ | ✓ | 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$.
sentence: $\forall x \, (x^2 \geq 0)$ is a sentence, because the quantifier binds its only variable $x$.
|
| $x^2 + 1$ | ✗ | ✗ | $x^2 + 1$ is neither a formula nor a sentence, because $x^2 + 1$ is a term, which names a number instead of making a claim. |
Notes
- Quantifying every free variable of a formula gives a sentence: $\forall x \, (x > 3)$ and $\exists x \, (x > 3)$ are sentences.
- A formula with free variables expresses a predicate, and a sentence expresses a proposition once its symbols are interpreted.