0% found this document useful (0 votes)
20 views

Resolution Davis Putnam

The document discusses different normal forms that can be used to express logical statements including negation normal form, disjunctive normal form, and conjunctive normal form. It also explains how the resolution method can be used to determine logical consistency by converting statements to clauses in conjunctive normal form and applying the resolution rule.

Uploaded by

Alaa CHOUMANE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Resolution Davis Putnam

The document discusses different normal forms that can be used to express logical statements including negation normal form, disjunctive normal form, and conjunctive normal form. It also explains how the resolution method can be used to determine logical consistency by converting statements to clauses in conjunctive normal form and applying the resolution rule.

Uploaded by

Alaa CHOUMANE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Resolution and Davis-Putnam

Computability and Logic


Logic Recap:
Expressive Completeness
Rewriting Statements
• We can rephrase (rewrite) any occurrence
of P ↔ Q as (P → Q) ∧ (Q → P).
• And, P → Q itself can rewritten as ¬P ∨ Q
• Therefore, any traditional propositional
logic expression (i.e. those using ¬, ∧, ∨,
→, ↔) can be rewritten into one that only
uses the Boolean connectives (¬, ∧, ∨).
Negation Normal Form
• Literals: Atomic Sentences or negations thereof.
• Negation Normal Form: An expression built up
with ‘∧’, ‘∨’, and literals.
• Using repeated DeMorgan and Double Negation,
we can transform any expression built up with ‘∧’,
‘∨’, and ‘¬’ into an expression that is in Negation
Normal Form.
• Example: ¬((A ∨ B) ∧ ¬C) ⇔ (DeMorgan)
¬(A ∨ B) ∨ ¬¬C ⇔ (Double Neg, DeM)
(¬A ∧ ¬B) ∨ C
Disjunctive Normal Form
• Disjunctive Normal Form: A generalized
disjunction of generalized conjunctions of literals.
• Using repeated distribution of ∧ over ∨, any
statement in Negation Normal Form can be
written in Disjunctive Normal Form.
• Example:
(A∨B) ∧ (C∨D) ⇔ (Distribution)
[(A∨B)∧C] ∨ [(A∨B)∧D] ⇔ (Distribution (2x))
(A∧C) ∨ (B∧C) ∨ (A∧D) ∨ (B∧D)
DNF and SOP
• In computer circuitry design, the term Sum Of Products
(SOP) is often used, since if you consider T as ‘1’, and F
as ‘0’, then ∧ is like multiplication, and ∨ is like addition
(where anything > 0 is considered 1)
– Thus, in computer circuitry design, (A∧C) ∨ (B∧C) ∨ (A∧D) ∨
(B∧D) is often written as: AC + BC + AD + BD (‘Sum of
Products’)
A B AB A B A+B

1 1 1 1 1 1
1 0 0 1 0 1
0 1 0 0 1 1
0 0 0 0 0 0
Conjunctive Normal Form
(or: Product of Sums: POS)
• Conjunctive Normal Form: A generalized
conjunction of generalized disjunctions of literals.
• Using repeated distribution of ∨ over ∧, any
statement in Negation Normal Form can be
written in Conjunctive Normal Form.
• Example:
(A∧B) ∨ (C∧D) ⇔ (Distribution)
[(A∧B) ∨ C] ∧ [(A∧B) ∨ D] ⇔ (Distribution (2x))
(A∨C) ∧ (B∨C) ∧ (A∨D) ∧ (B∨D)
Special Cases
• Any literal (such as A or ¬B) is in NNF, DNF (it
is a disjunction whose only disjunct is a
conjunction whose only conjunct is that literal),
and CNF
• A conjunction of literals (e.g. ¬A ∧ ¬B ∧ C) is in
NNF, DNF (a disjunction whose only disjunct is
that conjunction), and CNF
• A disjunction of literals is in NNF, DNF, and CNF
Summing Up
• Any traditional propositional logic expression can
be transformed into a Boolean Logic expression
• Any Boolean logic expression can be put into
NNF
• Any NNF expression can be put into CNF
• Any NNF expression can be put into CNF
• So, any traditional propositional logic expression
can be put into NNF, CNF, and DNF
Expressing any truth-function
using ‘and’, ‘or’, and ‘not’
• Even better: no matter what additional truth-
functional operators you define (e.g. XOR, ID, “If
…Then … Else”, etc.), you can always re-express
them in terms of the Boolean connectives ∧, ∨,
and ¬!
• Indeed, any truth-function, no matter how
complex, or defined over how many atomic
statements, can be expressed in terms of the
Boolean connectives ∧, ∨, and ¬!
• ‘Proof’: generalize from example on next slide.
Expressive Completeness
Step 1: Step 2:
P Q P*Q Create term for Disjunct all terms
T T F every ‘T’:

