Using Predicate Logic - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Using Predicate Logic

Description:

Roman(x) loyalto(x, Caesar) hate(x, Caesar) exclusive-or ... knows(John, x) hates(John, x) knows(John, Jane) y: knows(y, Leonid) y: knows(y, mother(y) ... – PowerPoint PPT presentation

Number of Views:157
Avg rating:3.0/5.0
Slides: 44
Provided by: caohoa
Category:
Tags: hates | logic | predicate | using

less

Transcript and Presenter's Notes

Title: Using Predicate Logic


1
Using Predicate Logic
  • Chapter 5

2
Using Propositional Logic
  • Representing simple facts
  • It is raining
  • RAINING
  • It is sunny
  • SUNNY
  • It is windy
  • WINDY
  • If it is raining, then it is not sunny
  • RAINING ? ?SUNNY

3
Using Propositional Logic
  • Theorem proving is decidable
  • Cannot represent objects and quantification

4
Using Predicate Logic
  • Can represent objects and quantification
  • Theorem proving is semi-decidable

5
Using Predicate Logic
  • Marcus was a man.
  • 2. Marcus was a Pompeian.
  • 3. All Pompeians were Romans.
  • 4. Caesar was a ruler.
  • All Pompeians were either loyal to Caesar or
    hated him.
  • 6. Every one is loyal to someone.
  • People only try to assassinate rulers they are
    not loyal to.
  • Marcus tried to assassinate Caesar.

6
Using Predicate Logic
  • Marcus was a man.
  • man(Marcus)

7
Using Predicate Logic
  • 2. Marcus was a Pompeian.
  • Pompeian(Marcus)

8
Using Predicate Logic
  • 3. All Pompeians were Romans.
  • ?x Pompeian(x) ?? Roman(x)

9
Using Predicate Logic
  • 4. Caesar was a ruler.
  • ruler(Caesar)

10
Using Predicate Logic
  • All Pompeians were either loyal to Caesar or
    hated him.
  • inclusive-or
  • ?x Roman(x) ? loyalto(x, Caesar) ? hate(x,
    Caesar)
  • exclusive-or
  • ?x Roman(x) ? (loyalto(x, Caesar) ?? ?hate(x,
    Caesar)) ?
  • (?loyalto(x, Caesar) ? hate(x,
    Caesar))

11
Using Predicate Logic
  • 6. Every one is loyal to someone.
  • ?x ?y loyalto(x, y) ?y ?x loyalto(x, y)

12
Using Predicate Logic
  • People only try to assassinate rulers they are
    not loyal to.
  • ?x ?y person(x) ? ruler(y) ?
    tryassassinate(x, y)
  • ? ?loyalto(x, y)

13
Using Predicate Logic
  • Marcus tried to assassinate Caesar.
  • tryassassinate(Marcus, Caesar)

14
Using Predicate Logic
  • Was Marcus loyal to Caesar?
  • man(Marcus)
  • ruler(Caesar)
  • tryassassinate(Marcus, Caesar)
  • ? ?x man(x) ? person(x)
  • ?loyalto(Marcus, Caesar)

15
Using Predicate Logic
  • Many English sentences are ambiguous.
  • There is often a choice of how to represent
    knowledge.
  • Obvious information may be necessary for
    reasoning
  • We may not know in advance which statements to
    deduce (P or ?P).

16
Reasoning
  • 1. Marcus was a Pompeian.
  • 2. All Pompeians died when the volcano erupted in
    79 A.D.
  • 3. It is now 2008 A.D.
  • Is Marcus alive?

17
Reasoning
  • Marcus was a Pompeian.
  • Pompeian(Marcus)
  • All Pompeians died when the volcano erupted in 79
    A.D.
  • erupted(volcano, 79) ? ?x Pompeian(x) ? died(x,
    79)
  • 3. It is now 2008 A.D.
  • now 2008

18
Reasoning
  • Marcus was a Pompeian.
  • Pompeian(Marcus)
  • All Pompeians died when the volcano erupted in 79
    A.D.
  • erupted(volcano, 79) ? ?x Pompeian(x) ? died(x,
    79)
  • 3. It is now 2008 A.D.
  • now 2008
  • ?x ?t1 ?t2 died(x, t1) ? greater-than(t2, t1)
    ? dead(x, t2)

19
Resolution
  • Robinson, J.A. 1965. A machine-oriented logic
    based on the resolution principle. Journal of ACM
    12 (1) 23-41.

20
Resolution
  • The basic ideas
  • KB ? ? KB ?? ?? false

21
Resolution
  • The basic ideas
  • KB ? ? KB ?? ?? false
  • (? ? ??) ? (?? ? ?) ? (? ? ?)

22
Resolution
  • The basic ideas
  • KB ? ? KB ?? ?? false
  • (? ? ??) ? (?? ? ?) ? (? ? ?)
  • sound and complete

23
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.
  • Repeat until either a contradiction is found or
    no progress can be made.
  • Select two clauses (? ? ?P) and (?? ? P).
  • Add the resolvent (? ? ?) to S.

24
Resolution in Propositional Logic
  • Example
  • KB P, (P ? Q) ? R, (S ? T) ? Q, T
  • ? R

25
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)

