230 likes | 440 Views
CHAPTER 7. LOGICAL AGENT. 석사 1 차 지 애 띠. OUTLINE. KNOWLEDGE-BASED AGENTS THE WUMPUS WORLD LOGIC PROPOSITIONAL LOGIC AGENT BASED ON PROPOSITIONAL LOGIC. KNOWLEDGE-BASED AGENTS. Knowledge Base - a set of representations of facts about the world
E N D
CHAPTER 7.LOGICAL AGENT 석사 1차 지 애 띠
OUTLINE • KNOWLEDGE-BASED AGENTS • THE WUMPUS WORLD • LOGIC • PROPOSITIONAL LOGIC • AGENT BASED ON PROPOSITIONAL LOGIC
KNOWLEDGE-BASED AGENTS • Knowledge Base - a set of representations of facts about the world - a set of sentences that is expressed in a knowledge representation language • Knowledge-Based Agent deriving new sentence from old one Inference engine Knowledgebase
KNOWLEDGE-BASED AGENTS • Outline of a knowledge-Based Agent • First, it TELLs the KB what it perceives (a way to add new sentences to the KB) • Second, it ASKs the KB what action it should perform (a way to query what is known) function KB-AGENT(percept) returns an action static:KB, a knowledge base t, a counter, initially 0, indicating time TELL(KB, MAKE-PERCEPT-SENTENCE(percept,t)) action - ASK(KB, MAKE-ACTION-QUERY(t)) TELL(KB, MAKE-ACTION-SENTENCE(action,t)) t t + 1 returnaction
THE WUMPUS WORLD • Performance measure • Environment • Actuators – turn left, turn right, die, forward, grab, shoot • Sensors • the agent will perceive a stench in the square containing the wumpus and the directly adjacent squares • the agent will perceive a breeze in the squares directly adjacent to a pit • the agent will perceive a glitter in the square where the gold is • the agent will perceive a bump when it walks into a wall • the agent will perceive a scream anywhere in the cave when the wumpus is killed.
A = Agent B = Breeze G = Glitter, Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus THE WUMPUS WORLD
P? P? W! S G V OK OK P? V V S OK OK P? P! V B V THE WUMPUS WORLD 1, 4 2, 4 3, 4 4, 4 A = Agent B = Breeze G = Glitter, Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus 1, 3 2, 3 3, 3 4, 3 1, 2 2, 2 3, 2 4, 2 1, 1 2, 1 3, 1 4, 1 A
LOGIC • Logic • formal language for provided the syntax and semantics are defined precisely • Syntax - the sentences in the language ex) x y • Semantics - the “meaning” of sentences ex) x y is false when y is bigger than x, and true otherwise • Model – possible world
i i i LOGIC • KB :“KB entails ” KB entails sentence if and only if is true in all worlds where KB is true • KB :“ is derived from KB by i” or “i derives from KB” • Soundness i is sound if whenever KB , it is also true that KB • Completeness i is complete ifwhenever KB , it is also true that KB
PROPOSITIONAL LOGIC : Syntax • Logical constant : True or False • Logical connective → ∧ | ∨ | ⇒ | ⇔| ㄱ • BNF(Bacus-Naur Form) • Sentence AtomicSentence | ComplexSentence • AtomicSentence True | False | Symbol • Symbol P | Q | R | … • ComplexSentence ㄱSentence • | Sentence ∧ Sentence • | Sentence ∨ Sentence • | Sentence ⇒ Sentence • | Sentence ⇔ Sentence
P Q ㄱP P∧Q P∨Q P⇒Q P⇔Q False False True False False True True False True True False True True False True False False False True False False True True False True True True True PROPOSITIONAL LOGIC : Semantics • Truth Table • Equivalence, Validity, & Satisfiability • Two sentences are equivalence if they are true in the same set of models • A sentence is valid if it it true in all models • A sentence is satisfiable if it is true in some model • A sentence is unsatisfiable if it is true in no models
α∨β, ㄱβ∨γ α∨γ ㄱα⇒β, β⇒γ ㄱα⇒γ = PROPOSITIONAL LOGIC : Inference • Modus Ponens (=Implication-Elimination) • And-Elimination • Double-Negation Elimination • Unit Resolution • Resolution α⇒ β, α β α1∧α2∧α3∧...∧αn αi ㄱㄱα α α∨β, ㄱβ α
1,4 2,4 3,4 4,4 1,3 W! 2,3 3,3 4,3 1,2 A S OK 2,2 OK 3,2 4,2 1,1 V OK 2,1 B V OK 3,1 P! 4,1 AGENT BASED ON PROPOSITIONAL LOGIC • Current state ㄱS1,1ㄱS2,1 S1,2 ㄱB1,1 B2,1ㄱB1,2 • Rules • R1 ㄱS1,1⇒ ㄱW1,1∧ㄱW1,2∧ㄱW2,1 • R2 ㄱS2,1⇒ ㄱW1,1∧ㄱW2,1∧ㄱW2,2∧ㄱW3,1 • R3 S1,2⇒ W1,3∨W1,2∨W2,2∨W1,1
AGENT BASED ON PROPOSITIONAL LOGIC • 1. Modus Ponens & And-Elimination : ㄱS1,1 & R1 ㄱW1,1 ㄱW1,2ㄱW2,1 • 2. Modus Ponens & And-Elimination : ㄱS2,1 & R2 ㄱW2,2 ㄱW2,1 ㄱW3,1 • 3. Modus Ponens : S1,2 & R4 W1,3∨W1,2∨W2,2∨W1,1 • 4. Unit Resolution α : W1,3∨W1,2∨W2,2 β : W1,1 (ㄱW1,1 from 1) W1,3∨W1,2∨W2,2 • 5. Unit Resolution α : W1,3∨W1,2∨W2,2 β : W2,2 (ㄱW2,2 from 2) W1,3∨W1,2 • 6. nit Resolution α : W1,3∨W1,2 β : W1,2 (ㄱW1,2 from 2) W1,3
AGENT BASED ON PROPOSITIONAL LOGIC • Finding pits and wumpuses using logical inference • A knowledge base that states the “physics” of the wumpus world : ㄱP1,1 and ㄱW1,1 • Bx,y ⇔ (Px,y+1 ∨ Px,y-1 ∨ Px+1,y ∨ Px-1,y) • Sx,y ⇔ (Wx,y+1 ∨ Wx,y-1 ∨ Wx+1,y ∨ Wx-1,y) • W1,1 ∨ W1,2 ∨ … ∨ W4,3 ∨ W4,4 - at least one • To say that there in at most one wumpus, we needs a total of 155 sentences containing 64 distinct symbols • Keeping track of location and orientation • Lx,y ∧ FacingRightt ∧ Forwardt ⇒ Lt+1x+1,y • Propositions need to depend on time • If a agent moves 100 steps, it needs 6400 rules
SUMMARY • Propositional Logic • Syntax : formal structure of sentences • Semantics : truth of sentences • Validity & Inference • Problems of propositional logic • In First-order logic, 6400 propositional rules 1