1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Chap. 7 & 10 [AIMA] Chang-Sheng Chen.

Slides:



Advertisements
Similar presentations
1 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional.
Advertisements

Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Knowledge and reasoning – second part
3/30/00 Agents that Reason Logically by Chris Horn Jiansui Yang Xiaojing Wu.
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.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Fall 2005.
Knowledge Representation & Reasoning.  Introduction How can we formalize our knowledge about the world so that:  We can reason about it?  We can do.
CS 561, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
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.
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.
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.
Knowledge in intelligent systems So far, we’ve used relatively specialized, naïve agents. How can we build agents that incorporate knowledge and a memory?
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 8 Jim Martin.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Let remember from the previous lesson what is Knowledge representation
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2005.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Agents that Reason Logically Logical agents have knowledge base, from which they draw conclusions TELL: provide new facts to agent ASK: decide on appropriate.
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.
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
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
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,
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
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.
For Friday Read chapter 8 Homework: –Chapter 7, exercise 1.
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.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
1 UNIT-3 KNOWLEDGE REPRESENTATION. 2 Agents that reason logically(Logical agents) A Knowledge based Agent The Wumpus world environment Representation,
Review: What is a logic? A formal language –Syntax – what expressions are legal –Semantics – what legal expressions mean –Proof system – a way of manipulating.
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.
Artificial Intelligence Logical Agents Chapter 7.
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)
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
DCP 1172 Introduction to Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Logical Agents.
Logical Agents Chapter 7.
Artificial Intelligence
Artificial Intelligence: Logic agents
Knowledge and reasoning – second part
Back to “Serious” Topics…
Logical Agents Chapter 7.
Knowledge Representation I (Propositional Logic)
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Chap. 7 & 10 [AIMA] Chang-Sheng Chen

DCP 1172, Ch. 7 2 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional logic Wumpus world example

DCP 1172, Ch. 7 3 Review We studied search because it facilitates the creation of agents that can reason about hypothetical (future) states of the world. But … we haven ’ t said much of anything about how those states should be represented. Or about how these future (successor) states can be generated from current states

DCP 1172, Ch. 7 4 Knowledge-Based Agents A knowledge-based agent is one that chooses its actions at least in part on the basis of the contents of its knowledge-base. A knowledge-base is simply a repository of things (i.e., domain-specific) you know represented in some useful way. The knowledge base cannot be a simple table. It has to be set up so that an agent can conclude facts about the world that are not already represented in the knowledge base. In other words, it has to reason about unseen worlds

DCP 1172, Ch. 7 5 Knowledge-Based Agent Agent that uses prior or acquired knowledge to achieve its goals Can make more efficient decisions Can make informed decisions Knowledge Base (KB): contains a set of representations of facts about the Agent’s environment Each representation is called a sentence Use some knowledge representation language (KRL), to TELL it what to know e.g., (temperature 72F) ASK agent to query what to do Agent can use inference to deduce new facts from TELLed facts Knowledge Base Inference engine Domain independent algorithms Domain specific content TELL ASK

DCP 1172, Ch. 7 6 Generic knowledge-based agent 1.TELL KB what was perceived Uses a Knowledge Representation Language (KRL) to insert new sentences, representations of facts, into KB 2.ASK KB what to do. Uses logical reasoning to examine actions and select best.

DCP 1172, Ch. 7 7 Knowledge Representation A knowledge representation is a formal scheme that dictates how an agent is going to represent its knowledge. Syntax ( 語法 ): Rules that determine the possible strings in the language. Semantics( 語意 ): Rules that determine a mapping from sentences in the representation to situations in the world.

DCP 1172, Ch. 7 8 Reasoning

DCP 1172, Ch. 7 9 Wumpus world example

DCP 1172, Ch Wumpus world characterization Deterministic?Yes – outcome exactly specified. Fully Observable?No – only local perception. Static?Yes – Wumpus and pits do not move. Discrete?Yes Episodic?(Yes) – because static.

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Exploring a Wumpus world A= Agent B= Breeze S= Smell P= Pit W= Wumpus OK = Safe V = Visited G = Glitter

DCP 1172, Ch Other tight spots

DCP 1172, Ch Another example solution No perception  1,2 and 2,1 OK Move to 2,1 B in 2,1  2,2 or 3,1 P? 1,1 V  no P in 1,1 Move to 1,2 (only option)

DCP 1172, Ch Example solution S and No S when in 2,1  1,3 or 1,2 has W 1,2 OK  1,3 W No B in 1,2  2,2 OK & 3,1 P

DCP 1172, Ch Representation and Mappings Two different kinds of entities are usually mentioned in the discussions about AI programs: Facts: truths in some relevant world (e.g., including each agent’s behavior and goals, etc.). Representation of facts in some chosen formalism. These are the things that we will actually be able to manipulate.

DCP 1172, Ch Mapping between Facts and Representations Facts Internal Representations Natural Language Representation (e.g., English, Chinese, etc.) Reasoning Programs * * Natural Language generation Natural Language understanding

DCP 1172, Ch Representation of Facts Initial facts Final facts Internal representation of initial facts Internal representation of final facts Desired real reasoning Operation of program * Forward representation mapping * Backward representation mapping

DCP 1172, Ch Logic in general

DCP 1172, Ch Types of logic

