F22H1 Logic and Proof Week 7 Clausal Form and Resolution.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Artificial Intelligence 8. The Resolution Method
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in 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.
Introduction to Theorem Proving
Standard Logical Equivalences
Resolution.
Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson.
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.
F22H1 Logic and Proof Week 5 Overview of weeks 5—9 Predicates and Quantifiers.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Resolution Theorem Proving
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
RESOLUTION: A COMPLETE INFERENCE PROCEDURE. I Then we certainly want to be able to conclude S(A); S(A) is true if S(A) or R(A) is true, and one of those.
Knowledge Representation Methods
RMIT University; Taylor's College This is a story about four people named Everybody, Somebody, Anybody and Nobody. There was an important job to be done.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
Inference and Resolution for Problem Solving
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
The Semantic Web – WEEK 8: An automatic Proof technique.. The “Layer Cake” Model – [From Rector & Horrocks Semantic Web cuurse] You are here!
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
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.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
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.
Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people in kingdom. There are three rules that apply.
F22H1 Logic and Proof Week 6 Reasoning. How can we show that this is a tautology (section 11.2): The hard way: “logical calculation” The “easy” way: “reasoning”
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
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.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
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;
Artificial Intelligence 7. Making Deductive Inferences Course V231 Department of Computing Imperial College, London Jeremy Gow.
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
11 Artificial Intelligence CS 165A Tuesday, October 30, 2007  Knowledge and reasoning (Ch 7) Propositional logic  First-order logic (Ch 8) 1.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Introduction to Logic for Artificial Intelligence Lecture 2
Proposition & Predicates
CSE 311 Foundations of Computing I
Logic Use mathematical deduction to derive new knowledge.
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
RESOLUTION.
Carlos Varela Rennselaer Polytechnic Institute August 30, 2007
Presentation transcript:

F22H1 Logic and Proof Week 7 Clausal Form and Resolution

We have many ways to say the same thing If you miss tutorials, you will do badly in the exam Anyone who doesn’t attend tutorials will do poorly in the module Doing well in the exam only happens if you attend tutorials Either you attend tutorials, or you do badly in the course. Etc … When we formalise this in predicate logic, things are just the same: Isn’t English Great!

But this is not much fun when you have to work out if one logical statement is the same as another, or even if one English statement means the same as another. Luckily there is a way to convert any predicate logic statement into a unique form. This means that if we suspect two logical statements may be equivalent, we can convert each into their unique form – if they end up the same, then they are equivalent. This process has various applications; it can be helpful in automated reasoning (trying to prove things). Also, the unique form is quite simple, and without quantifiers, so is easier for computer manipulation. Isn’t this a pain!

