Foundations of Artificial Intelligence - PowerPoint PPT Presentation

1 / 67
About This Presentation
Title:

Foundations of Artificial Intelligence

Description:

Nils Nilsson, AI: a new synthesis, Morgan Kaufman, 1998, chapters 15, 16 ... An infinite set of object constants strings starting with a capital or a numeral ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 68
Provided by: mach82
Category:

less

Transcript and Presenter's Notes

Title: Foundations of Artificial Intelligence


1
Foundations of Artificial Intelligence
  • Chapter 7 The predicate calculus
  • Luc De Raedt

2
Predicate calculus
  • Limitations of propositional calculus
  • Language and its syntax
  • Semantics (informally)
  • Quantifiers
  • Representing Knowledge
  • Resolution
  • Prolog
  • This part is based on
  • Nils Nilsson, AI a new synthesis, Morgan
    Kaufman, 1998, chapters 15, 16 and 17

3
The language and its syntax (restricted version)
  • Components
  • An infinite set of object constants strings
    starting with a capital or a numeral
  • E.g.
  • An infinite set of function constants of all
    arities strings starting with lowercase and
    superscripted with arity
  • E.g.
  • An infinite set of relation constants of all
    arities strings beginning with uppercase and
    superscripted with arity
  • E.g.
  • Traditional connectives

4
Terms (restricted)
  • An object constant is a term
  • A function constant f of arity n followed by n
    terms ti in parentheses is a term
  • Examples

5
Well-formed formulae (restricted)
  • Atoms A relation constant F of arity n followed
    by n terms ti is an atom
  • Examples
  • Propositional wffs any expression formed with
    the propositional calculus and atoms as
    propositions.
  • Example

6
Semantics (restricted version)
  • Worlds
  • The world can have an infinite number of objects,
    called individuals, the domain
  • The world can have an infinite number of
    functions f that map n-tuples of individuals into
    individuals
  • The world can have an infinite number of
    relations over individuals,

7
Interpretations
  • An interpretation maps
  • object constants to individuals
  • n-ary function constants onto n-ary functions
  • n-ary relation constants onto n-ary relations
  • Given an interpretation, an atom has
    the value True iff the relation denoted by R
    holds among for those individuals denoted by the
    ti

8
(No Transcript)
9
Models and related notions
  • An interpretation satisfies a wff if the wff has
    the value True under the interpretation
  • An interpretation that satisfies a wff is a model
    of that wff
  • Any wff that has the value True under all
    interpretations is a tautology (it is valid)
  • Any wff that does not have a model is
    unsatisfiable
  • If a wff ? has value True under all those
    interpretations for which each of the of wffs in
    a set ? has value true then ? logically entails
    ?, notation
  • Two wffs are equivalent iff their truth values
    are identical under all interpretations
  • Essentially, the notions from propositional logic
    carry over

10
Knowledge
  • Does the following knowledge base (set of
    formulae) has a model ?

11
Quantification
  • How to express
  • every object is red ?
  • there is an object which is red ?
  • For finite domains for infinite domains ?
  • Use variables and quantifiers !

12
Predicate calculus
  • Now introduce
  • An infinite set of variable symbols start with
    lowercase
  • Each variable is also a term !
  • The universal quantifier? and the existential
    one ?
  • If ? is a wff and v is a variable then the
    following are also wffs
  • Example
  • Scoping ? is within the scope of the
    quantifier

13
Variables, scoping, and quantifiers
  • Scoping
  • We will assume that all wffs are closed, i.e.
    that all variables are quantified, i.e. occur
    with the scope of a quantifier.
  • closed
  • Open
  • Equivalent
  • Not equivalent !

14
Semantics
  • has the value true (under a given
    interpretation) iff ?(v) has the value true for
    all assignments of the variable symbol v to
    individuals
  • has the value true (under a given
    interpretation) iff ?(v) has the value true for
    an assignments of the variable symbol to
    individuals

15
An example
16
Rules of inference
  • Some equivalences (De Morgan)
  • Universal instantiation
  • From infer where a is
    substituted for x throughout ?

