1 Chapter 8 Inference and Resolution for Problem Solving.

Slides:



Advertisements
Similar presentations
Artificial Intelligence 8. The Resolution Method
Advertisements

Resolution Proof System for First Order Logic
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Standard Logical Equivalences
Resolution.
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.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
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.
Logic Use mathematical deduction to derive new knowledge.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Predicate Calculus Russell and Norvig: Chapter 8,9.
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
Artificial Intelligence
Artificial Intelligence Chapter 14 Resolution in the Propositional Calculus Artificial Intelligence Chapter 14 Resolution in the Propositional Calculus.
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
CSCE 4613 Artificial Inteligence
1 Section 7.2 Equivalent Formulas Two wffs A and B are equivalent, written A  B, if they have the same truth value for every interpretation. Property:
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
1CS3754 Class Notes 14B, John Shieh, Figure 2.5: Further steps in the unification of (parents X (father X) (mother bill)) and (parents bill.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original.
KU NLP Resolution Theorem Proving Resolution Theorem Proving q Introduction - Resolution Principle q Producing the Clause Form q
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
Reasoning using First-Order Logic
The Law of Resolution Formal Aspects of Computer Science - Week 7 The Law of Resolution Lee McCluskey, room 2/07
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
第 1 6 章 谓词演算中的归结. 2 Outline Unification Predicate-Calculus Resolution Completeness and Soundness Converting Arbitrary wffs to Clause Form Using Resolution.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
Introduction to Logic for Artificial Intelligence Lecture 2
Knowledge Representation and Reasoning
Resolution in the Propositional Calculus
Horn Clauses and Unification
Elementary Metamathematics
Logic Use mathematical deduction to derive new knowledge.
Biointelligence Lab School of Computer Sci. & Eng.
Horn Clauses and Unification
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
Biointelligence Lab School of Computer Sci. & Eng.
Horn Clauses and Unification
Inference and Resolution for Problem Solving
RESOLUTION.
Resolution Proof System for First Order Logic
Presentation transcript:

1 Chapter 8 Inference and Resolution for Problem Solving

2 Chapter 8 Contents (1) l Normal Forms l Converting to CNF l Clauses l The Resolution Rule l Resolution Refutation l Proof by Refutation l Example: Graph Coloring

3 Chapter 8 Contents (2) l Normal Forms in Predicate Calculus l Skolemization l Unification l The Unification algorithm l The Resolution Algorithm l Horn Clauses in PROLOG

4 Normal Forms l A wff is in Conjunctive Normal Form (CNF) if it is a conjunction of disjunctions: n A 1 Λ A 2 Λ A 3 Λ … Λ A n n where each clause, A i, is of the form: n B 1 v B 2 v B 3 v … v B n n The B’s are literals. l E.g.: A Λ (B v C) Λ (¬A v ¬B v ¬C v D) l Similarly, a wff is in Disjunctive Normal Form (DNF) if it is a disjunction of conjunctions. l E.g.: A v (B Λ C) v (¬A Λ ¬B Λ ¬C Λ D)

5 Converting to CNF l Any wff can be converted to CNF by using the following equivalences: (1)A ↔ B  (A → B) Λ (B → A) (2)A → B  ¬ A v B (3) ¬ (A Λ B)  ¬ A v ¬ B (4) ¬ (A v B)  ¬ A Λ ¬ B (5) ¬¬ A  A (6)A v (B Λ C)  (A v B) Λ (A v C) l Importantly, this can be converted into an algorithm – this will be useful when when we come to automating resolution.

6 Clauses l Having converted a wff to CNF, it is usual to write it as a set of clauses. l E.g.: (A → B) → C l In CNF is: (A V C) Λ (¬B V C) l In clause form, we write: {(A, C), (¬B, C)}

7 The Resolution Rule l The resolution rule is written as follows: A v B¬ B v C A v C l This tells us that if we have two clauses that have a literal and its negation, we can combine them by removing that literal. l E.g.: if we have {(A, C), (¬A, D)} l We would apply resolution to get {C, D}

8 Resolution Refutation l Let us resolve: {(¬A, B), (¬A, ¬B, C), A, ¬C} l We begin by resolving the first clause with the second clause, thus eliminating B and ¬B: {(¬A, C), A, ¬ C} {C, ¬C} l Now we can resolve both remaining literals, which gives falsum:  l If we reach falsum, we have proved that our initial set of clauses were inconsistent. l This is written: {( ¬ A, B), ( ¬ A, ¬ B, C), A, ¬ C} ╞ 

9 Proof by Refutation l If we want to prove that a logical argument is valid, we negate its conclusion, convert it to clause form, and then try to derive falsum using resolution. l If we derive falsum, then our clauses were inconsistent, meaning the original argument was valid, since we negated its conclusion.

10 Proof by Refutation - Example l Our argument is: (A Λ ¬ B) → C A Λ ¬ B  C l Negate the conclusion and convert to clauses: {( ¬ A, B, C), A, ¬ B, ¬ C} l Now resolve: {(B, C), ¬ B, ¬ C} {C, ¬ C}  l We have reached falsum, so our original argument was valid.

11 Refutation Proofs in Tree Form l It is often sensible to represent a refutation proof in tree form: l In this case, the proof has failed, as we are left with E instead of falsum.

12 Example: Graph Coloring l Resolution refutation can be used to determine if a solution exists for a particular combinatorial problem. l For example, for graph coloring, we represent the assignment of colors to the nodes and the constraints regarding edges as propositions, and attempt to prove that the complete set of clauses is consistent. l This does not tell us how to color the graph, simply that it is possible.

13 Example: Graph Coloring (2) l Available colors are r (red), g (green) and b (blue). A r means that node A has been coloured red. l Each node must have exactly one color: A r v A g v A b ¬A r v ¬A g (  A r → ¬A g ) ¬A g v ¬A b ¬A b v ¬A r l If (A,B) is an edge, then: ¬A r v ¬B r ¬A b v ¬B b ¬A g v ¬B g l Now we construct the complete set of clauses for our graph, and try to see if they are consistent, using resolution.

14 Normal Forms in Predicate Calculus l A FOPC expression can be put in prenex normal form by converting it to CNF, with the quantifiers moved to the front. l For example, the wff: (  x)(A(x) → B(x)) → (  y)(A(y) Λ B(y)) l Converts to prenex normal form as: (  x)(  y)(((A(x) v A(y)) Λ (¬B(x) v A(y)) Λ (A(x) v B(y)) Λ (¬B(x) v B(y))))

15 Conversion to Prenex detail l (  x)(A(x)→B(x))→(  y)(A(y)ΛB(y)) l ¬ (  x)(A(x)→B(x)) v (  y)(A(y)ΛB(y)) l ¬ (  x)( ¬ A(x) v B(x)) v (  y)(A(y)ΛB(y)) l (  x)¬ ( ¬ A(x) v B(x)) v (  y)(A(y)ΛB(y)) l (  x)(¬¬ A(x)Λ ¬ B(x)) v (  y)(A(y)ΛB(y)) l (  x)( A(x)Λ ¬ B(x)) v (  y)(A(y)ΛB(y)) l (  x) (  y) ( A(x)Λ ¬ B(x)) v (A(y)ΛB(y))) l (  x)(  y)(((A(x)vA(y))Λ(¬B(x)vA(y))Λ(A(x) vB(y))Λ(¬B(x)v B(y))))

