Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Intro to Logic (Reading R&N: Chapter.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
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.
Knowledge Representation & Reasoning.  Introduction How can we formalize our knowledge about the world so that:  We can reason about it?  We can do.
1 Problem Solving CS 331 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic.
CS 460, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
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.
Computing & Information Sciences Kansas State University Lecture 11 of 42 CIS 530 / 730 Artificial Intelligence Lecture 11 of 42 William H. Hsu Department.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
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.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
LOGICAL AGENTS Yılmaz KILIÇASLAN. Definitions Logical agents are those that can:  form representations of the world,  use a process of inference to.
CS 4700: Foundations of Artificial Intelligence
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 )
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
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): 
Artificial Intelligence Lecture No. 9 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
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,
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
‘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.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part A Knowledge Representation and Reasoning.
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,
Class Project Due at end of finals week Essentially anything you want, so long as its AI related and I approve Any programming language you want In pairs.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 17, 2012.
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.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 13 –Reasoning with Uncertainty Tuesday –AIMA, Ch. 14.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 10 of 42 Wednesday, 13 September.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
1 UNIT-3 KNOWLEDGE REPRESENTATION. 2 Agents that reason logically(Logical agents) A Knowledge based Agent The Wumpus world environment Representation,
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.
1 Knowledge Representation Logic and Inference Propositional Logic Vumpus World Knowledge Representation Logic and Inference Propositional Logic Vumpus.
1 Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3-1 Logic Based Reasoning.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Artificial Intelligence Logical Agents Chapter 7.
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.
Propositional Logic: Logical Agents (Part I)
Knowledge and reasoning – second part
CS 4700: Foundations of Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Artificial Intelli-gence 1: logic agents
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Logical Agents Chapter 7.
Artificial Intelligence
Artificial Intelligence: Logic agents
Knowledge and reasoning – second part
Logical Agents Chapter 7.
CS 416 Artificial Intelligence
Knowledge Representation I (Propositional Logic)
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Intro to Logic (Reading R&N: Chapter 7)

Carla P. Gomes CS4700 Knowledge and Reasoning Knowledge and Reasoning  humans are very good at acquiring new information by combining raw knowledge, experience, with reasoning; Examples:  diagnosis –e.g., a physician diagnoses a patient, i.e., it infers what disease he/she has, based on the knowledge he/she acquired as a student, textbooks, prior cases and also some reasoning process (patterns of association, or other process) that he/she may not be able to describe.  car repair diagnosis  Common sense reasoning  Inventions, new ideas Key issues: 1- Representation of knowledge 2- Reasoning and inference processes

Carla P. Gomes CS4700 Knowledge-base Agents Representation of knowledge  knowledge base (*) called knowledge representation language Knowledge base = set of sentences in a formal language representing facts about the world(*)

Carla P. Gomes CS4700 Knowledge-base Agents Key issues: –Representation of knowledge  knowledge base –Reasoning processes  inference/reasoning (*) called knowledge representation language Knowledge base = set of sentences in a formal language representing facts about the world(*)

Carla P. Gomes CS4700 Knowledge bases Reasoning processes  inference/reasoning mechanisms to query what is known, to derive new information, to make decisions  i.e. how to derive new sentences from old sentences Logical agents – inference must obey the fundamental requirement that when one asks a question to the knowledge base, the answer should follow from what has been told to the knowledge base previously. (In other words the inference process should not “make things” up…)

Carla P. Gomes CS4700 Knowledge bases Key aspects: –How to add sentences to the knowledge base –How to query the knowledge base Both tasks may involve inference – i.e. how to derive new sentences from old sentences Logical agents – inference must obey the fundamental requirement that when one asks a question to the knowledge base, the answer should follow from what has been told to the knowledge base previously. (In other words the inference process should not “make things” up…)

A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update internal representations of the world –Deduce hidden properties of the world –Deduce appropriate actions

Carla P. Gomes CS4700 Mine Sweeper You have to find a way from a start field to an exit field on grid where mines are hidden. An electronic device tells you how many mines are hidden on the neighboring fields (vertically, horizontally, and diagonally). However, the device is unable to give the exact location of the mines that it has detected. How do you proceed?

Mine Sweeper 0

0

1 0

11 0

11 00

11 00

11 000

Carla P. Gomes CS4700 Knowledge Base Once we have walked on the board for a while, how can we express the knowledge that we have acquired? The initial cell, for instance, has no bomb. We could express this type of knowledge with 0/1 variables that tell us, for each cell, whether there is a bomb or not: B 13 = 0. When we see that our device can detect no mines in the proximity of the start field, we can express that knowledge as  B 12   B 14  B 22  B 23  B 24

