d_solver.mkTerm(LT, {z, zero})});
// Call the interpolation api, while the resulting interpolant is the output
Term output = d_solver.getInterpolant(conj);
-
// We expect the resulting output to be a boolean formula
ASSERT_TRUE(output.getSort().isBoolean());
+
+ // try with a grammar, a simple grammar admitting true
+ Sort boolean = d_solver.getBooleanSort();
+ Term truen = d_solver.mkBoolean(true);
+ Term start = d_solver.mkVar(boolean);
+ Grammar g = d_solver.mkGrammar({}, {start});
+ Term conj2 = d_solver.mkTerm(EQUAL, {zero, zero});
+ ASSERT_NO_THROW(g.addRule(start, truen));
+ // Call the interpolation api, while the resulting interpolant is the output
+ Term output2 = d_solver.getInterpolant(conj2, g);
+ // interpolant must be true
+ ASSERT_EQ(output2, truen);
}
TEST_F(TestApiBlackSolver, getInterpolantNext)
// We expect the resulting output to be a boolean formula
assertTrue(output.getSort().isBoolean());
+
+ // try with a grammar, a simple grammar admitting true
+ Sort bsort = d_solver.getBooleanSort();
+ Term truen = d_solver.mkBoolean(true);
+ Term start = d_solver.mkVar(bsort);
+ Grammar g = d_solver.mkGrammar(new Term[] {}, new Term[] {start});
+ Term conj2 = d_solver.mkTerm(EQUAL, zero, zero);
+ assertDoesNotThrow(() -> g.addRule(start, truen));
+ // Call the interpolation api, while the resulting interpolant is the output
+ Term output2 = d_solver.getInterpolant(conj2, g);
+ // interpolant must be true
+ assertEquals(output2, truen);
}
@Test
output = solver.getInterpolant(conj)
assert output.getSort().isBoolean()
+ boolean = solver.getBooleanSort()
+ truen = solver.mkBoolean(True)
+ start = solver.mkVar(boolean)
+ g = solver.mkGrammar([], [start])
+ conj2 = solver.mkTerm(Kind.EQUAL, zero, zero)
+ g.addRule(start, truen)
+ output2 = solver.getInterpolant(conj2, g)
+ assert output2 == truen
+
+
def test_get_interpolant_next(solver):
solver.setLogic("QF_LIA")
solver.setOption("produce-interpolants", "true")