Inference Techniques for Logical Reasoning Recall: Wumpus World - - PowerPoint PPT Presentation

inference techniques for logical reasoning recall wumpus
SMART_READER_LITE
LIVE PREVIEW

Inference Techniques for Logical Reasoning Recall: Wumpus World - - PowerPoint PPT Presentation

CSE 473 Chapter 7 Inference Techniques for Logical Reasoning Recall: Wumpus World Wumpus You (Agent) 2 Wumpusitional Logic Proposition Symbols and Semantics: Let P i,j be true if there is a pit in [i, j]. Let B i,j be true if there is a


slide-1
SLIDE 1

CSE 473

Chapter 7 Inference Techniques for Logical Reasoning

slide-2
SLIDE 2

2

Recall: Wumpus World

Wumpus You (Agent)

slide-3
SLIDE 3

3

Wumpusitional Logic

Proposition Symbols and Semantics: Let Pi,j be true if there is a pit in [i, j]. Let Bi,j be true if there is a breeze in [i, j].

slide-4
SLIDE 4

Wumpus KB

  • Statements currently known

to be true:

  • P1,1
  • B1,1

B2,1

  • Properties of the world: E.g.,

"Pits cause breezes in adjacent squares" B1,1  (P1,2  P2,1) B2,1  (P1,1  P2,2  P3,1) (and so on for all squares) Knowledge Base (KB) includes the following sentences:

slide-5
SLIDE 5

Is there no pit in [1,2]? KB ╞ P1,2 ? Recall from last time: m is a model of a sentence  if  is true in m M() is the set of all models of  KB ╞  (KB “entails” ) iff M(KB)  M()

slide-6
SLIDE 6

M(KB)  M(1)

𝟐 = P1,2

Therefore, KB ╞ P1,2

slide-7
SLIDE 7

7

Inference by Truth Table Enumeration

  • P1,2

In all models in which KB is true, P1,2 is also true Therefore, KB ╞ P1,2

P1,2 KB

Model 1 Model 2 : :

slide-8
SLIDE 8

8

Another Example

Is there a pit in [2,2]?

slide-9
SLIDE 9

9

Inference by Truth Table Enumeration

P2,2 is false in a model in which KB is true Therefore, KB ╞ P2,2

KB P2,2

slide-10
SLIDE 10

10

Inference by TT Enumeration

  • Algorithm: Depth-first enumeration of all

models (see Fig. 7.10 in text for pseudocode)

  • Algorithm sound?

Yes

  • Algorithm complete?

Yes

  • For n symbols, time and space?
  • time complexity =O(2n), space = O(n)
slide-11
SLIDE 11

11

Other Inference Techniques Rely on Logical Equivalence Laws

Two sentences are logically equivalent iff they are true in the same models: α ≡ ß iff α╞ β and β╞ α

slide-12
SLIDE 12

12

Inference Techniques also rely on Validity and Satisfiability

  • A sentence is valid if it is true in all models (a

tautology) e.g., True, A  A, A  A, (A  (A  B))  B

  • Validity is connected to inference via the Deduction

Theorem: KB ╞ α if and only if (KB  α) is valid

  • A sentence is satisfiable if it is true in some model

e.g., A  B, C

  • A sentence is unsatisfiable if it is true in no models

e.g., A  A

  • Satisfiability is connected to inference via the

following: KB ╞ α if and only if (KB  α) is unsatisfiable (proof by contradiction)

slide-13
SLIDE 13

13

Inference/Proof Techniques

  • Two kinds (roughly):

1. Model checking

  • Truth table enumeration (always exponential in n)
  • Efficient backtracking algorithms,

e.g., Davis-Putnam-Logemann-Loveland (DPLL)

  • Local search algorithms (sound but incomplete)

e.g., randomized hill-climbing (WalkSAT)

  • 2. Successive application of inference rules
  • Generate new sentences from old in a sound way
  • Proof = a sequence of inference rule applications
  • Use inference rules as successor function in a

standard search algorithm

Let us look at a #2 type technique: Resolution…

slide-14
SLIDE 14

14

Inference Technique I: Resolution

There is a pit in [1,3] or There is a pit in [2,2] There is no pit in [2,2] There is a pit in [1,3]

More generally, l1 …  lk,

  • li

l1  …  li-1  li+1  …  lk

Motivation

slide-15
SLIDE 15

15

Resolution

Terminology: Literal = proposition symbol or its negation E.g., A, A, B, B, etc. Clause = disjunction of literals E.g., (B  C  D) Resolution assumes sentences are in Conjunctive Normal Form (CNF): sentence = conjunction of clauses E.g., (A  B)  (B  C  D)

slide-16
SLIDE 16

16

Conversion to CNF

E.g., B1,1  (P1,2  P2,1) 1. Eliminate , replacing α  β with (α  β)(β  α).

(B1,1  (P1,2  P2,1))  ((P1,2  P2,1)  B1,1)

  • 2. Eliminate , replacing α  β with α β.

(B1,1  P1,2  P2,1)  ((P1,2  P2,1)  B1,1)

  • 3. Move  inwards using de Morgan's rule:

(B1,1  P1,2  P2,1)  ((P1,2  P2,1)  B1,1)

  • 4. Apply distributivity law ( over ) and flatten:

(B1,1  P1,2  P2,1)  (P1,2  B1,1)  (P2,1  B1,1) This is in CNF – Done!

slide-17
SLIDE 17

17

Inference Technique: Resolution

  • General Resolution inference rule (for CNF):

l1 …  li …  lk, m1  …  mj …  mn

l1  …  li-1  li+1  …  lk  m1  …  mj-1  mj+1 ...  mn

where li and mj are complementary literals i.e. li = mj . E.g., P1,3  P2,2,

  • P2,2

P1,3

slide-18
SLIDE 18

18

Soundness of Resolution Inference Rule

(Recall logical equivalence A  B  A  B) Express each clause as:

  • (l1  …  li-1  li+1  …  lk)  li
  • mj  (m1  …  mj-1  mj+1 ...  mn)
  • (li  …  li-1  li+1  …  lk)  (m1  …  mj-1  mj+1 ...  mn)

(since li = mj)

slide-19
SLIDE 19

19

Resolution algorithm

  • To show KB ╞ α, use proof by contradiction,

i.e., show KB  α unsatisfiable

slide-20
SLIDE 20

20

Resolution example

KB = (B1,1  (P1,2 P2,1))  B1,1 and  = P1,2

Resolution: Convert to CNF and show KB   is unsatisfiable

Given no breeze in [1,1], prove there’s no pit in [1,2]

slide-21
SLIDE 21

21

Resolution example

Empty clause (i.e., KB   α unsatisfiable)

slide-22
SLIDE 22

22

Next Time

  • WalkSAT
  • Logical Agents: Wumpus
  • First-Order Logic
  • To Do:

Project #2 Finish Chapter 7 Start Chapter 8