uniform derivation of decision procedures by...

17
Uniform Derivation of Decision Procedures by Superposition Alessandro Armando, Silvio Ranise, and Micha¨ el Rusinowitch

Upload: danghanh

Post on 20-Aug-2018

240 views

Category:

Documents


0 download

TRANSCRIPT

Uniform Derivation of Decision Procedures by

Superposition

Alessandro Armando, Silvio Ranise,

and Michael Rusinowitch

T � L1 ∨ L2 ∨ · · · ∨ Lk.

m

UnSat(T, L1, . . . , Lk)

Li = (si = ti) | (si 6= ti) – ground literals

T is decidable � T � C is decidable, C – ground clause

⇔ UnSatT (S) := UnSat(T ∪ S) is decidable,

S – set of ground literals

Decision algorithm for T is any algorithm that solves UnSatT (S).

1

Example 1

Theory of homomorphisms:a

H= {h(f(x, y)) = f(h(x), h(y))}

Consider:

S := {h(c) = c′, h(c′) = c, f(c, c′) = h(h(a)),

f(c′, c) = a, h(h(h(a))) 6= a};

C := [h(c) = c′, h(c′) = c, f(c, c′) = h(h(a)),

f(c′, c) = a] ⇒ h(h(h(a))) = a;

(we abbreviate L1, . . . , Lk ⇒ Lk+1, . . . , Ls for

L1∨, . . . , Lk ∨ Lk+1 ∨ · · · ∨ Ls)

Clearly T � C, so S is H-unsatisfiable.

aActually, H is decidable

2

Superposition calculus SP

Inference rules:

SuperpositionΓ ⇒ ∆, l[u′] = r Π ⇒ Σ, u = v

σ(Γ, Π ⇒ ∆, Σ, l[v] = r)

ParamodulationΓ, l[u′] = r ⇒ ∆ Π ⇒ Σ, u = v

σ(l[v] = r, Γ, Π ⇒ ∆, Σ)

ReflectionΓ, u′ = u ⇒ ∆

σ(Γ ⇒ ∆)

FactoringΓ ⇒ ∆, u = t, u′ = t′

σ(Γ, t = t′ ⇒ ∆, u = t′)

σ = MGU(u, u′), u′ is not a variable in Superposition and

Paramodulation.

3

Superposition calculus SP

Simplification rules:

SubsumptionS ∪ {C, C ′}

S ∪ {C}∃ θ(C) ⊆ C ′, @ ρ(C ′) = C

SimplificationS ∪ {C[θ(l)], l = r}

S ∪ {C[θ(r)], l = r}

DeletionS ∪ {Γ ⇒ ∆, t = t}

S

Simplification rules have higher priority than inference rules.

Theorem 1.1 SP is refutationally complete:

