Inference in first-order logic. Production systems.

Similar documents
Logic reasoning systems

Knowledge-based systems

Planning: situation calculus

Inference in first-order logic

CS 2710 Foundations of AI Lecture 12. Propositional logic. Logical inference problem

Propositional Logic: Review

Inference in first-order logic

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

MAI0203 Lecture 7: Inference and Predicate Calculus

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

AI Programming CS S-09 Knowledge Representation

CS 771 Artificial Intelligence. Propositional Logic

Inference in first-order logic

Inference Methods In Propositional Logic

Advanced Topics in LP and FP

Propositional and First-Order Logic

Knowledge Representation. Propositional logic

Logical Agent & Propositional Logic

Inference Methods In Propositional Logic

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II)

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

CS 2740 Knowledge Representation. Lecture 4. Propositional logic. CS 2740 Knowledge Representation. Administration

Propositional Logic: Methods of Proof. Chapter 7, Part II

Knowledge Representation. Propositional logic.

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

Deliberative Agents Knowledge Representation I. Deliberative Agents

CS 380: ARTIFICIAL INTELLIGENCE

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Dieter Fox, Henry Kautz )

CSCI-495 Artificial Intelligence. Lecture 17

Deductive Systems. Lecture - 3

Propositional Reasoning

Propositional Logic: Methods of Proof (Part II)

CS 4700: Foundations of Artificial Intelligence

Franz J. Kurfess Computer Science Department California Polytechnic State University San Luis Obispo, CA, U.S.A.

Logical Agents. Santa Clara University

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction

Intelligent Agents. Pınar Yolum Utrecht University

Propositional Logic: Models and Proofs

CS 730/830: Intro AI. 1 handout: slides. Wheeler Ruml (UNH) Lecture 11, CS / 15. Propositional Logic. First-Order Logic

Artificial Intelligence Chapter 7: Logical Agents

CS 7180: Behavioral Modeling and Decision- making in AI

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Logical Inference 2 rule based reasoning

Logical Agents. Chapter 7

Logical Agent & Propositional Logic

Propositional Resolution

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

Propositional and Predicate Logic - V

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

Logical Agents (I) Instructor: Tsung-Che Chiang

Propositional Logic Part 1

CSC242: Intro to AI. Lecture 11. Tuesday, February 26, 13

02 Propositional Logic

Propositional Logic: Logical Agents (Part I)

Lecture 11: Measuring the Complexity of Proofs

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Prolog and Logic Programming. CS152 Chris Pollett Dec. 3, 2008.

Propositional Logic: Bottom-Up Proofs

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Proof Methods for Propositional Logic

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

Lecture 7: Logic and Planning

Artificial Intelligence. Propositional Logic. Copyright 2011 Dieter Fensel and Florian Fischer

Logical Agents. September 14, 2004

Intelligent Systems. Propositional Logic. Dieter Fensel and Dumitru Roman. Copyright 2008 STI INNSBRUCK

Inf2D 13: Resolution-Based Inference

Propositional Logic Language

Set 9: Planning Classical Planning Systems Chapter 10 R&N. ICS 271 Fall 2017

Strong AI vs. Weak AI Automated Reasoning

Inference in Propositional Logic

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

Artificial Intelligence

Propositional logic II.

Introduction to Intelligent Systems

Introduction to Intelligent Systems

Tractable Reasoning with Incomplete First-Order Knowledge in Dynamic Systems with Context-Dependent Actions

CSC384: Intro to Artificial Intelligence Knowledge Representation II. Required Readings: 9.1, 9.2, and 9.5 Announcements:

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

CS 520: Introduction to Artificial Intelligence. Review

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

First Order Logic: Syntax and Semantics

a. (6.25 points) where we let b. (6.25 points) c. (6.25 points) d. (6.25 points) B 3 =(x)[ H(x) F (x)], and (11)

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Chapter 3: Propositional Calculus: Deductive Systems. September 19, 2008

