Resolution Strategies One common strategy for applying resolution is called level saturation. Here...

39
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original set, thus generating a new set of clause. The next step is trying to resolve every new clause against every new clause and every original clause, generating another new set. Then try to resolve those new clauses against themselves and the previous clauses.

Transcript of Resolution Strategies One common strategy for applying resolution is called level saturation. Here...

Resolution Strategies

One common strategy for applying resolution is

called level saturation. Here you try to resolve

every pair of clauses from the original set, thus

generating a new set of clause. The next step is

trying to resolve every new clause against every

new clause and every original clause, generating

another new set. Then try to resolve those new

clauses against themselves and the previous

clauses.

Restrictions of Resolution

Several ways to restrict the possible resolutions are:Unit resolution – one of the two clauses resolved

upon must be a unit clause (a single literal)Input resolution – one of the two clauses resolved

upon must be from the original set of clausesLinear resolution – after the first resolution step,

one of the two clauses resolved upon must be the

last clause generate.

These restrictions are sound, but not complete. Why?

Subsumption

One strategy that is complete is subsumption. On

clause subsumes another (in proposition calculus) if

it is a subset of the other clause. As we are trying to

obtain the empty clauses, smaller clauses are better.

So, if a clause subsumes another clauses, that other

clause may be eliminated. This works in both the

forward direction (a new clause is subsumed by and

old clause) and the backward direction (an old

clause is subsumed by a new clause).

Deletion Strategy

Delete any tautology or clause subsumed by another.

Predicate Calculus

Resolution also works for the predicate calculus, but

is more complicated (of course!). In particular,

reducing a formula to a clause set requires more

work, and we have to pay attention to the murder

rule.

Prenex Form

(From Chang and Lee, Symbolic Logic and

Mechanical Theorem Proving)

Prenex form occurs when the quantifiers all occur to

the left of the formula, that is a formula of the form

(Q1 x

1) (Q

2 x

2) (Q

3 x

3) (M), where Q

1, Q

2, Q

3, ... are

either ∀ or ∃, and M is a quantifier-free formula,

called the matrix.