UnSat(T ) ⇒ ∀ T`fairSP {}.

4

Theorem 1.1 gives us a semi-desicion procedure for T :

UnSat(T ∪ S) ⇒ SP derive empty clause

not UnSat(T ∪ S) ⇒ SP may diverge

For some theories T SP may give a decision procedure (Example:

T - set of ground clauses).

We give an uniform SP-based decision procedures for:

• Quantifier-free theory of

equality

• Theory of Lists

• Theory of Arrays

• Theory of Arrays with Ex-

tensionality

• Theory of Lists and Arrays

• Theory of Homomorphisms

5

The scheme of the decision procedure based on

SP

1. “Flatten” the the input set of literals S;

2. Show termination of SP on {Γ ∪ S} by specifying the clauses

that may appear during derivation.

6

Flattening S

flat equality: f(t1, . . . , tn) = t0 | t0 = f(t1, . . . , tn)

distinction: t1 6= t2

were ti is either a variable or an individual constant;

Flat literals � flat equality of flat distinction;

Flat clause � disjunction of flat literals

Lemma 1.2 Let T be a theory, S be a set of ground literals. Then

there (eff.) exists S ′ – a finite set set of flat literals, such that

UnSatT {S} ⇔ UnSatT S′

Example 2 The set from Example 2: S = {h(c) = c′, h(c′) = c,

f(c, c′) = h(h(a)) , f(c′, c) = a, h(h(h(a))) 6= a };

Can be flatten to S′ = {h(c) = c′, h(c′) = c, f(c, c′) = c2 ,

f(c′, c) = a, h(a) = c1, h(c1) = c2, h(c2) = c3, c3 6= a };

7

A Decision Procedure for the Quantifier-Free

Theory of Equality

Theory E :

Congruence axioms:

x = x (R)

x = y ⇒ y = x (S)

x = y, y = z ⇒ x = z (T)

substitutivity (Functional

monotonicity):

x = y ⇒

f(. . . x . . . ) = f(. . . y . . . )

Restriction on ordering �: f(t1, . . . , tn) � c for every constant c.

Lemma 2.1 Let S be a finite set of flat literals. Then SP{S} is

finite.

Proof. Saturation in SP can produce only flat literalsa�

aSuperposition can never apply to ground flat literals since simplification has

higher priority

8

A Decision Procedure for the Theory of Lists

Ax(L) : car(cons(x, y)) = x (1)

cdr(cons(x, y)) = y (2)L � E + Ax(L)

Lemma 3.1 Let S be a finite set of flat literals. Then the clauses

occurring in SP{L ∪ S} can be:

• empty clauses

• ground flat literals

• Ax(L)

Proof. By case analysis of rules and assumptions. �

Corollary 3.2 For every set S of flat literals SP{L ∪ S} is finite.

(In fact, |SP{L ∪ S}| is polynomial in |S|).

Theorem 3.3 SP is a decision procedure for L.

9

A Decision procedure for the Theory of Arrays

Ax(A) : select(store(a, i, e), i) =e (3)

i 6= j ⇒ select(store(a, i, e), j) =select(a, j) (4)

A � E + Ax(A) Restriction: t � s if

1) t contains select or store, but s is not and closed.

2) t is non-constant, s is constant.

Lemma 4.1 Let S be a finite set of flat literals. The clauses

occuring in the saturations of S ∪ Ax(A) by SP can only be:

• the empty clauses;

• the axioms in Ax(A);

• ground flat literals

• t ./ t′ ∨ c1 = c′1 ∨ · · · ∨ cn = c′n, where

t ./ t′ ∈ {c′ 6= c′′} ∪ {t = t′|t, t′ ∈ {ci, select(ci, i)}}

• select(c, x) = select(c′, x) ∨ c1 = k1 ∨ · · · ∨ cn = kn, where

ki ∈ {x, c, c′, c1, c′1, . . . , cn, c′n}

10

A Decision procedure for the Theory of Arrays

Lemma 4.1 Let S be a finite set of flat literals. The clauses

occuring in the saturations of S ∪ Ax(A) by SP can only be:

• the empty clauses;

• the axioms in Ax(A);

• ground flat literals

• t ./ t′ ∨ c1 = c′1 ∨ · · · ∨ cn = c′n, where

t ./ t′ ∈ {c′ 6= c′′} ∪ {t = t′|t, t′ ∈ {ci, select(ci, i)}}

• select(c, x) = select(c′, x) ∨ c1 = k1 ∨ · · · ∨ cn = kn, where

ki ∈ {x, c, c′, c1, c′1, . . . , cn, c′n}

Corollary 4.2 For S being a finite set of flat literals. Then every

saturation by SP of {A ∪ S} is finite.

Theorem 4.3 SP is a decision procedure for A.

11

A Decision procedure for the Theory of Arrays

with Extensionality

As is a many sorted version of A.

Ase � As+ ∀i.(select(a, i) = select(b, i)) ⇒ a = b (5)

Additional assumptions:

• f 6= select, store, f : s0, . . . , sn−1 → sn then si 6= ARRAY ;

• ΣAe

s

is sensible (there is at least one ground term for each sort).

Given S being a set of ground literals we proceed by:

1. “Lifting of inequalities”: t 6= t′ → ∃i.select(t, i) 6= select(t′, i);

Lemma 5.1 S is Ase-satisfiable iff S′ is As-satisfiable.

2. “Skolemization:” ∃i.select(t, i) 6= select(t′, i) →

select(t, sk(t, t′)) 6= select(t′, sk(t, t′))

Theorem 5.2 S′ is As-satisfiable iff S′′ is A-satisfiable.

3. Apply the decision procedure for A.

12

Combining Decision Procedures for Lists and

Arrays

Ax(U) = Ax(L) + Ax(A); U = Ax(U) + E

Lemma 6.1 Let S be a finite set of ground flat literals. The

clauses in SP{S ∪ Ax(U)} can only be of the types, specifying in

Lemma 3.1 and Lemma 4.1.

Lemma 6.2 All the saturations of S ∪ Ax(U) by SP are finite.

Theorem 6.3 SP is a decision procedure for U .

13

A Decision Procedure for the Theory of

Homomorphism

Recall: Ax(H) � h(f(x1, . . . , xn)) = f(h(x1), . . . , h(xn)) (6)

H = Ax(H)+ESketch of the Decision procedurea

Given a set Ψ of ground literals we:

1. Flatten Ψ

→2. Complete the set of (ground) equalities in Ψ modulo Ax(H) in

order to get a rewrite system R.

3. For each inequality s 6= t in Ψ compute the normal forms

s′ = s ↓R, t′ = t ↓R w.r.t. R. If there exists s 6= t ∈ Ψ s.t.

s′ = t′ then Ψ is H-unsatisfiable; otherwise Ψ is H-satisfiable.

aactually it’s an adaptation of the Knuth-Bendix completion procedure:

14

CompletionOrientation:

We want SP to generate only ground literals. For this reason we

should orient Ax(H) by the following way:

h(f(x1, . . . , xn)) � f(h(x1), . . . , h(xn))

otherwise, superposition between

f(h(x1), . . . , h(xn)) = h(f(x1, . . . , xn)) and h(c1) = c

will give us f(c, h(x2), . . . , h(xn)) = h(f(c1, x2, . . . , xn)).

Problem: SP{h(c) = c, f(c, c′) = c, Ax(H)} generates

f(c, hn(c′)) = c ∀n ≥ 0.

⇒ We cannot argue that SP{S ∪H} is finite.

However, decision procedure for H can be constructed by using a

special rule of inference additional to SP instead of Ax(H) using

so-called completion procedure.

15

Discussion

? what kind of uniformness in applying SP as a decision

procedure?

? is there a decidable theories to which SP cannot be applied as

a decision procedure? [Yes].

? how to check whether SP can be applied to a theory as a

decision procedure?

? is there a universal decision procedure that can be applied to

any decidable theory? [Skeptical]

? what is the time complexity of these decision procedures w.r.t.

the best time complexities?

? what is the relationship between congruence closure and SP

(applicability, complexity)?

16