T F T ⇒ P∧¬Q ⇒ (P∧¬Q) ∨ (¬P∧Q)


F T T ⇒ ¬P∧Q (note: expression is in DNF)
F F F

Note that this works for any truth-function defined over


any number of atomic statements.
We thus say that {∧, ∨, ¬} is expressively complete!!
CNF and Truth-Tables
• We can also generate a CNF that captures any truth-
function from its truth-table:
Step 1: Step 2:
P Q P*Q Create term for Disjunct all terms
every ‘F’: ⇒ (P∧Q) ∨ (¬P∧ ¬Q)
T T F ⇒P∧Q
T F T Step 3:
F T T Negate!
⇒ ¬((P∧Q) ∨ (¬P∧ ¬Q)), i.e.
F F F ⇒ ¬P ∧ ¬Q
⇒ ¬(P∧Q) ∧ ¬(¬P∧ ¬Q), i.e.
⇒ (¬P ∨ ¬ Q) ∧ (P ∨ Q) (CNF!)
CNF and Truth-Tables II
• More directly:
Step 1:
Create negated ‘term’ for
P Q P*Q every ‘F’:

T T F ⇒ ¬P ∨ ¬Q Step 2:
T F T Conjunct terms

F T T ⇒ (¬P ∨ ¬ Q) ∧ (P ∨ Q) (CNF!)

F F F ⇒P∨Q
Resolution
Resolution
• Resolution is, like the tree method, a method to check for
the logical consistency of a set of statements.
• Resolution requires all sentences to be put into CNF.
• A set of sentences in CNF is made into a clause set S: a set
of clauses, where a clause C is a set of literals.
– Each clause C represents a disjunction of literals
– The clause set S represents a conjunction of disjunctions of literals
Resolution Rule
• Clauses are resolved using the resolution
rule, and the resulting clause (the resolvent)
is added to the clause set:

L ∈ C1
L’ ∈ C2

CNEW = C1/L ∪ C2/L’


Putting into CNF
¬(P ↔ Q) ⇔ (Equiv)

¬((P → Q) ∧ (Q → P)) ⇔ (Impl)

¬((¬P ∨ Q) ∧ (¬Q ∨ P)) ⇔ (DeM)

¬(¬P ∨ Q) ∨ ¬(¬Q ∨ P) ⇔ (DeM, DN)

(P ∧ ¬Q) ∨ (Q ∧ ¬P) ⇔ (Dist)

((P ∧ ¬Q) ∨ Q) ∧ ((P ∧ ¬Q) ∨ ¬P) ⇔ (Dist)

(P ∨ Q) ∧ (¬Q ∨ Q) ∧ (P ∨ ¬P) ∧ (¬Q ∨ ¬P)


Resolution Graph
¬(P ↔ Q) ¬(Q ↔ R) ¬(P ↔ R)
⇓ ⇓ ⇓
(P ∨ Q) ∧ (¬P ∨ ¬Q) (Q ∨ R) ∧ (¬Q ∨ ¬R) (P ∨ R) ∧ (¬P ∨ ¬R)
⇓ ⇓ ⇓
{P, Q} {¬P, ¬Q} {Q, R} {¬Q, ¬R} {P, R} {¬P, ¬R}

{¬P, R} {P, ¬Q}

{P} {¬P}

