Data structures with arithmetic constraints: non-disjoint - - PowerPoint PPT Presentation

data structures with arithmetic constraints non disjoint
SMART_READER_LITE
LIVE PREVIEW

Data structures with arithmetic constraints: non-disjoint - - PowerPoint PPT Presentation

Data structures with arithmetic constraints: non-disjoint combinations E. Nicolini, C. Ringeissen, and M. Rusinowitch LORIA & INRIA-Lorraine ADDCT-UNIF 09 inrialoria-logo E. Nicolini et al. (LORIA & INRIA-Lorraine) Data structures


slide-1
SLIDE 1

inrialoria-logo

Data structures with arithmetic constraints: non-disjoint combinations

  • E. Nicolini, C. Ringeissen, and M. Rusinowitch

LORIA & INRIA-Lorraine

ADDCT-UNIF 09

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 1 / 25

slide-2
SLIDE 2

inrialoria-logo

Outline

1

Introduction

2

Data Structures

3

Arithmetic

4

Background on Combination

5

Conclusion

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 2 / 25

slide-3
SLIDE 3

inrialoria-logo Introduction

Outline

1

Introduction

2

Data Structures

3

Arithmetic

4

Background on Combination

5

Conclusion

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 3 / 25

slide-4
SLIDE 4

inrialoria-logo Introduction

Building Decision Procedures

The most investigated approaches: Rewriting techniques

◮ use a superposition calculus for FOL with Equality and prove its

termination for useful cases in verification

➼ Application to data structures [ARR03, ABRS09, BE07, dMB08] Combination techniques

◮ use procedures available for individual theories and try to build a

procedure for the union of theories

➼ Application to the union of data structures and fragments of arithmetic [KRRT05] Our approach: blend both the approaches to combine data structures sharing some arithmetic operators ➼ Application of the combination method proposed by Ghilardi-Nicolini-Zucchelli [GNZ08]: a combination method à la Nelson-Oppen [NO79] for non-disjoint unions of theories

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 4 / 25

slide-5
SLIDE 5

inrialoria-logo Data Structures

Outline

1

Introduction

2

Data Structures

3

Arithmetic

4

Background on Combination

5

Conclusion

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 5 / 25

slide-6
SLIDE 6

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, size : TREES →

NUM

size(null) = 0 size(bin(e, t1, t2)) = size(t1)+size(t2)+1 0 = 1

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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 6 / 25

slide-7
SLIDE 7

inrialoria-logo Data Structures

Possible shared theories

(Inj) ∀x, y s(x) = s(y) → x = y (Acy) ∀x x = sn(x) for all n ∈ N+ (S0) ∀x s(x) = 0

1

Theory of Integer Offsets [NRR09c]: TI = {Inj, Acy, S0}

2

Theory of Increment [NRR09b]: TS = {Inj, Acy}

3

Theory of Abelian Groups [NRR09a]: AG = AC(+) ∪ {x + (−x) = 0, x + 0 = x}

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 7 / 25

slide-8
SLIDE 8

inrialoria-logo Data Structures

Superposition Calculus

Superposition l[u′] = r u = t (l[t] = r)σ (i), (ii), (iii), (iv) Paramodulation l[u′] = r u = t (l[t] = r)σ (i), (ii), (iii), (iv) Reflection u′ = u ⊥ (i)

where (i) σ is the most general unifier of u and u′, (ii) u′ is not a variable , (iii) uσ tσ, (iv) l[u′]σ rσ.

Figure: Expansion Inference Rules.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 8 / 25

slide-9
SLIDE 9

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 C2 (for S0) S ∪ {s(t) = 0} S ∪ {s(t) = 0} ∪ ⊥

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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 9 / 25

slide-10
SLIDE 10

inrialoria-logo Data Structures

Superposition Calculi as Decision Procedures

Result ([NRR09c, NRR09b])

An appropriate Superposition Calculus leads to a decision procedure for a class of theories modelling data-structures with the unary successor function. ➼ Examples: Lists with length, Records with increment

Result ([NRR09a])

A Superposition Calculus modulo AG leads to a decision procedure for a class of theories modelling data-structures with the binary addition function. ➼ Examples: previous ones + Trees with size. Proof (AG case):

1

A many-sorted and unconstrained version the Superposition Calculus modulo AG developed by Godoy-Nieuwenhuis [GN04]

2

Use of AG-unification with free symbols

