Knowledge Representation Lecture # 17, 18 & 19. Motivation (1) Up to now, we concentrated on search methods in worlds that can be relatively easily represented.

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)
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.
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?
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
LOGICAL AGENTS Yılmaz KILIÇASLAN. Definitions Logical agents are those that can:  form representations of the world,  use a process of inference to.
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 2008.
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): 
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.
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,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
1 Problems in AI Problem Formulation Uninformed Search Heuristic Search Adversarial Search (Multi-agents) Knowledge RepresentationKnowledge Representation.
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.
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.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
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 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)
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.
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)
EA C461 – Artificial Intelligence Logical Agent
Learning and Knowledge Acquisition
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
Class #9– Thursday, September 29
Logical Agents Chapter 7.
CS 416 Artificial Intelligence
Artificial Intelligence Lecture 10: Logical Agents
Knowledge Representation I (Propositional Logic)
CMSC 471 Fall 2011 Class #10 Tuesday, October 4 Knowledge-Based Agents
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Knowledge Representation Lecture # 17, 18 & 19

Motivation (1) Up to now, we concentrated on search methods in worlds that can be relatively easily represented by states and actions on them a few objects, rules, relatively simple states problem-specific heuristics to guide the search complete knowledge: know all what’s needed no new knowledge is deduced or added well-defined start and goal states Appropriate for accessible, static, discrete problems.

Motivation (2) What about other types of problems? More objects, more complex relations Not all knowledge is explicitly stated Dynamic environments: the rules change! Agents change their knowledge Deduction: how to derive new conclusions Examples 1. queries on family relations 2. credit approval 3. diagnosis of circuits

Knowledge Representation A complete intelligent agent needs to be able to perform several tasks: – Perception: what is my state? – Deliberation: what action should I take? – Action: how do I execute the action? State recognition implies some form of knowledge representation Figuring out the right action implies some form of inference Two levels to think about: Knowledge level; what does the agent know? Implementation level: how is the knowledge represented? Key question: What is a good representation?

Knowledge Bases The golden dream: Tell the agent what it needs to know The agent uses rules of inference to deduce consequences This is the declarative approach to building agents. Agents have two different parts: A knowledge base, which contains a set of facts expressed in some formal, standard language An inference engine, with general rules for deducing new facts

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

CONTD… The Knowledge Base is a set of sentences.  Syntactically well-formed  Semantically meaningful A user can perform two actions to the KB:  Tell the KB a new fact  Ask the KB a question

Syntax of Sentences English acceptable an one is sentence This vs. This English sentence is an acceptable one. V P – ^Q R vs. P V –Q ^ R

Semantics of Sentences This hungry classroom is a jobless moon. Why is this syntactically correct sentence not meaningful? P V –Q ^ R Represents a world where either P is true, or Q is not true and R is true.

Logical Agents Reflex agents find their goal state by dumb luck 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

Knowledge-Based Agent environment agent ? sensors actuators Knowledge base Inference Engine Domain-independent algorithms Domain-specific content

A Knowledge-Based Agent A knowledge-based agent consists of a knowledge base (KB) and an inference engine (IE). A knowledge-base is a set of representations of what one knows about the world (objects and classes of objects, the fact about objects, relationships among objects, etc.) Each individual representation is called a sentence.

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

Knowledgebase Agents The sentences are expressed in a knowledge representation language. Examples of sentences The moon is made of green cheese If A is true then B is true A is false All humans are mortal Confucius is a human

Knowledge Base Inference Engine Input from environment Output (actions) Learning (KB update) The Inference engine derives new sentences from the input and KB The inference mechanism depends on representation in KB The agent operates as follows: 1. It receives percepts from environment 2. It computes what action it should perform (by IE and KB) 3. It performs the chosen action (some actions are simply inserting inferred new facts into KB).

The Wumpus World The Wumpus computer game The agent explores a cave consisting of rooms connected by passageways. Lurking somewhere in the cave is the Wumpus, a beast that eats any agent that enters its room. Some rooms contain bottomless pits that trap any agent that wanders into the room. Occasionally, there is a heap of gold in a room. The goal is to collect the gold and exit the world without being eaten

Wumpus PEAS description Performance measure: gold +1000, death -1000, -1 per step, -10 use arrow Environment: Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter iff gold is in the same square Bump iff move into a wall Woeful scream iff the wumpus is killed 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: Let turn, Right turn, Forward, Grab, Release, Shoot

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

Exploring the Wumpus World [2,1] = breeze indicates that there is a pit in [2,2] or [3,1], return to [1,1] to try next safe cell

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] (this is relatively sophisticated reasoning!)

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] (this is relatively sophisticated reasoning!) THUS … wumpus is in [1,3] THUS [2,2] is safe because of lack of breeze in [1,2] THUS pit in [1,3] (again a clever inference) move to next safe cell [2,2]

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]