{}
Satisfiability
• A clause is satisfied by a truth-value assignment if and
only if that assignment makes at least one literal in that
clause true.
• A clause set is satisfiable if and only if there is a truth-
value assignment that satisfies all clauses in that clause set.
• Figuring out whether some clause set is satisfiable is the
satisfiability problem. This problem is a central problem in
computer science, as many problems in computer science
can be reduced to a satisfiability problem.
• In our case: a set of sentences is consistent if and only if
the corresponding clause set is satisfiable.
Soundness and Completeness of
Resolution
• The rule of Resolution is sound, making the
method of resolution sound as well (so, if the
empty clause (which is a generalized disjunction
of 0 disjuncts, which is a contradiction) can be
resolved from a clause set, then that means that
that clause set is indeed unsatisfiable.
• It can be shown that resolution is complete, i.e.
that the empty clause can be resolved from any
unsatisfiable clause set.
Resolutions as Derivations
1. {A, B}
A ∨ (B ∧ C) ⇒ (A ∨ B) ∧ (A ∨ C) ⇒
2. {A, C}
3. {¬A, D, E}
(A ∨ B) → (D ∨ E) (¬A ∨ D ∨ E) ∧ (¬B ∨ D ∨ E) ⇒
⇓ ⇑ 4. {¬B, D, E}
¬(A ∨ B) ∨ (D ∨ E) ⇒ (¬A ∧ ¬B) ∨ (D ∨ E) ¬E ⇒ 5. {¬E}
¬A ⇒ 6. {¬A}
¬(C ∧ D) ⇒ ¬C ∨ ¬D ⇒ 7. {¬C, ¬D}
8. {B} 1,6
17.42 from LPL:
9. {C} 2,6
A ∨ (B ∧ C)
¬E 10. {D, E} 4,8
(A ∨ B) → (D ∨ E) 11. {D} 5,10
¬A 12. {¬D} 7,9
∴C∧D
13. {} 11,12
Resolutions as Decision
Procedures
• Resolution can be made into a decision
procedure by systematically exhausting all
possible resolvents (of which there are
finitely many).
• This will not be very efficient unless we add
some resolution strategies.
Resolution Strategies
• Clause Elimination Strategies
– Tautology Elimination
– Subsumption Elimination
– Pure Literal Elimination
• Resolving Strategies
– Unit Preference Resolution
– Linear Resolution
– Ordered Resolution
– Etc.
Tautology Elimination
• A tautologous clause is a clause that contains an
atomic statement as well as the negation of that
atomic statement. E.g. {A, B, ¬A} is tautologous.
• Obviously, for any tautologous clause C, any
truth-value assignment is going to satisfy C.
• Hence, with S any clause set, and with S’ the
clause set S with all tautologous clauses removed:
S is satisfiable if and only if S’ is satisfiable.
Subsumption Elimination
• A clause C1 subsumes a clause C2 if and only if
every literal contained in C1 is contained in C2, i.e.
C1 ⊆ C2. E.g. {A, B} subsumes {A, B, ¬C}
• Obviously, if C1 subsumes C2 , then any truth-
value assignment that satisfies C1 will satisfy C2.
• Hence, with S any clause set, and S’ the clause set
S with all subsumed clauses removed: S is
satisfiable if and only if S’ is satisfiable.
Pure Literal Elimination
• A literal L is pure with regard to a clause set S if
and only if L is contained in at least one clause in
S, but L’ is not.
• A clause is pure with regard to a clause set S if
and only if it contains a pure literal.
• Obviously, with S any clause set, and with S’ the
clause set S with all pure clauses removed: S is
satisfiable if and only if S’ is satisfiable.
Unit Preference Resolution
• A unit clause is a clause that contains one
literal.
• Unit preference resolution tries to resolve
using unit clauses first.
Unit Literal Deletion and
Splitting
• For any clause set S, SL is the clause set that is
generated from S as follows:
– Remove all clauses from S that contain L.
– Remove all instances of L’ from all other clauses
• Obviously, with C = {L} ∈ S, S is satisfiable if
and only if SL is satisfiable.
• It is also easy to see that for any clause set S, and
any literal L: S is satisfiable if and only if SL is
satisfiable or SL’ is satisfiable.
• The last observation suggests a splitting strategy
that forms the basis of Davis-Putnam.
Davis-Putnam
Davis-Putnam
• Recursive routine Satisfiable(S) returns true iff S is
satisfiable:

boolean Satisfiable(S)
begin
if S = {} return true;
if S = {{}} return false;
select L ∈ lit(S);
return Satisfiable(SL) || Satisfiable(SL’);
end
Davis-Putnam as Trees
{P, Q}
{P, ¬Q}
{¬P, Q}
{¬P, ¬Q}
(P) (¬P)

{Q} {Q}
{¬Q} {¬Q}
(Q) (¬Q) (Q) (¬Q)

{} {} {} {}
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} Step 4: Put clause set
¬(A → Q) {¬N} at root of tree
Step 1. Negate {A}
Conclusion (A) {¬Q} (¬A) Step 5: Do DP!
{N, Q} {¬N}
{¬N} {}
{¬Q} {¬Q}
(N) (¬N) (N) (¬N)
{} {Q} {} {}
{¬Q} {¬Q} {¬Q} {¬Q}
(Q) (¬Q) (Q) (¬Q) (Q) (¬Q) (Q) (¬Q)
{} {} {} {} {} {} {} {}
× × × × × × × ×
Simple Example
Invalid Argument
A→B ¬A ∨ B {¬A , B}
¬A ¬A {¬A}
¬B ¬¬B B {B}
(A) (¬A)
{B} {B}
{} (B) (¬B)
× ○ {}
Reached empty clause set: ×
So set of statements in root are consistent
So original argument is invalid
Model is given by branches: A False and B True
Making Davis-Putnam Efficient:
Adding Bells and Whistles
• The routine on the previous slide is not very
efficient. However, we can easily make it more
efficient:
– return false as soon as {}∈S
– add the unit rule: if {L}∈S return Satisfiable(SL)
– strategically add clause deletion strategies (e.g.
subsumption, pure literal)
– strategically choose the literal on which to split
• As far as I have gathered from the ATP literature,
such efficient Davis-Putnam routines are credited
to do well in comparison to other ATP routines.
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} Step 4: Put clause set
¬(A → Q) {¬N} at root of tree
Step 1. Negate {A}
Conclusion (A) {¬Q} (¬A) Step 5: Do DP!
{N, Q} {¬N}
{¬N} {}
{¬Q} {¬Q}
(N) (¬N) ×
{} {Q} Same example as before,
{¬Q} {¬Q} but stopping early (i.e. as
× (Q) (¬Q)
soon as {} is one of clauses)
{} {}
× ×
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} Step 4: Put clause set
¬(A → Q) {¬N} at root of tree
Step 1. Negate {A}
Conclusion (A) {¬Q} Step 5: Do DP!