17
  • Existential Generalization
  • From infer where a has
    been replaced by x throughout ?
  • Universal instantiation and Existential
    generalization are sound inference rules

18
Wumpus
  • Time could be incorporated as well

19
Some sentences
  • Not all students take both history and biology
  • Only one student failed history (requires )
  • No person likes a smart vegetarian
  • No person likes a professor unless the professor
    is smart

20
Clausal Form
  • Clauses are universally quantified disjunctions
    of literals all variables in a clause are
    universally quantified

21
Towards Resolution
  • Examples
  • We need to be able to work with variables !
  • Unification of two expressions/literals

22
Terms and instances
  • Consider following atoms
  • Ground expressions do not contain any variables

23
Substitution
24
Composing substitutions
  • Composing substitutions s1 and s2 gives s1 s2
    which is that substitution obtained by first
    applying s2 to the terms in s1and adding
    remaining term/vars pairs to s1
  • Apply to

25
Properties of substitutions
26
Unification
  • Unifying a set of expressions wi
  • Find substitution s such that
  • Example
  • The most general unifier, the mgu, g of wi has
    the property that if s is any unifier of wi
    then there exists a substitution s such that
    wiswigs
  • The common instance produced is unique up to
    alphabetic variants (variable renaming)

27
Disagreement set
  • The disagreement set of a set of expressions wi
    is the set of subterms ti of wi at the
    first position in wi for which the wi
    disagree

28
Unification algorithm
29
Predicate calculus Resolution
  • John Allan Robinson (1965)

30
Example
31
A stronger version of resolution
  • Use more than one literal per clause

32
Resolution
33
Resolution
  • Properties
  • Resolution is sound
  • Incomplete
  • But fortunately it is refutation complete
  • If KB is unsatisfiable then KB - ?

34
Refutation Completeness
  • To decide whether a formula KB w do
  • Convert KB to clausal form KB
  • Convert ?w to clausal form ?w
  • Combine ?w and KB to give ?
  • Iteratively apply resolution to ? and add the
    results back to ? until either no more resolvents
    can be added, or until the empty clause is
    produced.

35
Converting to clausal form
  • To convert a formula KB into clausal form
  • Eliminate implication signs
  • Reduce scope of negation signs
  • Standardize variables
  • Eliminate existential quantifiers using
    skolemization
  • Same as in prop. logic

36
Skolemization
  • General rule is that each occurrence of an
    existentially quantified variable is replaced by
    a skolem function whose arguments are those
    universally quantified variables whose scopes
    includes the scope of the existentially
    quantified one
  • Skolem functions do not yet occur elsewhere !
  • Resulting formula is not logically equivalent !

37
Skolemization examples
  • A well formed formula and its skolem form are not
    logically equivalent. However, a set of formulae
    is (un)satisfiable if and only if its skolem
    form is (un)satisfiable.

38
Converting to clausal form
  • 5. Convert to prenex form
  • Move all universal quantifiers to the front
  • 6. Put the matrix in conjunctive normal form
  • Use distribution rule
  • 7. Eliminate universal quantifiers
  • 8. Eliminate conjunction symbol
  • 9. Rename variables so that no variable in more
    than one clause.

39
Using resolution to prove theorems
40
Resolution Search Strategies
  • Ordering strategies
  • In what order to perform resolution ?
  • Breadth-first, depth-first, iterative deepening ?
  • Unit-preference strategy
  • Prefer those resolution steps in which at least
    one clause is a unit clause (containing a single
    literal)
  • Refinement strategies
  • Linear Input at least one of the clauses being
    resolved is a member of the original set of
    clauses

41
  • Refinement strategies (ctd.)
  • Ancestor c2 is a descendant of c1 iff c2 is a
    resolvent of c1 (and another clause) or if c2 is
    a resolvent of a descendant of c1 (and another
    clause) c1 is an ancestor of c2
  • Set of support the set of clauses coming from
    the negation of the theorem (to be proven) and
    their descendants
  • Set of support strategy require that at least
    one of the clauses in each resolution step
    belongs to the set of support
  • Ancestry filtering require that at least one of
    the clauses in each resolution step belongs to
    original set of clauses or is an ancestor of the
    other clause being resolved.

