n5474411399520 2 PDF
n5474411399520 2 PDF
n5474411399520 2 PDF
2
Using Propositional Logic
3
Using Predicate Logic
4
Using Predicate Logic
5
Using Predicate Logic
6
Using Predicate Logic
7
Using Predicate Logic
8
Using Predicate Logic
9
Using Predicate Logic
exclusive-or
x: Roman(x) (loyalto(x, Caesar) hate(x, Caesar))
(loyalto(x, Caesar) hate(x, Caesar))
10
Using Predicate Logic
11
Using Predicate Logic
7. People only try to assassinate rulers they are not loyal to.
12
Using Predicate Logic
13
Using Predicate Logic
14
Using Predicate Logic
15
Reasoning
Is Marcus alive?
16
Reasoning
17
Reasoning
18
Resolution
Robinson, J.A. 1965. A machine-oriented logic based on
the resolution principle. Journal of ACM 12 (1): 23-41.
19
Resolution
The basic ideas
KB |= KB |=false
20
Resolution
The basic ideas
KB |= KB |=false
( ) ( ) ( )
21
Resolution
The basic ideas
KB |= KB |=false
( ) ( ) ( )
22
Resolution in Propositional Logic
1. Convert all the propositions of KB to clause form (S).
2. Negate and convert it to clause form. Add it to S.
3. Repeat until either a contradiction is found or no progress can
be made.
a. Select two clauses ( P) and ( P).
b. Add the resolvent ( ) to S.
23
Resolution in Propositional Logic
Example:
KB = {P, (P Q) R, (S T) Q, T}
=R
24
Resolution in Predicate Logic
Example:
KB = {P(a), x: (P(x) Q(x)) R(x), y: (S(y) T(y)) Q(y), T(a)}
= R(a)
25
Resolution in Predicate Logic
Unification:
UNIFY(p, q) = unifier where SUBST(, p) = SUBST(, q)
26
Resolution in Predicate Logic
Unification:
x: knows(John, x) hates(John, x)
knows(John, Jane)
y: knows(y, Leonid)
y: knows(y, mother(y))
x: knows(x, Elizabeth)
28
Resolution in Predicate Logic
Unification: Most general unifier
UNIFY(knows(John, x), knows(y, z)) = {John/y, John/x, John/z}
= {John/y, Jane/x, Jane/z}
= {John/y, v/x, v/z}
= {John/y, z/x, Jane/v}
= {John/y, z/x}
29
Resolution in Predicate Logic
Unification: Occur check
UNIFY(knows(x, x), knows(y, mother(y))) = FAIL
30
Conversion to Clause Form
1. Eliminate .
P Q P Q
2. Reduce the scope of each to a single term.
(P Q) P Q
(P Q) P Q
x: P x: P
x: p x: P
P P
31
Conversion to Clause Form
4. Move all quantifiers to the left without changing their relative
order.
(x: P(x)) (y: Q(y)) x: y: (P(x) (Q(y))
5. Eliminate (Skolemization).
x: P(x) P(c) Skolem constant
x: y P(x, y) x: P(x, f(x)) Skolem function
6. Drop .
x: P(x) P(x)
7. Convert the formula into a conjunction of disjuncts.
(P Q) R (P R) (Q R)
8. Create a separate clause corresponding to each conjunct.
9. Standardize apart the variables in the set of obtained clauses.
32
Conversion to Clause Form
1. Eliminate .
2. Reduce the scope of each to a single term.
3. Standardize variables so that each quantifier binds a unique
variable.
4. Move all quantifiers to the left without changing their relative
order.
5. Eliminate (Skolemization).
6. Drop .
7. Convert the formula into a conjunction of disjuncts.
8. Create a separate clause corresponding to each conjunct.
9. Standardize apart the variables in the set of obtained clauses.
33
Example
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Pompeians were either loyal to Caesar or hated him.
6. Every one is loyal to someone.
7. People only try to assassinate rulers they are not loyal to.
8. Marcus tried to assassinate Caesar.
34
Example
1. Man(Marcus).
2. Pompeian(Marcus).
3. x: Pompeian(x) Roman(x).
4. ruler(Caesar).
5. x: Roman(x) loyalto(x, Caesar) hate(x, Caesar).
6. x: y: loyalto(x, y).
7. x: y: person(x) ruler(y) tryassassinate(x, y)
loyalto(x, y).
8. tryassassinate(Marcus, Caesar).
35
Example
Prove:
hate(Marcus, Caesar)
36
1. When did Marcus die?
2. Whom did Marcus hate?
3. Who tried to assassinate a ruler?
4. What happen in 79 A.D.?.
5. Did Marcus hate everyone?
37
Question Answering
PROLOG:
• Only Horn sentences are acceptable
38
Question Answering
PROLOG:
• Only Horn sentences are acceptable
• The occur-check is omitted from the unification: unsound
test P(x, x)
P(x, f(x))
39
Question Answering
PROLOG:
• Only Horn sentences are acceptable
• The occur-check is omitted from the unification: unsound
test P(x, x)
P(x, f(x))
• Backward chaining with depth-first search: incomplete
P(x, y) Q(x, y)
P(x, x)
Q(x, y) Q(y, x)
40
Question Answering
PROLOG:
• Unsafe cut: incomplete
A B, C A
B D, !, E
D B, C
D, !, E, C
!, E, C
41
Question Answering
PROLOG:
• Unsafe cut: incomplete
A B, C A
B D, !, E
D B, C
D, !, E, C
!, E, C