26
Resolution in Predicate Logic
  • Unification
  • UNIFY(p, q) unifier ? where SUBST(?, p)
    SUBST(?, q)

27
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)
  • UNIFY(knows(John, x), knows(John, Jane))
    Jane/x
  • UNIFY(knows(John, x), knows(y, Leonid))
    Leonid/x, John/y
  • UNIFY(knows(John, x), knows(y, mother(y)))
    John/y, mother(John)/x
  • UNIFY(knows(John, x), knows(x, Elizabeth)) FAIL

28
Resolution in Predicate Logic
  • Unification Standardization
  • UNIFY(knows(John, x), knows(y, Elizabeth))
    John/y, Elizabeth/x

29
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

30
Resolution in Predicate Logic
  • Unification Occur check
  • UNIFY(knows(x, x), knows(y, mother(y))) FAIL

31
Conversion to Clause Form
  • Eliminate ?.
  • P ? Q ? ?P ? Q
  • 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
  • Standardize variables so that each quantifier
    binds a unique variable.
  • (?x P(x)) ? (?x Q(x)) ? (?x P(x)) ? (?y
    Q(y))

32
Conversion to Clause Form
  • Move all quantifiers to the left without changing
    their relative order.
  • (?x P(x)) ? (?y Q(y)) ? ?x ?y (P(x) ? (Q(y))
  • Eliminate ? (Skolemization).
  • ?x P(x) ? P(c) Skolem constant
  • ?x ?y P(x, y) ? ?x P(x, f(x)) Skolem function
  • Drop ?.
  • ?x P(x) ? P(x)
  • 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.

33
Conversion to Clause Form
  • 1. Eliminate ?.
  • 2. Reduce the scope of each ? to a single term.
  • Standardize variables so that each quantifier
    binds a unique variable.
  • Move all quantifiers to the left without changing
    their relative order.
  • Eliminate ? (Skolemization).
  • Drop ?.
  • Convert the formula into a conjunction of
    disjuncts.
  • Create a separate clause corresponding to each
    conjunct.
  • Standardize apart the variables in the set of
    obtained clauses.

34
Example
  • Marcus was a man.
  • 2. Marcus was a Pompeian.
  • 3. All Pompeians were Romans.
  • 4. Caesar was a ruler.
  • All Pompeians were either loyal to Caesar or
    hated him.
  • 6. Every one is loyal to someone.
  • People only try to assassinate rulers they are
    not loyal to.
  • Marcus tried to assassinate Caesar.

35
Example
  • Man(Marcus).
  • 2. Pompeian(Marcus).
  • 3. ?x Pompeian(x) ? Roman(x).
  • 4. ruler(Caesar).
  • ?x Roman(x) ? loyalto(x, Caesar) ?? hate(x,
    Caesar).
  • ?x ?y loyalto(x, y).
  • ?x ?y person(x) ? ruler(y) ? tryassassinate(x,
    y)
  • ? ?loyalto(x, y).
  • 8. tryassassinate(Marcus, Caesar).

36
Example
  • Prove
  • hate(Marcus, Caesar)

37
Question Answering
  • When did Marcus die?
  • Whom did Marcus hate?
  • 3. Who tried to assassinate a ruler?
  • 4. What happen in 79 A.D.?.
  • 5. Did Marcus hate everyone?

38
Question Answering
  • PROLOG
  • Only Horn sentences are acceptable

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))

40
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)

41
Question Answering
  • PROLOG
  • Unsafe cut incomplete
  • A ? B, C ? A
  • B ? D, !, E
  • D ? ? B, C
  • ? D, !, E, C
  • ? !, E, C

42
Question Answering
  • PROLOG
  • Unsafe cut incomplete
  • A ? B, C ? A
  • B ? D, !, E
  • D ? ? B, C
  • ? D, !, E, C
  • ? !, E, C
  • Negation as failure ?P if fails to prove P

43
Homework
  • Exercises 1-13, Chapter 5, RichKnight AI Text
    Book
Write a Comment
User Comments (0)
About PowerShow.com