<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Weakly Equivalent Arrays</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jurgen Christ</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jochen Hoenicke</string-name>
          <email>hoenickeg@informatik.uni-freiburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science, University of Freiburg</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>The (extensional) theory of arrays is widely used to model systems. Hence, e cient decision procedures are needed to model check such systems. Current decision procedures for the theory of arrays saturate the read-over-write and extensionality axioms originally proposed by McCarthy. Various lters are used to limit the number of axiom instantiations while preserving completeness. We present an algorithm that lazily instantiates lemmas based on weak equivalence classes. These lemmas are easier to interpolate as they only contain existing terms. We formally de ne weak equivalence and show correctness of the resulting decision procedure.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        This work is supported by the German Research Council (DFG) as part of the Transregional Collaborative
Research Center \Automatic Veri cation and Analysis of Complex Systems" (SFB/TR14 AVACS)
Related Work Since the proposal of the theory of arrays by McCarthy [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] several
decision procedures have been proposed. We can identify two basic branches: rewrite-based and
instantiation-based techniques.
      </p>
      <p>
        Armando et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] used rewriting techniques to solve the theory of arrays. They showed
how to construct simpli cation orderings to achieve completeness. The benchmarks used in this
paper test speci c properties of the array operators like commutativity of stores if the indices
di er. While these benchmarks require a lot of instantiations of McCarthy's axioms, they are
easy for the decision procedure presented in this paper since the properties tested by these
benchmarks are properties satis ed by the weak equivalence relation presented in this paper.
      </p>
      <p>
        Bruttomesso et al. [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] present a rewrite based decision procedure to reason about arrays.
