Download presentation

Presentation is loading. Please wait.

Published byIsabel Bicknell Modified over 2 years ago

1
**Automated Deduction resolution (Otter) backward-chaining (Prolog)**

forward-chaining (Rete, Clips, Jess) also called “theorem provers” or “inference engines” example application: think about using rules to infer “right-of-way” in a driving simulation

2
**Resolution first-order (with unification) example**

(ab)(a’c)ᅡ(b”c”) where q=unifier(a,a’) and b”=apply(b,q), c”=apply(c,q) example X works_for(X,government) v receives_pension(X) works_for(kate,government) v works_for(kate,walmart) works_for(kate,walmart) v receives_pension(kate) q={X/kate}

3
**resolution is refutation-complete for FOL**

must convert all sentences to CNF a ground instance of a clause is formed by instantiating all variables with some constant P(X,Y)vQ(Y,Y) : {P(sam,bill)vQ(bill,bill); P(sam,joe)vQ(joe,joe)...} Herbrand’s Theorem: if a set of sentences is unsatisfiable, then there exists a set of ground (propositional) instances that is unsatisfiable Ground Resolution Theorem: if a set of propositional clauses is unsatisfiable, then there is a finite derivation of the empty clause Lifting Lemma: If there is proof of the empty clause using ground instances, then there is parallel proof using the original clauses with variables (using unification)

4
**Converting FOL sentences to CNF**

eliminate implications (abᅡab) move neg. inwards (DeMorgans’ Laws, x Pᅡx P) standardize variables apart (if X is used in multiple quantifiers, replace instance with X1, X2...) skolemization (replace vars with *new* constants) drop universal quantifiers distribute over break conjunctions into separate clauses “Everyone who loves all animals is loved by someone.” x (y animal(y)loves(x,y))y loves(y,x)

5
Example “The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missles, and all of its missles were sold to it by Colonel West, who is an American.” Prove that Colonel West is a criminal. x,y,z american(x)&weapon(y)&sells(x,y,z)&hostile(z) criminal(x) x owns(nono,x)&missle(x) x owns(nono,x)&missle(x)sells(west,x,nono) x missle(x)weapon(x) x enemy(x,america)hostile(x) american(west), enemy(nono,america) negation of query: criminal(west)

6
convert to CNF x,y,z american(x)&weapon(y)&sells(x,y,z)&hostile(z) criminal(x) {american(x1),weapon(y1),sells(x1,y1,z1),hostile(z1), criminal(x1)} x missle(x)weapon(x) {missle(x2),weapon(x2)} x owns(nono,x)&missle(x)sells(west,x,nono) {owns(nono,x3), missle(x3),sells(west,x3,nono)} x owns(nono,x)&missle(x) {owns(nono,M),missle(M)} – M is a skolem constant x enemy(x,america)hostile(x) {enemy(x4,america),hostile(x4)} american(west), enemy(nono,america),criminal(west)

8
**maybe thousands of clauses – difficult search **

search strategies: which clauses to resolve? unit preference: one clause must be of length 1 guarantees to reduce length of other clause (toward 0) set of support: one clause must be from the sos, e.g. negated query “source” of the unsatisfiability input resolution: one clause must be from the input (KB or query) linear resolution one clause must be from negated query OR a successor derived from it complete Otter – a real-world resolution theorem prover

9
**Backward-chaining recall: subgoal stack KB must be in Horn-clause form**

try to reduce to facts; might have to back-track KB must be in Horn-clause form in FOL, use unification for popped subgoal, try to unify with fact or head of some clause Prolog – a practical implementation of a back-chaining theorem prover funky syntax can be used for many solving many problems learn how to use back-chaining as “computational model” widely employed for expert systems, intelligent agents, control applications...

10
**Prolog syntax facts: predicate(args,...). rules:**

no quantifiers, variables in capital letters, written backwards, “:-” means “” , read as “if” “,” means conjunction; no disjunction X dog(X) mammal(X) mammal(X) :- dog(X). canPlay(Child) :- hasEaten(Child,dinner),finished(Child,homework). also support for strings, lists, numbers...

11
**Problem solving by back-chaining **

