Sep 29
Finish discussion of search methods:
- look at more work by students,
- discuss min/max from
chapter 7
Start material in chap 7 : knowledge representation
The text uses a wumpus world example, which we will look
at some lisp (or python) code for.
Wumpus world:
- grid of rooms
- one room has a wumpus; it moves around and can kill you.
- there are good places (gold)
- and bad places (pits)
- and some percepts that give hints about what's near (wumpus stench, pit breeze).
- you have one arrow that can be shot at the wumpus ... if you can deduce where it is.
All this is to motivate a discussion of deduction, i.e. logic.
logic concepts:
- sentences : well formed in some language. Example: x + y = 4
- truth : each is true or false in a particular world. Example: true if x=1,y=3
- reasoning: deducing new true sentences from a collection of true sentences
- algebra for combining sentences : not, or, and, implies, ...
propositional logic : symbols are sentences
- wumpus world sentences: p1 "there is a pit in position 1"
We want to develop an automated procedure so that given
a set of true sentences about the world, we can automatically
generate new ones. Moreover, given a specific one to test,
we can programmatically find out if the other ones imply it or not.
The idea is to have the software figure out things like :
there's a stench over there, and a pit over there.
Does that mean that the wumpus is over here?
The details of how the automated reasoning work gets a bit involved.
You should read chap 7, and we'll go over the details next week.
For now a few hints:
- KB is the knowledge base, our set of true statements
- each thing our agent sees (percepts) adds to the knowledge base
- proof by contradiction: if you want to prove B (i.e. show that B must be true given your knowledge base KB), then put (not B) into the knowledge base, apply the resolution rules (proof procedure for deducing new sentences), and find a sentence which must be false. Voila: you know that B must be true.
- wikipedia: Conjunctive_normal_form is how we organize our knowledge base
- wikipedia: First-order_resolution is how we mechanically process the proof.
Resolution takes things like
(A or B or C) and (D or E or not C)
and produces
(A or B or D or E)
by removing the matching (C), (not C) and collapsing the two "or" groups into one.
(Exercise : explain why is this valid?)
If the resolution procedure gets down to
(Z) and (not Z)
then resolution produces () which is false, and the original thing we added (not A) must be true.
So the procedure is:
1. Start with knowledge base in conjunctive normal form, i.e.
(A or B or D) and (not B or F) and ...
2. We want to see if some sentence D is logically implied.
3. So we add (not D) to get something like
(A or B or D) and (not B or F) and ... and (not D)
4. Then we go into a loop:
Search (hello!) for matching opposites
(... x ...) ... ( ... not x ... )
and remove them.
5. If the search produces the empty set, then D is proved.
If a complete search doesn't, then we can't tell about D.
The text looks at a number of variations on these idea, including
- other forms for the knowledge base, i.e. wikipedia: Horn clause
- wikipedia: first order logic (with "for all x ..." sorts of variables)
- forward and backward chaining searching
- ... but typically there are still many, many variables to search, and so the tricks from the earlier chapters have to be pulled in
Chapter 7 ends with an example of the wumpus world that uses all this to make decisions.