3

Considered theories: unit clauses with no variable of sort AG

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 10 / 25

slide-11
SLIDE 11

inrialoria-logo Arithmetic

Outline

1

Introduction

2

Data Structures

3

Arithmetic

4

Background on Combination

5

Conclusion

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 11 / 25

slide-12
SLIDE 12

inrialoria-logo Arithmetic

Linear Arithmetic

ΣQ := {0, 1, +, −, {fq}q∈Q, s, <}, where 0, 1 are constants, −, fq, s are unary function symbols. Let TQ be the set of all the ΣQ-sentences that are true in Q.

Fact

A 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 of equalities

3

Disequality Handler ➼ a function canon over arithmetic expressions to check whether an disequality can be canonized into an unsatisfiable disequality u = u.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 12 / 25

slide-13
SLIDE 13

inrialoria-logo Arithmetic

Non-Linear Arithmetic: The Theory of Q-Algebras

TQ−alg is AC(+) ∪ AC(×) ∪ U(+, 0) ∪ U(×, 1) plus

∀x x + (−x) = 0 (1) 0 = 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)

Fact

A TQ−alg-satisfiability procedure can be obtained by using the Buchberger algorithm for the computation of Groebner bases.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 13 / 25

slide-14
SLIDE 14

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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 14 / 25

slide-15
SLIDE 15

inrialoria-logo Background on Combination

A combination problem

Γ1 =    y = ℓ(a) b = cons(e, a) x = ℓ(b)    Γ2 = u ≥ 0 x + 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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 15 / 25

slide-16
SLIDE 16

inrialoria-logo Background on Combination

A combination problem

Γ1 =    y = ℓ(a) b = cons(e, a) x = ℓ(b)    Γ2 = u ≥ 0 x + 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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 15 / 25

slide-17
SLIDE 17

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 an equisatisfiable set of pure constraints Γ1 ∪ Γ2 ; Propagation the T1-constraint solving procedure and the T2-constraint solving 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 is reached. Pseudo-code:

  • 1. If T0-basisTi(Γi) = ∆i and ⊥ /

∈ ∆i for each i ∈ {1, 2}, then 1.1. For each D ∈ ∆i such that Tj ∪ Γj | = D, (i = j), add D to Γj 1.2. If Γ1 or Γ2 has been changed in 1.1, then rerun 1. Else return Unsatisfiable

  • 2. Return Satisfiable.
  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 16 / 25

slide-18
SLIDE 18

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 an equisatisfiable set of pure constraints Γ1 ∪ Γ2 ; Propagation the T1-constraint solving procedure and the T2-constraint solving 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 is reached. Pseudo-code:

  • 1. If T0-basisTi(Γi) = ∆i and ⊥ /

∈ ∆i for each i ∈ {1, 2}, then 1.1. For each D ∈ ∆i such that Tj ∪ Γj | = D, (i = j), add D to Γj 1.2. If Γ1 or Γ2 has been changed in 1.1, then rerun 1. Else return Unsatisfiable

  • 2. Return Satisfiable.
  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 16 / 25

slide-19
SLIDE 19

inrialoria-logo Background on Combination

Combination method: critical points

1

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 infinite theories used in the disjoint case) Our work: how to face these issues when dealing with (i) a combination of two data-structures sharing the theory of Integer Offsets (ii) a combination of one data structure and one theory of arithmetic sharing the theory of Increment (iii) a combination of two data-structures sharing the theory of Abelian Groups

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 17 / 25

slide-20
SLIDE 20

inrialoria-logo Background on Combination

Computation of bases for data structures

Result

In case of satisfiability, our Superposition Calculi compute T0-bases for T0 = TI, TS, AG. How to compute T0-bases: collect all the shared equalities in a saturation of Γ not containing ⊥.

Example

The saturation of Γ = {y = ℓ(a), b = cons(e, a), x = ℓ(b)} contains x = s(y)

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 18 / 25

slide-21
SLIDE 21

inrialoria-logo Background on Combination

Computation of TS-bases for fragments of arithmetic

Result

It is possible to compute TS-bases 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 Buchberger algorithm, as shown in Nicolini’s thesis. Then proceed as in (1).

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 19 / 25

slide-22
SLIDE 22

inrialoria-logo Background on Combination

Computation of TS-bases: example for the arithmetic

Example

