02 Propnd
02 Propnd
1
Declarative sentences (1.1)
A proposition or declarative sentence is one that can, in principle,
be argued as being true or false.
2
To clarify the manipulations we perform in logical proofs, we will
represent declarative sentences symbolically by atoms such as p,
q , r. (We avoid t, f , T , F for reasons which will become evident.)
Compositional sentences will be represented by formulas, which
combine atoms with connectives. Formulas are intended to
symbolically represent statements in the type of mathematical or
logical reasoning we have done in the past.
3
The set of connectives is due to the British mathematician George
Boole, who described an algebra using them (now called Boolean
algebra) in 1854.
However, it’s important to keep in mind that our proof system is not
concerned with true or false; it is concerned with what constitutes a
legal proof. Each of the rules makes intuitive sense, and this is not
surprising in light of our goal to show that provable equals true. But
we maintain a distinction between semantics and syntax at this
point.
4
The formal language of propositional logic
Let φ range over the set of propositional formulas. Then the
following grammar specifies the set of possible values for φ:
φ ::= p | φ ∧ φ | φ ∨ φ | ¬φ | φ → φ
5
Abstract syntax
In CS241 we studied context-free grammars as a tool for parsing
programs. There, our concern was in language recognition and
parsing, and therefore our grammars were very precise. Such
grammars exemplify what is called concrete syntax.
6
Binding priorities
To keep from having to explicitly use parentheses to disambiguate
every propositional formulat, we adopt conventions regarding which
connectives “bind more tightly” than others.
7
Thus, if p, q , and r are atoms, then the formula
p→q∧r
(¬p) → (q ∨ r)
to ¬p → q ∨ r.
The connective → is right-associative; that is, p → q → r means
p → (q → r).
8
When we use these rules, we should understand that our simplified
formulas really represent properly parenthesized formulas (which is
what our formal definitions will define).
Other texts might declare further conventions which we will not use,
such as ∧ binding more tightly than ∨.
9
The connectives, by example
Suppose we have the following statements:
10
The connective ∨ (pronounced “or”) intuitively expresses
disjunction, or the sense that at least one of the two formulas it
connects is true. p ∨ q means “Ling passed CS 245, or fulfilled her
breadth requirements.”
Note that the English word “or” sometimes has the sense that only
one of the two things it connects can be true, not both. But our
logical connective ∨ will permit both to be true, so it acts more like
the English construct “and/or”, as in “Ling passed CS 245 and/or
fulfilled her breadth requirements.”
There are phrases in English which give this sense without using
the English word “or”. Translation of an English sentence or
paragraph into formal logic is a difficult art.
11
The connective ∧ (pronounced “and”) intuitively expresses
conjunction, or the sense that both of the formulas it connects are
true. p ∧ q means “Ling passed CS 245 and fulfilled her breadth
requirements.”
12
Natural deduction (1.2)
A proof system is a mathematical formalization of a notion of proof.
There are many proof systems; we will study one called natural
deduction, invented by Gerhard Gentzen in the 1930’s. This system
nicely captures many of the aspects of mathematical proof we’re
familiar with, as well as having desirable technical qualities beyond
the scope of this course.
13
p: Ling passed CS 245.
q : Ling fulfilled her breadth requirements.
r: Ling earned her B.CS degree.
Consider the following argument: “If Ling earned her B.CS degree,
she passed CS 245 and fulfilled her breadth requirements. Ling did
not fulfil her breadth requirements. Therefore, Ling did not earn her
B.CS degree.”
14
In a typical situation, we have a set of formulas φ1 , φ2 , . . . , φn ,
and we wish to apply proof rules to these to derive new formulas,
among which is our desired conclusion ψ . We summarize this as:
φ1 , φ2 , . . . , φn ` ψ
This is a sequent. The sequent for our example is:
r → (p ∧ q), ¬q ` ¬r
We read the symbol ` as “yields” or “proves”. A sequent has zero or
more formulas on the left of `, and one formula on the right. The
order of the formulas on the left doesn’t matter.
15
A sequent such as r → (p ∧ q), ¬q ` ¬r is valid if we can find a
proof for it in our proof system.
16
Proof systems
A proof system consists of a set of rules dictating how a proof of
some formula may be obtained from proofs some other formulas.
17
The rules for conjunction
Conjunction has one introduction rule and two elimination rules.
And-introduction (∧i) says that if we have φ and ψ as formulas, we
can conclude φ ∧ ψ . We write this:
φ ψ
∧i
φ∧ψ
You can view this as a “before and after” view, with an abbreviated
name of the rule on the side. If you can construct proofs of the
formulas above the line, the rule says you then have a proof of the
formula below the line.
18
For and-elimination, the intuition is that if you can prove φ ∧ ψ , then
you can prove each of φ and ψ individually:
φ∧ψ φ∧ψ
∧e1 ∧e2
φ ψ
Note that in natural deduction, these and all subsequent rules apply
to whole formulas. They cannot be used to selectively rewrite
subformulas. For instance, we cannot rewrite (p ∧ q) as p if it
appears buried within a larger formula.
More concretely, the rule does not permit the following deduction:
(p ∧ q) → r
∧e1
p→r
In fact, as we shall eventually see, this is also an incorrect
conclusion from a semantic point of view.
19
A proof
This proof shows the validity of the sequent p ∧ q ` q ∧ p.
1 p∧q premise
2 p ∧e1 1
3 q ∧e2 1
4 q∧p ∧i 3, 2
We have numbered each line on the left, and labelled the rules used
on the right, with the corresponding line numbers. We also label as
a premise anything that is on the left-hand side of the sequent. This
is how we will be doing proofs.
20
This notation is a flattened version of the proof using the rules in the
form we gave them, because that more resembles a tree.
p∧q p∧q
∧e2 ∧e1
q p
∧i
q∧p
We can reconstruct such a tree from our version. Since the flattened
version is much more convenient, we will not be using tree proofs.
In general, our proofs may not be unique. That is, there may be
many different ways to demonstrate the validity of a particular
sequent.
21
Another proof
Give a proof of the sequent (p ∧ q) ∧ r ` q ∧ r.
22
Note that although we applied our rules to atoms in the previous
proof, the rules are stated in terms of general formulas. In fact,
because the rules talk about the “top-level” structure of the formulas
to which they are applied, we can get other proofs from this proof
almost for free.
23
Let’s do this by substituting (x ∧ y) for p, (x ∨ y) for q , and (¬x)
for r , yielding the sequent
((x ∧ y) ∧ (x ∨ y)) ∧ (¬x)) ` (x ∨ y) ∧ (¬x).
24
Implication—the elimination rule
φ φ→ψ
→e
ψ
This is a famous rule, called modus ponens (Latin for “mode that
affirms”). In classical deduction, this is the only rule used. As you
can imagine, this makes proofs longer, and less related to
mathematical proofs we know and love.
“Ling earned her B.CS degree. If Ling earned her B.CS degree, Ling
passed CS 245. Therefore, Ling passed CS 245.”
25
In this example, p can stand for “Ling earned her B.CS degree”, q
for “Ling passed CS 245”, and the sequent we have shown valid
with one application of →e is p, p → q ` q.
In this simple application of →e, the formulas φ and ψ are atomic.
But in general, they may be compound formulas as well.
(p ∧ q) (p ∧ q) → (r ∨ s)
→e
(r ∨ s)
26
Implication—the introduction rule
Suppose we wanted to prove a sequent like ` p → (q → p).
We would need an introduction rule for →, which would require us
to show that q → p is a theorem, if p is taken as a premise.
We show a proof of p → (q → p) below:
1 p assumption
2 q assumption
3 p copy of 1
4 q→p → i 2–3
5 p → (q → p) →i 1–4
27
What did we do? We introduced a proof box, which was a way of
marking the fact that we had made an assumption p. This kept the
assumption from “leaking” into the rest of the proof. But the
premises (and presumably any derived formulas) were valid inside
the proof box.
28
Note that we used a “copy rule”, which allows us to do what we did
in line 3. It lets us copy any formula whose proof box is still open.
Without this, we’d have to complicate our description of the →i rule.
29
Here is the general form of the rule →i.
φ
·
·
·
ψ
→i
φ→ψ
The first line in the box is an arbitrary formula φ of our choice. In the
box, we are allowed to use premises, plus any derived formula that
is on a previous line, with the exception of those introduced within
boxes that have since been closed. This allows us to nest boxes
(and their corresponding assumptions).
30
Implication Example
Let us try to prove the transitivity of implication:
p → q, q → r ` p → r.
31
Disjunction—introduction rules
Introducing and eliminating conjunction was fairly straightforward.
Introducing disjunction is also straightforward.
φ ψ
∨i1 ∨i2
φ∨ψ φ∨ψ
32
Disjunction—elimination rule
If we know that φ ∨ ψ is true, we know that at least one of the two is
true. So a reasonable rule for concluding χ would require us to be
able to prove χ from either one of φ or ψ . Since we can’t be sure
that either one is true, we must assume them in order to prove χ.
φ ψ
· ·
· ·
· ·
φ∨ψ χ χ
∨e
χ
33
We have already shown that ∧ is commutative.
1 p∨q premise
2 p assumption
3 q∨p ∨i2 2
4 q assumption
5 q∨p ∨i1 4
6 q∨p ∨e 1, 2–3,4–5
We now have introduction and elimination rules for all three binary
connectives. It remains to consider negation...
34
But what is negation?
35
What is negation?
What is it that we would like ¬φ to mean, for a formula φ?
36
A parting of ways
The meaning of proof-theoretic negation represents a major point of
departure between schools of logical thought, and the choice we
make fundamentally affects the properties of the resulting logic.
37
Intuitionism vs. Classicism
We will see that both perspectives on the proof theory of negation
have strong arguments in their favour. Although we are generally
more used to classical reasoning, we will see that there are
theorems that arise as a result of the classical interpretation of
negation that appear nonsensical.
38
We will first complete our study of propositional logic under the
classical interpretation, and then re-examine our proof rules from an
intuitionist perspective.
Note that all of the rules presented so far are valid under both
classicism and intuitionism.
39
Rules for double negation (classical)
The simplest way in which a negation may arise in a formula is in
the form of double negation. The rules for double negation are
straightforward:
¬¬φ φ
¬¬e ¬¬i
φ ¬¬φ
We are maintaining the naming convention that “e” refers to
elimination and “i” to introduction.
A double negation in English looks like “It is not true that Ling did
not pass CS 245.”
It turns out that the ¬¬i rule can be derived from other rules; the
textbook demonstrates this, and then moves it into the category of
derived rules.
40
Negation—elimination rule (classical)
In order to introduce or eliminate negation, we have to talk about
contradictions. A contradiction is any formula of the form φ ∧ ¬φ or
¬φ ∧ φ. We introduce the symbol ⊥ (pronounced “bottom”) into our
proofs to represent a contradiction. This naturally leads to the
not-elimination or ¬e rule:
φ ¬φ
¬e
⊥
We could also call this rule bottom-introduction, since it plays that
role. But this is not commonly done.
41
Bottom elimination (classical)
The rule for bottom elimination may be a little surprising.
⊥
⊥e
φ
This says that with ⊥ as a premise, one can conclude anything. In
other words, ⊥ → φ is a theorem for all φ.
The rule is reminiscent of statements like “If 2+2=5, then I’m a
monkey’s uncle.” We need this rule in order to get our notion of proof
to coincide with the still-to-be-introduced notion of semantic
interpretation of formulas.
42
Negation—introduction rule (classical)
Introducing negation is our last rule that requires the use of proof
boxes. If we make an assumption φ and end up with a contradiction,
then φ should not be true, so we must be able to conclude that ¬φ
is true.
φ
·
·
·
⊥
¬i
¬φ
We motivated formal propositional logic with the following example:
“If Ling earned her B.CS degree, she passed CS 245 and fulfilled
her breadth requirements. Ling did not fulfil her breadth
requirements. Therefore, Ling did not earn her B.CS degree.”
43
We can now show the corresponding sequent to be valid.
1 r assumption
2 r → (p ∧ q) premise
3 p∧q →e 1–2
4 q ∧e2 3
5 ¬q premise
6 ⊥ ¬e 4,5
7 ¬r ¬i 1–6
44
The derived rule modus tollens (classical)
We now establish the following rule, which comes as a
consequence of the rules we already have:
φ → ψ ¬ψ
MT
¬φ
Modus tollens (Latin for “mode that denies”) captures the argument
“If Ling earned her B.CS degree, then Ling passed CS 245. Ling did
not pass CS 245. Therefore, Ling did not earn her B.CS degree.”
45
The validity of the English argument we just made suggests that the
following English argument is also valid: “If Ling earned her B.CS
degree, then Ling passed CS 245. Therefore, if Ling did not pass
CS 245, Ling did not earn her B.CS degree.”
46
Proof of modus tollens
We can now prove modus tollens, or φ → ψ, ¬ψ ` ¬φ. But there
is a slight problem. This is not really a sequent. It is a template or
framework for creating sequents. If we substitute any specific
formulas for φ and ψ , we will get a sequent.
In order to prove it, we will create a proof schema, which has the
same parameters, φ and ψ . Any substitution of specific formulas in
the proof schema yields a valid proof.
47
1 φ→ψ premise
2 ¬ψ premise
3 φ assumption
4 ψ →e 1,3
5 ⊥ ¬e 2,4
6 ¬φ ¬i 3–5
48
The derived rule reductio ad absurdum
(classical)
Reductio ab absurdum (Latin for “reduction to the absurd”) is often
called proof by contradiction, and that is how we will abbreviate it
(PBC). As a rule, it looks like this:
¬φ
·
·
·
⊥
PBC
φ
This looks like not-introduction turned upside down, so it is not
surprising that we can use not-introduction and
double-negation-elimination to prove this rule.
49
The textbook writes PBC as (¬φ → ⊥) ` φ, and provides a
five-line proof schema. However, there is a problem with this: ⊥ is
not part of our language of formulas. We can make a rule that in
sequent schema, we can substitute any formula of the form ψ ∧ ¬ψ
for ⊥, but doing this to the five-line proof schema in the book does
not yield a valid proof.
50
The derived rule tertium non datur
(classical)
Our last derived rule is the law of the excluded middle, or LEM. (The
Latin name of the rule translates as “a third [thing] is not given”).
This simply states that φ ∨ ¬φ is a theorem for any φ. Intuitively, it
means that either φ is true or ¬φ is true.
This is a useful rule because its proof is longer than the others, and
so it saves much space when it is used. On the other hand, it is less
obvious how to use it than some of the other rules we have. It can
be a source of disjunctions that can be used in or-elimination (see
example 1.24 in the textbook). It plays an important role in a
mathematical proof in the next module.
51
1 ¬(φ ∨ ¬φ) assumption
2 φ assumption
3 φ ∨ ¬φ ∨i1 2
4 ⊥ ¬e 1,3
5 ¬φ ¬i 2–4
6 φ ∨ ¬φ ∨i2 5
7 ⊥ ¬e 1,6
8 ¬¬(φ ∨ ¬φ) ¬i 1–7
9 φ ∨ ¬φ ¬¬e 8
52
As an aside, note that the proofs of both PBC and LEM make use of
double negation elimination. This will be important later.
53
Theorems
Consider the following proof of p ` q → p.
1 q assumption
2 p premise
3 q→p →i 1–2
54
In other words, we can show validity of the sequent
` p → (q → p).
1 p assumption
2 q assumption
3 p copy of 1
4 q→p →i 2–3
5 p → (q → p) →i 1–4
55
We call a formula φ for which the sequent ` φ is valid a theorem
within our proof system.
We are still going to use the word “theorem” for things we prove,
using “Math 135”-style proofs, about our proof systems. Please
make sure you always understand in which sense the word is being
used.
56
Provable equivalence
Two formulas φ and ψ are provably equivalent if φ ` ψ and ψ ` φ
are valid. We sometimes write this φ a` ψ .
As an example, we proved p → q ` ¬q → ¬p earlier. If we prove
¬q → ¬p ` p → q , it will show that the formulas p → q and
¬q → ¬p are provably equivalent.
57
1 ¬q → ¬p premise
2 p assumption
3 ¬¬p ¬¬i 2
4 ¬¬q MT 1,3
5 q ¬¬e 4
6 p→q →i 2–5
58
Just as with mathematical proofs, there is a certain art to
constructing proofs in natural deduction. There is no simple recipe
or algorithm to create a proof of a sequent. You should study the
more complicated examples in the textbook, which also gives some
guidelines as to what to try. Do as many proofs as you can manage.
59
Intuitionism
Having fully developed the proof theory of propositional logic, let us
now go back and consider the consequences of adopting the
intuitionist point of view.
60
Intuitionism and conjunctions
If we interpret a formula φ as meaning “I can construct a proof of φ,”
then the formula φ ∧ ψ means “I can construct a proof of φ and a
proof of ψ .”
The intuitionistic proof rules for conjunction are the same as the
classical ones.
61
Intuitionism and implication
The formula φ → ψ now means “If I have a proof of φ, I can
transform it into a proof of ψ .”
62
Intuitionism and disjunction
Consider the following two statements:
“I have a proof of φ ∨ ψ .”
63
“I have a proof of φ ∨ ψ .”
64
So which interpretation of φ ∨ ψ is appropriate for intuitionism?
As we shall see, it turns out that the only way a formula φ ∨ ψ can
arise intuitionistically is through one of the two ∨-introduction rules.
Therefore, we always either have on hand a proof of φ or a proof of
ψ.
Put more strongly, whenever we arive at a disjunctive formula φ ∨ ψ
in an intuitionist proof, we always know which of φ and ψ is true
(proved)!
The rules for ∨-introduction and -elimination are the same as for
classical logic; the difference in interpretation forced upon us by
intuitionism arises from our treatment of negation.
65
Intuitionism and negation
By definition, the intuitionist interpretation of the formula ¬φ is
“There is no proof of φ,” which is not necessarily equivalent to
saying that φ is false.
Therefore, from φ, we can deduce ¬¬φ, and we have the rule for
double negation introduction:
φ
¬¬i
¬¬φ
66
Intuitionism and negation cont’d.
Can we carry out the same reasoning in reverse?
67
Intuitionism and negation cont’d.
On the other hand, a formula and its negation cannot simultaneously
be provable; hence the (single) negation elimination rule still holds.
68
Intuitionism cont’d.
The only core deduction rule that intuitionism rejects is the rule for
double negation elimination. What are the consequences of
rejecting just this single rule?
If we review the proofs of our derived rules, we see that two of their
proofs made use of double negation elimination. These are the
derived rules PBC and LEM. By rejecting this rule, we also reject the
proofs of these rules.
69
Intuitionism cont’d.
The answer, it turns out, is no. As you will see in part on your
assignment, the three rules, ¬¬e, PBC, and LEM, are all equivalent
to each other.
If we add any one of these rules to the core logic, the remaining
rules follow as well. Thus, of the deduction rules we have seen in
this course, intuitionism rejects the following three:
70
It should not be surprising, given our interpretation of disjunction,
that we reject the law of the excluded middle. Since we do not know,
from the formula φ ∨ ¬φ, which of φ and ¬φ (or both) is the
provable one, we cannot accept the disjunction as a proved
theorem.
71
So which logic is right?
Should we be classicists or intuitionists? Consider the following
atomic sentences:
p: it is raining outside
q : Ling will pass CS245
Now consider the two statements, p → q and q → p:
“If it is raining outside, then Ling will pass CS245.”
72
Which logic is right?
But it turns out that their disjunction, i.e., (p → q) ∨ (q → p), is a
theorem of classical logic! Consider:
1 q ∨ ¬q LEM
2 q assumption
3 p assumption
4 q copy of 2
5 p→q → i 3–4
6 (p → q) ∨ (q → p) ∨i1 5
7 ¬q assumption
8 q assumption
9 ⊥ ¬e 8, 7
10 p ⊥e 9
11 q → p → i 8–10
12 (p → q) ∨ (q → p) ∨i2 11
13 (p → q) ∨ (q → p) ∨e 1, 2–6, 7–12
Which logic is right?
Thus, under classical reasoning, “If it is raining outside then Ling will
pass CS245, or if Ling will pass CS245, then it is raining outside.”
75
Which logic is right?
Can we prove the same theorem in intuitionist logic?
76
Then we must have a proof of φ → ¬φ. But then consider the
following proof schema:
1 φ → ¬φ premise
2 φ assumption
3 ¬φ → e 2, 1
4 ⊥ ¬e 2, 3
5 χ ⊥e 4
6 φ→χ → i 2–5
What does this result mean?
77
If φ → ¬φ has a proof, then φ → χ has a proof for all φ, χ. Hence
everything follows from everything, and all formulas turn out to be
provable!
78
On the other hand....
Consider the following mathematical theorem and proof:
79
An intuitionist would reject the proof of this theorem.
80
On the other hand, if we had furnished a either a proof that c was
rational or a proof that c was irrational, we would have known which
branch of the proof to take, and we would have specific irrational
numbers a and b that satisfy the theorem.
81
So should we, like the intuitionists, throw out the theorem? Are we
really unconvinced that such numbers a and b exist?
82
The distinction between classicicm and intuitionism mirrors, in a way,
the same distinction between mathematics and computer science.
83
Computer science, however, is highly constructive. Although every
computer algorithm is an implementation of a mathematical
function, not every mathematical function has an implementation on
a computer. The central notion of implementation in computer
science forces us to restrict ourselves to those mathematical entities
that have a physical realization. Hence, computer science is
inherently constructive, and intuitionism therefore seems like a
natural choice.
84
However, there is at least one discipline within computer science in
which intuitionism plays a central role: the theory of types. In the
introductory module, we mentioned a fundamental and deep
connection between types in certain programming languages and
theorems of a particular logic. The connection is called the
Curry-Howard isomorphism, and the logic in question is, in fact,
intuitionist logic.
85
What’s coming next?
We have explored two proof theories for propositional logic:
classicism and intuitionism. We have seen how they arise from an
awareness of the different possible understandings of “truth”, and
which of these understandings the negation operator is intended to
negate.
86
difference is at most 2.” We need to extend it to capture the notion
that the word “every” makes this a compositional statement. That
will complicate both our proof system and our semantics.
87
Goals of this module
At the end of each lecture module (which may take up several days
of lecture) we will review its goals.
You may not have achieved these goals just by listening to the
lecture. Some will require reading in the text, doing assignment
questions, and working through examples of your own choosing.
88
We introduced a fair amount of terminology (formulas, sequents,
conjunction, disjunction, etc.) with which you need to be
comfortable.
You should have all of the rules of natural deduction in Figure 1.2 in
the book (twelve rules, plus the copy rule, plus four derived rules)
committed to memory. You should understand the intuitionist
interpretations of propositional formulas. You should memorize
which three proof rules are rejected by intuitionism. You should also
understand how the rules of propositional logic correspond to
elements of mathematical proof with which you are familiar from
other math and CS courses.
89
addition to assignment questions, there are many exercises in the
book for practice.
90