Artificial Intelligence: Logic agents

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Logic.
Artificial Intelligence Knowledge-based Agents Russell and Norvig, Ch. 6, 7.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 9 Jim Martin.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Knoweldge Representation & Reasoning
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Logical Agents Chapter 7 (based on slides from Stuart Russell and Hwee Tou Ng)
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Logical Agents (NUS) Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
‘In which we introduce a logic that is sufficent for building knowledge- based agents!’
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
Knowledge Representation Lecture # 17, 18 & 19. Motivation (1) Up to now, we concentrated on search methods in worlds that can be relatively easily represented.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
LOGICAL AGENTS CHAPTER 7 AIMA 3. OUTLINE  Knowledge-based agents  Wumpus world  Logic in general - models and entailment  Propositional (Boolean)
CS666 AI P. T. Chung Logic Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #6
Notes 7: Knowledge Representation, The Propositional Calculus
EA C461 Artificial Intelligence
Knowledge and reasoning – second part
EA C461 – Artificial Intelligence Logical Agent
EA C461 – Artificial Intelligence Logical Agent
Logical Agents Chapter 7.
Artificial Intelligence Logical Agents
Artificial Intelli-gence 1: logic agents
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Logical Agents.
Logical Agents Chapter 7.
Artificial Intelligence
Artificial Intelligence: Agents and Propositional Logic.
Artificial Intelligence: Logic agents
CS 416 Artificial Intelligence
Knowledge and reasoning – second part
Logical Agents Chapter 7.
Knowledge Representation I (Propositional Logic)
Methods of Proof Chapter 7, second half.
Problems in AI Problem Formulation Uninformed Search Heuristic Search
LECTURE 06 Logical Agent Course : T0264 – Artificial Intelligence
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Artificial Intelligence: Logic agents