This approach exploits some key properties of the store operation that are also captured by
the weak equivalence relation described in this paper. Contrary to our method, the rewrite
based approach is not designed for Nelson{Oppen style theory combination and thus not easily
integratable into an existing SMT solver. They extended the solver into an interpolating solver
for computing quanti er-free interpolants. In contrast to our method their solver depends on
the partitioning of the interpolation problem. We create a SMT proof without any knowledge
of the partitioning and can use proof tree preserving interpolation [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], which only requires a
procedure to interpolate the lemmas.
      </p>
      <p>
        A decision procedure for the theory of arrays based on instantiating McCarthy's axioms is
given by de Moura et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. The decision procedure saturates several rules that instantiate
array axioms under certain conditions. Several lters are proposed to minimise the number of
instantiations.
      </p>
      <p>
        Closest to our work is the decision procedure published by Brummayer et al. [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Their
decision procedure produces lemmas that can be derived from the axioms for the theory of arrays
proposed by McCarthy. They consider the theory of arrays with bitvector indices and prove
soundness and completeness of their approach in this setting. In contrast to our method, they do
not allow free function symbols (i. e., the combination of the theory of arrays with the theory
of uninterpreted function symbols) since they only consider a limited form of extensionality
where the extensionality axiom is only instantiated for arrays a and b if the formula contains
the literal a 6= b. We do not have this limitation, but add some requirements on the index
theory that prevent the procedure presented in this paper from using the theory of bitvectors
as index theory.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Notation</title>
      <p>A rst order theory consists of a signature and a set of models M. We assume the equality
symbol = with its usual interpretation is part of any signature. Every model contains for
every sort interpreted by this model a non-empty domain and a mapping from constant or
function symbol into the corresponding domain. A theory T is stably in nite if and only if
every satis able quanti er-free formula is satis ed in a model of T with an in nite universe.</p>
      <p>
        The theory of arrays TA is parameterised by an index theory TI and an element theory TE .
The signature of TA consists of the two functions [ ] and h i. Every model of the theory of
arrays satis es the select-over-store-axioms proposed by McCarthy [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]:
      </p>
      <p>8a i v: ahi
8a i j v: i 6= j =) ahi
vi[i] = v
vi[j] = a[j]</p>
      <p>(idx)
(read-over-write)
Additionally we consider the extensional variant of the theory of arrays. Then, every model
has to satisfy the extensionality axiom:
(ext)</p>
      <p>We use a; b to denote array-valued variables, i; j; k to denote index variables, and v; w to
denote element variables. Additionally we use subscripts to distinguish di erent variables. We
use P to denote a path in a graph. A path in a graph is interpreted as a sequence of edges.</p>
      <p>In the remainder of this paper, we consider quanti er-free TA-formulae. Furthermore we x
the index TI to a stably in nite theory and the element theory TE to a theory that contains at
least two di erent values1.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Towards a Nelson{Oppen-based Array Solver</title>
      <p>
        Multiple theories are usually combined with a variant of the Nelson{Oppen combination
procedure [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. The procedure requires the participating theories to be stably in nite and to only
share the equality symbol =.
      </p>
      <p>The procedure rst transforms the input such that every literal is pure with respect to the
theories. Let f (t) be a term in the input. If f is interpreted by theory T1 and t is interpreted by
theory T2, then f (t) is not pure. The rst step of the Nelson{Oppen procedure then generates
a fresh variable v, rewrites f (t) into f (v), and adds the de nition v = t as a new conjunct to
the formula. The fresh variable is shared between theories T1 and T2. This step is repeated
until all terms are pure. By abuse of notation, we name the shared variable after its de ning
term t, e. g., we use a[i] to denote the shared variable that is de ned as a[i].</p>
      <p>Let V be the set of fresh variables introduced in the rst step of the combination procedure.
The second step of the procedure tries to nd an arrangement of V , i. e., an equivalence
relation between variables in V such that T1 and T2 produce partial models that agree with this
equivalence relation. Finding such an arrangement is typically done by propagating equalities
or providing case split lemmas. In the following, we call this arrangement strong equivalence
to distinguish it from weak equivalence de ned in the next section. We write a b to denote
that a and b are strongly equivalent, i.e., that in the current arrangement the shared variables
a and b are equal.</p>
      <p>For the theory of arrays, we consider every term of the form h i or [ ] as being interpreted
by the array theory. We consider all array terms, store, and select terms to be shared and thus
they have to occur in the arrangement. Furthermore, every index term that appears in a store
or select is considered shared between the array theory and the index theory. Then the goal
is to nd a suitable arrangement to these shared terms such that all theories agree on this
arrangement.</p>
      <p>For an array solver to be used in Nelson{Oppen combination we have to propagate equalities
between shared array terms and shared select terms. Furthermore, the other theories have to
propagate equalities between terms used as index in a select or store. In the remainder of this
paper we will rst show how to propagate equalities between select terms and afterwards deal
with extensionality to propagate equalities between array-valued terms.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Weak Equivalences over Arrays</title>
      <p>The theory of arrays has two constructors for arrays: array variables, and store terms h i.
Assuming quanti er-free input, we can only constrain the values of a nite number of indices.</p>
      <p>1Note that TA is stably in nite under these conditions.</p>
      <p>These constraints can either be explicity like a[i] = v, or implicit like ahi vi where axiom
(idx) produces the corresponding ahi vi[i] = v. Hence, for quanti er-free input, arrays that
are connected via a sequence of h i can only di er in nitely many positions. We call such
arrays weakly equivalent. In this section we formally de ne weak equality and show how to
exploit this to produce a decision procedure for the (extensional) theory of arrays.</p>
      <p>Let S be the set of all terms of the form h i in the input formula and A be the set of all
array-valued terms that are not in S. Since ahi vi modi es a only at index i, these two arrays
are guaranteed to be equal on all indices except on index i. We generalise this observation to
chains of the form : : : hj wihi vi to extract a set of indices for which two arrays might store
di erent values.</p>
      <p>De nition 1 (weak equivalence). A weak equivalence graph GW contains vertices S [ A and
undirected edges de ned as follows:
1. a $ b if a</p>
      <p>b, and
2. a $i b if a has form bhi</p>
      <p>(P )
We write a , b if there exists a path P between nodes a and b in GW . In this case, we call a
and b weakly equal. The weak equivalence class containing all elements that are weakly equal
(P )
to a is de ned as WeakEQ(a) := fb j 9P: a , bg.</p>
      <p>For a path P we de ne Stores (P ) as the set of all indices corresponding to edges of the form
$, i. e., Stores (P ) := fi j 9a b: a $i b 2 P g.</p>
      <p>Example 1. Consider the formula a = bhj vi ^ b = chi wi ^ d = e ^ c[i] = w. The weak
equivalence graph for this example is shown in Figure 1. Note that the last conjunct is not
important for the construction of the weak equivalence graph.</p>
      <p>a
bhj
vi
j
b
d
chi</p>
      <p>wi
e</p>
      <p>i c</p>
      <p>We get two di erent weak equivalence classes. The rst one contains the nodes a, bhj vi,
b, chi wi, and c. The second contains d and e. Note that d and e are actually strongly
equivalent. Thus, they store the same value at every position. Let P denote the path from a
to c in the weak equivalence graph. Then, Stores (P ) = fi; jg. Thus, arrays a and c can only
di er in at most the values stored at the indices i and j.
(P )</p>
      <p>If we want to know if a[i] and b[i] should be equal, we check if a , b for a path P such that
i 62 Stores (P ). If this is the case, P witnesses the equivalence between the select terms.
De nition 2 (weak equivalence modulo i). Two arrays a and b are weakly equivalent modulo i
if and only if they are weakly equivalent and connected by a path that does not contain an edge
of the form $j where j i. We denote weak equivalence modulo i by a i b and de ne it as
a i b := 9P: a (,P) b ^ 8j 2 Stores (P ) : j 6 i.</p>
      <p>Using this de nition we can propagate equalities between shared selects if the arrays are
weakly equivalent modulo the index of the select.</p>
      <sec id="sec-4-1">
        <title>Lemma 1 (read-over-weakeq). Let</title>
        <p>and b[j] be two selects such that i</p>
        <p>be an arrangement satisfying the array axioms. Let a[i]
j and a i b. Then, a[i] b[j] holds.</p>
        <p>Proof. We induct over the length of the path P witnessing a
i b.</p>
        <p>Base case. In this case, a and b are the same term. Hence a[i]
b[j] holds by congruence.</p>
        <p>Step case. Let the step from c to b be the last step of path P . By induction hypothesis we
know that a[i] c[j] holds.</p>
        <p>If the edge between c and b is due to a strong equivalence (i. e., c b), then c[j] b[j]
follows from congruence.</p>
        <p>If the edge between c and b is of the form c $k b, then either c is bhk i or b is chk
both cases, we get the lemma j = k _ c[j] = b[j] from axiom (read-over-write). Since j
i 6 k, we get j 6 k and thus c[j] b[j]. We conclude a[i] b[j] by transitivity.
i. In
i and</p>
        <p>This lemma allows us to propagate equalities between shared selects. Note that it depends
upon disequalities between index terms needed to ensure a i b.</p>
        <p>If two arrays are weak equivalent modulo i they store the same value at the index i. The
reverse is not necessarily true. Therefore, we de ne a weaker relation weak congruence modulo i.
De nition 3 (weak congruence modulo i). Arrays a and b are weak congruent modulo i if and
only if they are guaranteed to store the same value at index i. We denote weak congruence
modulo i by i and de ne a i b := a i b_9a0 b0 j k: a i a0^i j^a0[j] b0[k]^k i^b0 i b.</p>
        <p>We use weak congruences to decide extensionality. Intuitively, if for all indices i the weak
congruence modulo i a i b holds, then a = b should be propagated. But this nave approach
requires checking every index occurring in the formula. To minimise the number of indices we
need to consider, we exploit the weak equivalence graph.</p>
        <p>Lemma 2 (weakeq-ext). Let</p>
        <p>(P )
two arrays such that a , b holds. If for all indices i 2 Stores (P ) we have a
holds.</p>
        <p>be an arrangement satisfying the array axioms. Let a and b be
i b, then a
b</p>
      </sec>
      <sec id="sec-4-2">
        <title>Proof. Follows from Lemma 1, De nition 3 and (ext).</title>
        <p>5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>A Decision Procedure Based on Weak Equivalences</title>
      <p>Our decision procedure is based on weak equivalences and the Nelson{Oppen combination
scheme. It propagates equalities between terms shared by multiple theories. We limit the
propagation to shared array terms and array select terms.</p>
      <p>The TA-formulae are preprocessed as follows. For every ahi vi contained in the input, we
(1) instantiate the axiom (idx) and (2) add a[i] to the set of terms contained in the input2.
Thus, the preprocessing step adds at most two select operations for every store.</p>
      <p>We propagate new equalities from weak equivalence relations and weak congruence relations
based on lemmas 1 and 2. These relations depend on the arrangement , which represents
logical equality (=). We now de ne a function Cond( ) that computes a condition (a conjunction
of equalities and inequalities) under which a weak equivalence or weak congruence holds. To
2This can be achieved by adding the equality a[i] = a[i].
denote the condition for a path that does not contain an edge labelled with index i we use
Condi( ). For an edge in the weak equivalence graph that represents an equality, the condition
re ects this equality. For an edge that comes from a hj i, no condition is needed. However,
Condi( ) should ensure that i does not occur on the path, so i 6= j needs to hold.</p>
      <p>Cond(a $ b) := a = b
Cond(a $j b) := true</p>
      <p>Condi(a $ b) := a = b
Condi(a $j b) := i 6= j
We can extend these de nitions to paths by conjoining the conditions for all edges on that path.
Then, we can compute Cond(a i b) using the path that witnesses a i b.</p>
      <p>Cond(a i b) := Condi(P ) where a (,P) b ^ 8j 2 Stores (P ) : i 6 j
Finally, to de ne Cond(a i b), we use the de nition of i.</p>
      <p>8Cond(a i b)
&gt;
Cond(a i b) := &lt; Cond(a i a0) ^ i = j ^ a0[j] = b0[k]
&gt;
:
^ k = i ^ Cond(b0 i b)
if a i b
if
a i a0 ^ i</p>
      <p>j ^ a0[j]
^ k
i ^ b0 i b
b0[k]
Example 2. Consider again the formula a = bhj vi ^ b = chi wi ^ d = e ^ c[i] = w from
Example 1 whose weak equivalence graph is shown in Figure 1. Assume i 6 j. Then we have
a i chi wi since no edge contains a label that is equivalent to i. We get Cond(a i chi wi)
a = bhj vi ^ i 6= j ^ b = chi wi.</p>
      <p>From Axiom (idx) we get chi wi[i] = w. With c[i] = w we conclude a i c since a i chi wi
and chi wi[i] = c[i]. We have Cond(a i c) Cond(a i chi wi) ^ chi wi[i] = c[i].</p>
      <p>To decide the theory of arrays we de ne two rules to generate instances of array lemmas.
We present the rules as inference rules. The rule is applicable if the current arrangement on
the shared variables V satis es the conditions above the line. The rule then generates a new
(valid) lemma that can propagate an equality under the current arrangement.</p>
      <p>The rst rule is based on Lemma 1. Two select terms are equivalent if the indices of the
selects are congruent and the arrays are weakly equivalent modulo that index. We only create
this lemma if the select terms existed in the formula. Note that we create for select terms in
the formula a shared variable with the same name in V .</p>
      <p>a i b
i
j</p>
      <p>a[i]; b[j] 2 V
i 6= j _ : Cond(a i b) _ a[i] = b[j]
(read-over-weakeq)</p>
      <p>The next rule is based on Lemma 2 and used to propagate an equality between two
extensionally equal array terms. Two arrays a and b have to be equal if there is a path P such that
a (,P) b and for all i 2 Stores (P ), a i b holds.</p>
      <p>a (,P) b
: Cond(P ) _
8i 2 Stores (P ) : a i b
_</p>
      <p>a; b 2 V
: Cond(a i b) _ a = b
i2Stores(P )
(weakeq-ext)</p>
      <p>
        The resulting decision procedure is sound and complete for the existential theory of arrays
assuming sound and complete decision procedures for the index and element theories.
Lemma 3 (soundness). Rules (read-over-weakeq) and (weakeq-ext) are sound.
Proof. Soundness of the rules follows directly from the lemma with the corresponding name.
Lemma 4 (completeness). The rules (read-over-weakeq) and (weakeq-ext) are complete.
The proof of this lemma can be found in the extended version of this paper [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
6
      </p>
    </sec>
    <sec id="sec-6">
      <title>Restricting Instantiations</title>
      <p>The preprocessor is the only component of our decision procedure that produces new select
terms and thus might trigger new lemmas. These lemmas only generate new (dis-)equality
literals between existing terms. Thus, reducing the number of select terms might reduce the
number of lemmas generated by our decision procedure and speed up the procedure.</p>
      <p>If the element theory is stably in nite we can omit the preprocessor step that adds for every
ahi vi the select a[i]. Instead, we simply assume a[i] to be di erent than any other b[i] unless
a b. This method preserves soundness and completeness.</p>
      <p>Lemma 5. (soundness of modi ed procedure) The modi ed procedure is sound.
Proof. Follows directly from Lemma 3 since it does not rely on the addition of a[i] for every
ahi i.</p>
      <p>
        For the completeness lemma we take into account the fact that the element theory is stably
in nite. Thus, if a[i] is not present we use a fresh element in the value domain.
Lemma 6 (completeness of modi ed procedure). The modi ed procedure is complete.
The proof of this lemma can be found in the extended version of this paper [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        This optimisation enables us to limit the number of additional terms in the input. Since
we only need to generate (read-over-weakeq) lemmas if the select terms in the conclusion are
present after preprocessing, this optimisation also reduces the number of lemmas. Furthermore,
it is widely applicable. In fact, the non-bitvector logics de ned in the SMTLIB [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] only allow
array sorts where the element theory is stably in nite. Thus, only the terms corresponding to
instantiations of Axiom (idx) are required. In an actual implementation even these terms could
be omitted (see [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]).
7
      </p>
    </sec>
    <sec id="sec-7">
      <title>Implementation and Evaluation</title>
      <p>
        We implemented the decision procedure described in this paper in our SMT solver
SMTInterpol [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Besides the aforementioned preprocessing step that applies (idx) to every h i in
the input, we also simplify TA-formulae by applying (read-over-write) if the index of the store
and the index of the select are syntactically equal. Furthermore, we contract terms of the form
ahi v2ihi v1i to ahi v1i. We only add a[i] to the set of terms contained in the formula if
we have ahi vi in the input and the domain of v is nite.
      </p>
      <p>
        We represent the weak equivalence relation and the weak equivalence modulo i relations in a
forest structure, similarly to the representation of equivalence graph in congruence solvers [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
Every node has an outgoing edge, and these edges build a spanning tree for every equivalence
class. The edges point from a child node to the parent node. The root node of every tree has
no outgoing edge and is the representative of its equivalence class.
      </p>
      <p>We have to distinguish between strong equivalence, weak equivalence, and weak equivalence
modulo i. The strong equivalence classes are already handled by the equality solver. In our
implementation of the array solver we treat them as indivisible and create a single node for
every strong equivalence class. To represent the weak equivalence relations the nodes have up
to two outgoing edges, a primary p and a secondary s, see Figure 2. The edges come from a
store operation and correspond to the edges $i in the weak equivalence graph. The index of
the primary edge is stored in the pi eld. The primary edge points towards the representative
struct node
p : node
pi : index
s : node
get-rep(n : node)
if n:p = nil then n
else get-rep(n:p)
make-rep(n : node)
if n:p 6= nil then
make-rep(n:p)
nnn:::ppp::pp:=i:=:n=inln:pi=;9 iendvgeert primary
make-repi(n)
get-repi(n : node; i : index)
if n:p = nil then n
elseif n:pi 6= i then get-repi(n:p; i)
elseif n:s = nil then n
else get-repi(n:s; i)
make-repi(n : node)
if n:s 6= nil then
if n:s:pi 6= n:pi then
n:s := n:s:p rmeopvreesetnotwaatirvdes
make-repi(n)
else
make-repi(n:s)
n:s:s := n:s invert
n:s := nil secondary edge
of the weak equivalence class. Every primary edge p connects the node representing (the strong
equivalence class of) a store ahj vi with the node representing a and the corresponding index
in the pi eld is j. Note, however, that the direction of the edge can be arbitrary, as we invert
the edges during the execution of the algorithm. If the primary edge is missing the node is the
representative of its weak equivalence class and of all its weak equivalence modulo i classes.</p>
      <p>While the primary edge is enough to represent the weak equivalence relation we need another
edge to represent weak equivalence modulo i. The representative of weak equivalence modulo i
is also found by following the primary edges. However, if the store of the primary edge is on
the index i, the secondary edge is followed instead. If the secondary edge is missing the node
is the representative of its weak equivalence modulo i class.</p>
      <p>The equivalence classes are represented as follows. Two arrays a and b are weakly equivalent
i get-rep(a) = get-rep(b) and a i b i get-repi(a; i) = get-repi(b; i).</p>
      <p>
        The algorithm proceeds by inserting the store edges one by one, similarly to the algorithm
presented in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. The algorithm that inserts a store edge is given in Figure 3. The algorithm
rst inverts the outgoing edges of one node to make it the representative of its weak equivalence
class. If the other side of the store edge lies in a di erent weak equivalence classes, the store
add-secondary(S : index set; a; b : node) add-store(a; b : node; i : index)
if a = b then
      </p>
      <p>return
if a:pi 2= S ^ get-repi(a; a:pi) 6= b then
make-repi(a)
a:s := b
add-secondary(S [ fa:pig; a:p; b)
else
make-rep(b)
if get-rep(a) = b then
add-secondary(fig; a; b)
b:p := a
b:pi := i
can be inserted as a new primary edge.</p>
      <p>If the nodes are already weakly equivalent the procedure add-secondary is called. This
procedure follows the path from the other array a to the array b that was made the
representative. For every node on this path it checks if a secondary edge needs to be added. If the
primary edge of the node is labelled with a store on i, the algorithm rst checks if the node is
weakly equivalent modulo i with b due to the new store edge. This is the case if no store on i
occurred on the path so far and the new store is also on an index di erent from i. We use the
set S to collect these forbidden indices. Then if b is not already the representative of the weak
equivalence modulo i class, the outgoing secondary edges are reversed and a new secondary
edge is added.</p>
      <p>The complexity of the procedure add-store is worst case quadratic in the size of the weak
equivalence class. This stems from make-repi being linear in the size and being called a linear
number of times. The overall complexity is cubic in the number of stores in the input formula.
The space requirement, however, is only linear. In our current implementation in SMTInterpol
this procedure was not a bottleneck so far. In SMTInterpol we also keep the stores that created
the primary and secondary edge in the data-structure. This allows for computing the paths
needed for lemma generation in linear time.</p>
      <p>Example 3. Figure 4 shows an example of the data structure where the primary edges are
labelled by the index of the corresponding store. This data structure represents only one weak
equivalence class with the representative node 0. The resulting data structure after adding a
store with index k between nodes 0 and 4 is shown on the right. Since nodes 0 and 4 were
already in the same weak equivalence class, secondary edges were added.</p>
      <p>These secondary edges are needed to connect the weak equivalence modulo i and modulo
j classes. Figure 5(a) shows how the rst secondary edge connects the two weak equivalence
modulo i classes rooted at nodes 0 resp. 3. This is necessary since there is now a new path
using the edge from 4 to 0. Note that no secondary edge is added to node 1, since nodes 1,
2, and 5 are still not weakly equivalent modulo i to the other nodes. Figure 5(b) shows the
connection between the two weak equivalence modulo j classes rooted at nodes 0 resp. 2. The
weak equivalence modulo j class rooted at node 6 is not a ected by a new edge between nodes
0 and 4 since these nodes are on a di erent path.</p>
      <p>
        We implemented this decision procedure in our SMT solver SMTInterpol [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] and tested
it on the benchmarks from the QF AX and QF AUFLIA devisions of the SMTEVAL 2013
benchmarks. We solved all benchmarks in 1:32 resp. 10:45 minutes without running into a
4
k
3
i
2
k
5
6
k
7
5
6
k
7
timeout of 10 minutes. According to the data from the SMTEVAL, no other solver was able to
solve all benchmarks in these divisions. We defer an up-to-date comparison to the SMTCOMP
2014.
8
      </p>
    </sec>
    <sec id="sec-8">
      <title>Conclusion and Future Work</title>
      <p>
        We presented a new decision procedure for the extensional theory of arrays. This procedure
exploits weak equalities to limit the number of axiom instantiations. The instantiations produced
by the decision procedure presented in this paper can be restricted to terms already present
in the input formula. Furthermore we discussed an implementation based on a graph
structure similar to congruence closure graphs. This decision procedure is implemented in our SMT
solver SMTInterpol [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. We plan to implement a variant of the quanti er-free interpolation for
arrays [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] based on the lemmas generated by this decision procedure. Since these lemmas only
generate mixed equalities, proof tree preserving interpolation [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] can be used.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Armando</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bonacina</surname>
            ,
            <given-names>M.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ranise</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schulz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>New results on rewrite-based satis ability procedures</article-title>
          .
          <source>ACM Trans. Comput. Log</source>
          .
          <volume>10</volume>
          (
          <issue>1</issue>
          ) (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Barrett</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stump</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tinelli</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>The SMT-LIB Standard: 2.0</article-title>
          . In: SMT (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Brummayer</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Biere</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Lemmas on demand for the extensional theory of arrays</article-title>
          .
          <source>JSAT</source>
          <volume>6</volume>
          (
          <issue>1-3</issue>
          ),
          <volume>165</volume>
          {
          <fpage>201</fpage>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Bruttomesso</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ghilardi</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ranise</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Quanti er-free interpolation of a theory of arrays</article-title>
          .
          <source>Logical Methods in Computer Science</source>
          <volume>8</volume>
          (
          <issue>2</issue>
          ) (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Christ</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hoenicke</surname>
          </string-name>
          , J.:
          <article-title>Weakly equivalent arrays</article-title>
          .
          <source>CoRR abs/1405</source>
          .6939 (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Christ</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hoenicke</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nutz</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>SMTInterpol: An interpolating SMT solver</article-title>
          .
          <source>In: SPIN</source>
          . pp.
          <volume>248</volume>
          {
          <issue>254</issue>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Christ</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hoenicke</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nutz</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Proof tree preserving interpolation</article-title>
          .
          <source>In: TACAS</source>
          . pp.
          <volume>124</volume>
          {
          <issue>138</issue>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>McCarthy</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          :
          <article-title>Towards a mathematical science of computation</article-title>
          .
          <source>In: IFIP Congress</source>
          . pp.
          <volume>21</volume>
          {
          <issue>28</issue>
          (
          <year>1962</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>de Moura</surname>
            ,
            <given-names>L.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bj</surname>
            <given-names>rner</given-names>
          </string-name>
          , N.:
          <article-title>Generalized, e cient array decision procedures</article-title>
          .
          <source>In: FMCAD</source>
          . pp.
          <volume>45</volume>
          {
          <issue>52</issue>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Nelson</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Oppen</surname>
            ,
            <given-names>D.C.</given-names>
          </string-name>
          :
          <article-title>Simpli cation by cooperating decision procedures</article-title>
          .
          <source>ACM Trans. Program. Lang. Syst</source>
          .
          <volume>1</volume>
          (
          <issue>2</issue>
          ),
          <volume>245</volume>
          {
          <fpage>257</fpage>
          (
          <year>1979</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Nieuwenhuis</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Oliveras</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Proof-producing congruence closure</article-title>
          .
          <source>In: RTA</source>
          . pp.
          <volume>453</volume>
          {
          <fpage>468</fpage>
          . Springer (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>