Reading preferences
Optional display controls need JavaScript. All reading content and navigation work without it.
How to use Read
This page follows Syntax of First-Order Logic in source order. Equations are native, unflattened MathML, and every source coordinate is available offline.
Introduction
In order to develop the theory and metatheory of first-order logic, we must first define the syntax and semantics of its expressions. The expressions of first-order logic are terms and formulas. Terms are formed from variables, constants, and functions. Formulas, in turn, are formed from predicates together with terms (these form the smallest, “atomic” formulas), and then from atomic formulas we can form more complex ones using logical connectives and quantifiers. There are many different ways to set down the formation rules; we give just one possible one. Other systems will chose different symbols, will select different sets of connectives as primitive, will use parentheses differently (or even not at all, as in the case of so-called Polish notation). What all approaches have in common, though, is that the formation rules define the set of terms and formulas inductively. If done properly, every expression can result essentially in only one way according to the formation rules. The inductive definition resulting in expressions that are uniquely readable means we can give meanings to these expressions using the same method—inductive definition.
First-Order Languages
Expressions of first-order logic are built up from a basic vocabulary containing variables, constants, predicates and sometimes functions. From them, together with logical connectives, quantifiers, and punctuation symbols such as parentheses and commas, terms and formulas are formed.
In the general case, we make use of the following symbols in first-order logic:
Logical symbols
Logical connectives: source 39 (negation), source 40 (conjunction), source 41 (disjunction), source 42 (conditional)
source 44 (universal quantifier), source 45 (existential quantifier). The propositional constant for falsity source 46.
The two-place identity source 48.
A denumerables set of variables: source 49, source 49, source 49, …
Non-logical symbols, making up the standard language of first-order logic
Punctuation marks: (, ), and the comma.
Most of our definitions and results will be formulated for the full standard language of first-order logic. However, depending on the application, we may also restrict the language to only a few predicates, constants, and functions.
Arithmetic language example
The language source 71 of arithmetic contains a single two-place predicate source 72, a single constant source 72, one one-place function source 73, and two two-place functions source 73 and source 73.
Set-theory language example
The language of set theory source 77 contains only the single two-place predicate source 78.
Order language example
The language of orders source 82 contains only the two-place predicate source 83.
Again, these are conventions: officially, these are just aliases, e.g., source 87, source 87, and source 87 are aliases for source 87, source 87 for source 88, source 88 for source 88, source 88 for source 88, source 88 for source 89.
In addition to the primitive connectives and quantifiers introduced above, we also use the following defined symbols:
source 100 (biconditional)
Truth source 104.
Terms and formula
Once a first-order language source 13 is given, we can define expressions built up from the basic vocabulary of source 14. These include in particular terms and formulas.
Inductive definition of first-order terms
The set of terms source 19 of source 19 is defined inductively by:
Every variable is a term.
Every constant of source 23 is a term.
If source 24 is an source 24-place function and source 24, …, source 24 are terms, then source 25 is a term.
Nothing else is a term.
A term containing no variables is a closed term.
Inductive definition of first-order formulas
The set of formulas source 43 of the language source 43 is defined inductively as follows:
source 46 is an atomic formula.
If source 50 is an source 50-place predicate of source 50 and source 50, …, source 51 are terms of source 51, then source 51 is an atomic formula.
If source 54 and source 54 are terms of source 54, then source 54 is an atomic formula.
If source 57 is a formula, then source 57 is a formula.
If source 60 and source 60 are formulas, then source 60 is a formula.
If source 63 and source 63 are formulas, then source 63 is a formula.
If source 66 and source 66 are formulas, then source 66 is a formula.
If source 72 is a formula and source 72 is a variable, then source 73 is a formula.
If source 75 is a formula and source 75 is a variable, then source 76 is a formula.
Nothing else is a formula.
By convention, we write source 102 between its arguments and leave out the parentheses: source 103 is an abbreviation for source 104. Moreover, source 104 is abbreviated as source 105. When writing a formula source 105 constructed from source 106, source 106 using a two-place connective source 106, we will often leave out the outermost pair of parentheses and write simply source 108.
Definitions of derived logical operators
Formulas constructed using the defined operators are to be understood as follows:
source 129 abbreviates source 130.
source 150 abbreviates source 150.
If we work in a language for a specific application, we will often write two-place predicates and functions between the respective terms, e.g., source 162 and source 162 in the language of arithmetic and source 163 in the language of set theory. The successor function in the language of arithmetic is even written conventionally after its argument: source 165. Officially, however, these are just conventional abbreviations for source 166, source 167, source 167 and source 167, respectively.
Definition of syntactic identity
The symbol source 171 expresses syntactic identity between strings of symbols, i.e., source 172 iff source 172 and source 172 are strings of symbols of the same length and which contain the same symbol in each place.
The source 176 symbol may be flanked by strings obtained by concatenation, e.g., source 177 means: the string of symbols source 178 is the same string as the one obtained by concatenating an opening parenthesis, the string source 179, the source 179 symbol, the string source 180, and a closing parenthesis, in this order. If this is the case, then we know that the first symbol of source 181 is an opening parenthesis, source 182 contains source 182 as a substring (starting at the second symbol), that substring is followed by source 183, etc.
As terms and formulas are built up from basic elements via inductive definitions, we can use the following induction principles to prove things about them.
Principle of induction on terms
Let source 191 be a first-order language. If some property source 192 is such that
it holds for every variable source 195,
it holds for every constant source 197 of source 197, and
it holds for source 199 whenever it holds for source 200, …, source 200 and source 200 is an source 200-place function of source 201
(assuming source 203, …, source 203 are terms of source 203), then source 204 holds for every term in source 204.
Exercise on induction for terms
Unsolved exercise. The source supplies the prompt only; no solution is added.
Principle of induction on formulas
Let source 213 be a first-order language. If some property source 214 holds for all the atomic formulas and is such that
it holds for source 218 whenever it holds for source 219; it holds for source 220 whenever it holds for source 221 and source 221; it holds for source 222 whenever it holds for source 223 and source 223; it holds for source 224 whenever it holds for source 225 and source 225;
it holds for source 228 whenever it holds for source 229; it holds for source 230 whenever it holds for source 231;
(assuming source 233 and source 233 are formulas of source 233), then source 234 holds for all formulas in source 234.
Unique Readability
Balanced-parentheses lemma for formulas
The number of left and right parentheses in a formula source 57 are equal.
Proof
We prove this by induction on the way source 62 is constructed. This requires two things: (a) We have to prove first that all atomic formulas have the property in question (the induction basis). (b) Then we have to prove that when we construct new formulas out of given formulas, the new formulas have the property provided the old ones do.
Let source 68 be the number of left parentheses, and source 68 the number of right parentheses in source 69, and source 69 and source 69 similarly the number of left and right parentheses in a term source 70.
Exercise on parentheses in terms
Unsolved exercise. The source supplies the prompt only; no solution is added.
Case: source 77 has source 77 left and source 77 right parentheses.
Case: source 83. Here we make use of the fact, left as an exercise, that source 85 for any term source 86.
Case: source 88.
Case: By induction hypothesis, source 95 and source 96. Thus source 96.
Case: By induction hypothesis, source 100. Thus, source 100.
Case: Similarly.
End of proof.
Definition of proper prefix
A string of symbols source 114 is a proper prefix of a string of symbols source 114 if concatenating source 115 and a non-empty string of symbols yields source 115.
No-formula-prefix lemma
If source 119 is a formula, and source 119 is a proper prefix of source 119, then source 120 is not a formula.
Proof
Exercise.
End of proof.
Exercise on the no-formula-prefix lemma
Unsolved exercise. The source supplies the prompt only; no solution is added.
Prove No-formula-prefix lemma.
Unique form of atomic formulas
If source 133 is an atomic formula, then it satisfies one, and only one of the following conditions.
source 138 where source 138 is an source 138-place predicate, source 139, …, source 139 are terms, and each of source 139, source 140, …, source 140 is uniquely determined.
source 141 where source 141 and source 141 are uniquely determined terms.
Proof
Exercise.
End of proof.
Exercise on unique atomic form
Unsolved exercise. The source supplies the prompt only; no solution is added.
Prove Unique form of atomic formulas (Hint: Formulate and prove a version of No-formula-prefix lemma for terms.)
Unique readability proposition
Every formula satisfies one, and only one of the following conditions.
source 158 is atomic.
source 160 is of the form source 160.
source 162 is of the form source 162.
source 164 is of the form source 164.
source 166 is of the form source 166.
source 170 is of the form source 170.
source 172 is of the form source 172.
Moreover, in each case source 174, or source 174 and source 174, are uniquely determined. This means that, e.g., there are no different pairs source 175, source 176 and source 176, source 176 so that source 176 is both of the form source 177 and source 177.
Proof
The formation rules require that if a formula is not atomic, it must start with an opening parenthesis (, source 184, or a quantifier. On the other hand, every formula that starts with one of the following symbols must be atomic: a predicate, a function, a constant, source 186.
So we really only have to show that if source 188 is of the form source 188 and also of the form source 189, then source 189, source 190, and source 190.
So suppose both source 192 and source 192. Then either source 193 or not. If it is, clearly source 194 and source 194, since they then are substrings of source 195 that begin in the same place and are of the same length. The other case is source 196. Since source 196 and source 197 are both substrings of source 197 that begin at the same place, one must be a proper prefix of the other. But this is impossible by No-formula-prefix lemma.
End of proof.
main operator of a Formula
Definition of a formula's main operator
The main operator of a formula source 24 is defined as follows:
In each case, we intend the specific indicated occurrence of the main operator in the formula. For instance, since the formula source 54 is of the form source 54 where source 55 is source 55 and source 55 is source 55, the second occurrence of source 56 is the main operator.
We call formulas by the names in Table of main operators and formula types depending on which symbol their main operator is. Recall, however, that defined operators do not officially appear in formulas. They are just abbreviations, so officially they cannot be the main operator of a formula. In proofs about all formulas they therefore do not have to be treated separately.
Table of main operators and formula types
The table pairs each outer operator with its formula type and an example.
| Main operator | Type of formula | Example |
|---|---|---|
| None | Atomic formula | source 85; source 87; source 88 |
| source 89 | Negation | source 89 |
| source 90 | Conjunction | source 90 (Reader correction: The source table places the closing parenthesis outside the math delimiter. The reader rendering includes it in the displayed conjunction) |
| source 91 | Disjunction | source 91 (Reader correction: The source table places the closing parenthesis outside the math delimiter. The reader rendering includes it in the displayed disjunction) |
| source 92 | Conditional | source 92 (Reader correction: The source table places the closing parenthesis outside the math delimiter. The reader rendering includes it in the displayed conditional) |
| source 93 | Biconditional | source 93 |
| source 94 | Universal formula | source 94 |
| source 95 | Existential formula | source 95 |
Source: content/first-order-logic/syntax-and-semantics/main-operator.tex, line 81.
subformula
Definition of immediate subformulas
If source 21 is a formula, the immediate subformulas of source 22 are defined inductively as follows:
Atomic formulas have no immediate subformulas.
Case: The only immediate subformula of source 27 is source 27.
Case: The immediate subformulas of source 30 are source 30 and source 30 (source 30 is any one of the two-place connectives).
Case: The only immediate subformula of source 34 is source 34.
Case: The only immediate subformula of source 37 is source 37.
Definition of proper subformulas
If source 42 is a formula, the proper subformulas of source 43 are defined recursively as follows:
Atomic formulas have no proper subformulas.
Case: The proper subformulas of source 48 are source 48 together with all proper subformulas of source 49.
Case: The proper subformulas of source 52 are source 52, source 52, together with all proper subformulas of source 53 and those of source 53.
Case: The proper subformulas of source 56 are source 56 together with all proper subformulas of source 57.
Case: The proper subformulas of source 60 are source 60 together with all proper subformulas of source 61.
Definition of subformula
The subformulas of source 66 are source 66 itself together with all its proper subformulas.
Transitivity of the subformula relation
Suppose source 92 is a subformula of source 92 and source 92 is a subformula of source 92. Then source 93 is a subformula of source 93. In other words, the subformula relation is transitive.
Exercise on subformula transitivity
Unsolved exercise. The source supplies the prompt only; no solution is added.
Upper bound on the number of subformulas
Suppose source 103 is a formula with source 103 connectives and quantifiers. Then source 104 has at most source 104 subformulas.
Exercise on counting subformulas
Unsolved exercise. The source supplies the prompt only; no solution is added.
Formation Sequences
Defining formulas via an inductive definition, and the complementary technique of proving properties of formulas via induction, is an elegant and efficient approach. However, it can also be useful to consider a more bottom-up, step-by-step approach to the construction of formulas, which we do here using the notion of a formation sequence.
To show how terms and formulas can be introduced in this way without needing to refer to their inductive definitions, we first introduce the notion of an arbitrary string of symbols drawn from some language source 23.
Definition of language strings
Suppose source 27 is a first-order language. An source 27-string is a finite sequence of symbols of source 28. Where the language source 29 is clearly fixed by the context, we will often refer to a source 30-string simply as a string.
Example of a string that is not a formula
For any first-order language source 34, all source 35-formulas are source 35-strings, but not conversely. For example, source 36 is an source 37-string but not an source 37-formula.
Definition of term formation sequence
A finite sequence of source 42-strings source 42 is a formation sequence for a term source 43 if source 43 and for all source 44, either source 44 is a variable or a constant, or source 44 contains a source 45-ary function source 45 (Reader correction: The source uses k both as the declared arity and as the final zero-based argument index, which displays k plus one arguments. The reader preserves and explicitly flags this mismatch) and there exist source 46 (Reader correction: The displayed index range contains k plus one argument positions, although the preceding source calls the function k-ary. The reader preserves and explicitly flags this mismatch) such that source 46 (Reader correction: The source calls f k-ary but displays arguments indexed from m sub zero through m sub k, which is k plus one displayed arguments. The reader preserves that source mismatch and does not silently choose a correction). When it is necessary to distinguish, we will refer to formation sequences for terms as term formation sequences.
Examples of term formation sequences
The sequence source 53 is a formation sequence for the term source 56, as is source 58
Definition of formula formation sequence
A finite sequence of source 65-strings source 65 is a formation sequence for source 66 if source 66 and for all source 67, either source 67 is an atomic formula or there exist source 68 and a variable source 68 such that one of the following holds:
source 71. source 72. source 73. source 74.
When it is necessary to distinguish, we will refer to formation sequences for formulas as formula formation sequences.
Examples of formula formation sequences
source 84 is a formation sequence of source 92, as is Displayed redundant formula formation sequence source 94
As can be seen from the second example, formation sequences may contain “junk”: formulas which are redundant or do not contribute to the construction.
Existence of formula formation sequences
Every formula source 111 in source 111 has a formation sequence.
Proof
Suppose source 115 is atomic. Then the sequence source 115 is a formation sequence for source 116.
Now suppose that source 118 and source 118 have formation sequences source 119 and source 119 respectively.
If source 123, then source 124 is a formation sequence for source 125. If source 126, then source 127 is a formation sequence for source 128. If source 129, then source 130 is a formation sequence for source 131. If source 132, then source 133 is a formation sequence for source 134.
If source 138, then source 139 is a formation sequence for source 140. If source 141, then source 142 is a formation sequence for source 143.
By the principle of induction on formulas, every formula has a formation sequence.
End of proof.
We can also prove the converse. This is important because it shows that our two ways of defining formulas are equivalent: they give the same results. It also means that we can prove theorems about formulas by using ordinary induction on the length of formation sequences.
Initial-subsequence lemma
Suppose that source 157 is a formation sequence for source 158, and that source 158. Then source 158 is a formation sequence for source 159.
Proof
Exercise.
End of proof.
Exercise on initial formation subsequences
Unsolved exercise. The source supplies the prompt only; no solution is added.
Prove Initial-subsequence lemma.
Equivalence of formula definitions
source 172 is the set of all source 172-strings source 172 such that there exists a formula formation sequence for source 173.
Proof
Let source 177 be the set of all strings of symbols in the language source 177 that have a formation sequence. We have seen in Existence of formula formation sequences that source 179, so now we prove the converse.
Suppose source 182 has a formation sequence source 182. We prove that source 183 by strong induction on source 183 (Reader correction: The reader interprets n as the final sequence index. The source calls the following m a length, but a sequence indexed zero through n has length n plus one). Our induction hypothesis is that every string of symbols with a formation sequence of length source 185 (Reader correction: The source calls m a sequence length while inducting on the final index n. Since a sequence indexed from zero through n has n plus one entries, the literal length statement is off by one. The reader treats m and n as final indices; equivalently, the proof may induct on length n plus one and use all shorter lengths) is in source 185. By the definition of a formation sequence, either source 186 (Reader correction: The printed sentence has a garden-path construction: 'either A is syntactically identical to A sub n is atomic.' The reader supplies appositive wording so the intended claim is that A, identical to the final entry A sub n, is atomic) is atomic or there must exist source 187 such that one of the following is the case:
source 190. source 191. source 192. source 193.
Now we reason by cases. If source 198 is atomic then source 199 (Reader correction: The source prints the undefined language L sub zero here, although this theorem fixes the first-order language L. The reader uses L and preserves the printed source in the source view). Suppose instead that source 200 (Reader correction: The source prints material-equivalence notation in this proof case, while the formation clauses and the argument require syntactic identity. The reader uses syntactic identity and preserves the printed source in the source view). By Initial-subsequence lemma, source 202 and source 202 are formation sequences for source 203 and source 203, respectively. Since these are proper initial subsequences of the formation sequence for source 205, they both have length less than source 205 (Reader correction: The source says the proper initial sequences have length less than n. The correct final-index statement is that they end at indices less than n; equivalently their lengths are less than n plus one). Therefore by the induction hypothesis, source 206 and source 206 are in source 206 (Reader correction: The source again prints the undefined language L sub zero here. The theorem concerns the fixed first-order language L, which the reader uses while preserving the printed source in the source view), and by the definition of a formula, so is source 208. The other cases follow by parallel reasoning.
End of proof.
Formation sequences for terms have similar properties to those for formulas.
Equivalence for term formation sequences
source 217 is the set of all source 217-strings source 217 such that there exists a term formation sequence for source 218.
Proof
Exercise.
End of proof.
Exercise on term formation sequences
Unsolved exercise. The source supplies the prompt only; no solution is added.
Prove Equivalence for term formation sequences. Hint: use a similar strategy to that used in the proof of Equivalence of formula definitions.
There are two types of “junk” that can appear in formation sequences: repeated elements, and elements that are irrelevant to the construction of the formation or term. We can eliminate both by looking at minimal formation sequences.
Definition of minimal formation sequence
A formation sequence source 238 for a formula source 239 is a minimal formation sequence for source 239 if for every other formation sequence source 240 for source 240, the length of source 241 is greater than or equal to source 241.
Similarly, a formation sequence source 243 for a term source 244 is a minimal formation sequence for source 245 if for every other formation sequence source 245 for source 245, the length of source 246 is greater than or equal to source 246.
Note that a formula or term can have more than one minimal formation sequence, but they will contain exactly the same strings.
Formation-sequence characterization of subformulas
The following are equivalent:
source 257 is a sub-formula of source 257.
source 258 occurs in every formation sequence of source 258.
source 259 occurs in a minimal formation sequence of source 259.
Proof
Exercise.
End of proof.
Exercise on subformulas and formation sequences
Unsolved exercise. The source supplies the prompt only; no solution is added.
Free variable and sentence
Definition of free variable occurrences
The free occurrences of a variable in a formula are defined inductively as follows:
Case: source 18 is atomic: all variable occurrences in source 19 are free.
Case: the free variable occurrences of source 22 are exactly those of source 22.
Case: the free variable occurrences of source 25 are those in source 25 together with those in source 26.
Case: the free variable occurrences in source 29 are all of those in source 29 except for occurrences of source 30.
Case: the free variable occurrences in source 33 are all of those in source 33 except for occurrences of source 34.
Definition of bound variable occurrence
An occurrence of a variable in a formula source 39 is bound if it is not free.
Exercise on bound variable occurrences
Unsolved exercise. The source supplies the prompt only; no solution is added.
Give an inductive definition of the bound variable occurrences along the lines of Definition of free variable occurrences.
Definition of quantifier scope and binding
If source 49 is an occurrence of a subformula in a formula source 50, then the corresponding occurrence of source 50 in source 50 is called the scope of the corresponding occurrence of source 52. Similarly for source 52.
If source 58 is the scope of a quantifier occurrence source 59 or source 60 in source 60, then the free occurrences of source 61 in source 61 are bound in source 61 and source 62. We say that these occurrences are bound by the mentioned quantifier occurrence.
Examples of scope, binding, and free variables
Consider the following formula: source 69. source 72 represents the scope of source 72. The quantifier binds the occurrence of source 73 in source 73, but does not bind the occurrence of source 74. So source 74 is a free variable in this case.
We can now see how this might work in a more complicated formula source 79: source 80. source 85 is the scope of the first source 85, source 85 is the scope of source 86, and source 86 is the scope of the second source 87. The first source 87 binds the occurrences of source 88 in source 88, source 88 binds the occurrence of source 89 in source 89, and the second source 89 binds the occurrence of source 90 in source 90. The first occurrence of source 90 and the fourth occurrence of source 91 are free in source 91. The last occurrence of source 92 is free in source 92, but bound in source 92 and source 92.
Definition of sentence
A formula source 96 is a sentence iff it contains no free occurrences of variables.
Substitution
Recursive definition of substitution in a term
We define source 14, the result of substituting source 14 for every occurrence of source 15 in source 15, recursively:
Definition of a term being free for a variable
A term source 30 is free for source 30 in source 30 if none of the free occurrences of source 31 in source 31 occur in the scope of a quantifier that binds a variable in source 32.
Examples of terms free and not free for substitution
Recursive definition of substitution in a formula
If source 46 is a formula, source 46 is a variable, and source 46 is a term free for source 47 in source 47, then source 47 is the result of substituting source 48 for all free occurrences of source 48 in source 48.
We often use the following convention to avoid cumbersome notation: If source 117 is a formula which may contain the variable source 117 free, we also write source 118 to indicate this. When it is clear which source 118 and source 119 we have in mind, and source 119 is a term (assumed to be free for source 119 in source 120), then we write source 120 as short for source 120. So for instance, we might say, “we call source 121 an instance of source 122.” By this we mean that if source 122 is any formula, source 123 a variable, and source 123 a term that's free for source 123 in source 124, then source 124 is an instance of source 124.