Also adds a call to get proof in a unit test.
CVC5_API_TRY_CATCH_END;
}
+std::string Solver::getProof(void) const
+{
+ CVC5_API_TRY_CATCH_BEGIN;
+ NodeManagerScope scope(getNodeManager());
+ CVC5_API_CHECK(d_smtEngine->getOptions().smt.produceProofs)
+ << "Cannot get proof explicitly enabled (try --prooduce-proofs)";
+ CVC5_API_RECOVERABLE_CHECK(d_smtEngine->getSmtMode() == SmtMode::UNSAT)
+ << "Cannot get proof unless in unsat mode.";
+ return d_smtEngine->getProof();
+ CVC5_API_TRY_CATCH_END;
+}
+
Term Solver::getValue(const Term& term) const
{
CVC5_API_TRY_CATCH_BEGIN;
*/
std::vector<Term> getUnsatCore() const;
+ /**
+ * Get the refutation proof
+ * SMT-LIB:
+ * \verbatim
+ * ( get-proof )
+ * \endverbatim
+ * Requires to enable option 'produce-proofs'.
+ * @return a string representing the proof, according to the the value of
+ * proof-format-mode.
+ */
+ std::string getProof() const;
+
/**
* Get the value of the given term.
* SMT-LIB:
{
try
{
- d_result = solver->getSmtEngine()->getProof();
+ d_result = solver->getProof();
d_commandStatus = CommandSuccess::instance();
}
catch (api::CVC5ApiRecoverableException& e)
ASSERT_THROW(d_solver.getUnsatCore(), CVC5ApiException);
}
-TEST_F(TestApiBlackSolver, getUnsatCore3)
+TEST_F(TestApiBlackSolver, getUnsatCoreAndProof)
{
d_solver.setOption("incremental", "true");
d_solver.setOption("produce-unsat-cores", "true");
+ d_solver.setOption("produce-proofs", "true");
Sort uSort = d_solver.mkUninterpretedSort("u");
Sort intSort = d_solver.getIntegerSort();
ASSERT_NO_THROW(unsat_core = d_solver.getUnsatCore());
+ ASSERT_NO_THROW(d_solver.getProof());
+
d_solver.resetAssertions();
for (const auto& t : unsat_core)
{
}
cvc5::api::Result res = d_solver.checkSat();
ASSERT_TRUE(res.isUnsat());
+ ASSERT_NO_THROW(d_solver.getProof());
}
TEST_F(TestApiBlackSolver, getValue1)