Propositional logic (revision) & semantic entailment. p. 1/34

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Propositional Logic Arguments (5A) Young W. Lim 11/8/16

Artificial Intelligence Knowledge Representation I

Class Assignment Strategies

Logical agents. Chapter 7. Chapter 7 1

Propositional Logic: Logical Agents (Part I)

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

Warm-Up Problem. Write a Resolution Proof for. Res 1/32

Transcription:

CS 1571 Introduction to AI Lecture 17 Inference in first-order logic. Production systems. Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Sentences in Horn normal form Horn normal form (HNF) in the propositional logic a special type of clause with at most one positive literal ( A B) ( A C D ) Typically written as: ( B A) (( A C ) D ) A clause with one literal, e.g. A, is also called a fact A clause representing an implication (with a conjunction of positive literals in antecedent and one positive literal in consequent), is also called a rule Generalized Modus ponens: is the complete inference rule for KBs in the Horn normal form. Not all KBs are convertible to HNF!!!

Horn normal form in FOL First-order logic (FOL) adds variables and quantifiers, works with terms Generalized modus ponens rule: σ = a substitution s.t. i SUBST( σ, φi') = SUBST( σ, φi ) φ1', φ 2 ' K, φ n ', φ1 φ 2 Kφ n τ SUBST ( σ, τ ) Generalized modus ponens: is complete for the KBs with sentences in Horn form; Not all first-order logic sentences can be expressed in this form Forward and backward chaining Two inference procedures based on modus ponens for Horn KBs: Forward chaining Idea: Whenever the premises of a rule are satisfied, infer the conclusion. Continue with rules that became satisfied. Typical usage: infer all sentences entailed by the existing KB. Backward chaining (goal reduction) Idea: To prove the fact that appears in the conclusion of a rule prove the premises of the rule. Continue recursively. Typical usage: If we want to prove that the target (goal) sentence α is entailed by the existing KB. Both procedures are complete for KBs in Horn form!!!

Forward chaining example Forward chaining Idea: Whenever the premises of a rule are satisfied, infer the conclusion. Continue with rules that became satisfied Assume the KB with the following rules: KB: R1: Steamboat ( Sailboat ( R2: R3: F1: F2: F3: Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( Steamboat (Titanic ) Sailboat (Mistral ) RowBoat(PondArrow) Theorem: Faster ( Titanic, PondArrow )? Forward chaining example KB: R1: R2: R3: Steamboat ( Sailboat ( Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow)?

Forward chaining example KB: R1: R2: R3: Steamboat ( Sailboat ( Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Rule R1 is satisfied: F4: Faster( Titanic, Mistral) Forward chaining example KB: R1: R2: R3: Steamboat ( Sailboat ( Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Rule R1 is satisfied: F4: Faster( Titanic, Mistral) Rule R2 is satisfied: F5: Faster( Mistral, PondArrow)

Forward chaining example KB: R1: R2: R3: Steamboat ( Sailboat ( Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Rule R1 is satisfied: F4: Faster( Titanic, Mistral) Rule R2 is satisfied: F5: Faster( Mistral, PondArrow) Rule R3 is satisfied: F6: Faster( Titanic, PondArrow) Backward chaining example Backward chaining (goal reduction) Idea: To prove the fact that appears in the conclusion of a rule prove the antecedents (if part) of the rule & repeat recursively. KB: R1: R2: R3: F1: F2: F3: Steamboat ( Sailboat ( Sailboat ( RowBoat ( Faster ( Faster ( x, Faster ( Steamboat (Titanic ) Sailboat (Mistral ) RowBoat(PondArrow) Theorem: Faster ( Titanic, PondArrow )

Backward chaining example Steamboat(Titanic) Faster ( Titanic, PondArrow ) R1 F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Sailboat(PondArrow) Steamboat ( Sailboat ( Faster ( Titanic, PondArrow ) { x / Titanic, y / PondArrow} Backward chaining example Steamboat(Titanic) Faster( Titanic, PondArrow) R1 R2 Sailboat(Titanic) F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Sailboat (PondArrow) RowBoat(PondArrow) Sailboat ( RowBoat ( Faster ( Faster ( Titanic, PondArrow ) { y / Titanic, z / PondArrow}

Backward chaining example Faster( Titanic, PondArrow) R1 R2 R3 F1: Steamboat (Titanic ) F2: Sailboat (Mistral ) F3: RowBoat(PondArrow) Steamboat(Titanic) Sailboat(Titanic) Faster( PondArrow) Faster( Titanic, Sailboat (PondArrow) RowBoat(PondArrow) Steamboat(Titanic) R1 R2 Sailboat(Mistral) Sailboat(Mistral) RowBoat(PondArrow) Backward chaining Faster( Titanic, PondArrow) y must be bound to R1 the same term R2 R3 Steamboat(Titanic) Sailboat(Titanic) Faster( PondArrow) Faster( Titanic, Sailboat(PondArrow) RowBoat(PondArrow) Steamboat(Titanic) R1 R2 Sailboat(Mistral) Sailboat(Mistral) RowBoat(PondArrow)

Knowledge-based system Knowledge base Inference engine Knowledge base: A set of sentences that describe the world in some formal (representational) language (e.g. first-order logic) Domain specific knowledge Inference engine: A set of procedures that work upon the representational language and can infer new facts or answer KB queries (e.g. resolution algorithm, forward chaining) Domain independent Automated reasoning systems Examples and main differences: Theorem provers Prove sentences in the first-order logic. Use inference rules, resolution rule and resolution refutation. Deductive retrieval systems Systems based on rules (KBs in Horn form) Prove theorems or infer new assertions (forward, backward chaining) Production systems Systems based on rules with actions in antecedents Forward chaining mode of operation Semantic networks Graphical representation of the world, objects are nodes in the graphs, relations are various links

Production systems Based on rules, but different from KBs in the Horn form Knowledge base is divided into: A Rule base (includes rule A Working memory (includes fact A special type of if then rule p 1 p2 K pn a1, a2, K, a k Antecedent: a conjunction of literals facts, statements in predicate logic Consequent: a conjunction of actions. An action can: ADD the fact to the KB (working memor REMOVE the fact from the KB (consistent with logic?) QUERY the user, etc Production systems Based on rules, but different from KBs in the Horn form Knowledge base is divided into: A Rule base (includes rule A Working memory (includes fact A special type of if then rule p 1 p2 K pn a1, a2, K, a k Antecedent: a conjunction of literals facts, statements in predicate logic Consequent: a conjunction of actions. An action can: ADD the fact to the KB (working memor REMOVE the fact from the KB!!! Different from logic QUERY the user, etc

Production systems Use forward chaining to do reasoning: If the antecedent of the rule is satisfied (rule is said to be active ) then its consequent can be executed (it is fired ) Problem: Two or more rules are active at the same time. Which one to execute next? R27 R105 Conditions R27 Conditions R105 Actions R27 Actions R105? Strategy for selecting the rule to be fired from among possible candidates is called conflict resolution Production systems Why is conflict resolution important? Or, why do we care about the order? Assume that we have two rules and the preconditions of both are satisfied: R1: A( B( C( add D( R2: A( B( E( delete A( What can happen if rules are triggered in different order?

Production systems Why is conflict resolution important? Or, Why do we care about the order? Assume that we have two rules and the preconditions of both are satisfied: R1: R2: A( B( C( add D( A( B( E( delete A( What can happen if rules are triggered in different order? If R1 goes first, R2 condition is still satisfied and we infer D( If R2 goes first we may never infer D( Production systems Problems with production systems: Additions and Deletions can change a set of active rules; If a rule contains variables testing all instances in which the rule is active may require a large number of unifications. Conditions of many rules may overlap, thus requiring to repeat the same unifications multiple times. Solution: Rete algorithm gives more efficient solution for managing a set of active rules and performing unifications Implemented in the system OPS-5 (used to implement XCON an expert system for configuration of DEC computer

Rete algorithm Assume a set of rules: A( B( C( add D( A( B( D( add E( A( B( E( delete A( And facts: A( 1), A(2), B(2), B(3), B(4), C(5) Rete: Compiles the rules to a network that merges conditions of multiple rules together (avoid repeat Propagates valid unifications Reevaluates only changed conditions Rete algorithm. Network. Rules: Facts: A( B ( C ( y ) add D ( A( B ( y ) D ( add E ( A( B ( E ( z ) delete A( A( 1), A(2), B (2), B (3), B (4), C (5)

Conflict resolution strategies Problem: Two or more rules are active at the same time. Which one to execute next? Solutions: No duplication (do not execute the same rule twice) Recency. Rules referring to facts newly added to the working memory take precedence Specificity. Rules that are more specific are preferred. Priority levels. Define priority of rules, actions based on expert opinion. Have multiple priority levels such that the higher priority rules fire first. Semantic network systems Knowledge about the world described in terms of graphs. Nodes correspond to: Concepts or objects in the domain. Links to relations. Three kinds: Subset links (isa, part-of link Member links (instance link Function links. Inheritance relation links Can be transformed to the first-order logic language Graphical representation is often easier to work with better overall view on individual concepts and relations

Semantic network. Example. Water Transports on Ship isa isa is-part is-part Ocean liner Oil tanker Engine Hull is-part member member is-part Swimming pool Queen Mary Exxon Valdez Boiler Inferred properties: Queen Mary is a ship Queen Mary has a boiler Planning: situation calculus

Representation of actions, situations, events The world is dynamic: What is true now may not be true tomorrow Changes in the world may be triggered by our activities Problems: Logic (FOL) as we had it referred to a static world. How to represent the change in the FOL? How to represent actions we can use to change the world? Planning Planning problem: find a sequence of actions that achieves some goal an instance of a search problem the state description is typically very complex and relies on a logic-based representation Methods for modeling and solving a planning problem: State space search Situation calculus based on FOL STRIPS state space search algorithm Partial-order planning algorithms

Situation calculus Provides a framework for representing change, actions and for reasoning about them Situation calculus based on the first-order logic, a situation variable models new states of the world action objects model activities uses inference methods developed for FOL to do the reasoning Situation calculus Logic for reasoning about changes in the state of the world The world is described by: Sequences of situations of the current state Changes from one situation to another are caused by actions The situation calculus allows us to: Describe the initial state and a goal state Build the KB that describes the effect of actions (operator Prove that the KB and the initial state lead to a goal state extracts a plan as side-effect of the proof

Situation calculus The language is based on the First-order logic plus: Special variables: s,a objects of type situation and action Action functions: return actions. E.g. Move(A, TABLE, B) represents a move action Move(x, represents an action schema Two special function symbols of type situation s 0 initial situation DO(a, denotes the situation obtained after performing an action a in situation s Situation-dependent functions and relations (also called fluent Relation: On(x, object x is on object y in situation s; Function: Above(x, object that is above x in situation s. Situation calculus. Blocks world example. A B A B C C Initial state On(A,Table, s 0 ) On(B,Table, s 0 ) On(C,Table, s 0 ) Clear(A, s 0 ) Clear(B, s 0 ) Clear(C, s 0 ) Clear(Table, s 0 ) Goal Find a state (situation) s, such that On(A,B, On(B,C, On(C,Table,

Blocks world example. A B A B C C Initial state On(A,Table, s 0 ) On(B,Table, s 0 ) On(C,Table, s 0 ) Clear(A, s 0 ) Clear(B, s 0 ) Clear(C, s 0 ) Clear(Table, s 0 ) Goal On(A,B, On(B,C, On(C,Table, Note: It is not necessary that the goal describes all relations Clear(A, Blocks world example. Assume a simpler goal On(A,B, A B C Initial state On(A,Table, s 0 ) On(B,Table, s 0 ) On(C,Table, s 0 ) Clear(A, s 0 ) Clear(B, s 0 ) Clear(C, s 0 ) Clear(Table, s 0 ) 3 possible goal configurations A B C C A B A B C Goal On(A,B,

Knowledge base: Axioms. Knowledge base needed to support the reasoning: Must represent changes in the world due to actions. Two types of axioms: Effect axioms changes in situations that result from actions Frame axioms things preserved from the previous situation Blocks world example. Effect axioms. Effect axioms: Moving x from y to z. MOVE ( x, Effect of move changes on On relations On( x, Clear ( x, Clear ( z, On( x, z, DO ( MOVE ( x,, ) On ( x, Clear ( x, Clear ( z, On( x, DO ( MOVE ( x,, ) Effect of move changes on Clear relations On( x, Clear ( x, Clear ( z, Clear ( DO ( MOVE ( x,, ) On( x, Clear ( x, Clear ( z, ( z Table ) Clear ( z, DO ( MOVE ( x,, )

Blocks world example. Frame axioms. Frame axioms. Represent things that remain unchanged after an action. On relations: On( u, v, ( u ( v On( u, v, DO ( MOVE ( x,, ) Clear relations: Clear ( u, ( u Clear ( u, DO ( MOVE ( x,, ) Planning in situation calculus Planning problem: find a sequence of actions that lead to a goal Planning in situation calculus is converted to the theorem proving problem Goal state: s On( A, B, On( B, C, On( C, Table, Possible inference approaches: Inference rule approach Conversion to SAT Plan (solution) is a byproduct of theorem proving. Example: blocks world

Planning in a blocks world. A B A B C C Initial state On(A,Table, s 0 ) On(B,Table, s 0 ) On(C,Table, s 0 ) Clear(A, s 0 ) Clear(B, s 0 ) Clear(C, s 0 ) Clear(Table, s 0 ) Goal On(A,B, On(B,C, On(C,Table, Planning in the blocks world. A B C A B C Initial state (s0) s 0 = On On On ( 0 ( 0 ( 0 A, Table, s ) B, Table, s ) C, Table, s ) s1 Clear ( A, s0 ) Clear ( B, s0 ) Clear C, s ) ( 0 Clear ( Table, s0 ) Action: MOVE ( B, Table, C ) s 1 = DO ( MOVE ( B, Table, C ), s0 ) On( A, Table, s1 ) Clear ( A, s On( B, C, s1) 1) On( B, Table, s Clear ( B, s1) 1) On C, Table, s ) Clear ( C, s1) ( 1 Clear Table, s ) ( 1

Planning in the blocks world. A B B A B C A C C Initial state (s0) s1 s2 s 1 = DO ( MOVE ( B, Table, C ), s0 ) On( A, Table, s1 ) On( B, C, s ) Clear ( A, s1) 1 On( B, Table, s Clear ( B, s1) 1) On C, Table, s ) Clear C, s ) ( 1 ( 1 Clear Table, s ) ( 1 Action: MOVE ( A, Table, B) s = 2 DO ( MOVE ( A, Table, B), s1) = DO ( MOVE ( A, Table, B), DO ( MOVE ( B, Table, C ), s0 )) ( A, B, s2 ) On( A, Table, s2 ) Clear ( B, s2 ) ( B, C, s2 ) On( B, Table, s2 ) Clear ( C, s2 ) ( C, Table, s2 ) Clear ( A, s2 Clear ( Table, s2 ) On On On ) Planning in situation calculus. Planning problem: Find a sequence of actions that lead to a goal Is a special type of a search problem Planning in situation calculus is converted to theorem proving. Problems: Large search space Large number of axioms to be defined for one action Proof may not lead to the best (shortest) plan.