CS 541: Artificial Intelligence Lecture IV: Logic Agent and First Order Logic.

Slides:



Advertisements
Similar presentations
First-Order Logic Chapter 8.
Advertisements

Russell and Norvig Chapter 7
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.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Artificial Intelligence Knowledge-based Agents Russell and Norvig, Ch. 6, 7.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
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.
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.
Methods of Proof Chapter 7, second half.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
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.
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
S P Vimal, Department of CSIS, BITS, Pilani
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.
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.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
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)
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.
Propositional Logic: Logical Agents (Part I)
EA C461 Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Logical Agents Chapter 7.
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
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
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

CS 541: Artificial Intelligence Lecture IV: Logic Agent and First Order Logic

Announcement  CA Office Hour: 3:00pm-4:00pm, Lieb 319.  Homework assignment should be checked at Moodle.

Schedule WeekDateTopicReadingHomework** 108/29/2012Introduction & Intelligent AgentCh 1 & 2N/A 209/05/2012Search: search strategy and heuristic searchCh 3 & 4sHW1 (Search) 309/12/2012Search: Constraint Satisfaction & Adversarial SearchCh 4s & 5 & 6 Teaming Due 409/19/2012Logic: Logic Agent & First Order LogicCh 7 & 8sHW1 due, Midterm Project (Game) 509/26/2012Logic: Inference on First Order LogicCh 8s & 9 610/03/2012 No class 7 10/10/2012Uncertainty and Bayesian Network Ch 13 & Ch14s HW2 (Logic) 8 10/17/2012 Midterm Presentation Midterm Project Due 9 10/24/2012Inference in Baysian NetworkCh 14sHW2 Due, HW3 (Probabilistic Reasoning) 10 10/31/2012Probabilistic Reasoning over TimeCh /07/2012Machine Learning HW3 due, 1211/14/2012Markov Decision ProcessCh 18 & 20HW4 (Probabilistic Reasoning Over Time) 1311/21/2012 No class Ch /29/2012Reinforcement learningCh 21HW4 due 1512/05/2012Final Project Presentation Final Project Due

Re-cap Lecture III  Constraint Satisfaction Problem  Constraint satisfaction problem (CSP) examples  Backtracking search for CSPs  Problem structure and problem decomposition  Local search for CSPs  Adversarial Search and Games  Games  Perfect play  Minimax decisions  α - β pruning  Resource limits and approximate evaluation  Games of chance  Games of imperfect information

Logic Agent Lecture IV: Part I

Outline  Knowledge-based agents  Wumpus world  Logic in general—models and entailment  Propositional (Boolean) logic  Equivalence, validity, satisfiability  Inference rules and theorem proving  Forward chaining  Backward chaining  Resolution

Knowledge bases  Knowledge base  Set of sentences in a formal language  Declarative approach to building an agent (or other system)  T ELL it what is needs to know  Then it can A SK itself what to do  Answers should follow from the KB  Agents can be viewed at the knowledge level  i.e., what they know, regardless of how implemented  Or at the implementation level  i.e., data structures in KB and algorithms that manipulate them

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

Wumpus world PEAS description  Performance measure  Gold +1000; Death  -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  Grabbing picks up gold if in same square  Releasing drops the gold in same square  Actuators  Left turn, right turn, forward, grab, release, shoot  Sensors  Breeze, glitter, smell

Wumpus world characterization  Observable??  No, only local perception  Deterministic??  Yes, outcomes exactly specified  Episodic??  No, sequential at the level of actions  Static??  Wumpus and pits do not move  Discrete??  Yes  Single-agent??  Yes, Wumpus is essentially a natural feature

Exploring a wumpus world

Other tight spots  Breeze in (1,2) and (2, 1)  No safe actions  Smell in (1,1)  Cannot move  Can use a strategy of coercion  Shoot straight ahead  Wumpus was there  dead  safe  Wumpus wasn’t there  safe

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 arithematics  x+2≥y is a sentence; x2+2> 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

Entailment

Models

Entailment in the wumpus world  Situation after detecting nothing in [1,1], moving right, breeze in [2,1]  Consider possible models for ?s assuming only pits  3 Boolean choices  8 possible models

Wumpus models

 KB=wumpus-world rules+observations

Wumpus models

 KB=wumpus-world rules+observations

Wumpus models

Inference

Propositional logic: Syntax

Propositional logic: Semantics