{N, Q}
{¬N}
{¬Q}
(¬N)
{Q} Same example as before,
{¬Q} but using unit rule
(Q)
{}
×
Davis-Putnam and Truth-Trees
• Observation: Davis-Putnam looks a bit like Truth-
Tree method. In fact, on the next slides, we’ll see:
– Like TT, ‘check marks’ can be used in representation of DP
– Like TT, whole statements can be used (i.e. no need for clauses)
• How does Davis-Putnam differ from Truth-Trees?
– Davis-Putnam is an ‘inside-out’ approach: it assigns a
truth-value to atomic statements and determines the
consequences of that assignment for the more complex
statements composed of those atomic statements.
– Truth-Trees is an ‘outside-in’ approach: it assigns truth-
values to complex statements and determines the
consequences of that assignment for the smaller
statements it is composed of.
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} √1 Step 4: Put clause set
¬(A → Q) {¬N} √3 at root of tree
Step 1. Negate {A} √2
Conclusion (A) {¬Q} √5 (¬A) Step 5: Do DP!
{N, Q} √4 {}
(N) (¬N)
×
{} {Q} √6
× (Q) (¬Q)
Same example as before,
{} {} but using check mark system
× ×
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} √1 Step 4: Put clause set
¬(A → Q) {¬N} √3 at root of tree
Step 1. Negate {A} √2
Conclusion (A) {¬Q} √5 Step 5: Do DP!

{N, Q} √4
(¬N)
{Q} √6
(Q)
Same example as before,
{} but using check mark system
× and unit rule
Step 2: Put into CNF Step 3: Make into clauses
A → (N ∨ Q) ¬A ∨ N ∨ Q {¬A, N, Q}
¬(N ∨ ¬A) ¬N ∧ A {¬N} {A}
A→Q A ∧ ¬Q {A} {¬Q}
{¬A, N, Q} √1 Step 4: Put clause set
¬(A → Q) {¬N} √3 at root of tree
Step 1. Negate {A} √2
Conclusion (A) {¬Q} √5 Step 5: Do DP!

{N, Q} √4
(¬N)
Same example as before,
{Q} √6 but using check mark system,
× unit rule, and TT rule that any
branch with atomic P and ¬P
can be closed
Can we do DP without CNF?
• Sure, simply consider a set of statements, and see
what happens to each of the statements when some
atomic claim is set to true or false, respectively.
• For example, when we set A to True:
– (A ∨ B) → (D ∨ E) becomes
– (True ∨ B) → (D ∨ E) becomes
– True → (D ∨ E) becomes
– D∨E
Rules for DP without CNF
¬ True True ∧ P True ∨ P True → P True ↔ P
⇒ False ⇒P ⇒ True ⇒P ⇒P

