4.1 Formulas as Objects
Chapter 3 ended on a question that no derivation can
answer. We show that a sequent holds by writing a
derivation of it; but how could we show that one does
not hold, that no derivation of
4.1.1. Why formulas must become objects
Here is the theorem that Section 4.7 proves, stated loosely:
If
can be derived from premises , then is true in every situation in which all the premises are true.
Read it as a mathematician reads a statement about
all integers. “For every integer
Chapters 1–3 never needed one. There we read
statements by eye: we found the main connective of
The description has three parts. First, the alphabet, the symbols formulas are written with. Second, the formation rules, which say how formulas are built. Third, a closing clause saying that nothing else is a formula. The third is the one that is easy to forget and that makes everything else work.
4.1.2. The alphabet
Formulas are strings of symbols. A string is a finite list of symbols written one after another, and its length is the number of symbols in it. The symbols are these.
- Atoms:
, infinitely many of them. Each atom is one symbol: is a single symbol whose name happens to carry a subscript, not the two symbols and . - The constant
, read “contradiction”, as in Chapter 1. - The connectives:
(the only one that takes one part) and (the binary connectives, which take two). - The parentheses
and .
An atom plays the part that a letter played in
Chapters 1–3: a statement whose inner structure we
ignore. In those chapters the letters were capitals,
Remark. Who is who: the letters of this chapter.
| Letter | Stands for | Inside a formula? | Example |
|---|---|---|---|
| an atom, one symbol of the language | yes | ||
| any formula: a metavariable, a name we use when talking about formulas | never | “if |
|
| a finite list of formulas, as in the sequents of Chapter 1 (Definition 1.2.3) | never | ||
| arbitrary statements; read from now on as atoms, or as any formulas (the last part of this section) | they are replaced |
Chapter 1 already used the three letters
Quick check. Which of these is a
formula, and which is a name for formulas or for a list:
Solution.
Two languages. Everything in this
chapter is said in two languages at once. The
object language is the language of
formulas: its expressions are strings over the alphabet
above, such as
Quick check. Sort into strings of the object language, claims of the metalanguage, and neither:
- (a)
- (b)
- (c) the main
connective of
is - (d)
- (e)
is a formula
Solution. (a) A string of the object language: a formula.
(b) A claim of the metalanguage, since
(c) A claim of the metalanguage, and true.
(d) Neither. The letter
(e) A claim of the metalanguage, and true:
4.1.3. Formulas
Chapter 1 described a statement as something “built from smaller ones by a connective”. The definition below says exactly how the building goes. It is an inductive definition: it names the starting pieces, names the ways of building new formulas from old, and then closes the door on everything else.
Building one formula. Here is the
formula
Each entry is an atom, or is built from earlier
entries by one connective. The atom
A list like this is called a formation sequence. The definition below has one more clause than the building steps. Its clause (F4) says that the formulas are exactly the last entries of such lists: the list you just saw, in general.
In clause (F4) below,
A formula is a string built from atoms and
The formulas are the strings given by the following clauses.
- (F1) Every atom is a
formula, and
is a formula. - (F2) If
is a formula, then is a formula. - (F3) If
and are formulas, then , , and are formulas. - (F4) Nothing
else is a formula: a string is a formula
only if it is the last entry of a
formation sequence. A formation
sequence is a finite list of strings
, with , in which every entry is an atom or , or is for some earlier entry (so ), or is for some earlier entries and (so ; is allowed) and some binary connective .
In words, clause by clause.
- (F1), the starting pieces. A single atom is
a formula, and so is
. These are the only formulas of length one. - (F2), negation. Writing
in front of a formula gives a formula. No parentheses are added: and are formulas, and is in front of the formula . - (F3), the binary connectives. Writing a
binary connective between two formulas
and wrapping the result in one pair of
parentheses gives a formula. The two formulas may be the
same:
is a formula. - (F4), nothing else. Clauses (F1)–(F3) say
which strings are formulas. They do not
say that other strings are not. Clause
(F4) does: a formula is exactly something we can reach
from atoms and
by finitely many uses of (F2) and (F3), and the formation sequence is the written record of such a reaching. Think of building blocks: (F1) lists the blocks, (F2) and (F3) the two ways of joining them, and (F4) says that only what is built in this way counts.
Two facts about formation sequences are used constantly, and both are immediate from the definition.
First, every entry of a formation sequence is
a formula. Walk along the list. The first entry
Second, every formula was made by one of the
clauses from formulas. Take a formula
Looking at the last step already tells us something
about the first symbol. A formula of the form
The first-symbol test. A formula of length one is an atom or
. A longer formula begins with or with , and if it begins with , it is for formulas and ends with .
(A formula of the form
Quick check. Write a formation
sequence for
Solution.
Write down a formation sequence for each of the
strings
Solution. For
For
For
Second readingMany formation sequences
A formula has many formation sequences. In Example (Formation sequences)
we could have listed
To show that a string is a formula, we exhibit a formation sequence, just as we show that a sequent holds by exhibiting a derivation. To show that a string is not a formula, exhibiting is not enough; we need a property that every formula has and the string lacks. The first-symbol test supplies such properties.
Show that none of the strings
Solution.
The last two strings are ones Chapter 1 wrote freely, and that is no mistake in Chapter 1. Chapter 1 used a convenient shorthand; the official formulas carry every parenthesis that (F3) puts in and none that it does not. We come back to the shorthand below.
Quick check. Which of the following strings are formulas? For each, give a formation sequence or name the test it fails.
- (a)
- (b)
- (c)
Solution. (a) A formula:
(b) Not a formula. It begins with
(c) Not a formula. It has length
4.1.4. Why this definition
Each feature of the definition is there because something breaks without it.
Without (F4), clauses (F1)–(F3)
would be satisfied by far too many collections of
strings. The collection of all strings
contains every atom and
Without the parentheses in (F3), a
string could be read in two ways. Take
Second readingTwo smaller points
Why not parentheses around a negation
too? Nothing would break, but nothing would be
gained. The symbol
Why atoms, and not sentences like “
Warning. A formula is a string of
symbols, and questions about formulas are questions
about strings. “Is
4.1.5. Parse trees
A formation sequence records how a formula was built, but it is a list, and a list hides the shape of the building. Chapter 1 drew the shape as a tree, with the main connective at the top (the tree after Definition 1.1.2). We now make that drawing official.
A parse tree is a formula’s construction drawn upside down: the last step at the root, the atoms at the leaves.
A parse tree for a formula is defined along the clauses of Definition 4.1.1.
- (T1) For an atom or
: a single node, labeled by that atom or by . - (T2) If
is a parse tree for , then the tree whose root is labeled and has hanging below it as its only subtree is a parse tree for . - (T3) If
and are parse trees for and , then the tree whose root is labeled , with hanging below it on the left and on the right, is a parse tree for . - (T4) Nothing
else is a parse tree: a tree is a parse tree
for a formula
only if that follows from finitely many uses of (T1)–(T3). In particular, a parse tree for is made by (T2), and a parse tree for by (T3).
The leaves are the nodes with nothing below them; a branch is a path from the root down to a leaf.
In words: (T1) is the tree of a formula that was not
built at all, a single node. (T2) puts a new root
Every formula has a parse tree. Take
a formation sequence of the formula and build a tree for
each entry in turn: an atom or
Could a formula have two different
parse trees? That would happen if one string could be
built in two different ways, as
Draw a parse tree for each formula: (a)
Solution. (a) A single
node labeled
(b) By (T1) the atoms
(c) The main connective is the
The leaves are
To draw a parse tree from a string, find the last
step, draw it as the root, and repeat on the parts. For
a formula
4.1.6. Subformulas
Each node of a parse tree is the root of the part of the tree below it, and that part is itself a parse tree, built by the same clauses, for a formula. The formulas that arise in this way are the pieces a formula is built from.
The subformulas of a formula
Until Section 4.3 this depends, as far as we know, on
the parse tree chosen; Section 4.3 shows there is only
one, so the subformulas of
So the subformulas of
For the formula (c) of Example (Three parse trees),
the subformulas are
A string that merely appears inside
a formula need not be a subformula. The formula
Quick check. Draw the parse tree of
Solution. The root is
The subformulas are the formula itself,
Warning. A parse tree is not a truth table. The tree records how a formula is built, and it is the same whatever the atoms stand for; nothing in it is true or false. Values come in Section 4.4, where they are computed along the tree, from the leaves up. Mixing the two, for instance writing “T” beside a node while drawing the tree, is a habit worth not forming: the same tree carries different values under different assignments.
4.1.7. Shorthand and official formulas
Nobody wants to write
The translation, from shorthand to official form, goes as follows.
- Put back the outer pair of parentheses of a formula
whose main connective is binary:
stands for . binds most tightly: it applies to the smallest formula that follows it. So stands for , not for . and bind more tightly than and : stands for . groups to the right: stands for .- Chapter 1 sometimes wrote a negation in parentheses
for emphasis, as in
; such parentheses are simply removed.
In a mixture of
Write the official formula for the shorthand
Solution. By rule 4,
The two trees are mirror images in shape, and they
say different things. Suppose
This is why the grouping convention matters. Grouping
to the right is the useful choice, because statements of
the form “if
Going the other way, from official to shorthand, we
drop every pair of parentheses the rules would put back.
From now on we write formulas in shorthand whenever
that is clearer, and every statement about “the formula
4.1.8. Letters, metavariables and substitution
We can now say exactly what the letters of Chapters 1–3 were.
Every rule was stated as a schema (Definition 1.2.1),
with metavariables:
In the language of this chapter, read the letters
A derivation written with letters is a template.
Substitution. Replace each atom of a derivation by a formula, the same formula at every occurrence of the same atom, and all such replacements at once. The result is again a derivation.
The fold below checks that every line stays a formula and stays justified.
Second readingWhy the result is again a derivation
Here is why. First, each line becomes a formula.
Replacing atoms by formulas in a formula
Second, each line is still justified. Each line of
the old derivation was a premise, an assumption, a
repetition, or an instance of a rule’s schema (Definition 1.4.2,
clauses (D1)–(D4)). Being an instance means: the line
and the lines it cites are the schema with its
metavariables replaced by certain formulas. The schema’s
own symbols are connectives,
Third, nothing about citations changes. The line numbers, the boxes, and which line cites which are untouched, and whether a line or a box is available depends on nothing else (Definition 1.4.2, the scope rule). So the result is a derivation, with the replaced premises and the replaced last line.
For instance, put
Line 4 is still
The fact is immediate rule by rule, because every rule was stated for arbitrary formulas from the start. It is what the phrase “the letters stand for arbitrary statements” (Chapter 1, Section 1.2) and the clause “replace each letter … the same statement for every occurrence” of Definition 2.3.1 were relying on. We use it twice later in the chapter, in the soundness proof of Section 4.7 and in the completeness proof of Section 4.8.
Remark. The replacement must be
uniform. Replacing only the first
Remark (Looking ahead). Section 4.3 proves that every formula is built in only one way. Then “the parse tree” of a formula makes sense, and with it the height of a formula.
4.1.9. Exercises
A. Check your understanding
- (a) Decide which of
the following strings are formulas. Give a formation
sequence for each formula, and for each nonformula name
the test or clause it fails: (i)
; (ii) ; (iii) ; (iv) ; (v) . - (b) List the
subformulas of
. - (c) Write a
formation sequence of
in which is listed once. - (d) Why does clause (F3) of Definition 4.1.1 put parentheses around its result, while (F2) does not?
- (e) Explain why
clauses (F1)–(F3) alone do not show that
is not a formula, and which clause does.
Solution. (a) (i) A
formula:
(ii) A formula:
.(iii) Not a formula. It begins with
, so by the first-symbol test it would be , and the string between the parentheses would contain a binary connective. It contains none.(iv) Not a formula. It begins with
, so it would be with the string . The only binary connective in that string is the , so would be the string , of length . A formula of length begins with , by the first-symbol test (one beginning with has length at least ). So is not a formula, and neither is the string. So here the doubled outer pair is not official.(v) Not a formula. It would be
with the one of the two. If it is the first, is the string ; if the second, is . Each has length and begins with an atom, so by the first-symbol test neither is a formula. (Chapter 1’s conventions give no reading of the shorthand ; Section 4.5 introduces it for the right-grouped and explains why either grouping would do.)
(b) The formula is
(c)
(d) A binary connective joins two formulas,
and without parentheses a string such as
(e) Clauses (F1)–(F3) say which strings are
formulas and never which are not: the collection of all
strings satisfies them. Clause (F4) says a formula is
the last entry of a formation sequence, and from it
follows the first-symbol test:
Answer each part in a line or two.
- (a) Is
a formula? - (b) Is
a formula? - (c) How many symbols
has
? - (d) Is
a formula? - (e) What is the main
connective of
? - (f) Which of these
are subformulas of
: ; the string ; ; ? - (g) Add one symbol
to
to make a formula. - (h) Delete as few
symbols as possible from
to make a formula. - (i) Insert one pair
of parentheses into
to make a formula, in two different ways. - (j) Write the
official formula for
. - (k) Draw the parse
tree of
and list its leaves. - (l) In the
derivation of Proposition 1.4.1
printed in this section, put
for , for and for . Is the result a derivation?
Solution.
(a) Yes:
is a formation sequence.(b) No. It would be
with the string . That string begins with and has length , and a formula beginning with has length at least .(c) Ten:
.(d) No. It is a claim of the metalanguage about two formulas;
is not a symbol of the alphabet.(e)
; officially the formula is .(f)
and . The string is not a formula. is a formula, but no node of the tree carries it.(g)
: the string begins with , so by the first-symbol test it must end with .(h) Delete all four parentheses, leaving
. The string has no binary connective, and a pair of parentheses is official only around a binary step; so the only formulas made of its symbols are and .(i)
and .(j)
.(k) Root
; on the left the leaf , on the right over and . The leaves are , , .(l) Yes. Lines 1–6 become
, , , , , , and lines 4, 5, 6 are still instances of , , . A substitution may put the same formula for two letters.
B. Practice
Each formula below appears, with capital letters, in a result of Chapter 1 (Proposition 1.4.2 and Proposition 1.6.1); here the letters are atoms. For each, write the official formula, draw its parse tree, and list its subformulas.
- (a)
- (b)
- (c)
Solution. (a) Official
form
(b) Official form
(c) Official form
Subformulas:
- (a) Write in
shorthand, dropping every pair of parentheses the
conventions allow:
and . - (b) Write the
official formula for:
and .
Solution. (a)
(b)
C. Going deeper
Suppose we forgot rule 4 of the shorthand, so that
- (a) List every official formula it could stand for, and draw the shape of each parse tree.
- (b) How many are there? Say how the count is found, by splitting at the main connective.
- (c) Which of them is the one rule 4 chooses?
Solution (Hint 1). The main connective is one of the three arrows. Choose it first.
Solution (Hint 2). Write
Solution. (a) The main connective is one of the three arrows; what lies on each side is then grouped in every possible way.
- Main connective the first arrow:
on the left, and on the right, grouped in one of two ways. This gives and . - Main connective the second arrow:
on the left and on the right, each grouped in one way. This gives . - Main connective the third arrow:
on the left, grouped in one of two ways, and on the right. This gives and .
Their parse trees have the root
(b) There are
(c) Rule 4 groups to the right, so the main
connective is the first arrow and its right side is
grouped to the right again:
The numbers