Definition · applies to formal languages · also called well-formed formula, wff

Undergraduate (first-order logic)

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:

  1. a relation symbol applied to terms, such as $x > 3$, is a formula,
  2. if $\varphi$ and $\psi$ are formulas, then so are $\neg \varphi$, $\varphi \land \psi$, $\varphi \lor \psi$, and $\varphi \implies \psi$, and
  3. if $\varphi$ is a formula and $x$ is a variable, then $\forall x \, \varphi$ and $\exists x \, \varphi$ are formulas.

Examples

Examples

Non-examples
Things that may be mistaken for examples of this term.

  • ✗ $x^2 + 1$ High school
    $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$ Undergraduate
    $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.

Notes

In elementary mathematics, a “formula” is an equation for calculating a quantity, such as $A = \pi r^2$; that meaning is different.

Distinctions involving this term

  • 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.
  • 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.

All definitions · All distinctions · All examples · Notation