PPT

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
Inference Rules



Modus Ponens
  , 

And-Elimination


Logical Equivalences
2
Logical Equivalences
3
Validity and Satisfiability

A sentence is valid if it is true in all models


A sentence is satisfiable if it is true in some
model


KB╞  iff (KB  ) is valid
(deduction theorem)
KB╞  iff (KB  ) is unsatisfiable
(proof by contradiction)
 is satisfiable iff  is not valid
 is valid iff  is unsatisfiable
4
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
5
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
6
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
7
Resolution
8
Resolution Example
KB = (B1,1  (P1,2 P2,1))  B1,1
P1,2
α=
9
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
10
Horn Clauses

Horn-Clause


Can be converted to an implication


Clause of or-ed literals where at most one
literal is positive
Example: ( a  b  c )  ( a  b  c )
Can use Modus Ponens and chaining in
an entailment procedure
11
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
12
Forward Chaining
13
Forward-Chaining Example
14
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
15
Analysis of Inference
Algorithms



Soundness
Completeness
Time Complexity
16
Improvement to
Model Checking


DPLL algorithm
Same as Model Enumeration with some
improvements:



Early termination
Pure symbol heuristic
Unit clause heuristic
17
DPLL (Backtracking)
18
An Inference Agent
in 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
19
An Inference Agent
in 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
20
21