Artificial Intelligence 1: logic agents - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

Artificial Intelligence 1: logic agents

Description:

Unit Resolution. Resolution. TLo (IRIDIA) 9. 10/5/09. Examples in Wumpus World ... Full Resolution Rule is a generalization of this rule: For clauses of length two: ... – PowerPoint PPT presentation

Number of Views:180
Avg rating:3.0/5.0
Slides: 45
Provided by: ericg172
Category:

less

Transcript and Presenter's Notes

Title: Artificial Intelligence 1: logic agents


1
Artificial Intelli-gence 1 logic agents
Notes adapted from lecture notes for CMSC 421 by
B.J. Dorr
  • Lecturer Tom Lenaerts
  • Institut de Recherches Interdisciplinaires et de
    Développements en Intelligence Artificielle
    (IRIDIA)
  • Université Libre de Bruxelles

2
Standard Logical Equivalences
3
Terminology
  • A sentence is valid iff its truth value is t in
    all interpretations (² f)
  • Valid sentences true, false, P Ç P
  • A sentence is satisfiable iff its truth value is
    t in at least one interpretation
  • Satisfiable sentences P, true, P
  • A sentence is unsatisfiable iff its truth value
    is f in all interpretations
  • Unsatisfiable sentences P Æ P, false, true

4
Examples
Sentence
Valid?
wealthy ) wealthy
valid
wealthy Ç wealthy
satisfiable, not valid
wealthy ) happy
w t, h f
inverse
satisfiable, not valid
(w ) h) ) (w ) h)
wf, ht w)h t, w ) h f
contrapositive
valid
(w ) h) ) (h )w)
w Ç h Ç (w) h)
valid
w Ç h Ç w Ç h
5
Examples
Sentence
Valid?
wealthy ) wealthy
valid
wealthy Ç wealthy
satisfiable, not valid
wealthy ) happy
w t, h f
inverse
satisfiable, not valid
(w ) h) ) (w ) h)
wf, ht w)h t, w ) h f
contrapositive
valid
(w ) h) ) (h )w)
w Ç h Ç (w) h)
valid
w Ç h Ç w Ç h
6
Inference
  • KB i a
  • Soundness Inference procedure i is sound if
    whenever KB i a, it is also true that KB ² a
  • Completeness Inference procedure i is complete
    if whenever KB ² a, it is also true that KB i a

7
Validity and Inference
((P Ç H) Æ H) ) P

P

H

P
H

(P
H)

H
((P
H)

H) )
P


Ç
Ç
Æ

Ç
Æ


T

T

T

F

T

T

F

T

T

T

F

T

T

F

T

F

F

F

F

T


8
Rules of Inference
  • a b
  • a b
  • Valid Rules of Inference
  • Modus Ponens
  • And-Elimination
  • And-Introduction
  • Or-Introduction
  • Double Negation
  • Unit Resolution
  • Resolution

9
Examples in Wumpus World
  • Modus Ponens a ) b, a b(WumpusAhead Æ
    WumpusAlive) ) Shoot, (WumpusAhead Æ WumpusAlive)
    Shoot
  • And-Elimination a Æ b a(WumpusAhead Æ
    WumpusAlive) WumpusAlive
  • Resolution a Ç b, b Ç g a Ç g(WumpusDead Ç
    WumpusAhead), ( WumpusAhead Ç Shoot)
    (WumpusDead Ç Shoot)

10
Proof Using Rules of Inference
  • Prove A ) B, (A Æ B) ) C, Therefore A ) C
  • A ) B A Ç B
  • A Æ B ) C (A Æ B) Ç C A Ç B Ç C
  • So A Ç B resolves with A Ç B Ç C deriving
    A Ç C
  • This is equivalent to A ) C

11
Rules of Inference (continued)
  • And-Introduction a1, a2, , an a1 Æ a2 Æ Æ an
  • Or-Introduction ai a1 Ç a2 Ç ai
    Ç an
  • Double Negation a a
  • Unit Resolution (special case of resolution)a Ç
    b Alternatively a ) b b
    b a
    a

12
Wumpus World KB
  • Proposition Symbols for each i,j
  • Let Pi,j be true if there is a pit in square i,j
  • Let Bi,j be true if there is a breeze in square
    i,j
  • Sentences in KB
  • There is no pit in square 1,1R1 P1,1
  • A square is breezy iff pit in a neighboring
    squareR2 B1,1 , (P1,2 Ç P2,1)R3 B1,2 , (P1,1
    Ç P1,3 Ç P2,2)
  • Square 1,1 has no breeze, Square 1,2 has a
    breezeR4 B1,1R5 B1,2

