-
Notifications
You must be signed in to change notification settings - Fork 57
SMTLib2 Output Consistency for Quantified Terms #450
Copy link
Copy link
Open
Description
I noticed that quantified formulas are dumped in many different ways, some of which are inconsistent with SMTLib2 and can not be parsed by other solvers.
We should add I/O tests for quantified terms and report or fix inconsistent output.
An basic example implementation could be based of these 2 tests:
@Test
public void quantifierIntegerDumpTest() {
requireIntegers();
requireQuantifiers();
IntegerFormula int1 = imgr.makeNumber(1);
IntegerFormula var = imgr.makeVariable("var_a");
BooleanFormula body = imgr.equal(int1, var);
BooleanFormula formula = qmgr.forall(var, body);
String formDump = mgr.dumpFormula(formula).toString();
// check that function is dumped correctly + necessary assert that has to be there
assertThat(formDump).contains("(assert (forall ((var_a Int)) (= 1 var_a)))");
checkThatAssertIsInLastLine(formDump);
checkThatDumpIsParseable(formDump);
}
@Test
public void quantifierBitvectorDumpTest() {
requireBitvectors();
requireQuantifiers();
BitvectorFormula int1 = bvmgr.makeBitvector(8, 1);
BitvectorFormula var = bvmgr.makeVariable(8, "var_a");
BooleanFormula body = bvmgr.equal(int1, var);
BooleanFormula formula = qmgr.forall(var, body);
String formDump = mgr.dumpFormula(formula).toString();
// check that function is dumped correctly + necessary assert that has to be there
assertThat(formDump).contains("(assert (forall ((var_a (_ BitVec 8))) (= #b00000001 var_a)))");
checkThatAssertIsInLastLine(formDump);
checkThatDumpIsParseable(formDump);
}
Reactions are currently unavailable