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
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: – Constant symbols (i.e., the "individuals"
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.
Logical Inference 1 introduction Chapter 9 Some material adopted from notes by Andreas Geyer-Schulz,, Chuck Dyer, and Mary Getoor.
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"
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
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.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Knoweldge Representation & Reasoning
Inference in First-Order Logic
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Propositional Logic: Methods of Proof (Part II)
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
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,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
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
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.:
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
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 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Automated Reasoning Systems For first order Predicate Logic.
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.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Backward chaining Assume the same representation of rules as in forward chaining, i.e. If is true, is true, … is true Then is true. Rule interpretation.
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 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,
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,
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
Logical Inference 2 Rule-based reasoning
Logical Agents Chapter 7 Selected and slightly modified slides from
Artificial Intelligence: Agents and Propositional Logic.
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Logical Inference 4 wrap up
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) Need to deal with more than one condition on left side of rule variables

Generalized Modus Ponens General case: Given atomic sentences P1, P2, ..., PN implication sentence (Q1  Q2  ...  QN)  R Q1, ..., QN and R are atomic sentences substitution subst(θ, Pi) = subst(θ, Qi) for i=1,...,N Derive new sentence: subst(θ, R) Substitutions subst(θ, α) denotes the result of applying a set of substitutions defined by θ to the sentence α A substitution list θ = {v1/t1, v2/t2, ..., vn/tn} means to replace all occurrences of variable symbol vi by term ti Substitutions made in left-to-right order in the list subst({x/Cheese, y/Mickey}, eats(y,x)) = eats(Mickey, Cheese)

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 algorithm

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 also complete for KBs containing only Horn clauses Proofs start with the goal query, find rules with that conclusion, and then prove each of the antecedents in the implication Keep going until you reach premises Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal Has already been proved true Has already failed

Backward chaining algorithm

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 model of the rules you have and the kind of reason you need to do, 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 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)