Skip to content

Commit 99cf7ef

Browse files
committed
fix(#305): improve model generation for array theory.
I was not able to reconstruct the formula/model directly, but only within CPAchecker. So we do not have a test for this case, except CPAchecker execution. For details, see #305.
1 parent 7d67338 commit 99cf7ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/org/sosy_lab/java_smt/solvers/princess/PrincessModel.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import ap.parser.ITerm;
2323
import ap.terfor.preds.Predicate;
2424
import ap.theories.ExtArray;
25+
import ap.theories.ExtArray.ArraySort;
2526
import ap.types.Sort;
27+
import ap.types.Sort$;
2628
import com.google.common.collect.ArrayListMultimap;
2729
import com.google.common.collect.ImmutableList;
2830
import com.google.common.collect.ImmutableSet;
@@ -137,10 +139,16 @@ private ImmutableList<ValueAssignment> getAssignments(
137139
&& creator.getEnv().hasArrayType(Iterables.getOnlyElement(asJava(cKey.args())))) {
138140
return ImmutableList.of();
139141
}
142+
Sort sort = Sort$.MODULE$.sortOf(cKey);
140143
if (ExtArray.Select$.MODULE$.unapply(cKey.fun()).isDefined()) {
141144
return getAssignmentsFromArraySelect(value, cKey, pArrays);
142-
} else if (ExtArray.Store$.MODULE$.unapply(cKey.fun()).isDefined()) {
143-
return getAssignmentsFromArrayStore((IFunApp) value, cKey, pArrays);
145+
} else if (sort instanceof ArraySort) {
146+
ExtArray arrayTheory = ((ArraySort) sort).theory();
147+
if (arrayTheory.store() == cKey.fun()) {
148+
return getAssignmentsFromArrayStore((IFunApp) value, cKey, pArrays);
149+
} else if (arrayTheory.store2() == cKey.fun()) {
150+
return getAssignmentsFromArrayStore((IFunApp) value, cKey, pArrays);
151+
}
144152
}
145153
}
146154

0 commit comments

Comments
 (0)