Truth tables for connectives

Wumpus world sentences

Truth tables for inference

Inference by enumeration

Logical equivalence

Validity and satisfiability

Proof methods  Proof methods divide into (roughly) two kinds:  Application of inference rules  Legitimate (sound) generation of new sentences from old  Proof = a sequence of inference rule applications  Can use inference rules as operators in a standard search algorithm  Typically require translation of sentences into a norm form  Model checking  Truth table enumeration (always exponential in n)  Improved backtracking, e.g., Davis-Putnam-Logemann-Loveland (DPLL)  Heurisitc search in model space (sound but incomplete)  E.g., min-conflicts-like hill-climbing algorithms

Forward and backward chaining

 Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found Forward chaining

Forward chaining algorithm

Forward chaining example

Proof of completeness

Backward chaining  Idea: work backwards from the query q:  To prove q by BC, check if q is known already, or, prove by BC all premises of some rule concluding q  Avoid loops: check if new subgoal is already on the goal stack  Avoid repeated work: check if new sub goal  Has already been proven true, or  Has already failed

Backward chaining example

Forward vs. backward chaining  FC is data-driven, cf. automatic, unconscious processing  E.g., object recognition, routine decisions  May do lots of work that is irrelevant to the goal  BC is goal-driven, appropriate for problem-solving  E.g., where are my keys? How do I get into a PhD program?  Complexity of BC can be much less than linear in size of KB

Resolution

Conversion to CNF

Resolution algorithm

Resolution example

Summary  Logical agents apply inference to a knowledge base to derive new information and make decisions  Basic concepts of logic:  Syntax: formal structure of sentences  Semantics: truth of sentences wrt models  Entailment: necessary truth of one sentence given another  Inference: deriving sentences from other sentences  Soundess: derivations produce only entailed sentences  Completeness: derivations can produce all entailed sentences  Wumpus world requires the ability to represent partial and negated information, reason by cases, etc.  Forward, backward chaining are linear-time, complete for Horn clauses  Resolution is complete for propositional logic  Propositional logic lacks expressive power

First-order Logic Lecture IV: Part II

Outline  Why first-order logic (FOL)?  Syntax and semantics of FOL  Fun with sentences  Wumpus world in FOL

Pros and cons of propositional logic

First-order logic  Whereas propositional logic assumes world contains facts,  First-order logic (like natural language) assumes that the world contains  Objects: people, houses, numbers, theories, Ronald McDonald, colors, baseball games, wars, centuries …  Relations: red, round, bogus, prime, multistoried…, brother of, bigger than, inside, part of, has color, occurred after, owns, comes between, …  Functions: father of, best friend, third inning of, one more than, end of…

Logics in general

Syntax of FOL: Basic elements

Atomic sentences  Atomic sentence = predicate(term 1, …, term n )  Or term 1 =term 2  Term=function(term 1,…,term n ) or constant or variable  E.g., Brother(King John, RichardTheLinonHeart)  >(Length(LeftLegOf(Richard))), Length(LeftLegOf(KingJohn)))

Complex sentences

Truth in first-order logic

Models for FOL: example

Truth example  Consider the interpretation in which  Richard  Richard the Lionheart  John  the evil King John  Brother  The brotherhood relation  Under this interpretation, Brother(Richard, John) is true, just in case Richard the Liohheart and the evil King John are in the brotherhood relation in the model

Models of FOL: lots!  Entailment in propositional logic can be computed by enumerating models  We can enumerate the FOL models for a given KB vocabulary, i.e.,  For each number of domain elements n from 1 to ∞  For each k-ary predicate P k in the vocabulary  For each possible k-ary relation on n objects  For each constant symbol C in the vocabulary  For each choice of referent for C from n Objects …  Computing entailment by enumerating FOL models is not easy!

Universal quantification

A common mistake to avoid

Existential quantification

Another common mistake to avoid

Properties of quantifiers

Fun with sentences

Equality

Interacting with FOL KBs

Knowledge base for the wumpus world

Deducing hidden properties

Keeping track of change

Describing actions I

Describing actions II

Making plans

Making plans: A better way

Summary  First-order logic:  Objects and relations are semantic primitives  Syntax: constants, functions, predicates, equality, quantiers  Increased expressive power: sufficient to define wumpus world  Situation calculus:  Conventions for describing actions and change in FOL  Can formulate planning as inference on a situation calculus KB