# F22H1 Logic and Proof Week 7 Clausal Form and Resolution.

## Presentation on theme: "F22H1 Logic and Proof Week 7 Clausal Form and Resolution."— 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.

Download ppt "F22H1 Logic and Proof Week 7 Clausal Form and Resolution."

Similar presentations