Γ =    x = c 1 + 2c + y = 2 + 3d 2c = d + x Γ is equivalent to the solved form: solve(Γ) =    x = c y = c + 1 d = c Therefore: Γ → y = s(x)

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 20 / 25

slide-23
SLIDE 23

inrialoria-logo Background on Combination

Computation of TS-bases: example for the arithmetic

Example

Γ =    x = c 1 + 2c + y = 2 + 3d 2c = d + x Γ is equivalent to the solved form: solve(Γ) =    x = c y = c + 1 d = c Therefore: Γ → y = s(x)

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 20 / 25

slide-24
SLIDE 24

inrialoria-logo Background on Combination

Computation of TS-bases: example for the arithmetic

Example

Γ =    x = c 1 + 2c + y = 2 + 3d 2c = d + x Γ is equivalent to the solved form: solve(Γ) =    x = c y = c + 1 d = c Therefore: Γ → y = s(x)

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 20 / 25

slide-25
SLIDE 25

inrialoria-logo Background on Combination

Non-disjoint extension of Nelson-Oppen applied to the theory of Increment (TS)

We have identified a class of theories DSTS modelling data structures modulo TS such that for any T ∈ DSTS ∪ {TQ, TQ-alg}: the Ghilardi-Nicolini-Zucchelli combination method is

1

complete

2

terminating

Theorem ([NRR09b])

For any Σ1-theory T1 ∈ DSTS and any Σ2-theory T2 ∈ {TQ, TQ-alg} ∪ DSTS such that Σ1 ∩ Σ2 = ΣS, T1 ∪ TS ∪ T2 has a decidable constraint satisfiability problem.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 21 / 25

slide-26
SLIDE 26

inrialoria-logo Background on Combination

Non-disjoint extension of Nelson-Oppen applied to the theory of Integer Offsets (TI)

We have identified a class of theories DSTI modelling data structures modulo TI such that for any T ∈ DSTI: the Ghilardi-Nicolini-Zucchelli combination method is

1

complete

2

terminating

Theorem ([NRR09c])

For any Σ1-theory T1 ∈ DSTI and any Σ2-theory T2 ∈ DSTI such that Σ1 ∩ Σ2 = ΣI, T1 ∪ TI ∪ T2 has a decidable constraint satisfiability problem.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 22 / 25

slide-27
SLIDE 27

inrialoria-logo Background on Combination

Non-disjoint extension of Nelson-Oppen applied to the theory of Abelian Groups (AG)

We have identified a class of theories DSTAG modelling data structures modulo AG such that for any T ∈ DSTAG: the Ghilardi-Nicolini-Zucchelli combination method is

1

complete

2

terminating

Theorem ([NRR09a])

For any Σ1-theory T1 ∈ DSTAG and any Σ2-theory T2 ∈ DSTAG such that Σ1 ∩ Σ2 = ΣAG, T1 ∪ AG ∪ T2 has a decidable constraint satisfiability problem.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 23 / 25

slide-28
SLIDE 28

inrialoria-logo Conclusion

Outline

1

Introduction

2

Data Structures

3

Arithmetic

4

Background on Combination

5

Conclusion

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 24 / 25

slide-29
SLIDE 29

inrialoria-logo Conclusion

Conclusion and future work

What about a theory of arithmetic over the integers? ➼ Computation of bases seems more difficult for the integers! Possibility of combining a data structure with a theory of arithmetic sharing the + operator? ➼ continuation of our work on abelian groups [NRR09a] How to deal with a non-convex data structure such as arrays? ➼ adaptation of the superposition calculus, to handle clauses instead of unit clauses

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 25 / 25

slide-30
SLIDE 30

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. Guillem Godoy and Robert Nieuwenhuis. Superposition with completely built-in abelian groups. Journal of Symbolic Computation, 37(1):1–33, 2004. 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.

  • E. Nicolini et al. (LORIA & INRIA-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 25 / 25

slide-31
SLIDE 31

inrialoria-logo Conclusion

In D. Van Hung and M. Wirsing, editors, Proc. of ICTAC 2005, volume 3722 of LNCS, pages 594–608, Hanoi (Vietnam), 2005. Springer-Verlag. Greg Nelson and Derek C. Oppen. 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. Data structures with arithmetic constraints: a non-disjoint combination. In Proc. of FroCoS’09, LNCS. 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-Lorraine)

Data structures with arithmetic constraints ADDCT-UNIF 09 25 / 25