SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran -...

39
SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI

Transcript of SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran -...

Page 1: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

SMELS: Sat Modulo Equality with Lazy Superposition

Christopher Lynch – Clarkson

Duc-Khanh Tran - MPI

Page 2: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Interest

Verification problems often reduce to formulas containing

• mostly ground equations and

• quantified equations representing properties or theories

Page 3: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Goal

Efficient inference system for deciding satisfiability of sets of equational clauses, mostly ground

Page 4: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Assumptions

• DPLL(cc) most efficient way of solving ground equational clauses

• Superposition most efficient way of solving nonground equational clauses

• Develop complete implementable combination of the two methods– DPLL(cc(Sup))

Page 5: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Contents of Talk

• DPLL(cc)

• Superposition

• SMELS: DPLL(cc) with Lazy Superposition

• Completeness

• Implementation plans

Page 6: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

DPLL(cc)

• DPLL: Given set of clauses S, tries to build model of S by adding literals one by one

• DPLL(cc): Given set of equational clauses, tries to build model by adding literals one by one, and checking consistency in background theory (Cong. Closure)

Page 7: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Responsibility of cc

• Receives set M of (dis)equations

• Notifies DPLL procedure if M inconsistent– Returns J µ M, justification of inconsistency

• Clause : J (or alternative) can be added as lemma

Page 8: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Using cc for implication

• Given M find L where M ² L– And find small J µ M where J ² L

• DPLL adds : J Ç L (or alternative) as lemma

Page 9: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Example

• f(a)=b Ç d!=e

• a=c Ç i!=j

• d=e Ç g!=h

• i=j

DPLL generates {i=j, a=c, g=h, d=e, f(a)=b}

g=h is justification for f(c)=b (not only one)

Then g!=h Ç f(c)=b added as lemma

Page 10: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Definition of Justification

• Let S be set of clauses, M (partial) model

• Model is set of (dis)equations

• Let L 2 M

• j is a function where – j(L) µ M and – S [ j(L) ² L

Page 11: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Summary so far

• DPLL sends partial model M to cc

• cc determines consistency of M

• If M ² L, there 9 just. j(L)

• It is sound to add : j(L) Ç L

• Note: We can always have j(L) = {L}– Self-justification

Page 12: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Superposition

¡ Ç u[s’] = v ¢ Ç s=t

--------------------------------

(¡ Ç ¢ Ç u[t] = v)¾

• ¾ = mgu(s,s’) and s’ not variable

• s !· t, u[s’] !· v, s=t max, u[s’] = v max

Also for u[s’] != v

Page 13: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Orderings are crucial

• Without orderings, no hope of termination

• Example: – : gt(x,0) Ç gt(s(x),0)– gt(c,0)

• With orderings it immediately halts

Page 14: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

SMELS

• Let S be set of clauses, g(S): ground clauses in S, v(S): nonground clauses in S

• DPLL receives g(S) and passes M to cc

• cc passes reduced implied (dis)equations T to Sup

• Sup performs inferences between T and v(S), justified ground clauses sent to DPLL

Page 15: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Superposition in DPLL(cc(Sup)

• There are two kinds of Superposition– Superposition among nonground clauses– Superposition among nonground clause and

implied (dis)equation from cc (Justified Sup)

• No Superposition between ground clauses

Page 16: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Nonground Superposition

• We modify Superposition so that inferences involve maximal literals of nonground part of clause (as opposed to max of entire clause)

• Equational Factoring and Equation Resolution also involve maximal nonground literal

Page 17: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Example of Nonground Sup

• Premises– f(g(a))=b Ç g(x)=x Ç f(g(x))=x – f(f(a))=c Ç g(a)=c Ç g(y)=y

• Conclusion– f(g(a))=b Ç f(f(a))=c Ç g(a)=c Ç g(x)=x Ç

f(x)=x

Page 18: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Justified Superposition

• Between nonground clause and literal L from cc, After Superposition, we add negation of justification

• Equivalently, a Superposition inference between nonground clause and : j(L) Ç L

Page 19: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Examples of Justified Sup

• Suppose j(f(a)=b) = {d=e, f(b)=e}

• Let g(f(c))=c Ç f(x)=x Ç f(x)=g(x) 2 v(S)

• Then Justified Superposition gives d!=e Ç f(b)!=e Ç g(f(c))=c Ç f(a)=a Ç b=g(a)

• This is ground, so passed back to DPLL

Page 20: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Example of DPLL(cc(Sup))

• p(a,b) = p1

• p(c,d) = p2

• p(e,f) = p3

• p1 = p2 Ç p1 = p3

• a != c

• a != e

• p(x1,y1) != p(x2,y2) Ç x1= x2

Page 21: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

DPLL

• Input: g(S) = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2 Ç p1=p3, a != c, a != e}

• Output: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2, a!=c, a!=e}