42
Answer extraction
  • Suppose we wish to prove whether KB (?w)f(w)
  • We are probably interested in knowing the w for
    which f(w) holds.
  • Add Ans(w) literal to each clause coming from the
    negation of the theorem to be proven stop
    resolution process when there is a clause
    containing only Ans literal

43
(No Transcript)
44
Horn clause logic and Prolog
  • SAT for propositional clausal theories is
    NP-complete, but for Horn-clauses it is
    polynomial
  • Inference with first order Horn clauses is also
    more efficient/easier than with full clauses
  • Horn clauses are the basis of Computational
    Logic, Logic Programming and the Prolog
    programming language
  • Horn clauses correspond to rules in a knowledge
    base
  • Very effective model for knowledge representation
  • We just the basics, so called pure Prolog

45
Horn logic/Prolog
46
Proof tree
  • - Moves
  • Moves - Bat_ok, Liftable
  • - Bat_ok, Liftable
  • Bat_ok -
  • - Liftable
  • Liftable -
  • -

47
SLD-derivation
  • - Moves
  • - Bat_ok, Liftable
  • - Liftable
  • -
  • Contains the sequence of goals that arise during
    the computation

48
p.4
These slides are adapted from Peter Flachs
book Simply Logical, John Wiley, 1994.
49
London Underground in Prolog (1)
p.3
  • Connected(Bond_street,Oxfd_circus,Central)
    -Connected(Oxfd_circus,Tottenham_court_road,Cent
    ral)-Connected(Bond_street,Green_park,Jubilee)-
    Connected(Green_park,Vharing_cross,Jubilee)-Conn
    ected(Green_park,Piccadilly_circus,Piccadilly)-C
    onnected(Piccadilly_circus,Leicester_square,Piccad
    illy)-Connected(Green_park,Oxfd_circus,Victoria)
    -Connected(Oxfd_circus,Piccadilly_circus,Bakerlo
    o)-Connected(Piccadilly_circus,Charing_cross,Bak
    erloo)-Connected(Tottenham_court_road,Leicester_
    square,Northern)-Connected(Leicester_square,Char
    ing_cross,Northern)-

50
London Underground in Prolog (2)
p.3-4
  • Two stations are nearby if they are on the same
    line with at most one other station in between
  • Nearby(Bond_street,Oxfd_circus).Nearby(Oxfd_circu
    s,Tottenham_court_road).Nearby(Bond_street,Totten
    ham_court_road).Nearby(Bond_street,Green_park).N
    earby(Green_park,Charing_cross).Nearby(Bond_stree
    t,Charing_cross).Nearby(Green_park,Piccadilly_cir
    cus).
  • or better
  • Nearby(x,y)-Connected(x,y,l).Nearby(x,y)-Connec
    ted(x,z,l),Connected(z,y,l).

51
p.5
  • Compare
  • Nearby(x,y)-Connected(x,y,l).Nearby(x,y)-Conne
    cted(x,z,l),Connected(z,y,l).
  • with
  • Not_too_far(x,y)-Connected(x,y,l).Not_too_far(x
    ,y)- Connected(x,z,l1),Connected(z,y,l2).

52
Proof tree
Fig.1.2, p.7
-Nearby(Tottenham_court_road,w)
Nearby(x1,y1)-Connected(x1,u1,l1)
Connected(Tottenham_court_road,Leicester_square,N
orthern)-
53
p.7
-Nearby(w,Charing_cross)
Nearby(x1,y1)-Connected(x1,z1,l1),Connected(z1,y
1,l1)
Connected(Bond_street,Green_park,Jubilee)
Connected(Green_park,Charing_cross,Jubilee)
54
Recursion (1)
p.8
  • A station is Reachable from another if they are
    on the same line, or with one, two, changes
  • Reachable(x,y)-Connected(x,y,l).Reachable(x,y)-
    Connected(x,z,l1),Connected(z,y,l2).Reachable(x,
    y)- Connected(x,z1,l1),Connected(z1,z2,l2),
    Connected(z2,y,l3).
  • or better
  • Reachable(x,y)-Connected(x,y,l).Reachable(x,y)-
    Connected(x,z,l),Reachable(z,y).

