Steps to Reproduce
- Save the following in a file, say
file.slk
. Note: ch_star
and arr_seg
are "established definitions", and are defined as in testcases/ex5/ex5a.slk
.
data ch_star{
int val;
}.
pred arr_seg<n> == self::ch_star<_> & n=1
or (exists q: self::ch_star<_> * q::arr_seg<n-1> & q = self + 1 & n > 1)
inv n>=1.
/*
* SECTION 1.
* `BaseCaseUnfold` of `arr_seg` sometimes fails, entailments (3),(4),(5),(6) in this section fail.
* Introducing the following lemma makes all entailments in this section valid.
* This section shows that `ch_star` and `arr_seg` have the expected behaviors.
*/
lemma self::arr_seg<a+b> & self+a=q <-> self::arr_seg<a> * q::arr_seg<b>.
// (1)
checkentail x::ch_star<_> * y::ch_star<_> & y=x+1 |- x::arr_seg<2>.
print residue.
expect Valid.
// (2)
checkentail x::ch_star<_> * y::arr_seg<1> & y=x+1 |- x::arr_seg<2>.
print residue.
expect Valid.
// (3)
checkentail x::arr_seg<1> * y::ch_star<_> & y=x+1 |- x::arr_seg<2>.
print residue.
expect Valid.
// (4)
checkentail x::arr_seg<1> * y::arr_seg<1> & y=x+1 |- x::arr_seg<2>.
print residue.
expect Valid.
// (5)
checkentail x::arr_seg<2> & y=x+1 |- x::arr_seg<1> * y::arr_seg<1>.
print residue.
expect Valid.
// (6)
checkentail x::arr_seg<1> * y::arr_seg<1> & y=x+1 |- x::arr_seg<2>.
print residue.
expect Valid.
/*
* SECTION 2.
* But even with the lemma, there are still entailments that fail.
*/
// (7)
checkentail x::arr_seg<3> & y=x+1 |- x::arr_seg<1> * y::arr_seg<2>.
print residue.
expect Valid.
// (8)
checkentail x::arr_seg<3> & y=x+2 |- x::arr_seg<2> * y::arr_seg<1>.
print residue.
expect Valid.
// (9)
checkentail x::arr_seg<4> & y=x+1 |- x::arr_seg<1> * y::arr_seg<3>.
print residue.
expect Valid.
// (a)
checkentail x::arr_seg<4> & y=x+2 |- x::arr_seg<2> * y::arr_seg<2>.
print residue.
expect Valid.
// (b)
checkentail x::arr_seg<4> & y=x+3 |- x::arr_seg<3> * y::arr_seg<1>.
print residue.
expect Valid.
- Run
sleek
on file.slk
.
Expected Behavior
Changing the order of entailments does not change the unexpected entailments.
Actual Behavior
Changing the order of entailments changes the unexpected entailments.
Let's say the above file has entailment order "123456789ab", where "a" and "b" represent the tenth and eleventh entailments.
Shifting entailment (1) down the list of entailments results in this table, where in the i^th row, entailment (1) is in the i^th position:
Entailment Order |
Unexpected List |
Actual Unexpected Entailments |
123456789ab |
7 |
7 |
213456789ab |
7 |
7 |
231456789ab |
7 |
7 |
234156789ab |
7 |
7 |
234516789ab |
7 |
7 |
234561789ab |
7 |
7 |
234567189ab |
68 |
78 |
234567819ab |
69 |
79 |
234567891ab |
6a |
7a |
23456789a1b |
6b |
7b |
23456789ab1 |
6 |
7 |
Shifting entailments (2),(3),(4),(6) down the list of entailments results in analogous tables: the "Actual Unexpected Entailments" column is the same. That is, entailment (7) always fails, and if the shifted entailment appears after entailment (7), then the entailment after the shifted entailment fails.
Shifting entailment (5) down the list of entailments results in this table, where entailment (7) always fails, and all other entailments are always valid:
Entailment Order |
Unexpected List |
Actual Unexpected Entailments |
512346789ab |
7 |
7 |
152346789ab |
7 |
7 |
125346789ab |
7 |
7 |
123546789ab |
7 |
7 |
123456789ab |
7 |
7 |
123465789ab |
7 |
7 |
123467589ab |
6 |
7 |
123467859ab |
6 |
7 |
123467895ab |
6 |
7 |
12346789a5b |
6 |
7 |
12346789ab5 |
6 |
7 |
Shifting entailment (7) down the list of entailments results in this table, where entailment (8) always fails, except when the shifted entailment appears immediately before entailment (8). Also, entailment (7) fails only when entailment (7) is before entailment (8):
Entailment Order |
Unexpected List |
Actual Unexpected Entailments |
712345689ab |
18 |
78 |
172345689ab |
28 |
78 |
127345689ab |
38 |
78 |
123745689ab |
48 |
78 |
123475689ab |
58 |
78 |
123457689ab |
68 |
78 |
123456789ab |
7 |
7 |
123456879ab |
7 |
8 |
123456897ab |
7 |
8 |
12345689a7b |
7 |
8 |
12345689ab7 |
7 |
8 |
Shifting entailment (8) down the list of entailments results in this table:
Entailment Order |
Unexpected List |
Actual Unexpected Entailments |
812345679ab |
18 |
78 |
182345679ab |
28 |
78 |
128345679ab |
38 |
78 |
123845679ab |
48 |
78 |
123485679ab |
58 |
78 |
123458679ab |
68 |
78 |
123456879ab |
7 |
8 |
123456789ab |
7 |
7 |
123456798ab |
7 |
7 |
12345679a8b |
7 |
7 |
12345679ab8 |
7 |
7 |
Shifting entailments (9),(a),(b) down the list of entailments results in analogous tables: the "Unexpected List" column is the same. That is, entailment (7) always fails, except when the shifted entailment appears immediately before entailment (7). Also, the shifted entailment fails only when the shifted entailment is before entailment (7).