slides

Lecture 1: Propositional Logic (I)
Fadoua Ghourabi
Ochanomizu University
[email protected]
Octobre 12, 2016
1 / 36
Contents
1
Declarative sentences
2
Constructing propositions
3
Quizz
4
Natural deduction
Rules for conjunction
Rules for double negation
2 / 36
First examples
Is this reasoning correct?
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
What do you think of the next one?
Example 1.2
If it is raining and Jane does not have her umbrella with her, then she
will get wet. Jane is not wet. It is raining. Therefore, Jane has her
umbrella with her.
3 / 36
First examples
Is this reasoning correct?
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
What do you think of the next one?
Example 1.2
If it is raining and Jane does not have her umbrella with her, then she
will get wet. Jane is not wet. It is raining. Therefore, Jane has her
umbrella with her.
3 / 36
First examples
How to prove that the reasonings in Examples 1.1 & 1.2 are correct?
We first need to develop a language to model the logical reasoning
in Example 1.1 & 1.2 å Propositional logic
(Logicomix)
4 / 36
Proposition
Proposition is a declarative sentence which we can evaluate
to True or False
Examples of declarative sentences
(1) The sum of 3 and 5 equals 10.
(2) Prof. Ohsumi won the 2016 Nobel Prize in Physiology/Medicine
(3) Jane is lying.
(4) Every even natural number > 2 is the sum of two prime numbers.
5 / 36
Proposition
Proposition is a declarative sentence which we can evaluate
to True or False
Examples of declarative sentences
(1) The sum of 3 and 5 equals 10.
(2) Prof. Ohsumi won the 2016 Nobel Prize in Physiology/Medicine
(3) Jane is lying.
(4) Every even natural number > 2 is the sum of two prime numbers.
5 / 36
Proposition
Proposition is a declarative sentence which we can evaluate
to True or False
Examples of non-declarative sentences
(1) Ready, steady, go!
(2) Could you please explain what is a proposition?
(3) May you find much happiness.
6 / 36
Proposition
A language for propositional logic
To translate English declarative sentences into strings of symbols
To focus on the reasoning rather than the meaning
To define a systematic approach to evaluate to True or False
If p and not q, then r. Not r. p. Therefore, q
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
Example 1.2
If it is raining and Jane does not have her umbrella with her, then she
will get wet. Jane is not wet. It is raining. Therefore, Jane has her
umbrella with her.
7 / 36
Atom
An atom is an atomic declarative sentence
Atom
“The number 5 is even.”
“The sun is shinning.”
Are these declarative sentences atoms?
“If the sun is shinning, then I go for a hike in the mountain.”
“I am not late.”
8 / 36
Atom
An atom is an atomic declarative sentence
Atom
“The number 5 is even.”
“The sun is shinning.”
Are these declarative sentences atoms?
“If the sun is shinning, then I go for a hike in the mountain.”
“I am not late.”
å An atom is a non-negative sentence
“I am late.” is an atom.
“I am not late.” is not an atom.
8 / 36
Atom
An atom is an atomic declarative sentence
Atom
“The number 5 is even.”
“The sun is shinning.”
Are these declarative sentences atoms?
“If the sun is shinning, then I go for a hike in the mountain.”
“I am not late.”
å An atom is a non-negative sentence
“I am late.” is an atom.
“I am not late.” is not an atom.
8 / 36
Constructing propositions
Declarative sentence:
“ If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
(1) Single out atoms
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
9 / 36
Constructing propositions
Declarative sentence:
“ If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
(1) Single out atoms
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
(2) Assign symbols p, q, r, . . . to atoms
p: “The sun is shinning.”
q: “I am sick.”
r : “I go for a hike in the mountain.”
9 / 36
Constructing propositions
Declarative sentence:
“ If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
(1) Single out atoms
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
(2) Assign symbols p, q, r, . . . to atoms
p: “The sun is shinning.”
q: “I am sick.”
r : “I go for a hike in the mountain.”
(3) Form a proposition by connecting atoms using logical operators
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
(p ∧ (¬q)) −→ r
9 / 36
Constructing propositions
Declarative sentence:
“ If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
(1) Single out atoms
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
(2) Assign symbols p, q, r, . . . to atoms
p: “The sun is shinning.”
q: “I am sick.”
r : “I go for a hike in the mountain.”
(3) Form a proposition by connecting atoms using logical operators
“ If {the sun is shinning} and not {I am sick}, then {I go for a hike in the mountain}.”
(p ∧ (¬q)) −→ r
9 / 36
Logical operators
¬q denotes the negation of q.
We say not q.
example: “I am not sick.”
q
True
False
¬q
False
True
p ∧ q denotes the conjunction of p and q.
We say p and q
p
True
example. “The sun is shinning and I am sick.” False
True
False
q
True
True
False
False
p∧q
True
False
False
False
10 / 36
Logical operators
¬q denotes the negation of q.
We say not q.
example: “I am not sick.”
q
True
False
¬q
False
True
p ∧ q denotes the conjunction of p and q.
We say p and q
p
True
example. “The sun is shinning and I am sick.” False
True
False
q
True
True
False
False
p∧q
True
False
False
False
10 / 36
Logical operators
p ∨ q denotes the disjunction of p and q.
We say p or q which means at least one of p and q is
p
True
example. “The sun is shinning or I am sick.” False
True
False
true.
q
True
True
False
False
p∨q
True
True
True
False
p −→ q denotes the implication between p and q.
We say p implies q which means that q is a logical consequence of p:
example. “If I put money in the vending machine then I get a drink.”
p
q
p −→ q
True True
True
True False
False
False True
True
False False
True
11 / 36
Logical operators
p ∨ q denotes the disjunction of p and q.
We say p or q which means at least one of p and q is
p
True
example. “The sun is shinning or I am sick.” False
True
False
true.
q
True
True
False
False
p∨q
True
True
True
False
p −→ q denotes the implication between p and q.
We say p implies q which means that q is a logical consequence of p:
example. “If I put money in the vending machine then I get a drink.”
p
q
p −→ q
True True
True
True False
False
False True
True
False False
True
11 / 36
Logical operators
“If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
p: “The sun is shinning.”
q: “I am sick.”
r: “I go for a hike in the mountain.”
(p ∧ (¬q)) −→ r
We can unambiguously omit some of the brackets because:
(1) Binding priorities
¬
>
(p ∧ (¬q)) −→ r
∨, ∧
≡
>
−→
p ∧ ¬q −→ r
¬(p −→ q) 6≡ ¬p −→ q
12 / 36
Logical operators
“If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
p: “The sun is shinning.”
q: “I am sick.”
r: “I go for a hike in the mountain.”
(p ∧ (¬q)) −→ r
We can unambiguously omit some of the brackets because:
(1) Binding priorities
¬
>
∨, ∧
(p ∧ (¬q)) −→ r
>
≡
−→
p ∧ ¬q −→ r
¬(p −→ q) 6≡ ¬p −→ q
(2) Right associativity of −→
p −→ q −→ r
≡
p −→ (q −→ r)
12 / 36
Logical operators
“If the sun is shinning and I am not sick, then I go for a hike in the mountain.”
p: “The sun is shinning.”
q: “I am sick.”
r: “I go for a hike in the mountain.”
(p ∧ (¬q)) −→ r
We can unambiguously omit some of the brackets because:
(1) Binding priorities
¬
>
∨, ∧
(p ∧ (¬q)) −→ r
>
≡
−→
p ∧ ¬q −→ r
¬(p −→ q) 6≡ ¬p −→ q
(2) Right associativity of −→
p −→ q −→ r
≡
p −→ (q −→ r)
12 / 36
”She brought neither pen nor pencil.”
p: “She brought a pen.”, q: “She brought a pencil.”
¬p ∧ ¬q
”Cancer will not be cured unless its cause is determined and a
new drug for cancer is found.”
p: “The cause of cancer is determined.”, q: “A new drug of
p ∧ q −→ r
cancer is found.”, r: “Cancer is cured.”
13 / 36
Quizz 121016
1/ Make sure that you fully understand the binding priorities by
inserting as many brackets as possible.
e.g. p ∧ q −→ r means (p ∧ q) −→ r since ∧ binds more tightly
than −→
(a) p ∨ q −→ p ∧ ¬q
(b) p ∨ (¬q −→ p ∧ r)
(c) Why p ∨ q ∧ r is problematic?
2/ Translate the following English sentences into propositions.
(a) “If the train arrives late and there are no taxis at the station, then
John is late for his meeting.”
(b) “The weather tomorrow is either rainy or cloudy.”
(c) “No teacher. No students. No class.”
(d) “Today, it will rain or shine, but not both.”
14 / 36
Sequent
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
p: “The train arrives late.”
q: “There are taxis at the station.”
r: “John is late for his meeting.”
p ∧ ¬q −→ r
15 / 36
Sequent
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
p: “The train arrives late.”
q: “There are taxis at the station.”
r: “John is late for his meeting.”
p ∧ ¬q −→ r
¬r
16 / 36
Sequent
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting. The train did arrive
late. Therefore, there were taxis at the station.
p: “The train arrives late.”
q: “There are taxis at the station.”
r: “John is late for his meeting.”
p ∧ ¬q −→ r
¬r
p
17 / 36
Sequent
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting.The train did arrive
late. Therefore, there were taxis at the station.
p: “The train arrives late.”
q: “There are taxis at the station.”
r: “John is late for his meeting.”
From
p ∧ ¬q −→ r
¬r
p
infer
q
suppose we have propositions p ∧ ¬q −→ r, ¬r, p that we call the
premises
we apply proof rules, that we call natural deduction rules, to
premises and propositions inferred from premises
eventually, we obtain proposition q that we call the conclusion
18 / 36
Sequent
Example 1.1
If the train arrives late and there are no taxis at the station, then John is
late for his meeting. John is not late for his meeting.The train did arrive
late. Therefore, there were taxis at the station.
p: “The train arrives late.”
q: “There are taxis at the station.”
r: “John is late for his meeting.”
From
p ∧ ¬q −→ r
¬r
p
infer
q
suppose we have propositions p ∧ ¬q −→ r, ¬r, p that we call the
premises
we apply proof rules, that we call natural deduction rules, to
premises and propositions inferred from premises
eventually, we obtain proposition q that we call the conclusion
18 / 36
Sequent
p ∧ ¬q −→ r, ¬r, p `
|
{z
}
premises
φ , φ , . . . , φn `
}
| 1 2 {z
premises
q
|{z}
conclusion
ψ
|{z}
conclusion
The above expression is called sequent
If a proof is found then the sequent is valid
we manage to infer the conclusion ψ by applying natural
deduction rules on propositions (premises and propositions
inferred from premises)
19 / 36
Sequent
p ∧ ¬q −→ r, ¬r, p `
|
{z
}
premises
φ , φ , . . . , φn `
}
| 1 2 {z
premises
q
|{z}
conclusion
ψ
|{z}
conclusion
The above expression is called sequent
If a proof is found then the sequent is valid
we manage to infer the conclusion ψ by applying natural
deduction rules on propositions (premises and propositions
inferred from premises)
å What are the natural deduction rules? How to choose them?
19 / 36
Sequent
p ∧ ¬q −→ r, ¬r, p `
|
{z
}
premises
φ , φ , . . . , φn `
}
| 1 2 {z
premises
q
|{z}
conclusion
ψ
|{z}
conclusion
The above expression is called sequent
If a proof is found then the sequent is valid
we manage to infer the conclusion ψ by applying natural
deduction rules on propositions (premises and propositions
inferred from premises)
å What are the natural deduction rules? How to choose them?
19 / 36
Rules for conjunction: (1) and-introduction
If we have φ and ψ, we can conclude φ ∧ ψ
å Note that φ and ψ can be any proposition
φ
ψ
φ∧ψ
∧i
Example
p: “The sun is shining.”, ¬q: “I am not sick.”
p
¬q
p ∧ ¬q
p: “They met yesterday”, q ∨ r:“They took a cup
of coffee or went for a walk”
p
q∨r
p ∧ (q ∨ r)
∧i
∧i
20 / 36
Rules for conjunction: (1) and-introduction
If we have φ and ψ, we can conclude φ ∧ ψ
å Note that φ and ψ can be any proposition
φ
ψ
φ∧ψ
∧i
Example
p: “The sun is shining.”, ¬q: “I am not sick.”
p
¬q
p ∧ ¬q
p: “They met yesterday”, q ∨ r:“They took a cup
of coffee or went for a walk”
p
q∨r
p ∧ (q ∨ r)
∧i
∧i
20 / 36
Rules for conjunction: (2) and-elimination
If we have φ ∧ ψ then we can conclude φ
φ∧ψ
φ
∧e1
If we have φ ∧ ψ then we can conclude ψ
φ∧ψ
ψ
∧e2
Example
p: “The sun is shining.”, ¬q: “I am not sick.”
p ∧ ¬q
p
∧e1
p ∧ ¬q
¬q
∧e2
21 / 36
Rules for conjunction: (2) and-elimination
If we have φ ∧ ψ then we can conclude φ
φ∧ψ
φ
∧e1
If we have φ ∧ ψ then we can conclude ψ
φ∧ψ
ψ
∧e2
Example
p: “The sun is shining.”, ¬q: “I am not sick.”
å pattern matching:
φ∧ψ
φ
∧e1
φ∧ψ
ψ
p ∧ ¬q
p
∧e1
p ∧ ¬q
¬q
∧e2
∧e2
21 / 36
Rules for conjunction: (2) and-elimination
If we have φ ∧ ψ then we can conclude φ
φ∧ψ
φ
∧e1
If we have φ ∧ ψ then we can conclude ψ
φ∧ψ
ψ
∧e2
Example
p: “The sun is shining.”, ¬q: “I am not sick.”
å pattern matching:
φ∧ψ
φ
∧e1
φ∧ψ
ψ
p ∧ ¬q
p
∧e1
p ∧ ¬q
¬q
∧e2
∧e2
21 / 36
Rules for conjunction: Example
We prove that p ∧ q, r ` q ∧ r is valid
(1) Write down the premises, leave a
gap, and then write the conclusion
1. p ∧ q
premise
2. r
premise
q∧r
22 / 36
Rules for conjunction: Example
We prove that p ∧ q, r ` q ∧ r is valid
(1) Write down the premises, leave a
gap, and then write the conclusion
(2) Apply suitable natural deduction
rules to fill the gap, in our example:
1. p ∧ q
premise
2. r
premise
q∧r
23 / 36
Rules for conjunction: Example
We prove that p ∧ q, r ` q ∧ r is valid
(1) Write down the premises, leave a
gap, and then the conclusion
(2) Apply suitable natural deduction
rules to fill the gap, in our example:
We apply ∧e2 to the first
premise, which gives us q
Then, we apply ∧i to q and
the second premise, which
gives us q ∧ r (pay attention
to the order 3, 2)
φ
Recall:
ψ
φ∧ψ
∧i
φ∧ψ
φ
1. p ∧ q
premise
2. r
premise
3. q
∧e2 1
4. q ∧ r
∧e1
φ∧ψ
ψ
∧e2
24 / 36
Rules for conjunction: Example
We prove that p ∧ q, r ` q ∧ r is valid
(1) Write down the premises, leave a
gap, and then the conclusion
(2) Apply suitable natural deduction
rules to fill the gap, in our example:
We apply ∧e2 to the first
premise, which gives us q
Then, we apply ∧i to q and
the second premise, which
gives us q ∧ r (pay attention
to the order 3, 2)
φ
Recall:
ψ
φ∧ψ
∧i
φ∧ψ
φ
∧e1
1. p ∧ q
premise
2. r
premise
3. q
∧e2 1
4. q ∧ r
∧i 3, 2
φ∧ψ
ψ
∧e2
25 / 36
Rules for conjunction: Example
We prove that p ∧ q, r ` q ∧ r is valid
Jas̀kowski-style proof
1. p ∧ q premise
(1) Write down the premises, leave a
gap, and then the conclusion
(2) Apply suitable natural deduction
rules to fill the gap, in our example:
We apply ∧e2 to the first
premise, which gives us q
Then, we apply ∧i to q and
the second premise, which
gives us q ∧ r (pay attention
to the order 3, 2)
φ
Recall:
ψ
φ∧ψ
∧i
φ∧ψ
φ
2. r
premise
3. q
∧e2 1
4. q ∧ r
∧i 3, 2
Gentzen-style proof
p∧q
q ∧e2
q∧r
∧e1
φ∧ψ
ψ
r
∧i
∧e2
26 / 36
Rules for conjunction: First example with Isabelle
theory examples
imports
Main names
begin
Open a new file and save
it examples.thy
Start a theory with the
name examples
Download theory
names.thy
and
save it in the same folder
as examples.thy
(ghourabi.net/TP16.html)
end
All the definitions and
proofs are delimited by
begin and end
27 / 36
Rules for conjunction: First example with Isabelle
General structure of a (propositional logic) proof in Isar language
lemma name:
assumes assm1 and · · · and assmn
shows goal
proof ...
[Steps of the proof]
...
qed
A name is given to lemma so that, once proved, it can be
used to prove other lemmas
assm1 · · · assmn are premises
goal is the conclusion
The above lemma defines the following sequent:
assm1 , · · · , assmn ` goal
28 / 36
Rules for conjunction: First example with Isabelle
We prove that p ∧ q, r ` q ∧ r is valid
lemma example1:
assumes “p ∧ q” and “r”
shows “q ∧ r”
proof ...
[Steps of the proof]
...
qed
try:
thm and introduction
thm and elimination1
thm and elimination2
Can you guess the natural deduction rules?
29 / 36
Rules for conjunction: First example with Isabelle
We prove that p ∧ q, r ` q ∧ r is valid
lemma example1:
assumes 1:“p ∧ q” and 2:“r”
shows “q ∧ r”
proof from 1 have 3:“q” by (rule and elimination2)
from 3 and 2 show “q ∧ r” by (rule and introduction)
qed
General scheme of an intermediate step of the proof
from 1 have 3:“q” by (rule and elimination2)
General scheme of the final step of the proof (no goal is left)
from 3 and 2 show “q ∧ r” by (rule and introduction)
30 / 36
Rules for conjunction: First example with Isabelle
We prove that p ∧ q, r ` q ∧ r is valid
lemma example1:
assumes 1:“p ∧ q” and 2:“r”
shows “q ∧ r”
proof from 1 have 3:“q” by (rule and elimination2)
from 3 and 2 show “q ∧ r” by (rule and introduction)
qed
General scheme of an intermediate step of the proof
from 1 have 3:“q” by (rule and elimination2)
General scheme of the final step of the proof (no goal is left)
from 3 and 2 show “q ∧ r” by (rule and introduction)
30 / 36
Rules for conjunction: Second example with Isabelle
Prove that p ∧ q ` q ∧ p is valid
(1) on paper
(2) with Isabelle
31 / 36
Rules for double negation: (3) notnot elimination
“It is not true that it is not raining.”
≡
“It is raining.”
32 / 36
Rules for double negation: (3) notnot elimination
“It is not true that it is not raining.”
≡
“It is raining.”
¬¬φ
φ
¬¬e
32 / 36
Rules for double negation: (3) notnot elimination
“It is not true that it is not raining.”
≡
“It is raining.”
¬¬φ
φ
¬¬e
32 / 36
Rules for double negation: (4) notnot elimination
“It is not true that it is not raining.”
≡
“It is raining.”
φ
¬¬φ
¬¬i
33 / 36
Rules for double negation: Example
Prove that p, ¬¬(q ∧ r) ` ¬¬p ∧ r
1. p
premise
2. ¬¬(q ∧ r)
premise
¬¬p ∧ r
34 / 36
Rules for double negation: Example
Prove that p, ¬¬(q ∧ r) ` ¬¬p ∧ r
1. p
premise
2. ¬¬(q ∧ r)
premise
3. ¬¬p
¬¬i 1
4. q ∧ r
¬¬e 2
¬¬p ∧ r
35 / 36
Rules for double negation: Example
Prove that p, ¬¬(q ∧ r) ` ¬¬p ∧ r
1. p
premise
2. ¬¬(q ∧ r)
premise
3. ¬¬p
¬¬i 1
4. q ∧ r
¬¬e 2
5. r
∧e2
6. ¬¬p ∧ r
∧i 3, 5
Remember:
φ∧ψ
ψ
φ
∧e2
ψ
φ∧ψ
∧i
Try the proof in Isabelle!
36 / 36