The unique form is called Clausal Form (since it involves a combination of `clauses’). There are various versions, and we will learn a common version. A conjunction of disjunctions looks like this: I.e. a list of things joined by ANDs, where each thing is either an `atomic’ predicate (maybe negated) or a list of atomic predicates joined by Ors. ANY statement in predicate logic cam be converted to a such a conjunction of disjunctions. The result is in what we call: Conjunctive Normal Form Clausal Form

There are six stages to the conversion: 1.Remove 2.De Morgan’s to move negation to atomic propositions 3.Skolemizing (gets rid of ) 4.`Eliminating’ universal quantifiers 5.Distributing AND over OR 6.Arrange into clauses and maybe reorder A Procedure for Clausal Form

Let’s go through the stages with: 1. Remove implications (i.e. use the implication equivalence) 2. Use De Morgan’s to move negation to atomic propositions

3. Skolemizing. We were here: In this step, we simply replace existentially quantified variables by constants. Generally, if we have we can replace this with I.e. we invent a specific individual for whom we can say that `something’ is true, and give it a unique name. In this case, choosing any name that comes into my head, we get:

4. Eliminate universal quantifiers Since there are no longer any existential quantifiers, the order of the universal quantifiers doesn’t matter. We may as well move them all the way to the left, like this: Meanwhile, it is guaranteed that every variable here is universally quantified (we only apply this process to propositions). So, why not just get rid of them, and we will take them as implicit

Now we distribute AND over OR – i.e. we mainly use this equivalence: We had this: In this case we’re fine already, since we don’t have an AND within brackets. It is already in Conjunctive normal form (CNF), we just have to tidy up: Now we have removed useless brackets, predicates within clauses are in alphabetical order, and the clauses themselves are in alphabetical order

Skolemisation II Actually Skolemisation is slightly more complicated. Consider this: If just replace the existential quantification with a constant we get Which says M302 is everyone’s mother. What we should do when there are universally quantified variables in the surrounding scope is make the existential variable a function (called a Skolem function) of those universally quantified variables. So: Here, f1(k) is the Skolem function, outputting the individual who is the mother of the input variable k.

Better do another one: Step 1: Remove implication Step 2: De Morgan’s

We were here Next: Step 3, Skolemization: In this case there are no universally quantified variables in the surrounding scope – I.e. everything here is true for a single individual z, not depending on x or g. So we don’t need a function Next: Step 4, eliminate universal quantifiers

Step 5: use the distributivity equivalences to get closer to CNF We were here: Recall the distributivity equivalence on the previous slide. If we think of : as P, as Q, and as R, then we get:

We were here: If we now think of: as P, and think of as the Q and R, we get: We are now in CNF !! Let’s tidy up and finish by placing it into some form of reproducible order … just a slight change to get it in a kind of alphabetical order

Resolution: how we do proofs in CNF Converting predicate logic statements to CNF is very convenient, because it simplifies the process of trying to prove things automatically. With fewer connectives and no quantifiers to worry about, there are fewer applicable equivalences or inference rules that can be used. In fact, we can do a great deal of automated proof work by using just one inference rule. This is called Resolution, and it is usually used in conjunction with Reasoning by Contradiction (see slides for week 6) The Resolution inference rule is basically: If, in CNF form, one clause contains X and another clause contains, then we can infer the union of those clauses, without the X and

Resolution To help understand, note that we will implicitly often use AND-introduction and AND-elimination. That is, if A AND B is true, then we know that A on its own is true, and that B on its own is true, and vice versa. Suppose we have these two clauses: 1) 2) The resolution rule allows us to infer the following – by noting that one of them contains something that is negated in the other. We join the clauses, eliminating that pair. 3)

Is it valid? Of course it is. But it is worth thinking about it to convince yourself Think of the simple case where you have: 1) 2) Clearly, resolution now gives us: 3) We could prove it in a longer way by: {Implication rule, from (1)} 4) {follows from 2 and 4} 5)

Proof by Contradiction using resolution Suppose we have a complex predicate logic statement, and we want to prove that a certain clause is true. (e.g. the statement may set out a state of a computer program, such as the constraints on variable values for a heart monitor application, and the clause may refer to the state of the warning indicator. Or the statement may set out various aspects of immigration law, and the clause express be whether a certain client is legal or not) In automated proof, we would typically (have a program that did): 1. convert the complex statement(s) to CNF 2. assume the NEGATION of the clause 3. Apply resolution several times, 4. If and when we find a contradiction, we have proved the clause.

E.g. Suppose our statement is: And we want to see if is true. We start with assuming the negation of what we want to prove. 1) Let’s also write down what we already know to be true 2) Resolution twice on the third clause of 2, using each part of 1, gets:: 3) Resolution using 3 and the second clause of 2 gives: 4) Resolution using 4 and the first clause of 2 gives: 5) -- this is the negation of 1), so we have a contradiction! (we could infer F from 1 and 6, and so have proved the negation of our assumption)

NOTE In reality, Resolution is sound, but not complete – we won’t necessarily always be able to prove what we want to prove. At any particular point, there will typically be many, many ways that the rule could be used with the clauses that are known or derived so far. There is no obvious way to decide which is the best move to make -- that’s a research issue, beyond our scope for the moment.