data structures with arithmetic constraints: a non ...€¦ · 2 data structures 3 arithmetic 4...
TRANSCRIPT
inrialoria-logo
Data Structures with Arithmetic Constraints:a Non-Disjoint Combination
E. Nicolini, C. Ringeissen, and M. Rusinowitch
LORIA & INRIA Nancy Grand Est
FroCoS’09
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 1 / 24
inrialoria-logo
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 2 / 24
inrialoria-logo
Introduction
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 3 / 24
inrialoria-logo
Introduction
Building and Combining Decision ProceduresUse Rewriting techniques
I use a superposition calculus for FOL with Equality and prove itstermination for useful cases in verification
ü Application to data structures [ARR03, ABRS09, BE07, dMB08]Use Combination techniques
I use procedures available for individual theories and try to build aprocedure for the union of theories
ü Application to disjoint unions of data structures and fragmentsof arithmetic [KRRT05]
Our approachUse both Rewriting an Combination techniques to considernon-disjoint unions of data structures and fragments of arithmeticü Application of the combination method proposed byGhilardi-Nicolini-Zucchelli [GNZ08]: a combination method à laNelson-Oppen [NO79] for non-disjoint unions of theories
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 4 / 24
inrialoria-logo
Data Structures
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 5 / 24
inrialoria-logo
Data Structures
Data structures using arithmetic operators
Lists :nil : LISTS, cons : ELEM × LISTS → LISTS, ` : LISTS → NUM
`(nil) = 0`(cons(x , y)) = s(`(y))
Trees :bin : ELEM × TREES × TREES → TREES,null : TREES, sizeL : TREES →NUM, sizeR : TREES → NUM
sizeL(null) = 0 sizeR(null) = 0sizeL(bin(e, t1, t2)) = s(sizeL(t1)) sizeR(bin(e, t1, t2)) = s(sizeR(t2))
Records : seli : RECS → NUM, inc : RECS → RECS
seli(inc(r)) = s(seli(r))
for any index i of sort NUM.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 6 / 24
inrialoria-logo
Data Structures
The Shared Theory of Increment
(Inj) ∀x , y s(x) = s(y)→ x = y(Acy) ∀x x 6= sn(x) for all n ∈ N+
(S0) ∀x s(x) 6= 0
1 Theory of Integer Offsets [NRR09b]: TI = {Inj ,Acy ,S0}2 Theory of Increment (this paper): TS = {Inj ,Acy}
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 7 / 24
inrialoria-logo
Data Structures
Superposition Calculus
Superpositionl[u′] = r u = t
(l[t ] = r)σ(i), (ii), (iii), (iv)
Paramodulationl[u′] 6= r u = t
(l[t ] 6= r)σ(i), (ii), (iii), (iv)
Reflectionu′ 6= u⊥ (i)
where (i) σ is the most general unifier of u and u′, (ii) u′ isnot a variable , (iii) uσ 6� tσ, (iv) l[u′]σ 6� rσ.
Figure: Expansion Inference Rules.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 8 / 24
inrialoria-logo
Data Structures
Superposition Calculus (for a successor function)
Ad hoc rules to be applied to ground terms:
R1 (for Inj)S ∪ {s(u) = s(v)}
S ∪ {u = v}
R2 (for Inj)S ∪ {s(u) = t , s(v) = t}S ∪ {s(v) = t ,u = v} if s(u) � t , s(v) � t and u � v
C1 (for Acy)S ∪ {sn(t) = t}
S ∪ {sn(t) = t} ∪ ⊥ if n ∈ N
where S is a set of literals and ⊥ is the symbol for the inconsistency.
Figure: Ground reduction Inference Rules.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 9 / 24
inrialoria-logo
Data Structures
Superposition Calculus as Decision Procedure
ResultAn appropriate Superposition Calculus leads to a decision procedurefor a class of theories DST modelling data-structures with the unarysuccessor function.
DST includes: Lists with length, Trees with size, Records withincrement.
Proof: For any theory T ∈ DST and any set of ground flat literals G,any saturation of Ax(T ) ∪G is as follows:
It must be finite.Some forms of non-ground equalities must be excluded.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 10 / 24
inrialoria-logo
Arithmetic
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 11 / 24
inrialoria-logo
Arithmetic
Linear ArithmeticΣQ := {0,1,+,−, {q_}q∈Q, s, <}, where 0,1 are constants, and−, q_, s are unary function symbols.Let TQ be the set of all the ΣQ-sentences that are true in Q.
FactA TQ-satisfiability procedure can be obtained by using
1 Fourier-Motzkin Elimination (for inequalities)ü to detect unsatisfiability or to compute implicit equalities
2 Gauss Elimination (for equalities)ü a function solve to compute the solved form of a set ofequalities
3 Disequality Handlerü a function canon over arithmetic expressions to check whetheran disequality can be canonized into an unsatisfiable disequalityu 6= u.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 12 / 24
inrialoria-logo
Arithmetic
Non-Linear Arithmetic: The Theory of Q-AlgebrasTQ-alg is AC(+) ∪ AC(×) ∪ U(+,0) ∪ U(×,1) plus
∀x x + (−x) = 0 (1)
0 6= 1 (2)
∀x s(x) = x + 1 (3)
∀x , y , z (x + y)z = xz + yz (4)
∀x , y q(x + y) = qx + qy (5)
∀x (q1 ⊕ q2)x = q1x + q2x (6)
∀x (q1 · q2)x = q1(q2x) (7)
∀x 1Qx = x (8)
∀x , y q(xy) = x(qy) (9)
FactA TQ-alg-satisfiability procedure can be obtained by using theBuchberger algorithm for the computation of Groebner bases.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 13 / 24
inrialoria-logo
Background on Combination
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 14 / 24
inrialoria-logo
Background on Combination
A combination problem
Γ1 =
y = `(a)b = cons(e,a)x = `(b)
Γ2 =
{u ≥ 0x + u = y
}Satisfiability of Γ1 ∪ Γ2?Γ1 ∪ Γ2 is unsatisfiable since
Γ1 → x = s(y)
Γ2 ∪ {x = s(y)} is T2-unsatisfiable:
Γ2 ∪ {x = s(y)} ↔ {u ≥ 0,u = −1}
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 15 / 24
inrialoria-logo
Background on Combination
A combination problem
Γ1 =
y = `(a)b = cons(e,a)x = `(b)
Γ2 =
{u ≥ 0x + u = y
}Satisfiability of Γ1 ∪ Γ2?Γ1 ∪ Γ2 is unsatisfiable since
Γ1 → x = s(y)
Γ2 ∪ {x = s(y)} is T2-unsatisfiable:
Γ2 ∪ {x = s(y)} ↔ {u ≥ 0,u = −1}
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 15 / 24
inrialoria-logo
Background on Combination
Non-disjoint combination method (à la Nelson-Oppen)Combination method developed by Ghilardi-Nicolini-Zucchelli [GNZ08]:Let T0 = T1 ∩ T2 and Σ0 = Σ1 ∩ Σ2
Purification Given a set of T1 ∪ T2-constraints Γ, produce anequisatisfiable set of pure constraints Γ1 ∪ Γ2 ;
Propagation the T1-constraint solving procedure and the T2-constraintsolving procedure fairly exchange shared positiveΣ0-clauses that are entailed by T1 ∪ Γ1 and by T2 ∪ Γ2
Until an inconsistency is detected or a saturation state isreached.
Pseudo-code1. If T0-basisTi (Γi) = ∆i and ⊥ /∈ ∆i for each i ∈ {1,2}, then
1.1. For each D ∈ ∆i such that Tj ∪ Γj 6|= D, (i 6= j), add D to Γj1.2. If Γ1 or Γ2 has been changed in 1.1, then rerun 1.
Else return Unsatisfiable2. Return Satisfiable.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 16 / 24
inrialoria-logo
Background on Combination
Non-disjoint combination method (à la Nelson-Oppen)Combination method developed by Ghilardi-Nicolini-Zucchelli [GNZ08]:Let T0 = T1 ∩ T2 and Σ0 = Σ1 ∩ Σ2
Purification Given a set of T1 ∪ T2-constraints Γ, produce anequisatisfiable set of pure constraints Γ1 ∪ Γ2 ;
Propagation the T1-constraint solving procedure and the T2-constraintsolving procedure fairly exchange shared positiveΣ0-clauses that are entailed by T1 ∪ Γ1 and by T2 ∪ Γ2
Until an inconsistency is detected or a saturation state isreached.
Pseudo-code1. If T0-basisTi (Γi) = ∆i and ⊥ /∈ ∆i for each i ∈ {1,2}, then
1.1. For each D ∈ ∆i such that Tj ∪ Γj 6|= D, (i 6= j), add D to Γj1.2. If Γ1 or Γ2 has been changed in 1.1, then rerun 1.
Else return Unsatisfiable2. Return Satisfiable.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 16 / 24
inrialoria-logo
Background on Combination
Combination method: critical points1 How to obtain the T0-bases, which are logical consequences of a
constraint Γ w.r.t. a theory T0 over a given sub-signatureü Computability of T0-bases
2 How to guarantee the termination of the exchange loopü Noetherianity of T0
3 How to ensure its completenessü T0-compatibility (extends the assumption on stably infinitetheories used in the disjoint case)
Our workHow to face these issues when dealing with a combination of
1 a data structure in DST2 a theory of arithmetic in {TQ,TQ-alg}
where the shared theory T0 is the theory of Increment TS.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 17 / 24
inrialoria-logo
Background on Combination
Computation of TS-bases for data structuresResultOur Superposition Calculus computes TS-bases for any T ∈ DST.
How to compute TS-bases: collect all the shared equalities in asaturation of Γ not containing ⊥.
Example (theory of Lists with length)The saturation of
Γ1 = {y = `(a),b = cons(e,a), x = `(b)}
containsx = s(y)
RemarkSimilar result in [NRR09b] for the shared theory of Integer Offsets.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 18 / 24
inrialoria-logo
Background on Combination
Computation of TS-bases for fragments of arithmetic
ResultTS-bases are computable for TQ and TQ-alg .
Proof Idea:
1 (Linear case) Assume Γ is a set of linear equalities. We have
T ∪ Γ |= a1 = sn(a2)⇐⇒ canon(a1γ − a2γ) = n
where γ = solve(Γ).2 (Non-linear case) It is possible to compute the set of all entailed
linear equalities by using a slight adaptation of the Buchbergeralgorithm, as shown in Nicolini’s thesis. Then proceed as in (1).
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 19 / 24
inrialoria-logo
Background on Combination
Computation of TS-bases: example for the arithmetic
Example (theory of arithmetic TQ)
Γ2 =
x = c1 + 2c + y = 2 + 3d2c = d + x
Γ2 is equivalent to the solved form:
solve(Γ2) =
x = cy = c + 1d = c
Therefore:Γ2 → y = s(x)
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 20 / 24
inrialoria-logo
Background on Combination
Computation of TS-bases: example for the arithmetic
Example (theory of arithmetic TQ)
Γ2 =
x = c1 + 2c + y = 2 + 3d2c = d + x
Γ2 is equivalent to the solved form:
solve(Γ2) =
x = cy = c + 1d = c
Therefore:Γ2 → y = s(x)
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 20 / 24
inrialoria-logo
Background on Combination
Computation of TS-bases: example for the arithmetic
Example (theory of arithmetic TQ)
Γ2 =
x = c1 + 2c + y = 2 + 3d2c = d + x
Γ2 is equivalent to the solved form:
solve(Γ2) =
x = cy = c + 1d = c
Therefore:Γ2 → y = s(x)
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 20 / 24
inrialoria-logo
Background on Combination
Data structures with arithmetic constraints
Example (Previous Examples Continued)In the theory of Lists with length:given Γ1 = {y = `(a),b = cons(e,a), x = `(b)}, we have:
Γ1 → x = s(y)
In the theory of arithmetic TQ:given Γ2 = {x = c,1 + 2c + y = 2 + 3d ,2c = d + x}, we have:
Γ2 → y = s(x)
In the union of theories:
Γ1 ∪ Γ2 is unsatisfiable
since {x = s(y), y = s(x)} is TS-unsatisfiable
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 21 / 24
inrialoria-logo
Background on Combination
Main result
We have identified a class of theories DST modelling data structuresmodulo TS such that for any T ∈ DST ∪ {TQ,TQ-alg}:the Ghilardi-Nicolini-Zucchelli combination method is
1 effective: TS-basisT is computable2 terminating: TS is Noetherian3 complete: T is TS-compatible
TheoremFor any Σ1-theory T1 ∈ DST and any Σ2-theoryT2 ∈ {TQ,TQ-alg ,TQ ∪ TQ-alg} ∪ DST such that Σ1 ∩ Σ2 = ΣS,T1 ∪ TS ∪ T2 has a decidable constraint satisfiability problem.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 22 / 24
inrialoria-logo
Conclusion
Outline
1 Introduction
2 Data Structures
3 Arithmetic
4 Background on Combination
5 Conclusion
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 23 / 24
inrialoria-logo
Conclusion
Conclusion and future work
sharing the theory of Increment (this paper): two possible theoriesof arithmetic over the the rationals, TQ and TQ-alg
sharing the theory of Integer Offsets [NRR09b]: which theory ofarithmetic over the integers?ü Computation of bases seems more difficult for the integers!sharing the theory of Abelian Groups [NRR09a]: which theory ofarithmetic sharing the + operator?ü Computation of bases?How to deal with a non-convex data structure such as arrays?ü adaptation of the superposition calculus, to handle clausesinstead of unit clauses
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 24 / 24
inrialoria-logo
Conclusion
References
Alessandro Armando, Maria P. Bonacina, Silvio Ranise, and Stephan Schulz.New results on rewrite-based satisfiability procedures.ACM Transactions on Computational Logic, 10(1), 2009.
Alessandro Armando, Silvio Ranise, and Michaël Rusinowitch.A rewriting approach to satisfiability procedures.Information and Computation, 183(2):140–164, 2003.
Maria Paola Bonacina and Mnacho Echenim.T-decision by decomposition.In Proc. of CADE’07, volume 4603 of LNCS, pages 199–214. Springer, July 2007.
Leonardo Mendonça de Moura and Nikolaj Bjørner.Engineering DPLL(T) + Saturation.In Proc. of IJCAR’08, volume 5195 of LNCS, pages 475–490. Springer, 2008.
Silvio Ghilardi, Enrica Nicolini, and Daniele Zucchelli.A comprehensive combination framework.ACM Transactions on Computational Logic, 9(2):1–54, 2008.
Hélène Kirchner, Silvio Ranise, Christophe Ringeissen, and Duc-Khanh Tran.On superposition-based satisfiability procedures and their combination.In D. Van Hung and M. Wirsing, editors, Proc. of ICTAC 2005, volume 3722 of LNCS, pages594–608, Hanoi (Vietnam), 2005. Springer-Verlag.
Greg Nelson and Derek C. Oppen.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 24 / 24
inrialoria-logo
Conclusion
Simplification by cooperating decision procedures.ACM Transaction on Programming Languages and Systems, 1(2):245–257, 1979.
Enrica Nicolini, Christophe Ringeissen, and Michaël Rusinowitch.Combinable extensions of abelian groups.In Proc. of CADE’09, volume 5663 of LNAI, pages 51–66. Springer, 2009.
Enrica Nicolini, Christophe Ringeissen, and Michaël Rusinowitch.Satisfiability procedures for combination of theories sharing integer offsets.In Proc. of TACAS’09, volume 5505 of LNCS, pages 428–442. Springer, 2009.
E. Nicolini et al. (LORIA & INRIA) Data structures with arithmetic constraints FroCoS’09 24 / 24