Representation, Reasoning, and Logic The objective of knowledge representation is to express knowledge in a computer-tractable form, so that agents can perform well. A knowledge representation language is defined by: Its syntax which defines all possible sequences of symbols that constitute sentences of the language (grammar to form sentences)

Representation, Reasoning, and Logic Its semantics determines the facts in the world to which the sentences refer (meaning of sentences) Each sentence makes a claim about the world. Its proof theory (inference rules and proof procedures)

Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences; i.e., define truth of a sentence in a world 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

Types of Logic Logics are characterized by what they commit to as “primitives” Ontological commitment: what exists—facts? objects? time? beliefs? Epistemological commitment: what states of knowledge?

Interpretations We want to have a rule for generating (or testing) new sentences that are always true But the truth of a sentence may depend on its interpretation! Formally, an interpretation is a way of matching objects in the world with symbols in the sentence (or in the knowledge database) A sentence may be true in one interpretation and false in another Terminology: A sentence is valid if it is true in all interpretations A sentence is satisfiable if it is true in at least one interpretation A sentence is unsatisfiable if it is false in all interpretations

Entailment Entailment means that one thing follows from another: KB ╞ α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true For example (P ^ Q) ⊨ (P V R) Entailment is a relationship between sentences (i.e., syntax) that is based on semantics

Models Models are formal definitions of possible states of the world We say m is a model of a sentence  if  is true in m M(  ) is the set of all models of  Then KB  if and only if M(KB)  M(  ) M(  ) M(KB)

Inference KB |- i  : sentence  can be derived from KB by inference procedure I For example -(AVB) ⊢ (-A ^ -B) Soundness: KB ⊢ f → KB ⊨ f i.e. all conclusions arrived at via the proof procedure are correct: they are logical consequences. Completeness: KB ⊨ f → KB ⊢ f i.e. every logical consequence can be generated by the proof procedure

Propositional Logic: Syntax

Propositional Logic: Semantics

Truth Tables AB  A A A A A  B A  B A  B TrueTrueFalseTrueTrueTrue TrueFalseFalseFalseTrueFalse FalseFalseTrueFalseFalseTrue FalseTrueTrueFalseTrueTrue

Propositional Inference: Truth Table Method

Logical equivalence Two sentences are logically equivalent iff both are true in same models: α ≡ ß iff α ╞ β and β ╞ α

Wumpus world sentences Let P i,j be true if there is a pit in [i,j] Let B i,j be true if there is a breeze in [i,j] R1: ¬P 1,1 “Pits cause breezes in adjacent squares” R2: B 11  P 12 v P 21 R3: B 2,1  (P 1,1  P 2,2  P 3,1 ) Include breeze precepts for the first 2 moves R4: ¬B 1,1 R5: B 2,1

Normal Forms

Horn Sentences

Example: Conversion to CNF B 1,1  (P 1,2  P 2,1 ) 1. Eliminate , replacing α  β with ( α  β )  ( β  α ). (B 1,1  (P 1,2  P 2,1 ))  ((P 1,2  P 2,1 )  B 1,1 ) 2. Eliminate , replacing α  β with  α  β. (  B 1,1  P 1,2  P 2,1 )  (  (P 1,2  P 2,1 )  B 1,1 ) 3. Move  inwards using de Morgan's rules and double- negation: (  B 1,1  P 1,2  P 2,1 )  ((  P 1,2   P 2,1 )  B 1,1 ) 4. Apply distributive law (  over  ) and flatten: (  B 1,1  P 1,2  P 2,1 )  (  P 1,2  B 1,1 )  (  P 2,1  B 1,1 ) Any KB can be converted into CNF

Validity and Satisfiability

Complementary Literals A literal is a either an atomic sentence or the negated atomic sentence, e.g.: P,  P Two literals are complementary if one is the negation of the other, e.g.: P and  P

Reasoning Patterns/Rules of Inference

Proofs using Inference in Wumpus World

Proof Methods Proof methods divide into (roughly) two kinds: Model checking: Truth table enumeration (sound and complete for propositional logic) Heuristic search in model space (sound but incomplete) Application of inference rules: Legitimate (sound) generation of new sentences from old A proof is a sequence of inference rule applications Inference rules can be used as operators in a standard search algorithm!

PL is Too Weak a Representational Language Consider the problem of representing the following information: Every person is mortal. (S1) Confucius is a person. (S2) Confucius is mortal. (S3) S3 is clearly a logical consequence of S1 and S2. But how can these sentences be represented using PL so that we can infer the third sentence from the first two? We can use symbols P, Q, and R to denote the three propositions, but this leads us to nowhere because knowledge important to infer R from P and Q (i.e., relationship between being a human and mortality, and the membership relation between Confucius and human class) is not expressed in a way that can be used by inference rules

Weakness of PL

Summary Looked at the requirements of a representation language Knowledge is stored in sentences in a knowledge representation language and stored in a knowledge base. A knowledge based agent is composed of a knowledge base and inference mechanism Inference is the process of deriving new sentences from old ones. Propositional logic is very simple language consisting of propositional symbols and logical connectives.