Use answer from second Z3 call only when solved

This commit is contained in:
Martin Blicha 2023-07-27 15:16:17 +02:00
parent 0fbeb3a69d
commit 742642ebae

View File

@ -207,7 +207,7 @@ std::string CHCSmtLib2Interface::querySolver(std::string const& _input)
solverBinary += " fp.xform.slice=false fp.xform.inline_linear=false fp.xform.inline_eager=false"; solverBinary += " fp.xform.slice=false fp.xform.inline_linear=false fp.xform.inline_eager=false";
std::string extendedQuery = "(set-option :produce-proofs true)" + _input + "\n(get-proof)"; std::string extendedQuery = "(set-option :produce-proofs true)" + _input + "\n(get-proof)";
auto secondResult = m_smtCallback(ReadCallback::kindString(ReadCallback::Kind::SMTQuery) + " " + solverBinary, extendedQuery); auto secondResult = m_smtCallback(ReadCallback::kindString(ReadCallback::Kind::SMTQuery) + " " + solverBinary, extendedQuery);
if (secondResult.success) if (secondResult.success and boost::starts_with(secondResult.responseOrErrorMessage, "unsat"))
return secondResult.responseOrErrorMessage; return secondResult.responseOrErrorMessage;
} }
return result.responseOrErrorMessage; return result.responseOrErrorMessage;
@ -670,7 +670,8 @@ CHCSolverInterface::CexGraph CHCSmtLib2Interface::graphFromZ3Proof(std::string c
ss >> answer; ss >> answer;
solAssert(answer == "unsat"); solAssert(answer == "unsat");
SMTLib2Parser parser(ss); SMTLib2Parser parser(ss);
solAssert(!parser.isEOF()); if (parser.isEOF()) // No proof from Z3
return {};
// For some reason Z3 outputs everything as a single s-expression // For some reason Z3 outputs everything as a single s-expression
auto all = parser.parseExpression(); auto all = parser.parseExpression();
solAssert(parser.isEOF()); solAssert(parser.isEOF());