55
Fig. 1.3, p.9
-Reachable(Bond_street,w)
Reachable(x1,y1)-Connected(x1,z1,l1),
Feachable(z1,y1)
Connected(Bond_street, Oxfd_circus,Central)
Reachable(x2,y2)-Connected(x2,z2,l2),
Reachable(z2,y2)
Connected(Oxfd_circus, Tottenham_court_road, Centr
al)
Reachable(x3,y3)-Connected(x3,y3,l3)
Connected(Tottenham_court_road, Leicester_square,
Northern)
56
p.12
Reachable(x,y,Noroute)-Connected(x,y,l). Reachabl
e(x,y,route(z,r))-Connected(x,z,l),
Reachable(z,y,r). -Reachable(Oxfd_
circus,Charing_cross,r).r route(Tottenham_court
_road,route(Leicester_square,Noroute))r
route(piccadilly_circus,Noroute)r
route(Picadilly_circus,route(Leicester_square,Noro
ute))
57
Proof tree
  • -Above(A,C)
  • Above(x,y)-On(x,z),Above(z,y)
  • -On(A,z),Above(z,C)
  • On(A,B)-
  • -Above(B,C)
  • Above(x1,y1)-On(x1,y1).
  • -On(B,C)
  • On(B,C)-
  • -

58
SLD-derivation
  • -Above(A,C)
  • -On(A,z),Above(z,C)
  • -Above(B,C)
  • -On(B,C)
  • -

59
SLD-tree
  • -Above(A,C)
  • / \
  • -On(A,C) -On(A,z),Above(z,C)
  • -Above(B,C)
  • / \
  • -On(B,C) -On(B,z),Above(z,C)
  • - -Above(C,C)
  • / \
  • -On(C,C) -On(C,z),Above(z,C)

60
SLD-derivation
  • SLD
  • Linear resolution with Selection rule for
    Definite clauses
  • SLD-derivation
  • Summarizes one proof path
  • SLD-tree
  • Summarizes all possible proofs
  • Substitutions
  • May be written explicitly

61
SLD-tree
  • Summarizes all possible proofs of the goal
  • Prolog selects leftmost literal in goal to
    resolve upon !
  • Clauses to resolve the literal with are chosen
    according to clause order !
  • Prolog traverses the tree depth-first in order
  • Prolog is incomplete (can get trapped into
    infinite paths in the tree)
  • Prolog is memory efficient (depth-first)
  • Alternatively, iterative deepening or breadth
    first (which would be complete)
  • Do not forget to standardize the variables apart
    in each resolution step !

62
p.44-5
Student_of(x,t)-Follows(x,c),Teaches(t,c).Follow
s(Paul,Computer_science).Follows(Paul,Expert_syst
ems).Follows(Maria,Ai_techniques).Teaches(Adrian
,Expert_systems).Teaches(Peter,Ai_techniques).Te
aches(Peter,Computer_science).
-Student_of(s,Peter)
-Follows(s,c),Teaches(Peter,c)
-Teaches(Peter,Ai_techniques)
-Teaches(Peter,Computer_science)
-Teaches(Peter,Expert_systems)
63
List processing examples
64
(No Transcript)
65
  • - M(B,c(A,c(B,nil)))
  • - M(B,c(B,nil))
  • -
  • Is B a member of A,B ?

66
  • - M(w,c(A,c(B,nil)))
  • \
  • - - M(w,c(B,nil)
  • wA / \
  • - -M(w,nil)
  • wB
  • Generate members w of A,B
  • Backtracking returns all solutions !
  • Prolog returns
  • Yes wA Yes wB Fail.

67
  • - M(B,w)
  • / \
  • - -M(B,w2)
  • wc(B,w1) \
  • - -M(B,w4)
  • wc(u1,c(B,u2))
  • infinite tree
  • Generate lists w that B is a member of ?
Write a Comment
User Comments (0)
About PowerShow.com