[SMTChecker] EncodingContext config flag to accumulate assertions

This commit is contained in:
Leonardo Alt 2019-07-19 19:31:25 +02:00
parent 508cf66da2
commit b204f27047
4 changed files with 12 additions and 1 deletions

View File

@ -52,6 +52,7 @@ void BMC::analyze(SourceUnit const& _source, shared_ptr<Scanner> const& _scanner
m_safeAssertions += move(_safeAssertions);
m_context.setSolver(m_interface);
m_context.clear();
m_context.setAssertionAccumulation(true);
m_variableUsage.setFunctionInlining(true);
_source.accept(*this);

View File

@ -50,6 +50,7 @@ void CHC::analyze(SourceUnit const& _source, shared_ptr<Scanner> const& _scanner
solAssert(z3Interface, "");
m_context.setSolver(z3Interface->z3Interface());
m_context.clear();
m_context.setAssertionAccumulation(false);
m_variableUsage.setFunctionInlining(false);
_source.accept(*this);

View File

@ -228,7 +228,10 @@ Expression EncodingContext::assertions()
void EncodingContext::pushSolver()
{
m_assertions.push_back(assertions());
if (m_accumulateAssertions)
m_assertions.push_back(assertions());
else
m_assertions.push_back(smt::Expression(true));
}
void EncodingContext::popSolver()

View File

@ -54,6 +54,9 @@ public:
m_solver = _solver;
}
/// Sets whether the context should conjoin assertions in the assertion stack.
void setAssertionAccumulation(bool _acc) { m_accumulateAssertions = _acc; }
/// Forwards variable creation to the solver.
Expression newVariable(std::string _name, SortPointer _sort)
{
@ -178,6 +181,9 @@ private:
/// Assertion stack.
std::vector<Expression> m_assertions;
/// Whether to conjoin assertions in the assertion stack.
bool m_accumulateAssertions = true;
//@}
};