Artificial Intelligence Sanguk Noh Logical Agents Agents that reason logically A Knowledge-Based Agent. function KB-Agent (percept) returns an action Tell(KB, Make-Percept-Sentence(percept,t)) action Ask(KB, Make-Action-Query(t)) Tell(KB, Make-Action-Sentence(action,t)) t t+1 return action. Tell: add new sentences to the KB. Ask: query what is known
A Knowledge-Based Agent KB a set of representations of facts about world declarative: adding one by one the sentences that represent the designer s knowledge learning: create general knowledge about the environment given a series of percepts fully autonomous agent Logic: representation, reasoning, and learning A Knowledge-Based Agent * inference Mechanism - What can we deduce? e.g.) If ~breeze and ~stench, then OK!
Representation, Reasoning and Logic * Knowledge representation language - Syntax: possible configurations - Semantics: the facts on the world e.g.) Syntax: x y Semantics: when x is greater than or equal to y, this is true. Representation, Reasoning and logic * Inference Given the syntax and semantics, we can derive an inference mechanism. Representation ----------------------------------------------------- World Sentences Semantics Entails Sentence Semantics Facts Follows Fact (Aspect of the real world)
Representation, Reasoning and logic Logical inference generates new sentences that are entailed by existing sentences. KB = α (KB entails α) Checking validity of sentences e.g.) propositional logic, first-order logic α (i derives α from KB) KB - i proof procedure(logically sound) Representation, Reasoning and logic Validity (Tautology) iff a sentence is true under all possible interpretations in all possible worlds satisfiable vs. unsatisfiable (self contradictory sentence) satisfiable iff there is some interpretation in some world for which it is true.
Propositional Logic * Syntax Propositional symbols and the logical connectives Sentence AtomicSentence ComplexSentence AtomicSentence True False Symbol Symbol P Q R ComplexSentence (Sentence) Sentence connective Sentence Sentence Connective Propositional Logic * Semantics: the interpretation of the proposition symbols and constants Truth table * Models Def.) model: a world in which a sentence is true under a particular interpretation a true row in a truth table. If the models of KB are all models of α, KB = α
Propositional Logic * Rules of inference α - β : β can be derived from α by inference. Figure 7.11 logical equivalences Modus Ponens ((α => β) ^ α) => β ((~α v β) ^ α) => β (~α ^ α ) v (β ^ α) => β ~(β ^ α) v β ~β v ~α v β = ((~β v β) v ~ α) e.g.) if (WumpusAhead ^ WumpusAlive) => Shoot and (WumpusAhead ^ WumpusAlive) are given, then Shoot can be inferred. And-Elimination (α ^ β) => α e.g.) from (WumpusAhead ^ WumpusAlive), WumpusAlive can be inferred. Resolution - Resolution If there is an axiom of the form E 1 E 2 and there is another axiom of the form ~E 2 E 3 then E 1 E 3 must be true. (Implication is transitive.) e.g.) If you invest in the stock market, then you will get rich. If you get rich, then you will be happy. Therefore, if you invest in the stock market, then you will be happy.
Propositional Logic * Monotonic Logic Entailed sentences are preserved when new knowledge is added. If KB 1 = α then (KB 1 KB 2 ) = α (no matter what the KB 2 is) * Horn Sentences (Horn Clauses) P 1^ P 2 ^ ^ P n Q polynomial time inference procedure. If Q is false, then it is ~P 1 V..V~P n When n=1 & P 1 is true, then Q. An Agent for the Wumpus World S ij : There is a Stench in [i,j]. B ij : There is a Breeze in [i,j]. W ij : Wumpus *Finding the wumpus 4 3 2 1 A S,OK V OK B,V OK 1 2 3 4
Finding the wumpus 1. R1: S 11 W 11 ^ W 12 ^ W 21 We know S 11. Therefore, W 11 ^ W 12 ^ W 21. We obtain W 11, W 12, and W 21. 2. R2: S 21 W 11 ^ W 21 ^ W 22 ^ W 31 We obtain W 11, W 21, W 22, and W 31. Finding the wumpus 3. R 3 : S 12 W 13 W 12 W 22 W 11 We obtain W 13 W 12 W 22 W 11. 4. α: W 13 W 12 W 22, β: W 11 ((α v β) ^ ~β) α (α ^ ~β) v (β ^ ~β) α ~ α v β v α W 13 W 12 W 22
Finding the wumpus 5. ((W 13 W 12 ) W 22 ) ^ W 22 (W 13 W 12 ) 6. (W 13 W 12 ) ^ W 12 W 13 Therefore, W 13. We conclude that the wumpus is in [1,3]. Using the propositional rules e.g.) A 11 ^ East A ^ W 21 GoForward For each action, say, should I go Forward? function P-KB-Agent (Percept) returns an action TELL(KB, Make-Percept-Sentence(percept,t)) for each action in the list of actions do if ASK(KB,Make-Action-Query(t,action)) then t t+1 return action end
Problems with the propositional agent e.g.) Simple rule Don t GO FORWARD if the wumpus is in front of you. 1. The world size: a set of 64 rules (16 squares x 4 orientations) 2. Inference procedure: Size of a Truth Table:2 n (n - # of symbols in KB) Problems with the propositional agent 3. The world changes over time. When the agent makes its first move, A 11 becomes false and A 21 becomes true. To run for 100 time steps, 64x100=6400 rules will be needed. becomes impractical for even very small worlds.
Program Completed School of CSIE The Catholic University of Korea http://cis.catholic.ac.kr/sunoh/