Artificial Intelligence
Dr. Malek Mouhoub
Department of Computer Science
University of Regina
Fall 2007
Malek Mouhoub, CS820 Fall 2007
1
5. Logic representation and automated reasoning
5. Logic representation and automated reasoning
• Resolution refutation proofs
• Strategies for resolution
• Predicate Calculus and Planning
Malek Mouhoub, CS820 Fall 2007
2
Resolution refutation proofs
Resolution refutation proofs
• Modus Ponens : [P ⇒ Q and P ] → Q
• Modus Tollens : [P ⇒ Q and ¬Q] → ¬P
• Resolution refutation proofs :
– Goal : Given a set of axioms (WFF) prove a theorem X
– Method : Start from W F F
∪ {¬X} and try to get a
contradiction using modus ponens or modus tollens.
Malek Mouhoub, CS820 Fall 2007
3
Resolution refutation proofs
Resolution refutation proofs
1. Put the premises or axioms into clause form.
2. Add the negation of what is to be proved, in clause form, to the
set of axioms.
3. Resolve these clauses together, producing new clauses that
logically follow from them.
4. Produce a contradiction by generating the empty clause.
5. The substitutions used to produce the empty clause are those
under which the opposite of the negated goal is true.
Malek Mouhoub, CS820 Fall 2007
4
Resolution refutation proofs
Resolution refutation proofs
Example :
Axioms :
1. All dogs are animals :
∀ X [dog(X) ⇒ animal(X)]
2. Fido is a dog : dog(f ido).
3. All animals will die : ∀ Y
[animal(Y ) ⇒ die(Y )]
Theorem to proof :
– Fido will die : die(f ido).
Malek Mouhoub, CS820 Fall 2007
5
Resolution refutation proofs
Resolution refutation proofs
Converting the predicates to a clause form :
1.
¬dog(X) ∨ animal(X)
2.
dog(f ido)
3.
¬animal(Y ) ∨ die(Y )
Negate the conclusion that Fido will die :
–
¬die(f ido).
Malek Mouhoub, CS820 Fall 2007
6
Resolution refutation proofs
Resolution refutation proofs
dog(X) V animal(X)
dog(fido)
animal(Y) V die(Y)
die(fido)
animal(fido)
die(fido)
Malek Mouhoub, CS820 Fall 2007
7
Resolution refutation proofs
Strategies for resolution
• Linear input form strategy.
• Breath first strategy.
• Set of support strategy.
• Input strategy.
• Linear strategy.
• Other techniques and strategies.
Malek Mouhoub, CS820 Fall 2007
8
Resolution refutation proofs
Strategies for resolution
Example :
Axioms :
– Whoever can read is literate :
∀ X [S(X) ⇒ L(X)]
– The dolphins are not literate :
∀ X [D(X) ⇒ ¬L(X)]
– Some dolphins are intelligent :
∃ X [D(X) ∧ I(X)]
Theorem :
– Some intelligent beings cannot read :
∃ X [I(X) ∧ ¬S(X)]
Malek Mouhoub, CS820 Fall 2007
9
Resolution refutation proofs
Strategies for resolution
WWF ∪ {X }:
• ¬S(X) ∨ L(X)
• ¬D(Y ) ∨ ¬L(Y )
• D(A) where A is a skolem constant.
• I(A)
Theorem :
Malek Mouhoub, CS820 Fall 2007
¬I(Z) ∨ S(Z)
10
Resolution refutation proofs
Linear input form strategy
• Take the negate goal and resolve it with one of the axioms to
get a new clause.
• This result is then resolved with one of the axioms to get another
new clause, which is again resolved with one of the axioms.
• This process continues until the empty clause is produced.
Malek Mouhoub, CS820 Fall 2007
11
Resolution refutation proofs
Linear input form strategy
I(Z) V S(Z)
I(A)
S(X) V L(X)
D(Y) V
L(Y)
D(A)
S(A)
L(A)
D(A)
Malek Mouhoub, CS820 Fall 2007
12
Resolution refutation proofs
Breath first strategy
• Each clause in the clause space is compared for resolution with
every clause in the clause space on the first round.
• The clauses at the second level of the search space are
generated by solving the clauses produced at the first level with
all the original clauses.
• We generate the clauses at the nth level by resolving all
clauses at level n − 1 against the elements of the original
clause set and all clauses previously produced.
Malek Mouhoub, CS820 Fall 2007
13
Resolution refutation proofs
Breath first strategy
I(A)
I(Z) V S(Z)
S(A)
L(A)
S(X) V L(X)
I(X) V L(X)
D(A)
L(A)
Malek Mouhoub, CS820 Fall 2007
I(Z) V
D(Y) V
S(Y) V
D(Z)
I(Z) V
D(Y)
D(Z)
L(Y)
D(A)
L(A)
S(A)
I(A)
14
Resolution refutation proofs
Set of support strategy
• Used for large clause spaces.
• One of the resolvents in each resolution have an ancestor in the
set of support.
Malek Mouhoub, CS820 Fall 2007
15
Resolution refutation proofs
Set of support strategy
I(Z) V S(Z)
I(A)
S(A)
I(Z) V L(Z)
L(A)
I(Y) V D(Y)
D(A)
Malek Mouhoub, CS820 Fall 2007
I(A)
S(X) V L(X)
D(Y) V
L(Y)
D(A)
L(A)
D(A)
D(A)
16
Resolution refutation proofs
Input strategy
• At least one of the resolvents must belong to the set of original
clauses.
Q(X) V P(X)
Q(Y) V P(Y)
Q(W) V P(W)
Q(U) V P(A)
P(U) V P(A)
P(X)
Q(W)
P(U)
(more general)
Q(W)
Malek Mouhoub, CS820 Fall 2007
17
Resolution refutation proofs
Linear strategy
• One of the resolvents is the last clause generated and the other
is either its ancestor or one of the original clauses
Q(X) V P(X)
Q(Y) V P(Y)
Q(W) V P(W)
Q(U) V P(A)
P(X)
Q(W)
P(A)
Malek Mouhoub, CS820 Fall 2007
18
Resolution refutation proofs
Predicate Calculus and Planning
• Modeling the problem.
• Forward method.
• Backward method.
• Means-ends analysis (GPS, STRIPS).
• RSTRIPS.
Malek Mouhoub, CS820 Fall 2007
19
Resolution refutation proofs
Modeling the problem
Modeling the initial and goal states :
• Initial state : FREE(C), FREE(B), ONTABLE(A), ONTABLE(B), ON(C,A), HANDFREE.
• Goal state : ON(B,C), ON(A,B).
A
C
A
B
B
Initial state
Malek Mouhoub, CS820 Fall 2007
C
Goal
20
Resolution refutation proofs
Modeling the problem
Modeling the elementary actions :
PICK(X)
p : ONTABLE(X), FREE(X), FREEHAND
a : INHAND(X)
r : ONTABLE(X), FREE(X), FREEHAND
PUT(X)
p : INHAND(X)
a : ONTABLE(X), FREE(X), FREEHAND
r : INHAND(X)
STACKPUSH(X,Y)
p : INHAND(X),FREE(Y)
a : FREEHAND, ON(X,Y), FREE(X)
r : INHAND(X), FREE(Y)
STACKPOP(X,Y)
p : FREEHAND, ON(X,Y), FREE(X)
a : INHAND(X), FREE(Y)
r : ON(X,Y), FREE(X), FREEHAND
Malek Mouhoub, CS820 Fall 2007
21
Resolution refutation proofs
Forward method
C
A
B
Initial state
STACKPOP(C,A)
PICK(B)
B
C
C
A
Malek Mouhoub, CS820 Fall 2007
B
A
22
Resolution refutation proofs
Backward method
A
B
C
Goal
STACKPUSH(A,B)
A
B
C
Goal
PICK(A)
B
C
A
STACKPUSH(B,C)
Malek Mouhoub, CS820 Fall 2007
23
Means-ends analysis (STRIPS)
Means-ends analysis (STRIPS)
Plan
Stack of goals
NIL
ON(C,B) ∧ ON(A,C)
NIL
ON(C,B)
ON(A,C)
ON(C,B) ∧ ON(A,C)
NIL
INHAND(C) ∧ FREE(B)
STACKPUSH(C,B)
ON(C,B)
ON(A,C)
ON(C,B) ∧ ON(A,C)
NIL
INHAND(C)
FREE(B)
INHAND(C) ∧ FREE(B)
STACKPUSH(C,B)
ON(C,B)
ON(A,C)
ON(C,B) ∧ ON(A,C)
NIL
FREEHAND ∧ ON(C,Y) ∧ FREE(C) [Y/A]
STACKPOP(C,Y) [Y/A]
INHAND(C)
Malek Mouhoub, CS820 Fall 2007
24
Means-ends analysis (STRIPS)
FREE(B)
INHAND(C) ∧ FREE(B)
STACKPUSH(C,B)
ON(C,B)
ON(A,C)
ON(C,B) ∧ ON(A,C)
Malek Mouhoub, CS820 Fall 2007
25
Means-ends analysis (STRIPS)
Plan
Stack of goals
STACKPOP(C,A)
FREE(B)
INHAND(C) ∧ FREE(B)
STACKPUSH(C,B)
ON(C,B)
ON(A,C)
ON(C,B) ∧ ON(A,C)
STACKPOP(C,A)
ON(A,C)
STACKPUSH(C,B)
ON(C,B) ∧ ON(A,C)
STACKPOP(C,A)
INHAND(A) ∧ FREE(C)
STACKPUSH(C,B)
STACKPUSH(A,C)
ON(A,C)
ON(C,B) ∧ ON(A,C)
STACKPOP(C,A)
INHAND(A)
STACKPUSH(C,B)
FREE(C)
INHAND(A) ∧ FREE(C)
STACKPUSH(A,C)
ON(A,C)
ON(C,B) ∧ ON(A,C)
Malek Mouhoub, CS820 Fall 2007
26
Means-ends analysis (STRIPS)
STACKPOP(C,A)
ONTABLE(A) ∧ FREE(A)
STACKPUSH(C,B)
PICK(A)
INHAND(A)
FREE(C)
INHAND(A) ∧ FREE(C)
STACKPUSH(A,C)
ON(A,C)
ON(C,B) ∧ ON(A,C)
STACKPOP(C,A)
FREE(C)
STACKPUSH(C,B)
INHAND(A) ∧ FREE(C)
PICK(A)
STACKPUSH(A,C)
ON(A,C)
ON(C,B) ∧ ON(A,C)
STACKPOP(C,A)
NIL
STACKPUSH(C,B)
PICK(A)
STACKPUSH(A,C)
Malek Mouhoub, CS820 Fall 2007
27
Means-ends analysis (STRIPS)
Procedure GPS(S,G)
If S = G Then return S
DIFF ← differences between S and G
loop 1 If empty(DIFF) Then return (fail)
Else D ← pop(DIFF)
OPER ← operators(D)
/∗ put all operators reducing D in OPER ∗/
loop 2 If empty(OPER) Then goto loop 1
OP ← pop(OPER)
PC ← precond(OP)
S1 ← GPS(S,PC)
If S1 = fail Then goto loop 2
S2 ← perform(OP,S1)
S3 ← GPS(S2,G)
If S3 = fail Then goto loop 2
Return S3
Malek Mouhoub, CS820 Fall 2007
28
Means-ends analysis (STRIPS)
¨
¥
Problem of interdependent subgoals
§
¦
A problem that STRIPS cannot solve : swapping the contents of
two memory addresses.
Initial state : CONT(X,A) ∧ CONT(Y,B)
Goal state : CONT(X,B) ∧ CONT(Y,A)
Operator : Assignment
ASSIGN(u,r,v,s)
p : CONT(u,r) ∧ CONT(v,s)
a : CONT(u,s)
r : CONT(u,r)
Malek Mouhoub, CS820 Fall 2007
29
Means-ends analysis (STRIPS)
¥
¨
Problem of interdependent subgoals
§
¦
Actual State
Stack of Goals
CONT(X,A)
CONT(X,r) ∧ CONT(v,B)
CONT(Y,B)
ASSIGN(X,r,v,B)
[r/A] [v/Y]
CONT(X,B)
CONT(Y,A)
CONT(X,B) ∧ CONT(Y,A)
CONT(X,B)
CONT(Y,A)
CONT(Y,B)
CONT(X,B) ∧ CONT(Y,A)
FAIL
Solution :
– Add the predicate CONT(Z,t) (a temporary variable).
– Postpone the assignment operator (RSTRIPS).
Malek Mouhoub, CS820 Fall 2007
30
Means-ends analysis (STRIPS)
¨
¥
Problem of interdependent subgoals
§
¦
Example 1 :
•
Initial state : FREE(C), FREE(B), ONTABLE(A), ONTABLE(B), ON(C,A), HANDFREE.
•
Goal state : ON(B,A)
•
Case 1 :
∧
ON(C,B).
SGOAL1 = ON(B,A), SGOAL2 = ON(C,B)
Plan P1
=
STACKPOP(C,A) ; PUT(C) ; PICK(B) ; STACKPUSH(B,A)
Plan P2
=
PICK(C) ; STACKPUSH(C,B)
The goal state can be obtained using the sequence : P1
•
Case 2 :
; P2
SGOAL1 = ON(C,B), SGOAL2 = ON(B,A)
P1 =
STACKPOP(C,A);STACKPUSH(C,B)
P2 = STACKPOP(C,B);PUT(C);PICK(B);STACKPUSH(B,A)
Problem :
P2
is conflicting with P1 .
Solution : choose the correct ordering of subgoals (to avoid the conflict).
Malek Mouhoub, CS820 Fall 2007
31
Means-ends analysis (STRIPS)
¨
¥
Problem of interdependent subgoals
§
¦
Example 2 :
• Initial state : FREE(C), FREE(B), ONTABLE(A), ONTABLE(B),
ON(C,A), HANDFREE.
• Goal state : ON(B,C) ∧ ON(A,B).
Failure in the two cases.
Malek Mouhoub, CS820 Fall 2007
32
Means-ends analysis (STRIPS)
RSTRIPS
¨
¥
Problem of interdependent subgoals
§
¦
Idea :
When the resolution of a subgoal B conflicts with a part of
the plan already generated, add a subgoal B’ such that B’ +
P = B.
To detect a conflict use the following predicate :
R[P,OP] : the value of this predicate is equal to the value of P
after performing OP.
Malek Mouhoub, CS820 Fall 2007
33
© Copyright 2026 Paperzz