16 Skolemization l Before resolution can be applied,  must be removed, using skolemization. l Variables that are existentially quantified are replaced by a constant:  (x) P(x) l is converted to: P(c) l c must not already exist in the expression.

17 Skolem functions l If the existentially quantified variable is within the scope of a universally quantified variable, it must be replaced by a skolem function, which is a function of the universally quantified variable. l Sounds complicated, but is actually simple: (  x)(  y)(P(x,y)) l Is Skolemized to give: (  x)(P(x,f(x)) l After skolemization,  is dropped, and the expression converted to clauses in the usual manner.

18 Unification (1) l To resolve clauses we often need to make substitutions. For example: {(P(w,x)), (¬P(y,z))} l To resolve, we need to substitute y for w, and z for x, giving: {(P(y,z)), (¬P(y,z))} l Now these resolve to give falsum.

19 Unification (2) l A substitution that enables us to resolve a set of clauses is called a unifier. l We write the unifier we used above as: {y/w, z/x} l A unifier (u) is a most general unifier (mgu) if any other unifier can be formed by the composition of u with some other unifier. l An algorithm can be generated which obtains a most general unifier for any set of clauses.

20 The Resolution Algorithm 1First, negate the conclusion and add it to the list of assumptions. 2Now convert the assumptions into Prenex Normal Form 3Next, skolemize the resulting expression 4Now convert the expression into a set of clauses 5Now resolve the clauses using suitable unifiers. l This algorithm means we can write programs that automatically prove theorems using resolution.

21 Horn Clauses in PROLOG (1) l PROLOG uses resolution. l A Horn clause has at most one positive literal: A v ¬B v ¬C v ¬D v ¬E … l This can also be written as an implication: B Λ C Λ D Λ E → A l In PROLOG, this is written: A :- B, C, D, E

22 Horn Clauses in PROLOG (2) l Horn clauses can express rules: A :- B, C, D l Or facts: A :- l Or goals: :- B, C, D, E l If a set of clauses is valid, PROLOG will definitely prove it using resolution and depth first search.

23 Skolemization Example (  x)([a(X) Λb(X)]→[c(X,I)Λ(  X)((  Z)[c(X,Z)] →d(X,X))])v(  X)(e(X)) (  x)([a(X) Λb(X)]→[c(X,I)Λ(  Y)((  Z)[c(Y,Z)] →d(X,Y))])v(  X)(e(X)) (  x)( ¬ [a(X) Λb(X)]v[c(X,I)Λ(  Y)((  Z)[c(Y,Z)] →d(X,Y))])v(  X)(e(X)) (  x)( ¬ [a(X) Λb(X)]v[c(X,I)Λ(  Y)((  Z)[ ¬ c(Y,Z)] vd(X,Y))])v(  X)(e(X)) (  x)([ ¬ a(X) v¬b(X)]v[c(X,I)Λ(  Y)((  Z)[ ¬ c(Y,Z)] vd(X,Y))])v(  X)(e(X)) (  x)([ ¬ a(X) v¬b(X)]v[c(X,I)Λ(  Y)((  Z)[ ¬ c(Y,Z)] vd(X,Y))])v(  W)(e(W)) (  x) (  Y)(  Z) (  W)([ ¬ a(X) v¬b(X)]v[c(X,I)Λ(¬ c(Y,Z) vd(X,Y))]v e(W)) (  x) (  W)([ ¬ a(X) v¬b(X)]v[c(X,I)Λ(¬ c(f(X),g(X)) vd(X,f(X)))])v e(W)) [ ¬ a(X) v¬b(X)]v[c(X,I)Λ(¬ c(f(X),g(X)) vd(X,f(X)))])v e(W) [ ¬ a(X) v¬b(X)vc(X,I)v e(W)] Λ [ ¬ a(X) v¬b(X)v¬ c(f(X),g(X)) vd(X,f(X))v e(W) [ ¬ a(X) v¬b(X)vc(X,I)v e(W)] Λ [ ¬ a(U) v¬b(U)v¬ c(f(U),g(U)) vd(U,f(U))v e(V)