tablished. For i = 3, the array elements A[i] depend on
the base case denoted by the equivalent assgiments of
constant expressions C
2
on array elements A[1] in the
satements s
1
and s
0
1
. Hence, the array elements A[3]
are equivalently computed. For the i = 4, the array el-
ements A[i] depend on the base case denoted by the in-
equivalent assgiments of constant expressions C
3
and
C
9
on array elements A[2] in the statements s
2
and
s
0
2
, respectively. Hence, the array elements A[4] are
inequivalently computed. For the rest of the domain
5 ≤ i ≤ N, the computation of A[i] depends on the
computation of A[i − 2] due to recurrence. Instead of
declaring the entire range of A[i], 3 ≤ i ≤ N, to be not
proved to be equivalent in the source and transformed
programs as (Verdoolaege et al., 2012), the recurrence
relation depicted by the index expressions A[i] and
A[i − 2] (i.e., i
m
= i
m−1
+ 2) are solved for the base
cases i = 3 and i = 4 in our proposed method. The so-
lution of the recurrence relation for i = 3 mapped to
the range 3 ≤ i ≤ N (3 ≤ i ≤ N ∧∃m ≥ 0 s.t. i = 3+2m
i.e., the odd iterator values) is declared as the index
range for which the array elements A[i] are equiva-
lently computed and the solution for i = 4 mapped to
the range (3 ≤ i ≤ N ∧ ∃m ≥ 0 s.t. i = 4+2m i.e., pre-
cisely the even iterator values) is declared as the index
range for which the array elements A[i] are inequiva-
lently computed.
The ET-node n
3
represents the goal of proving
equivalence of A[i], 3 ≤ i ≤ N, for proving equiva-
lence of D[i], 3 ≤ i ≤ N in Fig. 3. The ET-node n
6
represents the fact that for proving equivalence of A[i],
5 ≤ i ≤ N, the equivalence of A[i − 2] has to be estab-
lished. The recurrence relations are formed using the
method given below. In Fig. 3, we refer to the suffix
expression i associated with the ancestor node n
3
as
i
m
and the suffix expression i − 2 associated with its
recurring descendant node n
6
as i
m−1
thereby produc-
ing the recurrence i
m
= i
m−1
+ 2; the inequivalence
of the array element A[4] contributes to the base case
i
0
= 4 of the above recurrence. Thus, the recurrence
equation {i
0
= 4, i
m
= i
m−1
+ 2} depicts the non-
equivalent elements that would occur if we permit
the ET-node n
6
to reduce further. The solution of the
above-mentioned non-homogeneous recurrence equa-
tion is i
m
= 4 + 2m; hence, the “not proved” elements
of the ET-node n
3
is {v
3
(i) ↔ v
0
3
(i)|3 ≤ i ≤ N ∧ ∃m ≥
0 s.t. i = 4+2m}. To represent such elements of n
3
, a
child n
3,2
is created with R
want
n
3,2
= {v
3
(i) ↔ v
0
3
(i)|3 ≤
i ≤ N ∧ ∃m ≥ 0 s.t. i = 4 + 2m} thereby setting the
goal of proving equality of all the elements of R
want
n
3,2
.
The ET-node n
3,2
is then explored further to disprove
the proof goal R
want
n
3,2
following the existing method.
The proposed method tries to generalize the
proved cases next from Fig. 3 in a similar way as has
been described above. The recurrence equation {i
0
=
3, i
m
= i
m−1
+ 2} is found using the same steps as de-
scribed in the previous paragraph for the generaliza-
tion of the proof goal for the equivalent base case for
array elements A[3]. It depicts the “proved” elements
that would occur if the ET-node n
6
is permitted to re-
duce further. The solution of the above-mentioned re-
currence equation is i
m
= 3 + 2m. Hence, the gener-
alized “proved” elements at the ET-node n
3
is con-
jectured as {v
3
(i) ↔ v
0
3
(i)|3 ≤ i ≤ N ∧ ∃m s.t. i =
3 + 2m}. A child node n
3,1
of n
3
is created with
the goal of proving the conjecture, i.e., R
want
n
3,1
is set
as {v
3
(i) ↔ v
0
3
(i)|3 ≤ i ≤ N ∧ ∃m s.t. i = 3 + 2m} as
shown in Fig. 5. It is explored further to establish
the proof goal R
want
n
3,1
using the existing method and
R
lost
n
3,1
=
/
0. In the next step, R
lost
n
3,2
= {v
3
(i) ↔ v
0
3
(i)|3 ≤
i ≤ N ∧ ∃m ≥ 0 s.t. i = 4 + 2m} propagates back
to root node n
1
resulting in {v
1
(i) ↔ v
0
1
(i)|3 ≤ i ≤
N ∧ ∃m ≥ 0 s.t. i = 4 + 2m}. This enhancement can
also be used to precisely identify the equivalent and
non-equivalent portions of the output arrays with one
or more than one dimensions for the programs with
linear recurrences and one or multiple base cases.
6 RELATED WORK
We have enhanced a novel, fully automated approach
to the equivalence checking problem of static affine
programs which uses abstract interpetation operator
instead of using transitive closure operators. The two
most closely related approaches are those of (Shashid-
har et al., 2005), and (Karfa et al., 2011). In (Shashid-
har et al., 2005), the authors proposed an ADDG
based equivalence checking method to validate the
loop transformations. The authors of (Karfa et al.,
2011) redefine the equivalence of ADDGs to ver-
ify loop transformations along with a wide range of
arithmetic transformations. The equivalence checking
method relies on a normalization technique proposed
in (Karfa et al., 2011) and some simplification rules
to handle arithmetic transformations over arrays. As
explained before, all of these approaches are based on
transitive closures and therefore require uniform re-
currences, unlike the abstract interpretaion based ap-
proach proposed in (Verdoolaege et al., 2012). We
have enhanced the method for the programs with re-
currences and some non-equivalent base cases.
7 CONCLUSION
We have enhanced the most sophisticated method of
ENASE 2016 - 11th International Conference on Evaluation of Novel Software Approaches to Software Engineering
258