¬ False False ∧ P False ∨ P False → P False ↔ P


⇒ True ⇒ False ⇒P ⇒ True ⇒ ¬P

P ∧ True P ∨ True P → True P ↔ True


⇒P ⇒ True ⇒ True ⇒P

P ∧ False P ∨ False P → False P ↔ False


⇒ False ⇒P ⇒ ¬P ⇒ ¬P
Step 2: Put statements
at root of tree
A → (N ∨ Q) A → (N ∨ Q)
¬(N ∨ ¬A) ¬(N ∨ ¬A)
A→Q ¬(A → Q) Step 3: Do DP!

¬(A → Q) (A) (¬A)


Step 1. Negate N∨Q (True)
Conclusion ¬N False
(N) ¬Q (¬N) False
×
(True) Q
False (True)
¬Q (Q) ¬Q (¬Q)
×
(True) False
False (True)
× ×
Step 2: Put statements
at root of tree
A → (N ∨ Q) A → (N ∨ Q)
¬(N ∨ ¬A) ¬(N ∨ ¬A)
A→Q ¬(A → Q) Step 3: Do DP!

¬(A → Q) (A) (¬A)


Step 1. Negate N∨Q False
Conclusion ¬N False
(N) ¬Q (¬N) ×

False Q Same example, but


¬Q (Q) ¬Q (¬Q) leaving out the True’s
×
False False
× ×
Step 2: Put statements
at root of tree
A → (N ∨ Q) A → (N ∨ Q) √1
¬(N ∨ ¬A) ¬(N ∨ ¬A) √2
A→Q ¬(A → Q) √3 Step 3: Do DP!

¬(A → Q) (A) (¬A)


Step 1. Negate N ∨ Q √4 False
Conclusion ¬N √5 False
¬Q √6 ×
(N) (¬N)
False Q √7 Same example, but
(Q) (¬Q) using check mark
×
system
False False
× ×
17.42 from LPL:
A ∨ (B ∧ C)
¬E
(A ∨ B) → (D ∨ E) A ∨ (B ∧ C)
¬A ¬E
∴C∧D (A ∨ B) → (D ∨ E)
¬A
¬(C ∧ D)
A ¬A

¬E B∧C
D∨E ¬E
False B → (D ∨ E)
¬(C ∧ D) ¬(C ∧ D)
E ¬E
×
B∧C B∧C
False B→D
¬(C ∧ D) ¬(C ∧ D)
× Etc.
17.42 from LPL:
A ∨ (B ∧ C) Using check marks:
¬E
(A ∨ B) → (D ∨ E) A ∨ (B ∧ C) √1
¬A ¬E √4
∴C∧D (A ∨ B) → (D ∨ E) √2
¬A √3
¬(C ∧ D) √8
A ¬A

D∨E B ∧ C √6
False B → (D ∨ E) √5
E ¬E
×
False B → D √7
× B ¬B
C √9 False
C D √10 ¬C ×
False D ¬D √11 ¬D False False
× × ×
Can DP and TT be combined?
• OK, Davis-Putnam now really starts to look like
the truth tree method…
• Can these two methods be combined into one
method?
• Sure!
• Project: Investigate efficiency of this method
Example: DP and TT Combo
¬A → B √4 17.43 from LPL:
C → (D ∨ E) √2 ¬A → B
D → ¬C √3 C → (D ∨ E)
A → ¬E D → ¬C
¬(C → B) √1 A → ¬E
C ∴C→B
¬B
D ∨ E √6
1. TT rule: decompose ¬(C → B)
¬D 2. Unit rule: reduce with regard to C
¬¬A √5 3. Unit rule: reduce with regard to C
A 4. Unit rule: reduce with regard to ¬B
E 5. TT rule: decompose ¬¬A
6. Unit rule: reduce with regard to ¬B
¬E 7. Close between E and ¬E
×7
Exercise
• Show the argument below to be valid using:
– 1. Resolution
– 2. Davis-Putnam (on clauses)
– 3. Davis-Putnam (on original statements)
– 4. Davis-Putnam and Truth-Tree combo
Q ∨ ¬S
(P ∧ Q) ↔ R
¬S → R
----
¬P → (Q ↔ S)
Projects
• Compare and contrast efficiency of different
methods
– How is efficiency effected by
• Using Clause elimination strategies
• Using Unit rule
• Not putting into CNF
• Etc.
– What about combinations of different methods?

You might also like