Satisfiability. Rules of Inference.

Satisfiability.
Rules of Inference.
Satisfiability
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Def. A proposition is satisfiable if some setting of the variables
makes the proposition true.
For example, p ∧ ¬q is satisfiable because the expression is true
when p is true and q is false.
p. 2
Satisfiability
Satisfiability
Rules of Inference
Rules of replacement
Determining whether or not a complicated proposition is satisfiable
is not so easy.
Proof by
contradiction
How about this one?
(p ∨ q ∨ r) ∧ (¬p ∨ ¬q) ∧ (¬p ∨ ¬r) ∧ (¬r ∨ ¬q)
The general problem of deciding whether a proposition is satisfiable
is called SAT. One approach to SAT is to construct a truth table and
check whether or not a “T ” ever appears.
But this approach is not very efficient; a proposition with n variables has a truth table with 2n lines. For a proposition with just 30
variables, that’s already over a billion!
Is there an efficient solution to SAT?
p. 3
Satisfiability
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Is there an efficient solution to SAT?
No one knows.
An efficient solution to SAT would immediately imply efficient solutions to many, many other important problems involving packing, scheduling, routing, and circuit verification. Decrypting coded
messages would also become an easy task (for most codes).
p. 4
Tautology and contradiction
Satisfiability
Rules of Inference
Def. A compound proposition that is always true, no matter what the
truth values of the propositional variables that occur in it, is called a
tautology.
Example: p ∨ ¬p.
Example: p ∧ q → p.
p
¬p
p ∨ ¬p
T
F
F
T
T
T
p
q
p∧q
p∧q → p
T
F
T
F
T
T
F
F
T
F
F
F
T
T
T
T
Rules of replacement
Proof by
contradiction
Def. A compound proposition that is always false is called a contradiction.
p. 5
Can we infer new true statements
form a list of given statements?
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Given that:
1) It is raining now.
2) If it’s raining, it’s cloudy.
3) When it’s cloudy, it’s not sunny.
Prove that it is not sunny.
r
r→c
c → ¬s
¬s
p. 6
Use truth tables again?
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Truth tables are great1 , but, fortunately for us, more interesting
techniques exist.
To prove that a compound proposition is true, we can build an argument, a sequence of true propositions that leads to the proposition
we need.
There are inference rules that help us deduce new true propositions.
1
ha-ha, exponential (2n ) table size is not great at all
p. 7
Building a formal argument
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Given
(1)
r
(2)
r→c
(3)
c → ¬s
...
Deriving new true propositions
...
...
...
Need to prove
+
¬s
p. 8
Example
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Let’s first take just one inference rule.
And solve a small problem, using this rule.
p. 9
Inference Rules #1.
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A
A→ B
B
Meaning:
It is snowing today.
If it snows today, then we will go skiing.
We will go skiing.
p. 10
Building an argument
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Let’s get back to that problem:
1) It is raining now.
2) If it’s raining, it’s cloudy.
3) When it’s cloudy, it’s not sunny.
Prove that it is not sunny.
r
r→c
c → ¬s
¬s
p. 11
Building an argument
Satisfiability
Rules of Inference
Rules of replacement
Let’s prove
r
r→c
c → ¬s
¬s
Our argument:
(1)
(2)
(3)
...
r
r→c
c → ¬s
Proof by
contradiction
The rule
A
A→ B
B
Given.
Given.
Given.
p. 12
Building an argument
Satisfiability
Rules of Inference
Rules of replacement
Let’s prove
Proof by
contradiction
The rule
r
r→c
c → ¬s
¬s
Our argument:
(1)
(2)
(3)
r
r→c
c → ¬s
Given.
Given.
Given.
(4)
c
from 1 and 2.
A
A→ B
B
p. 13
Building an argument
Satisfiability
Rules of Inference
Rules of replacement
Let’s prove
Proof by
contradiction
The rule
r
r→c
c → ¬s
¬s
Our argument:
(1)
(2)
(3)
r
r→c
c → ¬s
Given.
Given.
Given.
(4)
(5)
c
¬s
from 1 and 2.
from 3 and 4.
A
A→ B
B
p. 14
How to prove an inference rule?
Satisfiability
Rules of Inference
Rules of replacement
A
A→ B
B
Proof by
contradiction
Inference rules must be always true. In other words, to prove it, we
have to show that the conjunction of the premises always implies
the conclusion:
(A ∧ (A → B)) → B
is a tautology (always true).
A
B
A→ B
A ∧ (A → B)
(A ∧ (A → B)) → B
T
F
T
F
T
T
F
F
T
T
F
T
T
F
F
F
T
T
T
T
p. 15
Rule 1. Or-Introduction (∨-I)
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A
A∨ B
“∨-I”
Example:
It is sunny.
It is sunny or math is hard.
p. 16
Rule 2. And-Introduction (∧-I)
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A
B
A∧ B
“∧-I”
Example:
People like cats.
People like dogs.
People like dogs and cats.
p. 17
Rule 3. And-Elimination (∧-E)
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A∧ B
A
“∧-E”
Example:
Alice sent a message to Bob, but Bob did not receive anything.
Bob did not receive anything.
p. 18
Rule 4. “Modus Ponens”
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A
A→ B
B
“MP”
Example:
It is snowing today.
If it snows today, then we will go skiing.
We will go skiing.
p. 19
Rule 5. “Modus Tollens”
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
¬B
A→ B
¬A
“MT”
Example:
I don’t need an umbrella.
When it rains, I need an umbrella.
It is not raining.
p. 20
Rule 6. “Hypothetical Syllogism”
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A→ B
B→C
A→ C
“HS”
Example:
If you want to get an A, get ready for the exam.
To get ready for the exam, do your homeworks.
If you want to get an A, do your homeworks.
p. 21
Rule 7. “Disjunctive syllogism”
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A∨ B
¬A
B
“DS”
Example:
There is too many people in the office, or the AC is broken.
There is not too many people.
The AC is broken.
p. 22
Rule 8. “Resolution”
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
A∨ B
¬A ∨ C
B∨C
“Res”
Example:
The list is empty, or the variable is a number.
The list is not empty, or the variable is an array.
The variable is a number, or it is an array.
p. 23
Satisfiability
A
A∨ B
“∨-I”
¬B
A→ B
¬A
“MT”
“HS”
A
B
A∧ B
“∧-I”
A→ B
B→C
A→ C
A∧ B
A
“∧-E”
A∨ B
¬B
A
“MP”
A∨ B
¬A ∨ C
B∨C
A
A→ B
B
Rules of Inference
Rules of replacement
Proof by
contradiction
“DS”
“Res”
p. 24
Example 1
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
(p → r) ∧ p
r∧p
(1)
(2)
(3)
(4)
(5)
(p → r) ∧ p
p→r
p
r
r∧p
Given.
∧-E, 1.
∧-E, 1.
MP, 2, 3.
∧-I, 3, 4.
p. 25
Example 2
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
(s ∧ p) → r
r→t
¬t
¬(s ∧ p)
(1)
(2)
(3)
(4)
(5)
(s ∧ p) → r
r→t
¬t
(s ∧ p) → t
¬(s ∧ p)
Given.
Given.
Given.
HS, 1, 2.
MT, 4, 3.
p. 26
Example 3
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
s → ¬(p ∧ q)
q∧s
¬p
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
s → ¬(p ∧ q)
q∧s
s
¬(p ∧ q)
¬p ∨ ¬q
q
¬(¬q)
¬p
Given.
Given.
∧-E, 2.
MP, 1, 3.
Equivalent to 4
∧-E, 2.
Equivalent to 6.
DS, 5, 7.
p. 27
Using the equivalence formulas
Satisfiability
Rules of Inference
Rules of replacement
The equivalence formulas provide rules of replacement.
Proof by
contradiction
For example, if the formula A is true then ¬(¬A) is true:
A
¬(¬A)
or a biconditional formula can be replaced by the conjunction of
two implications
A↔ B
(A → B) ∧ (B → A)
Each equivalence formula gives you two rules.
p. 28
Example 4
Satisfiability
Rules of Inference
Rules of replacement
Prove
Proof by
contradiction
p→r
¬p → q
q→s
¬r → s
(1)
(2)
(3)
p→r
¬p → q
q→s
Given.
Given.
Given.
(4)
(5)
(6)
(7)
(8)
¬p ∨ r
¬p → s
p∨s
r ∨s
¬r → s
Equivalent to (1).
2, 3, HS.
Equivalent to (5).
4, 5, Res
Equivalent to (7).
p. 29
Example 5
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
p→q
q → (r ∧ s)
¬r ∨ (¬t ∨ u)
p∧t
u
p. 30
Example 5
Satisfiability
Rules of Inference
Rules of replacement
Prove
p→q
q → (r ∧ s)
¬r ∨ (¬t ∨ u)
p∧t
u
(1)
(2)
(3)
(4)
p→q
q → (r ∧ s)
¬r ∨ (¬t ∨ u)
p∧t
Given.
Given.
Given.
Given.
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
p
t
q
r ∧s
r
¬(¬r)
¬t ∨ u
u
4, ∧-E.
4, ∧-E.
1, 5, M.P.
3, 7, M.P.
8, ∧-E
Equivalent to (9)
3, 10, D.S.
6, 11, D.S.
Proof by
contradiction
p. 31
Proof by contradiction
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
To proof by contradiction, we make an assumption that certain formula A is true, then produce an argument in such a way that at
some point we obtain a contradiction1 (for example, A ∧ ¬A).
If we inferred a contradiction, our assumed premise A was false,
therefore, its negation ¬A is true.
assuming A, we infer a contradiction
¬A
1
by definition, a compound proposition that is always false
p. 32
Example 6
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
p→q
¬q
¬p
(1)
(2)
p→q
¬q
Given.
Given.
(3)
(4)
(5)
(6)
p
q
¬q ∧ q
¬p
Assume.
1, 3, MP.
2, 4, ∧-I.
3–5, by contradiction
|
|
|
p. 33
Example 7
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
p→q
¬(p ∧ ¬q)
(1)
p→q
Given.
(2)
(3)
(4)
(5)
(6)
(7)
p ∧ ¬q
¬q
p
q
¬q ∧ q
¬(p ∧ ¬q)
Assume.
2, ∧-E.
2, ∧-E.
1, 3, MP.
3, 5, ∧-I.
2–6, by contradiction
|
|
|
|
|
p. 34
Deduction Theorem (→-I)
Satisfiability
Rules of Inference
Rules of replacement
Another interesting rule, is Deduction theorem. This rule says that
by assuming A and then deriving B, we prove implication A → B.
assuming A, we infer B
A→ B
Proof by
contradiction
“→-I”
Deduction theorem can be called Implication-Introduction. In this
sense, Modus Ponens can be called Implication-Elimination.
p. 35
Example 8
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove Hypothetical Syllogism
p→q
q→r
p→r
(1)
(2)
p→q
q→r
Given.
Given.
(3)
(4)
(5)
(6)
p
q
r
p→r
Assume.
1, 3, MP.
2, 4, MP.
3–5, →-I.
|
|
|
p. 36
Example 8
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
Prove
(¬p ∨ ¬q) → (r ∧ s)
r→t
¬t
p
p. 37
Example 8
Satisfiability
Rules of Inference
Prove
Rules of replacement
Proof by
contradiction
(¬p ∨ ¬q) → (r ∧ s)
r→t
¬t
p
(1)
(2)
(3)
(¬p ∨ ¬q) → (r ∧ s)
r→t
¬t
Given.
Given.
Given.
(4)
(5)
(6)
(7)
(8)
(9)
(10)
¬p
¬p ∨ ¬q
r ∧s
r
t
¬t ∧ t
p
Assume
1, 4, ∨-I
1, 5, M.P.
6, ∧-E.
2, 7, M.P.
3, 8, ∧-I.
4–9, by contradiction
|
|
|
|
|
|
p. 38
Common logical errors
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
p→q
q
p
The fallacy of affirming the conclusion.
((p → q) ∧ q) → p is not a tautology.
p. 39
Common logical errors
Satisfiability
Rules of Inference
Rules of replacement
Proof by
contradiction
p→q
¬p
¬q
The fallacy of denying the hypothesis.
((p → q) ∧ ¬p) → ¬q is not a tautology.
p. 40