Top Banner
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material
21

1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

Dec 13, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

1

Logical Inference Algorithms

CS 171/271(Chapter 7, continued)

Some text and images in these slides were drawn fromRussel & Norvig’s published material

Page 2: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

2

Inference Rules Modus Ponens

,

And-Elimination

Logical Equivalences

Page 3: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

3

Logical Equivalences

Page 4: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

4

Validity and Satisfiability A sentence is valid if it is true in all

models KB╞ iff (KB ) is valid

(deduction theorem) A sentence is satisfiable if it is true in some model KB╞ iff (KB ) is unsatisfiable

(proof by contradiction) is satisfiable iff is not valid

is valid iff is unsatisfiable

Page 5: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

5

Resolution Inference Rule Simple case:

a b, b c a c(b and b are complementary literals that are eliminated)

General case:replace a and c with disjunctions of any number of literals

Page 6: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

6

Conjunctive Normal Form Any sentence can be converted to a

logically equivalent sentence that is a conjunction of disjunctions of literals Ands of or-clauses This can be done by repeated applications of

biconditional elimination, implication elimination and distributivity

Motivation: if KB is in CNF, can devise an inference algorithm based on resolution

Page 7: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

7

Algorithm Using Resolution Convert (KB ) to conjunctive

normal form (CNF) Get pairs of clauses and eliminate

complementary literals if they exist If an empty clause results, (KB

) is unsatisfiable, which means KB╞ Proof by contradiction

Page 8: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

8

Resolution

Page 9: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

9

Resolution Example

KB = (B1,1 (P1,2 P2,1)) B1,1 α = P1,2

Page 10: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

10

Restricted Knowledge Bases If sentences in the KB are of a

particular form, inference may turn out to be easier, simpler, quicker

Full power of resolution not really needed in many practical situations

Case in point: Horn Clauses

Page 11: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

11

Horn Clauses Horn-Clause

Clause of or-ed literals where at most one literal is positive

Can be converted to an implication Example: ( a b c ) ( a b c )

Can use Modus Ponens and chaining in an entailment procedure

Page 12: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

12

Forward Chaining Algorithm Assume KB contains

single (positive) symbols known to be true implications

Implications with premises that contain the symbols yield new symbols once premise has been satisfied

Continue until q (the query symbol) is encountered

Page 13: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

13

Forward Chaining

Page 14: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

14

Forward-Chaining Example

Page 15: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

15

Backward-Chaining Variant of chaining that starts with

target query q Look for implications that conclude q

Take note of its premises If one of those premises can be shown

true (also by backward chaining), then q is true

Goal-directed reasoning

Page 16: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

16

Analysis of Inference Algorithms Soundness Completeness Time Complexity

Page 17: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

17

Improvement toModel Checking DPLL algorithm Same as Model Enumeration with

some improvements: Early termination Pure symbol heuristic Unit clause heuristic

Page 18: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

18

DPLL (Backtracking)

Page 19: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

19

An Inference Agentin the Wumpus World KB initially contains sets of sentences

that: State absence of pit in room [1,1] State absence of wumpus in room [1,1] State how a breeze arises State how a stench arises Knows there is exactly one wumpus

At least one wumpus Of two squares, one should not have wumpus

155 sentences with 64 distinct symbols

Page 20: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

20

An Inference Agentin the Wumpus World

On each percept: TELL status of stench or breeze Grab if glitter is perceived ASK if there is a provably safe

square, or at least a possible safe square, then go there May need a list of actions to go there

Page 21: 1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.

21