Carla P. Gomes CS4700 Logic: Outline 1.General principles of logic – main vehicle for representing knowledge 2.Wumpus World - a toy world similar to mine sweeper  it illustrates how a knowledge based agent operates 3.Propositional logic 4.Predicate logic 5.Proof Methods 1.Inference Rules (including induction) 2.Model Checking Algorithmic approaches 6.Satisfiability as an Encoding language 7.First Order Logic 8.Inference in First Order Logic

Carla P. Gomes CS4700 Logic in general Logics are formal languages for formalizing reasoning, in particular for representing information such that conclusions can be drawn A logic involves: –A language with a syntax for specifying what is a legal expression in the language; syntax defines well formed sentences in the language –Semantics for associating elements of the language with elements of some subject matter. Semantics defines the "meaning" of sentences (link to the world); i.e., semantics defines the truth of a sentence with respect to each possible world –Inference rules for manipulating sentences in the language Original motivation: Early Greeks, settle arguments based on purely rigorous (symbolic/syntactic) reasoning starting from a given set of premises.

Carla P. Gomes CS4700 Example of a formal language: Arithmetic E.g., the language of arithmetic –x+2 ≥ y is a sentence; ( x2+y > {} is not a sentence) –x+2 ≥ y is true iff the number x+2 is no less than the number y –x+2 ≥ y is true in a world where x = 7, y = 1 –x+2 ≥ y is false in a world where x = 0, y = 6

Carla P. Gomes CS4700 Several systems – biological, mechanical, electric, etc --- can be represented by appropriate sets of “features” with constraints among the features encoding physical or other laws relevant to the organism or device; Reasoning can then be used among other purposes, to diagnose malfunctions in these systems; for example, features associated with “causes” can be inferred from features associated with “symptoms”. This general approach is key to an important class of AI applications. Language to Specify Systems as Constrained Featured Sets

Carla P. Gomes CS4700 Simple Robot Domain Consider a robot that is able to lift a block, if that block is liftable (i.e., not too heavy), and if the robot’s battery power is adequate. If both of these conditions are satisfied, then when the robot tries to lift a block it is holding, its arm moves. block Feature 1: BatIsOk (True or False) Feature 2: BlockLiftable (True or False) Feature 3: RobotMoves (True or False)

Carla P. Gomes CS4700 Simple Robot Domain (BatIsOk and BlockLiftable) implies RobotMoves block We need a language to express the features/properties/assertions and constraints among them; also inference mechanisms, i.e, principled ways of performing reasoning. Example logical statement about the robot:

Carla P. Gomes CS4700 Binary valued featured descriptions Consider the following description: –The router can send packets to the edge system only if it supports the new address space. For the router to support the new address space it is necessary that the latest software release be installed. The router can send packets to the edge system if the latest software release is installed. The router does not support the new address space. –Features: Router –Feature 1 – router can send packets to the edge of system –Feature 2 – router supports the new address space Latest software release –Feature 3 – latest software release is installed

Carla P. Gomes CS4700 Binary valued featured descriptions –Constraints: The router can send packets to the edge system only if it supports the new address space. (constraint between feature 1 and feature 2); It is necessary that the latest software release be installed for the router to support the new address space. (constraint between feature 2 and feature 3); The router can send packets to the edge system if the latest software release is installed. (constraint between feature 1 and feature 3); How can we write these specifications in a formal language and reason about the system?

Carla P. Gomes CS4700 Logical Reasoning: Entailment Entailment means that one thing follows from another: KB ╞ α A Knowledge base KB entails sentence α iff α is true in all worlds where KB is true –E.g., the KB containing “Giants won” and “Reds won” entails “Either the Giants won or the Reds Won” Why? –E.g., x+y = 4 entails 4 = x+y –Entailment is a relationship between sentences (i.e., syntax) that is based on semantics We can think of a knowledge base as a statement and we talk about a knowledge base entailing a sentence.

Carla P. Gomes CS4700 Models Logicians typically think in terms formally structured worlds with respect to which truth can be evaluated; Example: – x + y >= 7, is true in all the worlds in which x >= 7 - y, assuming that we are dealing with real numbers, in particular x = 7 and y = 0 or x = 8 and y = 1, etc ; –Basically, each world corresponds to a different assignment to the variables satisfying the constraints; note each assignment determines the truth or falsehood of the arithmetic sentence. We say m is a model of a sentence α if α is true in m M(α) is the set of all models of α (i.e., models that assign true to α ).