13
Inference in Wumpus World
  • Apply biconditional elimination to R2R6 (B1,1)
    (P1,2 Ç P2,1)) Æ ((P1,2 Ç P2,1) ) B1,1)
  • Apply AE to R6R7 ((P1,2 Ç P2,1) ) B1,1)
  • Contrapositive of R7R8 ( B1,1 ) (P1,2 Ç
    P2,1))
  • Modus Ponens with R8 and R4 ( B1,1)R9 (P1,2
    Ç P2,1)
  • de MorganR10 P1,2 Æ P2,1

14
Searching for Proofs
  • Finding proofs is exactly like finding solutions
    to search problems.
  • Can search forward (forward chaining) to derive
    goal or search backward (backward chaining) from
    the goal.
  • Searching for proofs is not more efficient than
    enumerating models, but in many practical cases,
    its more efficient because we can ignore
    irrelevant propositions

15
Full Resolution Rule Revisited
  • Start with Unit Resolution Inference Rule
  • Full Resolution Rule is a generalization of this
    rule
  • For clauses of length two

16
Resolution Applied to Wumpus World
  • At some point we determine the absence of a pit
    in square 2,2R13 P2,2
  • Biconditional elimination applied to R3 followed
    by modus ponens with R5R15 P1,1 Ç P1,3 Ç P2,2
  • Resolve R15 and R13R16 P1,1 Ç P1,3
  • Resolve R16 and R1R17 P1,3

17
Resolution Complete Inference Procedure
  • Any complete search algorithm, applying only the
    resolution rule, can derive any conclusion
    entailed by any knowledge base in propositional
    logic.
  • Refutation completeness Resolution can always be
    used to either confirm or refute a sentence, but
    it cannot be used to enumerate true sentences.

18
Conjunctive Normal Form
  • Conjunctive Normal Form is a disjunction of
    literals.
  • Example(A Ç B Ç C) Æ (B Ç D) Æ ( A) Æ (B Ç
    C)

19
CNF Example
  • Example (A Ç B) , (C ) D)
  • Eliminate ,
  • ((A Ç B) ) (C ) D)) Æ ((C ) D) ) (A Ç B)
  • Eliminate )
  • ( (A Ç B) Ç ( C Ç D)) Æ ( ( C Ç D) Ç (A Ç B)
    )
  • Drive in negations(( A Æ B) Ç ( C Ç D)) Æ
    ((C Æ D) Ç (A Ç B))
  • Distribute( A Ç C Ç D) Æ ( B Ç C Ç D) Æ (C
    Ç A Ç B) Æ ( D Ç A Ç B)

20
Resolution Algorithm
  • To show KB ² a, we show (KB Æ a) is
    unsatisfiable.
  • This is a proof by contradiction.
  • First convert (KB Æ a) into CNF.
  • Then apply resolution rule to resulting clauses.
  • The process continues until
  • there are no new clauses that can be added (KB
    does not entail a)
  • two clauses resolve to yield empty clause (KB
    entails a)

21
Simple Inference in Wumpus World
  • KB R2 Æ R4 (B1,1 , (P1,2 Ç P2,1)) Æ B1,1
  • Prove P1,2 by adding the negation P1,2
  • Convert KB Æ P1,2 to CNF
  • PL-RESOLUTION algorithm

22
Horn Clauses
  • Real World KBs are often a conjunction of Horn
    clauses
  • Horn clause
  • proposition symbol or
  • (conjunction of symbols) ) symbol
  • ExampleC Æ (B ) A) Æ (C Æ D ) B)

23
Forward Chaining
  • Fire any rule whose premises are satisfied in the
    KB.
  • Add its conclusion to the KB until query is
    found.

24
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
25
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
26
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
27
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
28
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
29
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
30
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
31
Forward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
32
Backward Chaining
  • Motivation Need goal-directed reasoning in order
    to keep from getting overwhelmed with irrelevant
    consequences
  • Main idea
  • Work backwards from query q
  • To prove q
  • Check if q is known already
  • Prove by backward chaining all premises of some
    rule concluding q

33
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
34
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
35
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
36
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
37
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
38
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
39
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
40
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
41
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
42
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
43
Backward Chaining Example
P ) Q L Æ M ) P B Æ L ) M A Æ P ) L A Æ B ) L A B
44
Forward Chaining vs. Backward Chaining
  • FC is data-drivenit may do lots of work
    irrelevant to the goal
  • BC is goal-drivenappropriate for problem-solving
Write a Comment
User Comments (0)
About PowerShow.com