Document Sample

Expert Systems Using First Order Logic 1 Outline • Syntax & Semantics • Examples • Wumpus World Example 2 Syntax • Constants: 2, apple, .. • Predicates: >, <, Brother … • Functions: Sqrt, Max, .. • Variables: x, y, a , b, ... • Connectives: ,,, =>, <=> • Equality: = • Quantifiers: , 3 Atomic Sentences • Atomic Sentence = • predicate(Term1, … , Termn) • or term1 = term2 • Term = • function(term1, …, termn) • or constant or variable • e.g. • Sqrt(x) > min( x, 1/x) 4 Complex Sentences • made from atomic sentences using connectives • ( S1), S1 S2… • e.g. Brother( John, Richard) => • Brother( Richard, John) 5 Truth in first-order logic • Sentences are true or false with respect to a model and an interpretation • Model has objects and relations among them • Interpretation maps • constant symbols -> objects • predicate symbols -> relations 6 • function symbols -> functional relations Universal Quantification • <variables> <sentence> • Everyone at Massey is smart • x At(x, Massey) => Smart(x) • The FOR_ALL x is actually a shorthand for writing all possible instantiations of x • e.g. At(Chris, Massey)=>Smart(Chris)AND 7 At(John, Massey)=>Smart(John) Existential Quantification • <variables> <sentence> • Someone at Auckland is smart • x At(x, Auckland) => Smart(x) • The THERE_EXISTS x is a shorthand for writing all possible instantiations of x • e.g. At(Alan, Auckland)=>Smart(Alan)OR 8 At(Jack, Auckland)=>Smart(Jack) Properties of Quantifiers • xy • same as y x • xy • same as y x • xy • NOT same as y x 9 Quantifier Duality • FOR_ALL can be expressed as a THERE_EXISTS and vice-versa • FOR_ALL x Likes(x, IceCream) • x Likes(x, IceCream) • THERE_EXISTS x Likes(x, broccoli) • x Likes(x, broccoli) 10 Examples • Brothers are siblings • Sibling is reflexive • One’s mother is one’s female parent 11 Equality • term1 = term2 under a given interpretation if and only if term1 and term2 refer to the same object • In this way it is possible to restrict the number of possible labels for the same object • FOR_ALL x, y P(x) AND P(y) => x = y 12 FOL KB Overview • Diagnostic Rules • Causal Rules • Effect Axioms • Frame Problem • Qualification Problem • Ramification Problem 13 FOL Knowledge Bases • Additional facts added • TELL( KB, Percept[S, B, NG]) • smell, breeze & no glitter • Query Knowledge base • ASK(KB, THERE_EXIST a, Action(a)) • ASK(KB, S) returns some or all substitutions (sigma) so that KB |= S/sigma14 Deduction • Hidden properties deduced by diagnostic and causal rules • Diagnostic rule:- infer cause from effect • FOR_ALL y Breezy(y) => • THERE_EXIST x, Pit(x) AND Adjacent(x,y) • Causal rule:- infer effect from cause • FOR_ALL x,y Pit(x) AND Adjacent(x,y) => • Breezy(y) 15 Situation Calculus • Facts often only hold at some time • SC:- add a time argument to each non eternal argument • Holding(Gold, now) • Situations connected by results of actions • s1=Result (a, s0),result of action a applied to s0 16 Changing states 17 Describing Actions • Effect axioms • FOR_ALL s AtGold(s) AND a=grab => • Holding(Gold, Result(Grab,s)) • Frame axioms, describe no changes • FOR_ALL s HoldingGold(s) AND a=grab => • Holding(Gold, Result(Grab,s)) 18 Describing Action Cont • Frame problem:- • find elegant way to handle non changes • representation- avoid frame axioms • inference- avoid repeated copy overs • Qualification problem:- • realistic descriptions require endless additional details • Ramification problem:- • realistic problems have endless secondary 19 Successor state axioms • Each axiom about a predicate • P true afterwards <=> • [an action made P true OR • [P already true AND no action made P false]] • FOR_ALL a, s Holding(Gold, Result(a,s)) <=> • [(a=Grab AND AtGold(s)) OR • [Holding(Gold,s) AND a != Release]] 20 Making Plans • Initial Conditions:- At(Agent, [1,1], s0) • At(Gold, [1,2], s0) • Query: • ASK(KB, s Holding(Gold,s)) • Answer: • {s/Result(Grab, Result(Forward,s0))} 21 Plans Extended • Plans are action sequences [a1, a2, .., an] • PlanResult(p,s) • is the result of executing p in s • Query: • ASK(KB, p • Holding(Gold,PlanResult(p,s0)) • Answer 22 • {p/ [Forward, Grab]} Summary • FOL • objects and relations are semantic primitives • syntax: constants, functions, predicates, equality and quantifiers • Situation calculus • actions and change in FOL • planning as inference on a situation calculus knowledge base 23 Inference • Proofs • Unification • Generalized Modus Ponens • Forward and Backward chaining 24 Proofs • Sound Inference: • find alpha such that KB |= alpha • Proof process is search, operators are inference rules 25 Inference Rules • Modus Ponens:- • alpha, alpha => beta / beta • And Introduction:- • alpha, beta / alpha beta • Universal Elimination: • x alpha / alpha{x/ t} 26 Inference Rules cont. • Existential Elimination:- • x alpha / alpha{x/ t’} • Existential Introduction • alpha / x alpha{ t/x} 27 Example Proof • Bob is a buffalo:- • 1. Buffalo(Bob) • Pat is a Pig:- • 2. Pig(Pat) • Buffaloes outrun pigs:- • 3. x, y Buffalo(x) Pig(y) => Faster(x,y) • Bob outruns Pat 28 Example cont • And Introduction (1 & 2 ):- • 4. Buffalo(Bob) Pig(Pat) • Universal Elimination (3), {x/Bob, y/Pat} • 5. Buffalo(Bob) Pig(Pat) => Faster(Bob, Pat) • Modus Ponens (6&7):- • Faster(Bob, Pat) 29 Search with primitive inference rules • Operators are inference rules • States are sets of sentences • Goal test checks state to see if it contains query sentence • AI, UE, MP is a common inference pattern • Problem:- a huge branching factor especially for UE • NEED a substitution that makes the rule 30 premise match some known facts Unification • A substitution sigma unifies atomic sentences p and q if p/sigma = q/sigma p q sigma Knows(John, x) Knows(John, Jane) Knows(John, x) Knows(y,Jane) Knows(John, x) Knows(y, Mother(y)) 31 Generalised Modus Ponens • p1’, p2’, … pn’, (p1 p2 …. Pn => q) • --------------------------------------------- • q/ sigma • where pi’/ sigma = pi/ sigma • GMP used with KB of definite clauses: • a single atomic sentence • (conjunction of atomic sentences) => 32 • (atomic sentence) Example • p1’ = Faster(Bob, Pat), • p2’ = Faster(pat,Steve) • p1 p2 => q = • Faster(x, y) Faster(y, z) => Faster(x,z) • sigma = {x/Bob, y/Pat, z/Steve} • q/sigma = Faster(Bob, Steve) 33 Forward Chaining • When a new fact p is added to KB • for each rule that p unifies with a premise • if other premises are known then add the conclusion to KB and continue chaining • Forward chaining is data driven • inferring properties and categories from percepts 34 Forward chaining example • 1. Buffalo(x) Pig(y) => Faster(x,y) • 2. Pig (y) Slug(z) => Faster(y,z) • 3. Faster(x, y) Faster(y, z) => Faster(x,z) • 4. Buffalo(Bob) [1a, x] • 5. Pig(Pat) [1b, ][2a, x] -> • 6. Faster(Bob, Pat) [3a,x], [3b,x] • 7. Slug(Steve)[2b, ]-> • 8. Faster (pat, Steve) [3a, x][3b, ]-> 35 • Faster(Bob, Steve) [3a,x][3b,x] Backward chaining • When a query q is added to KB • If a matching fact q’ is known, return the unifier • for each rule whose consequent q’ matches q • attempt to prove each premise by backward chaining • Backward chaining is query driven • can try to find one solution or all solutions • Basis of logic programming, e.g. Prolog 36 Backward chaining example • 1. Pig(y) Slug(z) => Faster(y,z) • 2. Slimy(z) Creeps(z) => Slug(z) • 3. Pig(Pat) 4. Slimy(Steve) 5.Creeps(Steve) Faster( y, z) {y/Pat, Z/Steve} 1 Pig(y) Slug(z) {z/Steve} 3 {y/Pat} 2 4 {z/Steve} Slimy(z) Creeps(z) 5 {z/Steve} 37

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 7 |

posted: | 8/14/2011 |

language: | English |

pages: | 37 |

OTHER DOCS BY liaoqinmei

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.