• j(p1=p2) = {p1=p2}

• For all other L 2 M, j(L) = ;

Page 22: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

cc

• Input: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2, a!=c, a!=e}

• Output: T = {p(a,b)=p2, p(c,d)=p2, p(e,f)= p3, p1=p2, a!=c, a!=e}

• j(p(a,b)=p2) = {p1=p2}

Page 23: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Sup

• Input: T = {p(a,b)=p2, p(c,d)=p2, p(e,f)= p3, p1=p2, a!=c, a!=e}

• v(S) = {p(x1,y1) != p(x2,y2) Ç x1= x2}

• Justified Superposition gives {p1!=p2 Ç p2!=p(x2,y2) Ç a=x2, p2!=p(x2,y2) Ç c=x2, p3!=p(x2,y2) Ç e=x2}

• Also: p1!=p2 Ç a=c

Page 24: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

DPLL

• Input: g(S) = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2 Ç p1=p3, a != c, a != e, p1!=p2 Ç a=c}

• Output: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a!=e}

• j(p1=p3) = ;

Page 25: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

cc

• Input: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a!=e}

• Output: T = {p(a,b)=p3, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a!=e}

• j(p(a,b)=p3) = ;

Page 26: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Sup

• Input: T = {p(a,b)=p3, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a!=e}

• v(S) = {p(x1,y1) != p(x2,y2) Ç x1= x2}

• Justified Superposition gives a=e

Page 27: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

DPLL

• Input: g(S) = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2 Ç p1=p3, a != c, a != e, p1!=p2 Ç a=c, a=e}

• Output: UNSAT

Page 28: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Example 2

• Repeat example, suppose that original set did not contain a!=e

• Then everything is the same up until the last DPLL step

Page 29: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

DPLL

• Input: g(S) = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p2 Ç p1=p3, a != c, p1!=p2 Ç a=c, a=e}

• Output: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a=e}

Page 30: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

cc

• Input: M = {p(a,b)=p1, p(c,d)=p2, p(e,f)= p3, p1=p3, a!=c, a=e}

• Output: T = {p(e,b)=p3, p(c,d)=p2, p(e,f)= p3, p1=p3, c!=e, a=e}

• All justifications empty

Page 31: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Sup

• Input: T = {p(e,b)=p3, p(c,d)=p2, p(e,f)= p3, p1=p3, c!=e, a=e}

• v(S) = {p(x1,y1) != p(x2,y2) Ç x1= x2}

• Justified Superposition gives nothing new

• Therefore T is a model modulo v(S)

Page 32: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Schematic Saturation

• Example theory v(S) is decidable

• We could use Schematic Saturation to prove the decidability

• We could also use Schematic Saturation to compile nonground theory and efficiently perform Justified Superposition

Page 33: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Instantiation

• Resolution + self-justification =Instantiation

• j(p(a)) = {p(a)}

• Nonground clause q(x) Ç ~p(x)

• Justified Resolution gives q(a) Ç ~p(a)

• As far as we know, first combination of instantiation with ordered resolution

Page 34: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Completeness

• Suppose S is saturated by SMELS

• Let M be model of g(S)

• Then M is v(S) model of g(S)

Page 35: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Completeness Proof

• Modifed version of BG model generation

• May have implications for selection rules and goal-directed Superposition

• Justifications are key

Page 36: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Completeness implies

• S is SAT implies– Ground model M (modulo v(S)) is generated

in finite time, or– M (modulo v(S)) is generated in infinite time

• S is UNSAT implies– Unsatisfiable ground g(S) is found

Page 37: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Comparisons

• BE: Uses Eager Superposition (works for some theories)

• SPASS+T: FOL theorem prover is driver, which calls SMT, not complete

• InstGen: Instantiates clauses but no orderings

• Simplify: Instantiates terms but is not complete

Page 38: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Conclusions

• SMELS = DPLL(cc(Sup))

• DPLL sends partial model to cc

• cc passes reduced implications to Sup

• Sup handles nonground part using powerful orderings

Page 39: SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.

Future Work

• Implement using compilation of Justification Superposition using Schematic Saturation

• Combine with other theories like Linear Arithmetic