CSE 341 -- S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.

Slides:



Advertisements
Similar presentations
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Advertisements

Resolution Proof System for First Order Logic
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Standard Logical Equivalences
Resolution.
First Order Logic Resolution
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.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
CSE (c) S. Tanimoto, 2008 Propositional Logic
Inference and Resolution for Problem Solving
Artificial Intelligence
CSE (c) S. Tanimoto, 2007 Unification 1 Unification Predicate calculus rules are sometimes so general that we need to create specializations of.
CSE (c) S. Tanimoto, 2005 Logic Programming 1 Logic Programming Outline: Motivation Examples: The Grandmother relation Formulation in Prolog Logic,
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.
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Horn clauses A literal is an atomic formula or its negation A clause is a disjunction of literals.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
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.
1 Chapter 8 Inference and Resolution for Problem Solving.
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
1CS3754 Class Notes 14B, John Shieh, Figure 2.5: Further steps in the unification of (parents X (father X) (mother bill)) and (parents bill.
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.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
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;
C. Varela1 Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure Carlos Varela Rennselaer Polytechnic Institute November.
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
© Kenneth C. Louden, Chapter 12 - Logic Programming Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
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.
CSE (c) S. Tanimoto, 2008 Predicate Calculus II 1 Predicate Calculus 2 Outline: Unification: definitions, algorithm Formal interpretations and satisfiability.
1-1 An Introduction to Logical Programming Sept
Answer Extraction To use resolution to answer questions, for example a query of the form  X C(X), we must keep track of the substitutions made during.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
CSE (c) S. Tanimoto, 2001 Logic Programming
Introduction to Logic for Artificial Intelligence Lecture 2
CSE 341, S. Tanimoto Logic Programming -
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2004 Unification
CSE S. Tanimoto Unification
Horn Clauses and Unification
Reasoning with the Propositional Calculus
CSE (c) S. Tanimoto, 2002 Unification
Reasoning with the Propositional Calculus
CSE (c) S. Tanimoto, 2004 Logic Programming
CSE (c) S. Tanimoto, 2002 Logic Programming
Horn Clauses and Unification
Encoding Knowledge with First Order Predicate Logic
Reasoning with the Propositional Calculus
Reasoning with the Propositional Calculus
Encoding Knowledge with First Order Predicate Logic
RESOLUTION.
Encoding Knowledge with First Order Predicate Logic
Resolution Proof System for First Order Logic
Prolog Concepts.
Carlos Varela Rennselaer Polytechnic Institute August 30, 2007
Presentation transcript:

CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses Unification Resolution of Horn Clauses

CSE S. Tanimoto Horn Clauses and Unification 2 Propositional Logic If the butler had a motive and the butler was alone with the victim then the butler is guilty. Define our atomic formulas: P: The butler had a motive. Q: The butler was alone. R: The butler is guilty. Express the compound formula: (P & Q) -> R

CSE S. Tanimoto Horn Clauses and Unification 3 Clause Form Any boolean formula can be put into conjunctive normal form (CNF). If not Y then X and not Z. Y or (X & not Z) (Y or X & (Y or not Z) (X V Y) & (Y V ~Z) clauses: (X V Y), (Y V ~Z) X, Y, and ~Z are called literals. Each clause is a disjunction of literals. A formula in CNF is a conjunction of clauses. For our example with the butler, we get the following clause: ~ P V ~ Q V R

CSE S. Tanimoto Horn Clauses and Unification 4 Resolution Resolution is a way to make a new clause from two existing clauses. If the two original clauses were true, then the new one is, too. The two existing clauses must be compatible, in order to use resolution. There must exist some literal in one clause that occurs negated in the other clause. Example: Clause 1: A V ~ B V C Clause 2: B V D These are compatible, because the literal ~B in Clause 1 occurs negated (as B) in Clause 2. These two clauses have a unique resolvent, since there is only one complementary literal, B. The resolvent is formed by disjoining (i.e., combining with "V" all the literals of clause 1 and clause 2 except the ones involving B. This results in A V C V D.

CSE S. Tanimoto Horn Clauses and Unification 5 Predicate Logic “Every Macintosh computer uses electricity.” (all x) (Macintosh(x) implies UsesElectricity(x)) variables: x, y, z, etc. constants: a, b, c, etc. function symbols: f, g, etc. Predicate symbols: P, Q, Macintosh, UsesElectricity quantifiers: all, exists Logical connectives: not, implies, and, or. ~, ->, &, V.

CSE S. Tanimoto Horn Clauses and Unification 6 Clause Form (all x) (Macintosh(x) -> UsesElectricity(x) UsesElectricity(x) V Not Macintosh(x). Clause form for predicate calculus expressions is similar to that for propositional calculus expressions. To achieve clause form, several steps may be required. a. Rewrite X -> Y expressions as ~ X V Y. b. Reduce scopes of negation. c. Using strict rules, eliminate quantifiers. If the scope of a universal quantifier is the whole formula, then drop the quantifier, the quantification will be implicit. Using Skolem constants and or Skolem functions, remove any existential quantifiers. d. Convert to conjunctive normal form

CSE S. Tanimoto Horn Clauses and Unification 7 Horn Clauses Horn clause: at most one unnegated literal (X V Y) is not a Horn clause. (Y V ~Z) is a Horn clause. “If X is the mother of Y and Y is a parent of Z, then X is a grandmother of Z.” (m(X,Y) & p(Y, Z)) -> g(X,Z). grandmother(X, Z) provided mother(X, Y) and parent (Y, Z) g(X,Z) :- m(X,Y), p(Y,Z). ; Edinburgh Prolog syntax grandmother(X, Z) :- % head mother(X, Y), % subgoal 1 parent(Y, Z). % subgoal 2

CSE S. Tanimoto Horn Clauses and Unification 8 How Does Matching Work in Prolog? Literals are matched using a method called unification. The scope of a variable in Prolog is a single clause. Unification involves substituting “terms” for variables.

CSE S. Tanimoto Horn Clauses and Unification 9 Unification of Literals A substitution is a set of term/variable pairs. { f(a)/x, b/y, z/w } A unifier for a pair of literals is a substitution that when applied to both literals, makes them identical. P(x, a), P(f(a), y) have the unifier { f(a)/x, a/y } P(x), P(y) have the unifier { a/x, a/y }, but they also have the unifier { x/y }. The latter is more general because after unifying with { x/y} we get P(x) whereas with the other it is P(a), yet we can obtain the latter from the former with an additional substitution { a/x }.

CSE S. Tanimoto Horn Clauses and Unification 10 Horn-Clause Resolution Example of resolution with the grandmother rules: g(X, Z) :- m(X, Y), p(Y, Z). m(X, Y) :- p(X, Y), f(X). g(X, Z) :- p(X, Y), f(X), p(Y, Z). more generally, from: P :- Q1, Q2. Q1 :- R1, R2. we obtain the resolvent: P :- R1, R2, Q2

CSE S. Tanimoto Horn Clauses and Unification 11 A Backtracking Horn-Clause Resolver Maintain the rules in a database of rules. Accept a query (goal) as a positive unit clause, e.g., P(a, b). Put this goal on the subgoal list. Repeatedly try to satisfy the next clause on the subgoal list as follows: Find a rule in the database whose head unifies with the subgoal. Apply the same unifier to the literals in the body of that rule and replace the subgoal by these new literals. If the subgoal list is empty, stop. The combined set of unifiers includes the solution.