Prenex Form (cont'd)

To put a formula into prenex form, we do the

following steps:1. Get rid of -> and <-> by using the equivalences F

<->G = (F -> G) ^ (G -> F) and F -> G = ~F v G.2. Push ~ in to the atoms by using the equivalences

~~F = F, ~(F v G) = ~F ^ ~G, ~(F ^ G) = ~F v ~G.3. Rename bound variables if necessary.4. Move the quantifiers to the outside.

Moving Quantifiers to the Outside

We use the following equivalences:(Q x) F(x) v G = (Q x) (F(x) v G)(Q x) F(x) ^ G = (Q x) (F(x) ^ G(∀ x) F(x) ^ (∀ x) H(x) = (∀ x) (F(x) ^ H(x))(∃ x) F(x) v (∃ x) H(x) = (∃ x) (F(x) v H(x))(Q1 x) F(x) v (Q2 x) H(x) = (Q1 x) (Q2 z) (F(x) v H(z))(Q1 x) F(x) ^ (Q2 x) H(x) = (Q1 x) (Q2 z) (F(x) ^ H(z))

Prenex Form - Example

(∀ x) (∀ y) ((∃ z) (P(x,z) ^ P(y,z)) -> (∃ u) Q(x,y,u))

Skolem Standard Form

To achieve Skolem Standard form, we do the

following;Transform the formula into prenex normal form.Put the matrix into conjunctive normal form (CNF).Eliminate the existentially quantified variables by

using Skolem functions (and constants)Drop the universal quantifiers as only universally

quantified variables remain.

Skolem Functions

Consider the formula (∀ x) (∃ y) x >= y. That is, for

every x, there is some y less than x. If that's the

case, we could create a function smaller(x) that,

given an x, returns some number smaller than x.

There are many such functions, by the formula

guarantees that one exists. Consider the formula (∀

x) x >= smaller(x). These two formulas are not

equivalent under an interpretation (why?) but one is

unsatisfiable iff the other is unsatisfiable (why?)

Skolem Functions (cont'd)

We can replace each existentially quantified variable

by a new Skolem function whose arguments are all

the universally quantified variable to the left of its

quantifier – as those are the values that the

existentially quantified variable depends on. If there

are no universally quantified variables to the left,

we replace the variable by a function of no

arguments, or a constant. Once we have no

existentially quantified variables, we drop the ∀'s.

Skolem Normal Form - Example

(∃ x) (∀ y) (∀ z) (∃ u) (∀ v) (∃ w) P(x,y,z,u,w)

Resolution

The resolution procedure for predicate calculus is a

refutation procedure. The steps are:Negate the formulaPut the formula into Skolem Standard form (which

requires putting it into prenex for first)Write the formula as a set of clausesUse the resolution rule repeatedly to find the empty

clause (box) if possible.

Binary Resolution Rule

The resolution rule for predicate calculus is a bit

more complicated because of the presence of

variables. Two literals don't have to be exactly the

same, but rather could unify. The binary resolution

rule corresponds to the marriage rule: If C

1 and C

2 are two clauses with no variables in common and L

1 and

L2 are two literals in C

1 and C

2, respectively, where L

1 and ~L

2 have

the mgu σ, then the clause (σ(C1)-σ(L

1) U (σ(C

1)-σ(L

1) is the binary

resolvent of C1 and C

2.

Factors

For propositional calculus, the murder rule simply

means that the clauses are sets. For predicate

calculus, since we have variables, we must deal

with the case when two (or more) literals in a single

clause unify:

If two (or more) literals (with the same sign) of a

clause C have an mgu σ, then σ(C) is called a factor

of C.

Resolution Rule for Pred. Calc.

Remembering that a murder may only occur the night

before a wedding, we now have the (full) resolution

rule:

A resolvent of two clauses C1 and C

2 is a binary

resolvent of C1 or a factor of C

1 and C

2 or a factor of

C2.

Resolution Rule - Example

C1 = P(x) v P(f(y)) v R(g(y))

C2 = ~P(f(g(a))) v Q(b)

Resolution Procedure

Resolution is sound and complete.

Many of strategies used in propositional calculus

resolution apply to predicate calculus (with

modification).Level saturation is the same.A clause C

1 subsumes a clause C

2 iff there is a

substitution σ such that σ(C1) ⊆ C

2. The deletion

strategy used this new definition of subsumption.Unit, input, and linear resolution are the same.

Other Strategies - Definitions

Definitions: A clause is called positive is it does not

contain any negative literals. A clause is called

negative if it does not contain any negative literals.

A clause is called mixed if it is neither positive nor

negative.

Positive Hyperresolution

In positive hyperresolution, a single step is a series of

resolution steps between a nucleus, (a negative or

mixed clause) and several electrons (positive

clauses). The result must be a positive clause, i.e.,

the electrons must knock out all the negative literals

in the nucleus. Example: R(x) v R(a), S(x), ~R(a) v

~S(a) -> □.

Negative Hyperresolution

Negative Hyperresolution is just like positive

hyperresolution except that the nucleus is positive

or mixed and the electrons are negative clauses.

Set of Support Resolution

A subset T of a set of clauses S is called a set of

support if S – T is satisfiable. For example, given a

theorem with hypothesis and a conclusion, the

hypotheses are normally satisfiable, so T could be

the clauses formed by the conclusion. A set-of-

support resolution is one in which both parent

clauses are not from S – T. A set-of-support

deduction is one where every resolution is a set-of-

support resolution.

Automated Theorem Provers

Otter – Argonne National Lab, McCuneProver9 - McCuneSETHEO – Technical University of MunichE-SETHEO - TUMVampire- Manchester University, Voronkov

Users of Automated Thm. Proving

Mathematical ProofProof-checkingProgram VerificationQuestion AnsweringGeneral ReasoningCombine with other Reasoning Modules

Horn Clauses

A Horn clause is a restricted predicate calculus

formula of formP1 ^ P

2 ^ P

3 ^ ... P

n -> Q

or justQ

The formulas Pi and Q must be positive literals.

Queries

Given a set of Horn clauses (the hypotheses) and a

query (the conclusion) , we can easily check if the

query is true.A ^ B ^ C -> DB -> CAEA ^ E -> B------------------------D

Proof

One systematic way is to keep a stack of goals yet to

be proved. Begin by pushing the conclusion (D) on

the stack. While the stack is not empty, pop the

stack to get the current goal. If a fact (atomic

clause) matches the goal, return T. If not, search for

an implication whose right-hand side matches the

goal, and then push all the conjuncts from the left-

hand side onto the stack (if not already there).

Example

D (conclusion)A B C (matches first clause)B C (A is a fact)A E C (matches fifth clause)E C (A is a fact)C (E is a fact)B (matches second clause)A E (matches fifth clause)E (A is a fact) (E is a fact)

Resolution

Alternatively we could use resolution. Written as a

clause set (with the conclusion negated) we have:~A v ~B v ~C v D~B v CAE~A v ~E v B~D

A restricted form of resolution called LUSH or SLD

works fine for these sets.

Lists

We can add a list constructor to this language:

[] means the empty list, and cons(x,y) means the list

with first element x and the remainder is y (so x is

added to the beginning of list y). We can use

standard list notation as shorthand for our lists. So,

the list cons(a, cons(b, cons(c, []))) would be

written [a,b,c]. We also use the vertical bar (|) with

brackets to be shorthand for cons – [x|y] means

cons (x,y).

Statements about Lists

We can use this notation to define list operations:

member(x, [x | y])member(x, z) -> member(x, [y | z])

means that x is a member of a list which has x as its

head, and if x is a member z, then x is a member of

the list constructed by adding y to the head of z.

Sorting

What does it mean if one list is the sorted version of

another list? For example, consider [3,1,4,2] and

[1,2,3,4]. The both must have the same members,

and the second list must be in order. We assume

that we have predicates for the usual mathematical

relations such as <=. So, to state that a list is in

order we could say:

Sorting (cont'd)

inOrder([y | z])^(x <= y)->inOrder([x, y | z])inOrder([])inOrder([x])

Same Elements

To check if two lists have exactly the same member

is a little more complicated. To state this property,

we use a three argument member predicate which

removes the member of the list, i.e.,member(x, y, z)

means that x is a member of y and that z is the result

of removing (one instance of) x from y.

So member(3,[1,2,3,4],[1,2,4]) is true.

Same Elements (cont'd)

member(x, [x | y], y)member(x, y, z) -> member(x, [w | y], [w | z])

sameElements([], [])sameElements(y, z), member(x, w, z) -> sameElements([x | y], w)

Sorting

sameElements(x,y) ^ inOrder(y) -> sorted(x,y)sameElements([], [])sameElements(y, z), member(x, w, z) -> sameElements([x | y], w)member(x, [x | y], y)member(x, y, z) -> member(x, [w | y], [w | z])inOrder([y | z])^(x <= y)->inOrder([x, y | z])inOrder([])inOrder([x])

Prolog

sorted(L1,L2) :- sameElements(L1,L2), inOrder(L2).

inOrder([X,Y|L]) :- X =< Y, inOrder([Y|L]).inOrder([]).inOrder([_]).

sameElements([],[]).sameElements([X|L1],L2) :- sameElements(L1,L3), member(X,L2,L3).

member(X,[X|L],L).member(X,[Y|L],[Y|L1]) :- member(X,L,L1).

Prolog (cont'd)

Prolog is a language built on top of a resolution

theorem prover. So the specification of the program

is (or can be) the executable program. We blur the

distinction between the declarative and the

procedural.