Automated Deduction - PowerPoint PPT Presentation

About This Presentation
Title:

Automated Deduction

Description:

also called 'theorem provers' or 'inference engines' example application: think about using rules to infer 'right-of-way' in ... inwards (DeMorgans' Laws, x P? ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 18
Provided by: thomasr1
Category:

less

Transcript and Presenter's Notes

Title: Automated Deduction


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)
  • (a?b)?(?a?c)?(b?c)
  • where qunifier(a,a) and bapply(b,q),
    capply(c,q)
  • example
  • ?X ?works_for(X,government) v receives_pension(X)
  • works_for(kate,government) v works_for(kate,walmar
    t)
  • works_for(kate,walmart) v receives_pension(kate)
  • qX/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)...
  • Herbrands 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 (a?b??a?b)
  • 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),?hosti
    le(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
    )

7
(No Transcript)
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
  • 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). Xal Xsue
12
Map-Coloring in Prolog
color(red). color(green). color(blue). color(yello
w). valid_coloring(A,B,C,D,E) -
color(A),color(B),color(C),color(D),color(E),
not AB, not AC, not AD, not AE, not BC,
not BD, not CD, not DE.
  • effectively enumerates all combinations of colors
    and tests them for consistency.
  • will try Ared, Bred, Cred, Dred, Ered first
  • fail, because doesnt satisfy not AB.
  • then back-track to Ared, Bred, Cred, Dred,
    Egreen, which fails not AC.
  • and so on, until reach Ared, Bgreen, Cblue,
    Dyellow, Egreen
  • 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). Bsam. Btweety.
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
  • 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 1980s
  • 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
  • http//www.siliconvalleyone.com/clips.htm
  • JESS
  • re-implementation in Java at Sandia National Lab
  • http//www.jessrules.com/

17
  • syntax (defrule name PATTERN gt ACTION)
  • (defrule welcome-toddlers
  • (person ?X) (age ?X ?Y) (lt ?Y 3))
  • gt
  • (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))
  • gt (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)
Write a Comment
User Comments (0)
About PowerShow.com