
This is part 4 of 11 in the Formal Methods 101 series. It extends the propositional logic from part 3 with variables and quantifiers.
Introduction
First-order logic (FOL) extends zero-order (propositional) logic to include variables and quantifiers.
Its operators are used to form expressions over variables. These expressions are known as predicates: Boolean-valued functions that return TRUE or FALSE depending on the values assigned to their variables.
First-order logic is made up of logical symbols (negation, binary connectives and quantifiers) and non-logical symbols (predicate symbols and functions).
Non-logical symbols
Predicate variables
- A predicate variable (symbol) with a valence of 0: A
- A predicate variable (symbol) with a valence of 2: A(b, d)
A predicate variable is Boolean-valued, so it may take the value TRUE (1) or FALSE (0). A predicate may have n arguments and is said to have a valence (or arity, the number of arguments) from 0 up to n. The argument values determine whether the predicate evaluates to TRUE or FALSE.
Functions
An example function is f(b, v). This follows the standard definition of a function, which is not required to return a Boolean value.
Logical symbols
The connectives are the same as in propositional logic, applied to predicates.
| Operator | Symbol | Example predicate | True when |
|---|---|---|---|
| Negation (NOT) | ¬ | ¬A | A is assigned FALSE |
| Conjunction (AND) | ∧ | A ∧ B | A and B are both assigned TRUE |
| Disjunction (OR) | ∨ | A ∨ B | at least one of A and B is assigned TRUE |
| Material implication | → | A → B | B is TRUE, or A is FALSE |
| Material bijection | ↔ | A ↔ B | A and B are assigned the same value |
- Negation: if A is assigned TRUE, the predicate ¬A evaluates to FALSE; if A is assigned FALSE, ¬A evaluates to TRUE.
- Conjunction: the predicate is TRUE if and only if (iff) the variables A and B are both assigned TRUE.
- Disjunction: the predicate is TRUE iff A or B (or both) is assigned TRUE.
- Material implication: if A is TRUE, then B is TRUE. It gives no information about B when A is not TRUE. The predicate may be TRUE or FALSE depending on whether it breaks the rule of material implication.
- Material bijection: if A is TRUE, then B is TRUE, and if B is TRUE, then A is TRUE; if A is FALSE, then B is FALSE, and if B is FALSE, then A is FALSE. The values of A and B are never different. It is equivalent to implication both ways, (A → B) ∧ (B → A), and the predicate may be TRUE or FALSE depending on whether it breaks that rule.
Quantifiers
The two quantifiers bind a variable over the domain of discourse. ∀ (for all) says a predicate holds for every element of the domain, and ∃ (there exists) says it holds for at least one.
Order of operations
Operators are evaluated in this order:
- ¬ is evaluated first.
- ∧ is evaluated next.
- ∨ is evaluated next.
- The ∀ and ∃ quantifiers are evaluated next.
- → is evaluated last (and so is ↔).
In the examples I put the quantified formula in parentheses, so its scope is explicit whichever precedence convention is used.
An example predicate
∀B ∃A ( (C(x, y) ∧ ¬D) → ((A ∧ E(t, z)) ∨ F) )
This reads: for all B, there exists an A such that, C and not D implies A and E, or F.
As the example shows, first-order logic is very expressive. It can be used to build extensive, complex models of a domain of discourse.