combinatorial enumeration/search (unbound variables) often interested in variable binding of solution father(X,Y) :- parent(X,Y),male(X). mother(X,Y) :- parent(X,Y),female(X). sibling(X,Y) :- parent(Z,X),parent(Z,Y). grandparent(X,Y) :- parent(X,Z),parent(Z,Y). uncle(X,Y) :- parent(Z,Y),sibling(X,Z),male(X). male(john). male(sam). male(joe). male(bill). female(sue). female(ellen). parent(sam,john), parent(ellen,john). parent(ellen,joe). parent(sam,joe). parent(sue,bill). parent(al,sam). parent(sue,ellen). query: ?- uncle(bill,john). yes. query: ?- uncle(sue,john). fail. query: ?- grandparent(X,john). X=al; X=sue

12
**Map-Coloring in Prolog**

color(red). color(green). color(blue). color(yellow). valid_coloring(A,B,C,D,E) :- color(A),color(B),color(C),color(D),color(E), not A=B, not A=C, not A=D, not A=E, not B=C, not B=D, not C=D, not D=E. effectively enumerates all combinations of colors and tests them for consistency. will try A=red, B=red, C=red, D=red, E=red first fail, because doesn’t satisfy not A=B. then back-track to A=red, B=red, C=red, D=red, E=green, which fails not A=C. and so on, until reach A=red, B=green, C=blue, D=yellow, E=green not very efficient, but illustrative of the kind of combinatorial problem-solving that can be simulated via back-chaining

13
**Negation in Prolog Can have negative literals in antecedents.**

not strict FOL semantics “negation-as-failure” ...,not p(X),... means try to prove p(X) (by back-chaining with current variable bindings) if cannot prove it, then proceed if can prove it, then fail and back-track very handy – allows default inference, compact KB canFly(X) :- bird(X),not broken(wings(X)). bird(X) :- canary (X). bird(X) :- penguin(X). bird(X) :- eagle(X). canary(tweety). penguin(opus). eagle(sam). broken(wings(opus)). ?- canFly(B). B=sam. B=tweety.

14
**Forward-Chaining requires Horn-clause KB**

combining universally-quantified rules with ground facts can generate many inferences how to do this efficiently Rete algorithm generates a graph structure firing rules to create nodes “production system”, basis of many expert systems e.g. XCON or R1, for configuring computers, or MYCIN for diagnosing blood diseases also the basis of “cognitive architectures” like ACT and SOAR (Allan Newell and Herb Simon) based on theory that brain does symbolic pattern matching, which triggers associations that activate other concepts...

15
**grandparent(sue,john)**

Rete algorithm until quiescence... find all rules that could fire (i.e. are “activated” by a combination of input nodes, see colors below) pick rule with highest priority (conflict resolution) unify antecedent with incoming edges apply unifier to consequent; create new node uses hash tables and many other optimizations for efficiency father(X,Y) :- parent(X,Y),male(X). mother(X,Y) :- parent(X,Y),female(X). sibling(X,Y) :- parent(Z,X),parent(Z,Y). grandparent(X,Y) :- parent(X,Z),parent(Z,Y). uncle(X,Y) :- parent(Z,Y),sibling(X,Z),male(X). male(john). male(sam). male(joe). male(bill). female(sue). female(ellen). parent(sam,john), parent(ellen,john). parent(ellen,joe). parent(sam,joe). parent(sue,bill). parent(al,sam). parent(sue,ellen). uncle(bill,john) sibling(bill,ellen) mother(sue) grandparent(sue,john)

16
**practical implementations of Rete (forward-chaining inference engines)**

CLIPS invented at NASA in 1980’s used for many applications, especially discrete simulations, e.g. of traffic flow, shuttle operation, clock mechanisms, agents encode rules in KB; executes forward-chaining by Rete JESS re-implementation in Java at Sandia National Lab

17
**syntax: (defrule name PATTERN => ACTION)**

(defrule welcome-toddlers (person ?X) (age ?X ?Y) (< ?Y 3)) => (assert (toddler ?X)) (printout t "Hello, little one!" crlf)) (defrule library-rule-1 (book (name ?X) (status late) (borrower ?Y)) (borrower (name ?Y) (address ?Z)) => (send-late-notice ?X ?Y ?Z)) pattern-match left-hand side execute right-hand side actions: assert, retract, printout... can have structured “objects” with “slots” can define functions... can call invoke external procedures (e.g. graphics)

Similar presentations

OK

Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.

Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Simple ppt on the circulatory system Ppt on film industry bollywood dance Ppt on tourism industry in india Ppt on relations and functions for class 11th economics Ppt on endangered and extinct species in india What does appt only meaning Ppt on positive thinking tips Ppt on mars one scam Ppt on 2004 tsunami in india Ppt on how to produce electricity from footsteps