Logical Reasoning I Lecture 4 2 January 25


















![Exploring the world Perception: Stench, Breeze, Glitter, Bump, Scream Perceive: [None, None] Lecture 4 Exploring the world Perception: Stench, Breeze, Glitter, Bump, Scream Perceive: [None, None] Lecture 4](https://slidetodoc.com/presentation_image_h2/5059170f5e6272a96e23ae6b00381934/image-19.jpg)






- Slides: 25
Logical Reasoning I Lecture 4 -2 January 25 th, 1999 CS 250 Lecture 4 -1 CS 250: Intro to AI/Lisp
Announcements • • • Unix classes Office hours today TA (Office hours, Style) Quiz Midterm on Tuesday of 6 th Week Project descriptions by email by end of week • Lisp for Windows Lecture 4 -1 CS 250: Intro to AI/Lisp
A Little Lisp • What about progn? • Validity checking? Lecture 4 -1 CS 250: Intro to AI/Lisp
Designing an Interplanetary Explorer • Goals for the explorer • Actions we can take • Situations that might arise Lecture 4 -1 CS 250: Intro to AI/Lisp
Telling Your Computer about the World • What you know • How to go from what you know to what you don’t know • Will Rogers Lecture 4 -1 CS 250: Intro to AI/Lisp
Knowledge Base Knowledge base: Database : : Knowledge: Data • KB stores what the computer knows about the world • Knowledge representation language – How we encode knowledge about the world – Each bit of knowledge is a sentence Lecture 4 -1 CS 250: Intro to AI/Lisp
Getting through to your computer • KB Interaction – Tell: Add new sentences to the KB – Ask: Query what’s known (or what follows from what is known) Lecture 4 -1 CS 250: Intro to AI/Lisp
Tell-Ask. lisp I ; ; Main Functions on KBs: Tell, Retract, Ask-Each, ; ; Ask, Ask-Pattern[s] ; ; ; First we define a very simple kind of knowledge base, ; ; ; literal-kb, that just stores a list of literal sentences. (defstructure literal-kb "A knowledge base that just stores a set of literal sentences. " (sentences '())) Lecture 4 -1 CS 250: Intro to AI/Lisp
Tell-Ask. lisp II ; ; ; ; ; There are three generic functions that operate on knowledge bases, and that must be defined as methods for each type of knowledge base: TELL, RETRACT, and ASK-EACH. Here we show the implementation for literal-kb; elsewhere you'll see implementations for propositional, Horn, and FOL KBs. (defmethod tell ((kb literal-kb) sentence) "Add the sentence to the knowledge base. " (pushnew sentence (literal-kb-sentences kb) : test #'equal)) (defmethod retract ((kb literal-kb) sentence) "Remove the sentence from the knowledge base. " (deletef sentence (literal-kb-sentences kb) : test #'equal)) (defmethod ask-each ((kb literal-kb) query fn) "For each proof of query, call fn on the substitution that the proof ends up with. " (declare (special +no-bindings+)) (for each s in (literal-kb-sentences kb) do Lecture(when 4 -1 CS 250: (funcall Intro to AI/Lisp fn +no-bindings+)))) (equal s query)
Tell-Ask. lisp III ; ; ; There are three other ASK functions, defined below, that are defined in terms of ASK-EACH. These are defined once and for all here (not for each kind of KB). " (defun ask (kb query) "Ask if query sentence is true; return t or nil. " (ask-each kb (logic query) #'(lambda (s) (declare (ignore s)) (RETURN-FROM ASK t)))) ; ; ; Omitted pattern-matching ASK’s Lecture 4 -1 CS 250: Intro to AI/Lisp
Knowledge-Based Agents perceive the world around them Perceptions are recorded in the KB Actions are chosen based on the KB Results of actions are recorded Lecture 4 -1 CS 250: Intro to AI/Lisp
Levels of Agents • Knowledge level – What an agent knows – Planetary core samples must be taken at least 100 mm below the surface • Logical level – Knowledge is encoded at this level – Min. Depth(Core. Sample, 100) • Implementation level – Inside the machine Lecture 4 -1 CS 250: Intro to AI/Lisp
Building Knowledge Agents • Lean on the inference mechanism – Tell agent what it needs to know • Declarative – Declare the state of the world, and let ‘er rip • Adding learning – Reacting to percepts Lecture 4 -1 CS 250: Intro to AI/Lisp
Separate Domain-Specific from the General Lecture 4 -1 CS 250: Intro to AI/Lisp
Wumpus World Lecture 4 -1 CS 250: Intro to AI/Lisp
Specifying the Wumpus World • Percepts? • Actions? • Goals? Lecture 4 -1 CS 250: Intro to AI/Lisp
Describing the Wumpus World • Is the world… – Deterministic – Fully accessible – Static – Discrete Lecture 4 -1 CS 250: Intro to AI/Lisp
One Environment is Easy • If we know the environment well, can engineer it • Range of environments? Lecture 4 -1 CS 250: Intro to AI/Lisp
Exploring the world Perception: Stench, Breeze, Glitter, Bump, Scream Perceive: [None, None] Lecture 4 -1 CS 250: Intro to AI/Lisp
Move Forward to 2, 1 Lecture 4 -1 CS 250: Intro to AI/Lisp
Perception after One Move Lecture 4 -1 Stench: None Breeze: Yes Glitter: None Bump: None Scream: None CS 250: Intro to AI/Lisp
What Does the World Look Like? Lecture 4 -1 CS 250: Intro to AI/Lisp
Knowledge Representation • Not just computer readable… …computer reasonable as well • Syntax - Rules for building expressions • Semantics - Relationship between facts in the world and sentences • Examples? Lecture 4 -1 CS 250: Intro to AI/Lisp
Entailment • What follows from what • Entailment is relationship among sentences – KB entails a • “Follows” is a relationship among facts in the world • Inference procedures that generate only entailed sentences is sound Lecture 4 -1 CS 250: Intro to AI/Lisp
Logical Committment Lecture 4 -1 CS 250: Intro to AI/Lisp