Section 5.1 read quantified sentences by eye. That is
enough to understand them, and not enough to reason with
them: every quantifier rule of Sections 5.3 to 5.6, and
the rule for using an equation in Section 5.7, has the
form “put the term in for the variable
in ”, written , and a rule
has to say exactly which symbols change. This section
makes the language of Section 5.1 exact, in the way
Section 4.1 made the propositional language exact, says
exactly what does, and
names the one way it goes wrong,
capture.
Which
letters are holes
Three sentences, over the domain :
- “” is
not a statement. It is the open sentence of item (e) of
Example (Statements and nonstatements),
true for some values of and false for
others.
- “” is a statement, and a true one. The letter
still appears,
but the quantifier has closed its hole: the sentence
does not ask which we mean.
- “” is neither true nor false as it stands. It
is true when is
(every natural
number is at least ) and false when is (the number is not at least ). It is an open
sentence in , although it
begins with a quantifier.
So the question “is this a statement?” is not
answered by looking for quantifiers. It is answered by
asking which letters are still holes. In the third
sentence is
closed by
and is open. The
open letters will be called free, and
the closed ones bound.
Here is why the difference matters for reasoning.
Over , the
sentence is an open sentence in , and it is true for
every : given
, the number differs from
it. Now suppose that we want to say the same thing about
a particular number named by another letter, and we put
in for without thinking. The
result is “some number differs from itself”, which is
false. Nothing about numbers went wrong. The that we put in landed
inside the scope of , and the quantifier took hold of it: the new
was meant to name
a number from outside, and it has become the
quantifier’s own placeholder. This is
capture.
Capture is the one trap of substitution, and the
rules of Sections 5.3 to 5.7 substitute at almost every
step. So we need exact answers to three questions: what
the expressions are that can be put in; which
occurrences of
get replaced; and when putting in for is safe.
The first things to build are the names of
objects.
A term is a name of an object, built from
variables and constants by function symbols.
Definition
5.2.1 (Term)
The terms are the strings given by
the following clauses.
- (Tm1) Every variable
is a term, and every constant symbol is a term.
- (Tm2) If is a function symbol of
arity and are
terms, then is a term.
- (Tm3)
Nothing else is a term: a string is a
term only if it is the last entry of a
finite list of strings in which every entry is a
variable, a constant symbol, or for
some function symbol of arity and
earlier entries .
In words: variables and constants are terms, a
function symbol applied to as many terms as it has
places is a term, and nothing else is.
A variable of a term is a variable that
occurs in . A term
with no variables, such as or , names one fixed
object once the symbols are interpreted; a term with
variables, such as , names an object only once its variables have
values.
Shorthand. We write terms in the
familiar way:
for , , , for (a sequence is a
function symbol, as Section 5.1 said). School
conventions about grouping say which term is meant.
Here are terms, simplest first.
- and : by (Tm1). The
degenerate terms, built in no steps; every argument
about all terms has to handle them.
- ,
officially :
by (Tm2) from the terms and .
- : by
(Tm2) twice, from , for a one-place . Its only building
blocks are constants, so it has no variables.
- ,
officially , with the two-place minus: by
(Tm2) three times, from the variables and . Its variables are
and . The letter is a function symbol,
not a variable.
↺Second readingThe
symbols of the language, strings that are not terms, and
two more shorthand rules
Section 4.1 described the propositional language by
its alphabet and its formation rules. The language of
predicate logic has more symbols, of more kinds.
- Variables: , with
subscripts , and in analysis also . There are infinitely many, so that a fresh
one is always available. Each is one symbol.
- Constant symbols, such as , , , , , . (A letter may be a
constant in one language and a function symbol in
another: in a language with a sequence, is the sequence’s
one-place function symbol, as below, and not a
constant.)
- Function symbols, each with a
number of places , its arity: and , the arithmetic symbols
, and (two places), and in front of a number,
halving ,
squaring and (one place).
The one-place and the two-place minus are different
symbols written alike; the number of terms they are
applied to shows which is meant.
- Predicate symbols, each with an
arity :
, , , , , , and for a fixed set
(one place, as in
Section 5.1).
- Equality , which every language
has.
- The constant , the connectives
of Chapter 4, and the
quantifier symbols and .
- Parentheses ,
, and the
comma.
Which constant, function, and predicate symbols are
available depends on the subject. For the argument of
Section 5.1 we need the constant and the one-place
predicate symbols
and . For
arithmetic we need , , , , and . Every formula uses
only finitely many symbols, and we never need to fix the
whole list in advance.
Strings that are not terms, each by
one clause:
- is not
a term. It does not name an object; it says something
about one. It is built with a predicate symbol, and
(Tm2) uses only function symbols. It will be a
formula.
- , for a
one-place , is not
a term: (Tm2) applies to exactly one
term.
Terms can be drawn as trees, exactly as formulas were
in Section 4.1: a variable or a constant is a single
node, and is a node labeled with the trees of below it,
in order. And a term can be read in only one way. The
proof is the proof of unique readability for formulas in
Section 4.3 (Theorem 4.3.3),
with the parentheses and commas of (Tm2) doing the work
that the parentheses of (F3) did there. We do not repeat
it.
Shorthand rules 1 and 3.
Rule 1. Two-place predicate symbols
such as
are written between their terms: is shorthand for
. The
one-place symbol is written after its term: is shorthand for
. (When
sets are themselves objects of the domain, is a two-place
predicate symbol and is ; in this chapter is a fixed set, except
in one example of Section 5.7 where sets are the
objects, so we treat as one-place.) We write for .
Rule 3. The bounded quantifiers of Definition 5.1.1,
and the rest, stand for the formulas
given there.
Next, the statements and open sentences. Atomic
formulas say something about terms; everything else is
built from them by connectives and quantifiers.
A first-order formula is built from predicates
applied to terms, by the connectives and the two
quantifiers.
- (Fm1): the atomic formulas, a predicate
symbol with its terms, or an equation, or , take the place of
Chapter 4’s atoms.
- (Fm2), (Fm3): the connectives, as
before.
- (Fm4): puts or , with a
variable , in front of a formula,
without parentheses, as is.
Structural induction and recursion (Theorem 4.3.1,
Theorem 4.3.4)
carry over to terms and first-order formulas, with the
atomic formulas as base case and one new building step
for each quantifier (the fold below says how).
↺Second readingInduction
and recursion on formulas
The base case covers every atomic
formula (and ),
and there are two new building steps, from to and
to , for every variable , each with one part,
like the step to . So, to prove
that every formula has a property, prove it for the
atomic formulas and , and prove that it
passes from
to ,
, and , and
from
to . To define a function on formulas, give
one clause for each of these cases. The proofs in
Section 4.3 go through word for word with the new cases
added, and unique readability holds for the same reason;
we use all three without repeating them. The same two
principles hold for terms, with (Tm1) as the base case
and (Tm2) as the one building step.
Shorthand. The conventions of
Section 4.1 for dropping parentheses stay, with three
additions. Rules 1 and 3 (predicate symbols written
between their terms, as in ; bounded quantifiers as abbreviations)
are in the fold on the symbols of the language, above;
rule 2 matters in every section:
Rule 2. A quantifier binds as tightly as
: it
applies to the smallest formula that follows it. So
stands for , an implication whose hypothesis is . For the
quantifier to govern the whole implication, write , where the parentheses are the official
ones around the implication.
Rule 2 matters in every rule section. The formula
has main connective , while has main symbol . The rule for
using a “for every” (Section 5.3) applies only to the
second.
Parse trees. A parse tree for a
first-order formula is drawn as in Section 4.1, with one
new kind of node: a quantifier node,
labeled
or , with
the tree of the formula it governs as its only subtree.
The leaves are atomic formulas (or ); their terms have
trees of their own, which we do not draw. Here is the
tree of .
The root is the quantifier node , so the
formula’s main symbol is . Below it is
the implication, with the atomic formula on the left and the
quantifier node on the right, which governs the atomic
formula .
Quick check. Draw the parse tree of
, written in shorthand.
What is its main symbol?
Solution. By shorthand rule 2, each
quantifier applies to the smallest formula after it, so
the official formula is and its main symbol is
. The root is
. Its left
subtree is the node above the leaf . Its right subtree
is the node , below it the node , and below that
the leaf .
The two
nodes are on different branches.
Free and
bound: drawing the arrows
The parse tree shows which quantifier governs which
part of a formula. That is exactly what decides whether
a letter is a hole. Draw an arrow from each occurrence
of a variable to the nearest quantifier on that variable
above it in the parse tree. An occurrence with an arrow
is bound; one with none is a hole still open.
Figure B. Each bound occurrence
points to its quantifier. The first points nowhere: it is
free.
An occurrence of a variable is bound if a
quantifier on that variable stands above it in the parse
tree; otherwise it is free.
Definition
5.2.3 (Free and Bound Variables)
Let be a
formula and a
variable. An occurrence of in is an appearance
of inside one of
the terms of an atomic formula of . (The written just after a
quantifier symbol, as in , is part of the
quantifier node and is not an occurrence.)
- An occurrence of is
bound if the path from its leaf up to
the root of the parse tree passes through a quantifier
node or
, with the
same variable . The lowest such node
binds the occurrence.
- An occurrence that is not bound is
free.
- The scope of a quantifier node is
the part of the tree below it: the formula it
governs.
- The variable
is a free variable of , or is
free in , if at least one
occurrence of in
is
free.
A variable appears in if it is written
anywhere in : inside a term,
or just after a quantifier symbol. Every freshness
condition of this chapter is stated with “appear”; in
practice, a fresh letter is one written nowhere yet.
Definition
5.2.4 (Sentence)
A sentence is a formula with no free
variables.
A sentence is what Chapter 1 called a statement, once
the domain and the symbols are fixed: every hole is
closed, so it is true or false. A formula with free
variables is an open sentence, true or false only once
values are given to its free variables.
Examples. The domain is irrelevant to all of them:
being free or bound is a matter of the string, not of
what it means.
- : the occurrence of is bound by ; the occurrence
of has no
quantifier on
above it, so it is free. The free variables are alone. Not a
sentence.
- : the occurrence of in is
free (no quantifier stands above it:
the
governs only ),
and the occurrence in is bound. So is a free variable of
this formula, and it is not a sentence.
- : the occurrence of has two quantifiers on
above it, and the
lower one, , binds it. The outer binds nothing.
A sentence.
↺Second readingOccurrences,
‘appear’, and the recursive description of
‘free’
In words: an occurrence of is bound when it lies
in the scope of a quantifier on ; quantifiers on other
variables do not bind it. If several quantifiers on
stand above it,
the nearest one, the lowest in the tree, is the one that
binds it. A free occurrence is a hole still open. A
variable is free in a formula if it has at least
one free occurrence, even if it has bound
occurrences too.
So appears in
,
although it has no occurrence there. A variable that
does not appear in has no occurrence
in , and no
quantifier of is on it; that is
why the freshness conditions use “appear”.
Three more examples:
- and are sentences: they
contain no variables at all. So is . These
are the degenerate cases.
- : the single occurrence of lies below the node
, so it is
bound. A sentence.
- , the parse tree
drawn above: both occurrences of are bound by the root;
the occurrence of
in is bound
by . A
sentence.
The recursive description. In proofs
about all formulas we need “ is free in ” in the form that
structural induction can use, one case per clause of Definition 5.2.2.
- is free in an
atomic formula exactly when occurs in one of its
terms; is never
free in .
- is free in
exactly
when is free in
.
- is free in
exactly when is free in or in .
- is free in
, and in ,
exactly when is a
different variable from and
is free in .
Each line is read off the tree. In an atomic formula
there are no quantifier nodes, so every occurrence is
free. The tree of or adds
a root that is not a quantifier node, so it binds
nothing. The tree of adds the root on top of the
tree of : an
occurrence of
inside
keeps its path, with one more node at the top, so it is
free in exactly when it was free in and the new node
is not a quantifier on , that is, when and are different
variables.
↺Second readingThe
free variables of a limit statement
Example
(The free variables of a limit statement)
With the conventions of Section 5.1 (domain , the sequence as a
function symbol ),
“the sequence
converges to ” is
the formula Write it without bounded quantifiers, and find
its free variables. Is it a sentence?
Solution. Unfolding the three
bounded quantifiers by Definition 5.1.1
( under each
, under the ) gives The variables that occur are , , , and . Check each.
- Every occurrence of lies below
the root : bound.
- Every occurrence of lies below : bound.
- Every occurrence of (in , in , and in the term
) lies below
:
bound.
- The occurrence of has no quantifier on
above it:
free.
So is the only
free variable, and the formula is not a
sentence. It is an open sentence in , as it should be: until
is given a value,
“ converges to
” is neither true
nor false, and which values make it true depends on the
sequence (for the value does and does not; for no value does). Putting in front gives
the sentence “
converges”.
The other symbols in it are not variables, and “free”
and “bound” do not apply to them. The letter is a function symbol;
the formula is certainly about the sequence , but is fixed by the
language, like ,
and cannot be quantified in this logic. The symbol is a one-place
predicate symbol,
is a constant, and , , , and are predicate
and function symbols of the language.
Warning. The same letter can occur
free and bound in one formula. In , the first is a hole and the
second is the quantifier’s placeholder, and the two have
nothing to do with each other. This is legal, and it is
a trap for the reader: a proof that “uses ” from such a formula
has to say which
it means. The book avoids it by renaming the bound
variable (the last part of this section explains how):
says the same thing, and the question does
not arise.
Quick check. Is free in ? At which occurrences?
Solution. Yes. By shorthand rule 2
the formula is . The
occurrence of in
lies below
only,
which is a quantifier on , so it is
free. The occurrence of in lies below , so it is
bound. One free occurrence is enough: is a free variable of
the formula. The variable , by contrast, is not
free: its only occurrence lies below .
Substitution, by example first
We now come to the operation that every quantifier
rule uses. The rule of Section 5.3 will take the premise
of Section 5.1’s argument and produce
: it
strips the quantifier and puts in for . The rule of Section
5.5 goes the other way. Both need to say exactly what
“put in for ” does. The answer has
one principle: only the free
occurrences are replaced, because only they are holes. A
bound occurrence belongs to its quantifier, and the
quantifier is not asking for a value.
is with
put in for every
free occurrence of , and nothing else
changed.
Example
(Four substitutions)
Compute each substitution by the rule in the slogan
above.
- (a) .
- (b) .
- (c) .
- (d) .
Solution. (a) The
implication passes the substitution to both sides, and
in each atomic formula the term becomes : the result is . This is
the step that Section 5.3’s rule makes in the argument
of Section 5.1.
(b) The conjunction passes it to both parts.
In the
becomes , giving . In the
quantifier is on ,
so the substitution stops. The result is Only the free occurrence of changed. The bound one,
in , was the
quantifier’s placeholder, and replacing it would have
turned the sentence “every is at least ” into a claim about
.
(c) The quantifier is on , a variable different
from , so it
passes the substitution on: the result is .
(d) The quantifier is on , so nothing changes:
the result is . There was no free to replace.
Here are the clauses those computations followed.
Definition
5.2.5 (Substitution of a Term for a
Variable)
Let be a term
and a variable.
For a term , the
term is
with every
occurrence of
replaced by ; by
recursion on terms, For a formula , the formula
, read
“ with for ”, is defined by
recursion on : and the last two lines likewise with in place of .
A compound term is written in parentheses: puts
in for .
Two facts follow from the definition at once, and
both are used again and again.
First, : putting in for itself changes
nothing. In each clause the replaced symbol is again.
Second, and more useful: if is not free in , then , for every term . Example (d) was one
instance. Later sections use it; its proof, a structural
induction, is in the fold below.
↺Second readingThe
clauses in words, why the definition defines, and the
claim proved
In words, clause by clause: in a term, every is replaced, since a
term has no quantifiers. In an atomic formula, the
replacement happens inside its terms. The connectives
pass the substitution to their parts. A quantifier on
stops it: below there is no
free occurrence of to replace. A
quantifier on another variable passes it on.
Well defined. The clauses give one
value for each case of Definition 5.2.2,
so structural recursion (carried over as above) says
that they define exactly one formula for each
. And the
result is a formula: each clause builds its value by the
clauses of Definition 5.2.1
and Definition 5.2.2
from values already known to be terms and formulas.
This is a different operation from the substitution
of Section
4.5 (the one in Lemma 4.5.3).
There, formulas were put in for atoms,
at every occurrence. Here a term is put
in for a variable, and bound
occurrences are left alone.
Claim. Let be a variable and a term. For every
formula : if
is not free in
, then .
Idea. Substitution changes only
free occurrences of , and there are none.
Formally, structural induction on , using the
recursive description of “free” case by case. The only
case with any content is a quantifier on a variable
other than , where
the substitution is passed on, and the induction
hypothesis applies because is still not free
inside.
Proof. For terms first: if does not occur in a
term , then , by induction
on (a variable
other than and a
constant are unchanged by the clauses, and when each ). Now we
prove the claim by structural induction on .
Atomic formulas and . If is not free in , then
occurs in none of
the (the
recursive description), so each , and the
clause for atomic formulas returns . The
same holds for , and .
Connectives. If is not free in , it is not
free in , so
by the
induction hypothesis. If is not free in , it
is free in neither part, and the same argument applies
to both.
Quantifiers. Consider . If
is , then by the definition, whatever
is. If
is a different
variable and is
not free in , then is not free in (the recursive
description), so by the induction hypothesis. The
case of is the same.
This proves the claim for every formula .
One substitution at a time. replaces one
variable. Two substitutions in a row are made one after
the other, and the second acts on the result of the
first. So is , and then turns it into , not into the
swapped :
the first step has already lost track of which was which. To swap two
variables, go through a letter that appears nowhere:
, , give , , .
Quick check. Compute . Which formula would swapping and give?
Solution. The first step gives
,
and the second . The swap is , reached
by , , with a new letter
.
Capture,
and the practical rule
The definition of substitution never refuses. Given
any , and , it returns a formula.
Sometimes that formula does not say what we meant.
Take , the example at the start of the
section, and .
The quantifier is on a variable different from , so the definition
passes the substitution through, and The definition was followed correctly. The
meaning is wrong. The formula
says something about the number : some number differs
from it, which over is true whatever
is. We wanted to
say the same thing about the number , and we got “some
number differs from itself”, which is false. The we put in was supposed
to name a number from outside, and it landed in the
scope of
and was captured.
Compare a substitution that is safe. Over ,
says that is
smaller than every number (false, as it happens, for
every ; but what
matters is what it says). Put in for : the quantifier passes the
substitution on, and which says exactly that is smaller than
every number. Nothing was captured, because the term
does not
contain , the only
variable quantified above the occurrence of .
The difference between the safe case and the unsafe
one is exactly this: whether a variable of is quantified somewhere
above a free occurrence of .
A term is free for when putting it in for
lets none of its
variables be captured.
Definition
5.2.6 (Free For)
Let be a term,
a variable, and
a formula.
The term is
free for in if
no free occurrence of in lies in the scope
of a quantifier or such that is a variable of .
In words: look at each place where will go, that is, at
each free occurrence of . Look at the
quantifiers above it in the tree. If none of them is on
a variable of ,
the substitution is safe there. The term is free for
when it is safe
at every such place. Informally: no variable of
becomes
bound when is put in.
Four special cases, each immediate from the
definition, cover most uses.
- A term with no variables (, , ) is free for every
variable in every formula: there is no to capture.
- The variable
is free for in
every formula. A free occurrence of never lies in the scope
of a quantifier on ; if it did, it would be
bound.
- A variable
that does not appear in is free for every
variable in : no quantifier of
is on .
- If is
not free in , every term is
free for in : there are no
free occurrences to check. (And then by
the claim above.)
In our examples: is not
free for in ,
because the free occurrence of lies in the scope of
and is a variable of the
term . Likewise
is not free
for in .
And
is free for in :
the only quantifier above the free occurrence of is on , which is not a
variable of .
“Free for” is the precise condition under which says about
what says about . The rules
(Section 5.3),
(Section 5.5) and (Section
5.7) carry it as a side condition.
↺Second readingA
second capture, the recursive description of ‘free for’,
and why it asks no more than it needs
Here is a second example, with a compound term. Over
, is
true for every :
there is a number larger than . Put in for : The result says that some number is larger
than its own successor, which is false. It should have
said that some number is larger than , which is true.
The recursive description. For
induction proofs, “free for” can be read off case by
case, like “free”:
- is free for
in every atomic
formula and in ;
- is free for
in exactly when
it is free for in
, and in
exactly when it is free for in both and ;
- is free for
in (and
in ) exactly when either
is not free in
, or is not a variable of
and is free for in .
The first two lines hold because an atomic formula
has no quantifiers and a connective node is not a
quantifier. For the third: if is not free in ,
there is nothing to check. If it is free, then is a different variable
and the free occurrences of in are
those in ;
each lies in the scope of the new root and of the
quantifiers inside above it. The
root is harmless exactly when is not a variable of
, and the
quantifiers inside are harmless exactly when is free for in .
Section 5.3 shows the capture example of this section
turning a true premise into a false conclusion when the
side condition is ignored. The definition asks for no
more than it needs: a variable of may be quantified
elsewhere in , as long as no
free occurrence of lies in its scope. For
instance, is free
for in , and the result says of what the original said
of .
Before you substitute. Look at each
free occurrence of and at the quantifiers
above it. If none of them is on a letter of , go ahead. If one is,
rename that quantifier’s letter to a brand-new letter
first (next subsection), and then substitute. Nothing
else can go wrong.
Quick check. Is free for in ? Is ?
Solution. By shorthand rule 2 the
formula is . The term is not free for : the free of lies under , and is a letter of the
term. Rename first, , and then substitute
to get . The term is free for : the only quantifier
above the free is
on , which is not
a letter of .
Warning. Capture changes meaning,
and it gives no warning: the definition of returns a
formula either way. Over , is
true for every ,
and is , which is false. Before putting in for , check that no variable
of is quantified
above a free occurrence of .
Quick check. Is free for in ?
Is it free for in
? Compute both substitutions and say what
each result claims.
Solution. In :
yes. The only quantifier above the occurrence of is on , and is not a variable of
. The result
is , “
is smaller than every number”, which is what the
original said about .
In : no. The occurrence of lies in the scope of
, and
is a variable of
. The
definition gives : “every number is larger than
its own successor”. That is a sentence about no
particular number at all, and a false one; the original
said something about , and the result should
have said the same about . The
of was
captured.
Renaming
bound variables
What should we do when is not free for in ? A bound variable
is a placeholder, and the name of a placeholder does not
matter. “Some number differs from ” can be written or
, just as and
are the same integral. So the way out is: rename
the bound variable first, then substitute.
Renaming. Let be a formula and
variables,
with not
appearing in . The formula
is obtained from by
renaming the bound variable to ; likewise
from . The same may be done to a quantifier
anywhere inside a larger formula.
In words: change the variable after the quantifier,
and change the occurrences it binds, to a letter that
appears nowhere in the formula. The condition that does not appear in
does two
jobs. It makes
free for in (the third
special case above), so no new is captured by a
quantifier inside . And it ensures
that no free
already in
is captured by the new quantifier . Without it,
renaming can change the meaning:
says something about (over , that ), and “renaming”
to would give , a
sentence that is simply true.
Renaming a bound letter is treated as never changing
what a formula says; Sections 5.4 and 5.6 derive it at
the front of a formula, and the fold says where the rest
stands.
↺Second readingThe
status of renaming
Its status. Renaming is not a rule
of the calculus, and we have not proved that it keeps
meaning. Here is where it stands. For a renaming at the
front of a formula, and
can each be derived from the other in three lines, once
the rules of Section 5.4 are available; that section
does it, and Section 5.6 does the same for . A renaming
inside a larger formula we take as a
convention of this book: formulas that differ only by
renaming bound variables are treated as saying the same
thing. Its justification in terms of meaning is the one
the Looking-ahead box at the end of this section points
to.
The recipe. To put in for in when is not free for : rename each quantifier
of that is
on a variable of
and has a free occurrence of in its scope, each to a
different variable that appears neither in nor in (each such step is a
renaming in the sense above); then substitute. After the
renaming, is free
for .
- with
for : rename to , giving ;
then substitute, giving ,
“some number differs from ”. True over for every , as intended.
- with for :
rename to ; substitute, giving . True over , as intended.
Which fresh letter we choose does not matter: two
choices give formulas that differ only by a renaming.
From now on, whenever a rule writes , it will
require to be
free for in , and if we want a
that is not, we
rename first.
How
substitution looks in a mathematical proof
Mathematicians substitute constantly and never write
. Two examples
show the operation, and its trap, in their natural
habitat.
“Apply the hypothesis with in place of
.”
Suppose we know that converges to , and we have fixed an
for some other purpose. A proof says: “applying the
hypothesis with , there is
an with
for all ”. The hypothesis
is , with and the proof uses the instance
with the term : The term contains
the variable : the fixed
of the
proof, not the bound one of the hypothesis. It is free
for in
, because
the only quantifiers above the free occurrences of in are on and . Section 5.3’s rule
makes this step, and “”
then comes from by arithmetic.
“Take .” Now suppose the proof has chosen
, so it knows
with
free. A tempting step is to “apply this with in place of ”. No rule allows this:
has been chosen,
not quantified, so no term may be put in for it. Writing
the step out shows how badly it goes wrong, because
is not even free
for in : the occurrence of
lies in the scope
of . The
substitution produces which says that every term of
the sequence is within of , a far stronger claim
that does not follow. In words, the error is to let the
threshold be “the
we are looking
at”, when is the
placeholder of “for all ”. A proof that needs a statement about a
particular index names it with a new letter, say , and substitutes
, which is free
for .
↺Second readingInduction,
as a formula
Induction, as a formula. The display
after Axiom 4.2.1
in Section 4.2 used a property . With substitution
it can be written for any formula in which the
variable is free,
as the formula where plays the
part of and
the part of . The term is free for in : its only
variable is , and
a free occurrence of never lies in the scope
of a quantifier on . This is how the
principle of induction reads in the language of this
chapter; its status (a basic property of ) is unchanged.
↺Second readingPartial
terms
Mathematics writes and , which name
nothing for some values: , or a sequence with no limit. In the language
of this chapter every term names an object, because
every function symbol is defined everywhere on the
domain. Mathematics keeps partial operations out of
trouble with hypotheses: is written only under
, as in
, where the value at is never used; and “the
limit” is written only after it has been proved that
there is exactly one (Section 5.8). Some logics allow
terms that name nothing; this book does not need
them.
Exercises
A. Check your
understanding
Solution. (a) (i) The
single occurrence of , in , is bound by (the after belongs to the
quantifier node and is not an occurrence); the
occurrence of in
is free (no
quantifier on ).
Free variables: .
Not a sentence.
(ii) The
occurrence of is
bound by ,
that of by . No free
variables: a sentence.
(iii) By
shorthand rule 2 this is . In the left part,
is bound by and is free. In the right
part, is bound by
and is free (the governs only
the left part). Free variables: and , each with one free and
one bound occurrence. Not a sentence.
(iv) Every
occurrence of lies below
, and both occurrences of lie below ; is a constant. A
sentence.
(b) (i) A term, by (Tm2) twice. (ii) A
formula, atomic by (Fm1): the predicate applied to the terms
and . (iii) Neither: is a formula, not
a term, and (Tm2) applies only to a term. (iv)
Neither: (Fm4) puts a variable after
, and is a constant
symbol.
(c) False. The variable is not free for in ,
since the free occurrence of lies in the scope of
. (A
variable
is free for when is itself, or when does not appear in the
formula.)
(d) True. The formula is by shorthand rule 2. The passes the
substitution to both parts; is
unchanged because its quantifier is on , and becomes .
Solution.
(a) The of and the of are free; the of is bound by
and the
of by . Free
variables: , .
(b) Yes: every
occurrence is bound.
(c) By shorthand
rule 2 the governs only , so the formula is
and the of is free. Repair:
.
(d) As written,
is free, so the
formula speaks of one fixed . Repair: ;
is a function
symbol, not a variable.
(e) .
(f) .
(g)
(shorthand rule 2: the governs only
the first ).
(h) , then . No: the
swap is .
(i) , then : the second
substitution also reaches the inside the term put in
by the first.
(j) No: the free
lies in the scope
of , and
is the variable
of the term.
(k) Yes: .
(l) Rename to : ;
then .
B. Practice
Solution. (a) No
quantifiers, so is free for . Every occurrence of
is replaced:
. The
inside and the
already in now stand side by
side; with no quantifier around, both are the same free
, as intended.
(b) By shorthand rule 2 the formula is . The constant has no variables, so it
is free for . The
left part is unchanged (quantifier on ); the free in becomes : .
(c) Not free for: the free occurrence of
lies in the scope
of , and
is a variable of
. Rename to , which appears nowhere:
. Then substitute: . (Without renaming, the definition would
give , which says nothing about .)
(d) Not free for: the free occurrence of
lies in the scope
of , and
the term is .
Rename to : , “
doubled is something”, then substitute: . (Without renaming, the result would be
, “some number is its own double”, a claim
about no particular number.)
(e) By shorthand rule 2 the formula is . The occurrence of in is bound, and
the one in is
free and not in the scope of any quantifier; so is free for (the above the bound
is irrelevant,
since that occurrence is not replaced). The result is
.
Solution. (a) For terms:
For formulas: These are the four lines of the recursive
description of “free” (in the fold after the examples of
free and bound occurrences), rewritten as sets: exactly when is free in . By structural
recursion (carried over to terms and to first-order
formulas), each set of clauses defines exactly one
function.
(b) First formula. , so . , so . The conjunction gives , which agrees with A1(a)(iii).
Second formula. . Then , and . So the formula is an
open sentence in
alone (over it
is true for every : given , take ).
Solution. (a) , and then gives . The swap is , a different formula, and it says something
different: over
with read as
and naming , the swap is true
(), while the
computed formula, “some is above and below ”, is false.
(b) ; then
gives ; then gives , the swap. At each step the only quantifier
above the replaced occurrence is , and the term
(, , ) is not , so it is free.
(c)
is not free for
in : the
of lies inside , so would be
captured and say . The go-between must
appear nowhere in , bound letters
included (“appear”, in “Free and bound: drawing the
arrows”).
Worked examples of these types: “One substitution at
a time”; the practical rule “Before you substitute”.
Marking scheme. (10 points)
- 3: (a), both steps computed and the swap written,
with the difference shown (by the strings, or by one
reading in which they differ).
- 4: (b), the three substitutions in the right order,
each result correct, and the free-for check stated once
for each step.
- 3: (c), capture named, with the captured formula
written.
Fatal error (0 for the part): treating and as happening at the
same time.
C. Going deeper
Exercise
(C1: Challenge: What substitution does to the free
variables)
Let be a
formula, a
variable and a
term, with free
for in , and with free in .
- (a) Prove that the
free variables of are the free
variables of other than , together with the
variables of :
with the notation of B2. Prove it in the
following form, by structural induction on : for every in which is free for , if , then ; if , then . The term version, the atomic case
and the connective cases are done below; prove the case
of (the case of is
the same).
- (b) Show, with the
capture example , , that the conclusion can fail when is not free for . Show also, with an
example of your own, that it can fail when is not free in .
Given for (a). Terms. Let
be a term in
which occurs.
Then . By induction on : if is the variable , then and both sides
are . (A
constant, or a variable other than , does not contain .) If ,
then ; for each containing , the induction
hypothesis gives , and for each not containing , (as in the
proof of the claim in the text). At least one contains , so the union over
is .
Formulas. We prove, by structural induction
on , the
statement : if is free for in , then when , and
when . The second half is
the claim proved in the text, for every ; so in each case
below we assume and prove the equation.
Write for
the set .
Atomic. Let with occurring in some . By the clause for
atomic formulas,
is the union over
of the sets .
Exactly as in the term case for (the
result for terms for each containing , for the
others, and at least one containing ), this union is . The same for
. ( has no free
variables.)
Negation. , by the induction hypothesis
( is free for
in , and is free in ).
Binary connective. Let be free in ;
then is free for
in both parts,
and is free in at
least one. If it is free in both, the induction
hypothesis gives . If it
is free in
only, then , and , because . Symmetrically if it is free
in only.
Solution (Hint 1). When is free in , what
does “free for” tell you about and ?
Solution (Hint 2). Start from and apply the induction hypothesis to
. Then see
where removing
from the resulting set needs something about and .
Solution. (a) The term
version and the atomic, negation and connective cases
are given in the statement. It remains to treat the
quantifiers.
Quantifier. If is not free in , then
by the claim of the text.
Now let be free
in . Then is not and is free in ; and since is free for in while
is free there,
and is free for in (the recursive
description of “free for”). So where the third equality uses ,
and the last uses . The case
of is the
same.
This proves for every
formula, and (a) is its first half.
(b) With and : , so the equation would give . But , whose set of free variables is . The of the term was
captured, so it is not free in the result; the
quantifier case of the proof fails because .
For the second hypothesis, take and . Then is not free in , and is free for (there are no
quantifiers). Now , with
free variables , while the equation
would give . Without a free , nothing is put in, so
the variables of
do not appear.
Marking scheme. (10 points)
- 3: the quantifier case reduced to by the definitions.
- 3: the use of “free for” to get
and free for
in , naming where it
is used.
- 1: the case “
not free in ” handled by the claim of the text.
- 3: both counterexamples of (b), each checked by
computing both sides.
Fatal errors (0 for the step): using the equation
for a part in which is not free (it fails
there; see the second example in (b)); removing from without
justification.
Solution. (a) A renaming
needs a variable that does not appear in the formula, so
the two letters cannot be exchanged in one step; go
through a third letter .
- In , rename the bound to , which does not appear:
.
- Rename the bound to , which no longer
appears: .
- Rename the bound to , which no longer
appears: .
Each step renames one quantifier and the occurrences
it binds, to a letter absent from the formula at that
moment. The result is the second sentence. (Over both say “there is no
largest natural number”, in two spellings.)
(b) A renaming changes only which
letters are used. It does not change
the parse tree’s shape, which quantifier symbol ( or ) sits at which
node, or which quantifier node binds which occurrence.
In the root is a node; in the root is an node. No sequence
of renamings turns a node into an
node, so no
sequence of renamings leads from one sentence to the
other.
The two sentences also say different things: over
, the first is
true (take ) and the second false (for any , take ). This is Example (Swapping two quantifiers)
again. Renaming changes the names of
the placeholders; swapping changes the
order in which they are chosen, and the
order is what carries the meaning.