Professional Documents
Culture Documents
02 Propositional2018 PDF
02 Propositional2018 PDF
Steffen Hölldobler
International Center for Computational Logic
Technische Universität Dresden, Germany
and
North Caucasus Federal University, Russian Federation
I Syntax
I Semantics
I Proof Procedures
I Satisfiability Testing
I Properties
Steffen Hölldobler
Propositional Logic 1
Syntax – Formulas
I Definition 3.2 Let Σ be an alphabet. The set of words (or strings) over Σ
is denoted by Σ∗ and is the smallest set satisfying the following conditions:
1 Λ ∈ Σ∗ .
2 If w ∈ Σ∗ and a ∈ Σ, then aw ∈ Σ∗ .
Λ is called empty word or empty string.
Steffen Hölldobler
Propositional Logic 2
The Alphabet of Propositional Logic
Steffen Hölldobler
Propositional Logic 3
Propositional Formulas
I Definition 3.4
A (propositional) atomic formula, briefly called atom, is a propositional variable.
Steffen Hölldobler
Propositional Logic 4
Structural Induction
. E ⊆ L(R).
. E satisfies the three conditions of Definition 3.5.
. Because L(R) is the smallest set satisfying these conditions,
L(R) ⊆ E must hold. qed
Steffen Hölldobler
Propositional Logic 5
Structural Recursion
I Proof Exercise
Steffen Hölldobler
Propositional Logic 6
Structural Recursion – Example
I M = N.
I We obtain:
0 if F is an atom,
foo1 (F ) = foo1 (G) if F is of the form ¬G,
foo1 (G1 ) + foo1 (G2 ) + 1 if F is of the form (G1 ◦ G2 ).
Steffen Hölldobler
Propositional Logic 7
Structural Recursion – Another Example
∅ if F is an atom,
{1π | π ∈ pos(G)} if F is of the form ¬G,
pos(F ) = {Λ} ∪
{1π1 | π1 ∈ pos(G1 )} ∪ {2π2 | π2 ∈ pos(G2 )}
if F is of the form (G1 ◦ G2 )
Steffen Hölldobler
Propositional Logic 8
Subformulas
Steffen Hölldobler
Propositional Logic 9
Semantics
Steffen Hölldobler
Propositional Logic 10
The Structure of the Truth Values
. Conjunction ∧∗ /2.
. Disjunction ∨∗ /2.
. Implication →∗ /2.
. NAND ↑ ∗ /2.
. NOR ↓∗ /2.
. Equivalence ↔∗ /2.
Steffen Hölldobler
Propositional Logic 11
The Functions over the Set of Truth Values
∧∗ ∨∗ →∗ ←∗ ↑ ∗ ↓∗ 6→∗ 6←∗
> > > > > > ⊥ ⊥ ⊥ ⊥
> ⊥ ⊥ > ⊥ > > ⊥ > ⊥
⊥ > ⊥ > > ⊥ > ⊥ ⊥ >
⊥ ⊥ ⊥ ⊥ > > > > ⊥ ⊥
Q∗ `∗
↔∗ 6↔∗ .∗ 6.∗ &∗ 6&∗
> > > ⊥ > ⊥ > ⊥ > ⊥
> ⊥ ⊥ > > ⊥ > ⊥ ⊥ >
⊥ > ⊥ > > ⊥ ⊥ > > ⊥
⊥ ⊥ > ⊥ > ⊥ ⊥ > ⊥ >
Steffen Hölldobler
Propositional Logic 12
Interpretations
Steffen Hölldobler
Propositional Logic 13
Satisfiability of Formulas
. F is called satisfiable
if there is an interpretation I = (W, ·I ) with F I = >.
. F is called valid (or F is a tautology)
if for all interpretations I = (W, ·I ) we have: F I = >.
. F is called falsifiable
if there is an interpretation I = (W, ·I ) with F I = ⊥.
. F is called unsatisfiable
if for all interpretations I = (W, ·I ) we have: F I = ⊥.
Steffen Hölldobler
Propositional Logic 14
Truth Tables
Steffen Hölldobler
Propositional Logic 15
Working with Truth Tables
Steffen Hölldobler
Propositional Logic 16
Models
I Abbreviations
Steffen Hölldobler
Propositional Logic 17
Validity and Unsatisfiability
Steffen Hölldobler
Propositional Logic 18
Satisfiability of a Set of Formulas
Steffen Hölldobler
Propositional Logic 19
Logical Consequences
I Proof Exercise
Steffen Hölldobler
Propositional Logic 20
Equivalence and Normal Forms
I Semantic Equivalence
I Clausal Form
Steffen Hölldobler
Propositional Logic 21
Semantic Equivalence
. ≡ is reflexive: F ≡ F .
. ≡ is symmetric: If F ≡ G, then G ≡ F .
. ≡ is transitive: If F ≡ G and G ≡ H, then F ≡ H.
This follows immediately from Definition 3.18 Exercise
Steffen Hölldobler
Propositional Logic 22
Well-Known Semantic Equivalences
(F ∧ F ) ≡ F
(F ∨ F ) ≡ F idempotency
(F ∧ G) ≡ (G ∧ F )
(F ∨ G) ≡ (G ∨ F ) commutativity
((F ∧ G) ∧ H) ≡ (F ∧ (G ∧ H))
((F ∨ G) ∨ H) ≡ (F ∨ (G ∨ H)) associativity
((F ∧ G) ∨ F ) ≡ F
((F ∨ G) ∧ F ) ≡ F absorption
(F ∧ (G ∨ H)) ≡ ((F ∧ G) ∨ (F ∧ H))
(F ∨ (G ∧ H)) ≡ ((F ∨ G) ∧ (F ∨ H)) distributivity
Steffen Hölldobler
Propositional Logic 23
Theorem 3.19 (continued)
I Proof Exercise
Steffen Hölldobler
Propositional Logic 24
Positions
I Recall
∅ if F is an atom,
{1π | π ∈ pos(G)} if F is of form ¬G,
pos(F ) = {Λ} ∪
{1π1 | π1 ∈ pos(G1 )} ∪ {2π2 | π2 ∈ pos(G2 )}
if F is of the form (G1 ◦ G2 ).
I Definition 3.20
Let F be a formula. The set of positions in F , in symbols PF , is pos(F ).
Steffen Hölldobler
Propositional Logic 25
Subformulas and Replacements
Steffen Hölldobler
Propositional Logic 26
The Replacement Theorem
Steffen Hölldobler
Propositional Logic 27
Proof Replacement Theorem (Continuation)
[F ]I = [¬F 0 ]I Assumption
= ¬∗ [F 0 ]I Def I
= ¬∗ [F 0 dπ 0 7→ He]I IH and Def ≡
= [¬(F 0 dπ 0 7→ He)]I Def I
= [(¬F 0 )d1π 0 7→ He]I Def replacement
= [F d1π 0 7→ He]I Assumption
√
II Hence, F ≡ F d1π 0 7→ He
II (G1 ◦ G2 ) analogously
. i =2 analogously qed
Steffen Hölldobler
Propositional Logic 28
Agreement
I If π 6∈ PF then F dπ 7→ He = F .
I Let F dπe = G.
If it is obvious from the context which subformula G is to be replaced,
then we write F dG 7→ He instead of F dπ 7→ He.
Steffen Hölldobler
Propositional Logic 29
Negation Normal Form
Steffen Hölldobler
Propositional Logic 30
The Rules of the Algorithm
I Example
Steffen Hölldobler
Propositional Logic 31
3.3.3 Clause Form
I Definition 3.26
A literal is a propositional variable, or a negated propositional variable.
A propositional variable is also called positive literal,
whereas a negated propositional variable is called negative literal.
I Notation
. L (possible indexed) denotes a literal.
. Generalized disjunction
[F1 , . . . , Fn ] = (. . . ((F1 ∨ F2 ) ∨ F3 ) ∨ . . . ∨ Fn )
. Generalized conjunction
hF1 , . . . , Fn i = (. . . ((F1 ∧ F2 ) ∧ F3 ) ∧ . . . ∧ Fn )
Steffen Hölldobler
Propositional Logic 32
Clauses
I Definition 3.27
Steffen Hölldobler
Propositional Logic 33
An Observation
Steffen Hölldobler
Propositional Logic 34
Transformation into Clause Form
I Theorem 3.28
I Proof of 1
Steffen Hölldobler
Propositional Logic 35
An Algorithm for the Transformation into Clause Form
Steffen Hölldobler
Propositional Logic 36
A Lemma
I Proof Exercise
Steffen Hölldobler
Propositional Logic 37
Induction Principle for While-Loops
I A loop invariant for a while-loop W is a statement E having the following
property: If E holds, then E still holds after one execution of the body of W .
I Proof
Steffen Hölldobler
Propositional Logic 38
Soundness of the Algorithm
Steffen Hölldobler
Propositional Logic 39
Termination of the Algorithm
. Weak Termination
There is at least one way to execute the algorithm such that it terminates.
. Strong Termination The algorithm terminates independently of
which choice we make in the non-deterministic situations.
Steffen Hölldobler
Propositional Logic 40
Multisets
˙ 1, 2, 2, 2, 3}.
. {1, ˙
. M1 M2 holds iff M2 is obtained from M1 by deleting a number n from M1
and replacing it by finitely many numbers which are all less than n.
˙ 1, 2, 2, 2, 3}˙ {1,
. {1, ˙ 1, 1, 1, 2, 2, 2, 2}.
˙
. is not transitive and, hence, is not an ordering relation.
. Observation there cannot be infinitely long sequences (Mi | i ≥ 0) of finite
multisets of natural numbers such that M0 M1 . . ..
Proof see Dershowitz, Manna: Proving Termination with Multiset Orderings,
CACM 22, 465-475 (1979).
Steffen Hölldobler
Propositional Logic 41
Proof of Termination
I Example
h[¬(p ∨ (¬(p ∧ q) ∧ ¬r))]i ˙ }˙
{5
h[¬p], [¬(¬(p ∧ q) ∧ ¬r)]i ˙ 4}˙
{0,
h[¬p], [¬¬(p ∧ q), ¬¬r ]i ˙ 3}˙
{0,
h[¬p], [(p ∧ q), ¬¬r]i ˙ 2}˙
{0,
h[¬p], [(p ∧ q), r]i ˙ 1}˙
{0,
h[¬p], [p, r], [q, r ]i ˙{0, 0, 0}˙
˙ . . . , 0}˙ and
I Observation If G is in clause form, then f(G) = {0,
the number of clauses occurring in G is equal to
the number of occurrences of 0 in f(G).
Steffen Hölldobler
Propositional Logic 42
Proof Methods
I {F1 , . . . , Fn } |= F
iff (hF1 , . . . , Fn i → F ) is valid
iff ¬(hF1 , . . . , Fn i → F ) is unsatisfiable
iff hF1 , . . . , Fn , ¬F i is unsatisfiable.
I Resolution
I Semantic tableaus
Steffen Hölldobler
Propositional Logic 43
Resolution
I Resolution is search for the empty clause using an appropriate inference rule.
Steffen Hölldobler
Propositional Logic 44
Example
I Some Facts
I Question
K4 Will it rain?
p it is hot
q it is humid
r it will rain
I Formalization
F1 ((p ∧ q) → r )
F2 (q → p)
F3 q
F4 r
Steffen Hölldobler
Propositional Logic 45
Example (continued)
{((p ∧ q) → r ), (q → p), q} |= r
iff
(h((p ∧ q) → r), (q → p), qi → r ) is valid
iff
¬(h((p ∧ q) → r), (q → p), qi → r) is unsatisfiable
iff
h((p ∧ q) → r ), (q → p), q, ¬r i is unsatisfiable
iff
h[¬p, ¬q, r], [¬q, p], [q], [¬r]i is unsatisfiable
Steffen Hölldobler
Propositional Logic 46
How to Show Unsatisfiability?
I Recall
h[¬p, ¬q, r], [¬q, p], [q], [¬r ]i
I Observation
{[¬p, ¬q, r], [q]} |= [¬p, r ]
I Hence
h[¬p, ¬q, r ], [¬q, p], [q], [¬r]i ≡ h[¬p, ¬q, r], [¬q, p], [q], [¬r], [¬p, r]i
Steffen Hölldobler
Propositional Logic 47
Resolution Rule
Steffen Hölldobler
Propositional Logic 48
Derivations and Refutations
I F may contain [ ].
Steffen Hölldobler
Propositional Logic 49
Example (continued)
1 [¬p, ¬q, r ]
2 [¬q, p]
3 [q]
4 [¬r]
5 [¬q, ¬q, r] res(1, 2)
6 [r] res(3, 5)
7 [] res(4, 6)
Steffen Hölldobler
Propositional Logic 50
Resolution Proofs
I Requirements
. Soundness If `r F , then |= F .
. Completeness If |= F , then `r F .
I Observation
Steffen Hölldobler
Propositional Logic 51
The Calculus of Natural Deduction
Steffen Hölldobler
Propositional Logic 52
An Introductory Example
Steffen Hölldobler
Propositional Logic 53
Inference Rules – Examples
G (G → F )
(→ E)
F
bGc
..
.
F
(→ I)
(G → F )
(p ∧ q) ((p ∧ q) → (q ∧ p))
(→ E)
(q ∧ p)
Steffen Hölldobler
Propositional Logic 54
Natural Deduction - Inference Rules
I Negation
b¬F c bF c
[] .. .. F ¬F
(f ) . . (¬E)
G [] [] []
(raa) (¬I)
F ¬F
I Conjunction
F G (F ∧ G) (F ∧ G)
(∧I) (∧E) (∧E)
(F ∧ G) F G
I Disjunction
bF c bGc
F G . .
.. ..
(∨I) (∨I)
(F ∨ G) (F ∨ G) (F ∨ G) H H
(∨E)
H
Steffen Hölldobler
Propositional Logic 55
Natural Deduction – Inference Rules (Continued)
I Implication
bGc b¬F c
.. .. G (G → F )
. . (→ E)
F ¬G F
(→ I) (→ I)
(G → F ) (G → F )
I Equivalence
bGc bF c
.. .. G (G ↔ F ) F (G ↔ F )
. . (↔ E) (↔ E)
F G F G
(↔ I)
(G ↔ F )
Steffen Hölldobler
Propositional Logic 56
Derivation Trees
Steffen Hölldobler
Propositional Logic 57
Derivation Trees – Notation
I Let j be an index.
j
5bGc denotes the tree obtained from 5G by marking
F F
at least one of the uncancelled occurrences of the hypothesis G by b cj .
Steffen Hölldobler
Propositional Logic 58
Derivation Trees – Formal Definition (1)
I Definition 3.38 The set of derivation trees in the calculus of natural deduction
is the smallest set X with the following properties
5H
1
r
H2
is in X.
Steffen Hölldobler
Propositional Logic 59
Derivation Trees – Formal Definition (2)
H
3 If 5H1 ∈ X , j is a new index, and
2
bH1 c
..
.
H2
r
H3
is an instance of a rule r ∈ {(raa), (¬I), (→ I)}, then
j
5bH1 c
H2
rj
H3
is a derivation tree in X .
Steffen Hölldobler
Propositional Logic 60
Derivation Trees – Formal Definition (3)
5H 5H
1 2
r
H3
is a derivation tree in X .
Steffen Hölldobler
Propositional Logic 61
Derivation Trees – Formal Definition (4)
j j
5 5bF c 5bGc
(F ∨G) H H
(∨E)j
H
is a derivation tree in X.
6 If 5G
F,
5F ∈ X and j is a new index, then
G
j j
5bGc 5bF c
F G
(↔ I)j
(G ↔ F )
is a derivation tree in X .
Steffen Hölldobler
Propositional Logic 62
Derivations and Proofs
bpc1
(→ I)1
(p → p)
Steffen Hölldobler
Propositional Logic 63
The Introductory Example Revisited
2 3
b(q ∧ r )c b(q ∧ r )c
(∧E) (∧E)
2 3
bpc q bpc r
(∨I) (∨I) (∨I) (∨I)
1 1
b(p ∨ (q ∧ r ))c (p ∨ q) (p ∨ q) b(p ∨ (q ∧ r ))c (p ∨ r ) (p ∨ r )
(∨E)2 (∨E)3
(p ∨ q) (p ∨ r )
(∧I)
((p ∨ q) ∧ (p ∨ r ))
(→ I)1
((p ∨ (q ∧ r)) → ((p ∨ q) ∧ (p ∨ r )))
Steffen Hölldobler
Propositional Logic 64
Lemmas (1)
Steffen Hölldobler
Propositional Logic 65
Lemmas (2)
I The lemma
¬(F ∧ G) F
(l2)
¬G
F bGc1
(∧I)
¬(F ∧ G) (F ∧ G)
(¬E)
[]
(¬I)1
¬G
Steffen Hölldobler
Propositional Logic 66
Lemmas (3)
I The lemma
¬(F ∧ G) G
(l3)
¬F
bF c1 G
(∧I)
¬(F ∧ G) (F ∧ G)
(¬E)
[]
(¬I)1
¬F
Steffen Hölldobler
Propositional Logic 67
Lemmas (4)
I The lemma
¬(F ∨ G)
(l4)
(¬F ∧ ¬G)
bF c1 bGc2
(∨I) (∨I)
¬(F ∨ G) (F ∨ G) ¬(F ∨ G) (F ∨ G)
(¬E) (¬E)
[] []
(¬I)1 (¬I)2
¬F ¬G
(∧I)
(¬F ∧ ¬G)
Steffen Hölldobler
Propositional Logic 68
Another Example Demonstrating the Use of Lemmas
I A proof of (p ∨ ¬p)
b¬(p ∨ ¬p)c1
(l4)
(¬p ∧ ¬¬p) b¬(p ∨ ¬p)c1
(∧E) (l4)
¬¬p (¬p ∧ ¬¬p)
(l1) (∧E)
p ¬p
(¬E)
[]
(raa)1
(p ∨ ¬p)
Steffen Hölldobler
Propositional Logic 69
Some Remarks on Natural Deduction
I Sequent calculus
I Proof theory
Steffen Hölldobler
Propositional Logic 70
3.6 Properties
I Compactness Theorem
Steffen Hölldobler
Propositional Logic 71
3.6.1 Compactness Theorem – Introduction
I Let L(R, n) ⊆ L(R) be the set of formulas in which only the variables
p1 , . . . , pn occur.
Steffen Hölldobler
Propositional Logic 72
Compactness Theorem
Steffen Hölldobler
Propositional Logic 73
Proof of Part (ii) of the Compactness Theorem
Steffen Hölldobler
Propositional Logic 74
Proof of Part (ii) of the Compactness Theorem (continued)
I We construct a model I for G as follows:
Set I := ∅, K0 := N and n = 1.
Do the following:
If there are infinitely many j ∈ Kn−1 with [pn ]Ij = > , then set
I := I ∪ {pn } and Kn := Kn−1 \ {j | [pn ]Ij = ⊥}, (>)
else set
Kn := Kn−1 \ {j | [pn ]Ij = >}. (⊥)
Set n := n + 1.
Goto “Do the following”.
I I is an interpretation.
Proof Exercise
Steffen Hölldobler
Propositional Logic 75
Proof of Part (ii) of the Compactness Theorem (continued)
I To show I is a model for G.
I Then, F ∈ Gn ⊆ Gn+1 ⊆ . . .
and each interpretation In , In+1 , . . . is a model for F .
Steffen Hölldobler
Propositional Logic 76
Implications of the Compactness Theorem
Steffen Hölldobler
Propositional Logic 77
Soundness and Completeness Theorems
I Lemma 3.47 (Propositional Resolution Lemma) Let F = hC1 , . . . , Cn i be a
propositional formula in clause form with the clauses Ci , 1 ≤ i ≤ n, and let C
be a resolvent of two clauses from F . Then F ≡ (F ∧ C) holds.
I Proof To show I |= (F ∧ C) iff I |= F
⇒ immediate
⇐ Suppose I |= F . Let C be the resolvent of Ci and Cj wrt A, 1 ≤ i, j ≤ n
. Let Ci0 = Ci “without” A and Cj0 = Cj “without” ¬A
. Then C = (Ci0 ∨ Cj0 )
. Case 1 I |= A
Then I 6|= ¬A
Because I |= Cj we conclude I |= Cj0
Hence I |= C
. Case 2
I 6|= A
Because I |= Ci we find I |= Ci0
Hence I |= C qed
Steffen Hölldobler
Propositional Logic 78
An Implication of the Resolution Lemma
Steffen Hölldobler
Propositional Logic 79
Resolution Method
. Suppose `r F
. By Theorem 3.28 there is a formula G in clause form with G ≡ ¬F
. By Definition 3.34 we find a resolution refutation for G
i.e. by Definition 3.33 a resolution derivation with [ ] as last element
. Let D1 , . . . , Dm , [ ] be all resolvents computed in that refutation
. By Corollary 3.48 we find G ≡ hG, D1 , . . . , Dm , [ ]i
. Because [ ] is unsatisfiable we conclude by Theorem 3.19 that G ≡ [ ]
i.e. G ist unsatisfiable
. Because G ≡ ¬F and Theorem 3.14 we find |= F
Steffen Hölldobler
Propositional Logic 80
Completeness of the Resolution Method
. Suppose |= F
. By Theorem 3.28 we find a formula G in clause form with G ≡ ¬F
. By Theorem 3.14 we find that G is unsatisfiable
. To show there is a resolution refutation for G
. The proof is by induction on the number n of propositional variables
occurring in G
Steffen Hölldobler
Propositional Logic 81
Completeness of the Resolution Method (continued)
Steffen Hölldobler
Propositional Logic 82
Completeness of the Resolution Method (continued)
0 and G 0 .
I Applying the induction assumption we find refutations for G⊥ >
0
I resolvents G> resolvents G 0
Steffen Hölldobler
Propositional Logic 83