DCP 1172, Ch The Semantic Wall Physical Symbol System World +BLOCKA+ +BLOCKB+ +BLOCKC+ P 1 :(IS_ON +BLOCKA+ +BLOCKB+) P 2 :((IS_RED +BLOCKA+)

DCP 1172, Ch Truth Depends on Interpretation (e.g., Anti-spam or anti-virus mail filtering ) Filteringwith H 1 (msg) FilteringWith H 2 (msg) Mail Spool Discard MTA 1 (or MUA 1 ) Accept MTA 0 MTA = Mail Transfer Agent MUA = Mail User Agent MTA 2 (or MUA 1 )

DCP 1172, Ch Entailment Entailment is different than inference

DCP 1172, Ch Reasoning - Logic as a representation of the World

DCP 1172, Ch Models

DCP 1172, Ch Inference

DCP 1172, Ch Basic symbols Expressions only evaluate to either “true” or “false.” P“P is true” ¬P“P is false”negation P V Q“either P is true or Q is true or both”disjunction P ^ Q“both P and Q are true”conjunction P => Q“if P is true, the Q is true”implication P  Q“P and Q are either both true or both false” equivalence

DCP 1172, Ch Propositional logic: syntax

DCP 1172, Ch Propositional logic: semantics

DCP 1172, Ch Truth tables Truth value: whether a statement is true or false. Truth table: complete list of truth values for a statement given all possible values of the individual atomic expressions. Example: PQP V Q TTT TFT FTT FFF

DCP 1172, Ch Truth tables for basic connectives PQ¬P¬QP V QP ^ QP=>QP  Q TTFFTTTT TFFTTFFF FTTFTFTF FFTTFFTT

DCP 1172, Ch Propositional logic: basic manipulation rules ¬(¬A) = ADouble negation ¬(A ^ B) = (¬A) V (¬B)Negated “and” ¬(A V B) = (¬A) ^ (¬B)Negated “or” A ^ (B V C) = (A ^ B) V (A ^ C)Distributivity of ^ on V A => B = (¬A) V Bby definition ¬(A => B) = A ^ (¬B)using negated or A  B = (A => B) ^ (B => A)by definition ¬(A  B) = (A ^ (¬B))V(B ^ (¬A))using negated and & or …

DCP 1172, Ch Propositional inference: enumeration method

DCP 1172, Ch Enumeration: Solution

DCP 1172, Ch Propositional inference: normal forms “sum of products of simple variables or negated simple variables” “product of sums of simple variables or negated simple variables”

DCP 1172, Ch Deriving expressions from functions Given a boolean function in truth table form, find a propositional logic expression for it that uses only V, ^ and ¬. Idea: We can easily do it by disjoining the “T” rows of the truth table. Example: XOR function PQRESULT TTF TFTP ^ (¬Q) FTT(¬P) ^ Q FFF RESULT = (P ^ (¬Q)) V ((¬P) ^ Q)

DCP 1172, Ch A more formal approach To construct a logical expression in disjunctive normal form from a truth table: -Build a “minterm” for each row of the table, where: - For each variable whose value is T in that row, include the variable in the minterm - For each variable whose value is F in that row, include the negation of the variable in the minterm - Link variables in minterm by conjunctions -The expression consists of the disjunction of all minterms.

DCP 1172, Ch Example: adder with carry Takes 3 variables in: x, y and ci (carry-in); yields 2 results: sum (s) and carry- out (co). To get you used to other notations, here we assume T = 1, F = 0, V = OR, ^ = AND, ¬ = NOT. co is: s is:

DCP 1172, Ch Tautologies Logical expressions that are always true. Can be simplified out. Examples: T T V A A V (¬A) ¬(A ^ (¬A)) A  A ((P V Q)  P) V (¬P ^ Q) (P  Q) => (P => Q)

DCP 1172, Ch Validity and satisfiability Theorem

DCP 1172, Ch Proof methods

DCP 1172, Ch Inference Rules

DCP 1172, Ch Inference Rules

DCP 1172, Ch Wumpus world: example Facts: Percepts inject (TELL) facts into the KB [stench at 1,1 and 2,1]  S1,1 ; S2,1 Rules: if square has no stench then neither the square or adjacent square contain the wumpus R1: !S1,1  !W1,1  !W1,2  !W2,1 R2: !S2,1  !W1,1  !W2,1  !W2,2  !W3,1 … Inference: KB contains !S1,1 then using Modus Ponens we infer !W1,1  !W1,2  !W2,1 Using And-Elimination we get: !W1,1 !W1,2 !W2,1 …

DCP 1172, Ch Limitations of Propositional Logic 1. It is too weak, i.e., has very limited expressiveness: Each rule has to be represented for each situation: e.g., “don’t go forward if the wumpus is in front of you” takes 64 rules 2. It cannot keep track of changes: If one needs to track changes, e.g., where the agent has been before then we need a timed-version of each rule. To track 100 steps we’ll then need 6400 rules for the previous example. Its hard to write and maintain such a huge rule-base Inference becomes intractable

DCP 1172, Ch Summary

DCP 1172, Ch Next time First-order logic:[AIMA] Chapter 7

DCP 1172, Ch Knowledge Representation A knowledge representation is a formal scheme that dictates how an agent is going to represent its knowledge. Syntax: Rules that determine the possible strings in the language. Semantics: Rules that determine a mapping from sentences in the representation to situations in the world.

DCP 1172, Ch Reasoning The knowledge base can ’ t be a simple table. It has to be set up so that an agent can conclude facts about the world that are not already represented in the knowledge base. In other words, it has to reason about unseen worlds

DCP 1172, Ch Reasoning