Carla P. Gomes CS4700 Wumpus World Performance measure –gold +1000, –death (falling into a pit or being eaten by the wumpus) –-1 per step, -10 for using the arrow Environment –Squares adjacent to wumpus are smelly –Squares adjacent to pit are breezy –Glitter iff gold is in the same square –Shooting kills wumpus if you are facing it –Shooting uses up the only arrow –Grabbing picks up gold if in same square –Releasing drops the gold in same square Sensors: Stench, Breeze, Glitter, Bump, Scream Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot

Carla P. Gomes CS4700 Models KB ╞ α iff M(KB)  M(α) –E.g. KB = Giants won and Reds Won –α = Giants won or Reds Won –Other ways of talking about entailment: KB ╞ α

Carla P. Gomes CS Wumpus World

Carla P. Gomes CS4700 Wumpus world characterization Fully Observable No – only local perception Deterministic Yes – outcomes 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

Carla P. Gomes CS4700 Exploring a wumpus world Stench, Breeze, Glitter, Bump, Scream None, none, none, none, none The knowledge base of the agent consists of the rules of the Wumpus world plus the percept nothing in [1,1]

Carla P. Gomes CS4700 Exploring a wumpus world Stench, Breeze, Glitter, Bump, Scream None, none, none, none, none The knowledge base of the agent consists of the rules of the Wumpus world plus the percept nothing in [1,1]; by inference, the agent’s knowledge base also has the information that [2,1] and [1,2] are okay.

Carla P. Gomes CS4700 Exploring a wumpus world Stench, Breeze, Glitter, Bump, Scream None, none, none, none, none V A – Agent V – visited B - Breeze A/B P? Pit in (2,2) or (3,1) None, breeze, none, none, none

Carla P. Gomes CS4700 Exploring a wumpus world S S  Wumpus nearby Wumpus cannot be in (1,1) or in (2,2) (Why?)  Wumpus in (1,3) Not breeze in (1,2)  no pit in (2,2); but we know there is a pit in (2,2) or (3,1)  pit in (3,1) P? S = (Stench, none, none, none, none) P W P SS

Carla P. Gomes CS4700 Exploring a wumpus world Difficult inference, because it combines knowledge gained at different times in difference places; this inference is beyond the abilities of most animals. In each case where the agent draws a conclusion from the available information, that conclusion is guaranteed to be correct if the initial information is correct - fundamental property of logical reasoning! P W P

Carla P. Gomes CS4700 Entailment in the wumpus world Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for KB with respect to the cells (1,2), (2,2) and (3,1), with respect to the existence or non existence of pits 3 Boolean choices  8 possible interpretations (enumerate all the models) Knowledge Base in the Wumpus World  Rules of the wumpus world + new percepts

Carla P. Gomes CS4700 Wumpus models KB = wumpus-world rules + observations IS the KB true in all of them? KB false

Carla P. Gomes CS4700 Entailment in Wumpus World KB = wumpus-world rules + observations α 1 = "[1,2] has no pit", KB ╞ α 1, –In every model in which KB is true, α 1 is True (proved by model checking) Models of the KB and α1

Carla P. Gomes CS4700 Wumpus models KB = wumpus-world rules + observations α2 = "[2,2] has no pit", this is only True in some of the models for which KB is True, therefore KB ╞ α2 Inference algorithm used to reason about α 1 and α 2  Model Checking Models of the KB and α2

Carla P. Gomes CS4700 Inference: Model Checking Inference by Model checking – we enumerate all the KB models and check if α 1 and α 2 are True in all the models (which implies that we can only use it when we have a finite number of models).

Carla P. Gomes CS4700 Inference KB ├ i α we say sentence α can be derived from KB by procedure i Soundness (or Truth preservation): i is sound if whenever KB ├ i α, it is also true that KB╞ α; an unsound procedure can conclude statements that are not true. Completeness: i is complete if whenever KB╞ α, it is also true that KB ├ i α; a complete procedure is able to derive any sentence that is entailed. That is, the procedure will answer any question whose answer follows from what is known by the KB.

Carla P. Gomes CS4700 Preview: we will define a logic -- first-order logic: –First-order logic is expressive enough to say almost anything of interest; –There exists a sound and complete inference procedure for first-order logic, i.e., the procedure will answer any question whose answer follows from what is known by the KB. As a starting point we will consider a restricted form of first order logic, propositional logic.