Skip to content

Commit bc066d5

Browse files
committed
Skip Values of Uninterpreted Sorts
1 parent ea87100 commit bc066d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

liquidjava-verifier/src/main/java/liquidjava/smt/TranslatorToZ3.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.microsoft.z3.RealExpr;
1313
import com.microsoft.z3.Solver;
1414
import com.microsoft.z3.Sort;
15+
import com.microsoft.z3.Symbol;
1516
import com.microsoft.z3.Model;
1617

1718
import java.util.ArrayList;
@@ -27,6 +28,7 @@
2728
import liquidjava.processor.context.AliasWrapper;
2829
import liquidjava.utils.Utils;
2930
import liquidjava.utils.constants.Keys;
31+
import com.microsoft.z3.enumerations.Z3_sort_kind;
3032

3133
import org.apache.commons.lang3.NotImplementedException;
3234

@@ -63,10 +65,10 @@ public Counterexample getCounterexample(Model model) {
6365
// Extract constant variable assignments
6466
for (FuncDecl<?> decl : model.getDecls()) {
6567
if (decl.getArity() == 0) {
66-
String name = decl.getName().toString();
67-
String value = model.getConstInterp(decl).toString();
68-
// Skip opaque Z3 object values
69-
if (!value.contains("!val!"))
68+
Symbol name = decl.getName();
69+
Expr<?> value = model.getConstInterp(decl);
70+
// Skip values of uninterpreted sorts
71+
if (value.getSort().getSortKind() != Z3_sort_kind.Z3_UNINTERPRETED_SORT)
7072
assignments.add(name + " == " + value);
7173
}
7274
}

0 commit comments

Comments
 (0)