AI in the News April 6, 2005: GIDEON - Global Infectious Disease and Epidemiology Network. Media review by Vincent J. Felitti. JAMA, the Journal of the American Medical Association ( Vol. 293, No. 13, pages 1674-1675; subscription req'd.). "GIDEON: The Global Infectious Disease and Epidemiology Network is a superbly designed expert system created to help physicians diagnose any infectious disease (337 recognized) in any country of the world (224 included). The program was created and has been progressively refined over more than a decade by a talented group of Americans, Canadians, and Israelis ============================================= December 13, 2004: WebMed dispenses advice to students. By Robyn Shelton. Orlando Sentinel. "The site -- 24/7 WebMed -- takes students through questions, judges the severity of their symptoms and offers guidance for what to do next. ... 'It's decision-support systems, or artificial intelligence in a way,' said Dr. Scott Gettings, DSHI medical director. 'The system learns about you as you flow through and answer questions and determines how ill you are.' It makes no attempt to go further and diagnose the patient's illness -- but gauges the seriousness of the symptoms. 'This is not intended to take the place of human interaction, but to augment it,' said Dr. Michael Deichen, associate director of clinical services at the UCF Student Health Center. 'It really just helps the students know with what urgency they should be evaluated.'" 28 November 2018

“Thinking Rationally” Computational models of human “thought” processes Computational models of human behavior Computational systems that “think” rationally Computational systems that behave rationally 28 November 2018

Logical Agents Reflex agents find their way from Arad to Bucharest by dumb luck Chess program calculates legal moves of its king, but doesn’t know that a piece cannot be on 2 different squares at the same time Logic (Knowledge-Based) agents combine general knowledge with current percepts to infer hidden aspects of current state prior to selecting actions Crucial in partially observable environments 28 November 2018

Outline Knowledge-based agents Wumpus world Logic in general Propositional and first-order logic Inference, validity, equivalence and satifiability Reasoning patterns Resolution Forward/backward chaining 28 November 2018

Knowledge Base Knowledge Base : set of sentences represented in a knowledge representation language and represents assertions about the world. Inference rule: when one ASKs questions of the KB, the answer should follow from what has been TELLed to the KB previously. tell ask 28 November 2018

Generic KB-Based Agent 28 November 2018

Abilities KB agent Agent must be able to: Represent states and actions, Incorporate new percepts Update internal representation of the world Deduce hidden properties of the world Deduce appropriate actions 28 November 2018

A Typical Wumpus World Wumpus 28 November 2018

Wumpus World PEAS Description 28 November 2018

Wumpus World Characterization Observable? Deterministic? Episodic? Static? Discrete? Single-agent? 28 November 2018

Wumpus World Characterization Observable? No, only local perception Deterministic? Yes, outcome exactly specified Episodic? No, sequential at the level of actions Static? Yes, Wumpus and pits do not move Discrete? Yes Single-agent? Yes, Wumpus is essentially a natural feature. 28 November 2018

Exploring the Wumpus World [1,1] The KB initially contains the rules of the environment. The first percept is [none, none,none,none,none], move to safe cell e.g. 2,1 [2,1] breeze which indicates that there is a pit in [2,2] or [3,1], return to [1,1] to try next safe cell 28 November 2018

Exploring the Wumpus World [1,2] Stench in cell which means that wumpus is in [1,3] or [2,2] YET … not in [1,1] YET … not in [2,2] or stench would have been detected in [2,1] THUS … wumpus is in [1,3] THUS [2,2] is safe because of lack of breeze in [1,2] THUS pit in [1,3] move to next safe cell [2,2] 28 November 2018

Exploring the Wumpus World [2,2] move to [2,3] [2,3] detect glitter , smell, breeze THUS pick up gold THUS pit in [3,3] or [2,4] 28 November 2018

What is a logic? A formal language Syntax – what expressions are legal (well-formed) Semantics – what legal expressions mean in logic the truth of each sentence with respect to each possible world. E.g the language of arithmetic X+2 >= y is a sentence, x2+y is not a sentence X+2 >= y is true in a world where x=7 and y =1 X+2 >= y is false in a world where x=0 and y =6 28 November 2018

Entailment One thing follows from another KB |=  KB entails sentence  if and only if  is true in worlds where KB is true. E.g. x+y=4 entails 4=x+y Entailment is a relationship between sentences that is based on semantics. 28 November 2018

Models Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated. m is a model of a sentence  if  is true in m M() is the set of all models of  28 November 2018

Wumpus world model 28 November 2018

Wumpus world model 28 November 2018

Wumpus world model 28 November 2018

Wumpus world model 28 November 2018

Wumpus world model 28 November 2018

Wumpus world model 28 November 2018

Logical inference The notion of entailment can be used for logic inference. Model checking (see wumpus example): enumerate all possible models and check whether  is true. If an algorithm only derives entailed sentences it is called sound or truth preserving. Otherwise it just makes things up. i is sound if whenever KB |-i  it is also true that KB|=  Completeness : the algorithm can derive any sentence that is entailed. i is complete if whenever KB |=  it is also true that KB|-i  28 November 2018

Schematic perspective If KB is true in the real world, then any sentence  derived From KB by a sound inference procedure is also true in the real world. 28 November 2018

Inference KB |-i a Soundness: Inference procedure i is sound if whenever KB |-i a, it is also true that KB |= a Completeness: Inference procedure i is complete if whenever KB |= a, it is also true that KB |-i a 28 November 2018

Validity and Inference ((P V H) ^ ØH) => P P H P V H (P H) Ø V ^ H ((P V H) ^ ØH) => P T T T F T T F T T T F T T F T F F F F T 28 November 2018

Rules of Inference a |- b a b Valid Rules of Inference: Modus Ponens And-Elimination And-Introduction Or-Introduction Double Negation Unit Resolution Resolution 28 November 2018

Examples in Wumpus World Modus Ponens: a => b, a |- b (WumpusAhead ^ WumpusAlive) => Shoot, (WumpusAhead ^ WumpusAlive) |- Shoot And-Elimination: a ^ b |- a (WumpusAhead ^ WumpusAlive) |- WumpusAlive Resolution: a V b, Øb V g |- a V g (WumpusDead V WumpusAhead), (ØWumpusAhead V Shoot) ` (WumpusDead V Shoot) a => b a b a ^ b a a V b Øb V g a V g 28 November 2018

Proof Using Rules of Inference Prove A => B, (A ^ B) => C, Therefore A => C A => B |- ØA V B A ^ B => C |- Ø(A ^ B) V C |- ØA V ØB V C So ØA V B resolves with ØA V ØB V C deriving ØA V C This is equivalent to A => C 28 November 2018

Rules of Inference (continued) And-Introduction a1, a2, …, an a1 ^ a2 ^ … ^ an Or-Introduction ai a1 V a2 V …ai … V an Double Negation ØØa a Unit Resolution (special case of resolution) a V b Alternatively: Øa => b Øb Øb a a 28 November 2018

Wumpus World KB Proposition Symbols for each i,j: Let Pi,j be true if there is a pit in square i,j Let Bi,j be true if there is a breeze in square i,j Sentences in KB “There is no pit in square 1,1” R1: ØP1,1 “A square is breezy iff pit in a neighboring square” R2: B1,1  (P1,2 V P2,1) R3: B1,2  (P1,1 V P1,3 V P2,2) “Square 1,1 has no breeze”, “Square 1,2 has a breeze” R4: ØB1,1 R5: B1,2 28 November 2018

Inference in Wumpus World Apply biconditional elimination to R2: R6: (B1,1 => (P1,2 V P2,1)) ^ ((P1,2 V P2,1) => B1,1) Apply AE to R6: R7: ((P1,2 V P2,1) => B1,1) Contrapositive of R7: R8: (ØB1,1 => Ø(P1,2 V P2,1)) Modus Ponens with R8 and R4 (ØB1,1): R9: Ø(P1,2 V P2,1) de Morgan: R10: ØP1,2 ^ ØP2,1 28 November 2018

Searching for Proofs Finding proofs is exactly like finding solutions to search problems. Can search forward (forward chaining) to derive goal or search backward (backward chaining) from the goal. Searching for proofs is not more efficient than enumerating models, but in many practical cases, it’s more efficient because we can ignore irrelevant propositions 28 November 2018

Full Resolution Rule Revisited Start with Unit Resolution Inference Rule: Full Resolution Rule is a generalization of this rule: For clauses of length two: 28 November 2018

Resolution Applied to Wumpus World At some point we determine the absence of a pit in square 2,2: R13: ØP2,2 Biconditional elimination applied to R3 followed by modus ponens with R5: R15: P1,1 V P1,3 V P2,2 Resolve R15 and R13: R16: P1,1 V P1,3 Resolve R16 and R1: R17: P1,3 28 November 2018

Resolution: Complete Inference Procedure Any complete search algorithm, applying only the resolution rule, can derive any conclusion entailed by any knowledge base in propositional logic. Refutation completeness: Resolution can always be used to either confirm or refute a sentence, but it cannot be used to enumerate true sentences. 28 November 2018

Conjunctive Normal Form Conjunctive Normal Form is a disjunction of literals. Example: (A V B V ØC) ^ (B V D) ^ (Ø A) ^ (BVC) literals clause 28 November 2018

CNF Example Example: (A V B)  (C => D) Eliminate  Eliminate => ((A V B) => (C => D)) ^ ((C => D) => (A V B) Eliminate => (Ø (A V B) V (ØC V D)) ^ (Ø(ØC V D) V (A V B) ) Drive in negations ((ØA ^ ØB) V (ØC V D)) ^ ((C ^ ØD) V (A V B)) Distribute (ØA V ØC V D) ^ (ØB V ØC V D) ^ (C V A V B) ^ (ØD V A V B) 28 November 2018

Resolution Algorithm To show KB |= a, we show (KB ^ Øa) is unsatisfiable. This is a proof by contradiction. First convert (KB ^ Øa) into CNF. Then apply resolution rule to resulting clauses. The process continues until: there are no new clauses that can be added (KB does not entail a) two clauses resolve to yield empty clause (KB entails a) 28 November 2018

Simple Inference in Wumpus World KB = R2 ^ R4 = (B1,1  (P1,2 V P2,1)) ^ ØB1,1 Prove ØP1,2 by adding the negation P1,2 Convert KB ^ P1,2 to CNF PL-RESOLUTION algorithm 28 November 2018

Horn Clauses Real World KB’s are often a conjunction of Horn clauses proposition symbol; or (conjunction of symbols) => symbol Examples: C (B => A) (C ^ D => B) 28 November 2018

Forward Chaining Fire any rule whose premises are satisfied in the KB. Add its conclusion to the KB until query is found. 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Motivation: Need goal-directed reasoning in order to keep from getting overwhelmed with irrelevant consequences Main idea: Work backwards from query q To prove q: Check if q is known already Prove by backward chaining all premises of some rule concluding q 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Backward Chaining Example P => Q L ^ M => P B ^ L => M A ^ P => L A ^ B => L A B 28 November 2018

Forward Chaining vs. Backward Chaining FC is data-driven—it may do lots of work irrelevant to the goal BC is goal-driven—appropriate for problem-solving 28 November 2018