Logical Inference 2 Rule-based reasoning

Slides:



Advertisements
Similar presentations
Inference in First-Order Logic
Advertisements

Some Prolog Prolog is a logic programming language
Inference Rules Universal Instantiation Existential Generalization
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Automated Reasoning Systems For first order Predicate Logic.
Artificial Intelligence Inference in first-order logic Fall 2008 professor: Luigi Ceccaroni.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Resolution in Propositional and First-Order Logic.
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals"
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Inference in First-Order Logic
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
Logical Inference 2 rule based reasoning
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Logical Inference Chapter 9 Some material adopted from notes by Andreas Geyer-Schulz,, Chuck Dyer, and Mary Getoor.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
Reasoning with Propositional Logic automated processing of a simple knowledge base CD.
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.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
For Friday Finish chapter 9 Program 1 due. Program 1 Any questions?
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
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.
EA C461 Artificial Intelligence
Logical Inference 2 Rule-based reasoning
Announcements No office hours today!
Logical Inference 1 introduction
EA C461 – Artificial Intelligence Logical Agent
Resolution in the Propositional Calculus
Logical Inference 4 wrap up
Logical Inference: Through Proof to Truth
Logical Agents Chapter 7.
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Propositional Resolution
CSE 311 Foundations of Computing I
Artificial Intelligence
Biointelligence Lab School of Computer Sci. & Eng.
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
MA/CSSE 474 More Math Review Theory of Computation
Biointelligence Lab School of Computer Sci. & Eng.
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Logical Inference Chapter 9 Chuck Dyer, and mary Getoor
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Problems in AI Problem Formulation Uninformed Search Heuristic Search
Logical Inference 4 wrap up
Logical Agents Chapter 7 Andreas Geyer-Schulz and Chuck Dyer
Presentation transcript:

Logical Inference 2 Rule-based reasoning Chapter 9 Some material adopted from notes by Andreas Geyer-Schulz,, Chuck Dyer, and Mary Getoor

Automated inference for FOL Automated inference for FOL is harder than PL Variables can potentially take on an infinite number of possible values from their domains Hence there are potentially an infinite number of ways to apply the Universal Elimination rule Godel's Completeness Theorem says that FOL entailment is only semi-decidable If a sentence is true given a set of axioms, there is a procedure that will determine this If the sentence is false, there’s no guarantee a proce-dure will ever determine this — it may never halt

Generalized Modus Ponens P, P=>Q |= Q Generalized Modus Ponens (GMP) extends this to rules in FOL Combines And-Introduction, Universal-Elimina-tion, and Modus Ponens, e.g. from P(c) and Q(c) and x P(x)Q(x)  R(x) derive R(c) Must deal with More than one condition on left side of rule variables

Our rules are Horn clauses A Horn clause is a sentence of the form: P1(x)  P2(x)  ...  Pn(x)  Q(x) where ≥ 0 Pis and 0 or 1 Q Pis and Q are positive (i.e., non-negated) literals Equivalently: P1(x)  P2(x) …  Pn(x) where the Pi are all atomic and at most one is positive Prolog is based on Horn clauses Horn clauses represent a subset of the set of sentences representable in FOL

Horn clauses II Special cases These are not Horn clauses: Typical rule: P1  P2  … Pn  Q Constraint: P1  P2  … Pn  false A fact: true  Q These are not Horn clauses: dead(x)  alive(x) married(x, y)  loves(x, y)  hates(x, y) likes(john, mary) likes(x, y)  hates(x, y) Can’t assert or conclude disjunctions, no negation No wonder reasoning over Horn clauses is easier

Horn clauses III Where are the quantifiers? Examples: Variables in conclusion are universally quantified Variables only in premises are existentially quantified Examples: parent(P,X)  isParent(P) P X parent(P,X)  isParent(P) parent(P1, X)  parent(X, P2)  grandParent(P1, P2) P1,P2 X parent(P1,X)  parent(X, P2)  grandParent(P1, P2) Prolog: grandParent(P1,P2) :- parent(P1,X), parent(X,P2)

Forward & Backward Reasoning We usually talk about two reasoning strategies: forward and backward ‘chaining’ Both are equally powerful You can also have a mixed strategy

Forward chaining Proofs start with the given axioms/premises in KB, deriving new sentences using GMP until the goal/query sentence is derived This defines a forward-chaining inference procedure because it moves “forward” from the KB to the goal [eventually] Inference using GMP is sound and complete for KBs containing only Horn clauses

Forward chaining example KB: allergies(X)  sneeze(X) cat(Y)  allergicToCats(X)  allergies(X) cat(felix) allergicToCats(mary) Goal: sneeze(mary)

Backward chaining Backward-chaining deduction using GMP is complete for KBs containing only Horn clauses Start with goal query, find rules with that conclusion, then prove each rule antecedent Keep going until you reach premises Avoid loops: check if new subgoal is already on goal stack Avoid repeated work: check if new subgoal Has already been proved true Has already failed

Backward chaining example KB: allergies(X)  sneeze(X) cat(Y)  allergicToCats(X)  allergies(X) cat(felix) allergicToCats(mary) Goal: sneeze(mary)

Forward vs. backward chaining Forward chaining is data-driven Automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal Efficient when you want to compute all conclusions Backward chaining is goal-driven, better for problem-solving and query answering Where are my keys? How do I get to my next class? Complexity of BC can be much less than linear in the size of the KB Efficient when you want one or a few decisions Good where the underlying facts are changing

Mixed strategy Many practical reasoning systems do both forward and backward chaining The way you encode a rule determines how it is used, as in % this is a forward chaining rule spouse(X,Y) => spouse(Y,X). % this is a backward chaining rule wife(X,Y) <= spouse(X,Y), female(X). Given a set of rules and the kind of reasoning needed, it’s possible to decide which to encode as FC and which as BC rules.

Completeness of GMP GMP (using forward or backward chaining) is complete for KBs that contain only Horn clauses not complete for simple KBs with non-Horn clauses What is entailed by the following sentences: (x) P(x)  Q(x) (x) P(x)  R(x) (x) Q(x)  S(x) (x) R(x)  S(x)

Completeness of GMP The following entail that S(A) is true: (x) P(x)  Q(x) (x) P(x)  R(x) (x) Q(x)  S(x) (x) R(x)  S(x) If we want to conclude S(A), with GMP we cannot, since the second one is not a Horn clause It is equivalent to P(x)  R(x)

How about in Prolog? Try encoding this in Prolog q(X) :- p(X). r(X) :- neg(p(X)). s(X) :- q(X). s(X) :- r(X). We should not use \+ or not (in SWI) for negation since it means “negation as failure” Prolog explores possible proofs independently It can’t take a larger view and realize that one branch must be true since p(x)  ~p(x) is always true (x) P(x)  Q(x) (x) P(x)  R(x) (x) Q(x)  S(x) (x) R(x)  S(x)