mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Keep a copy of assertions that are added to the solvers
This commit is contained in:
parent
95e6b2e40d
commit
31ef421fff
@ -43,18 +43,21 @@ SMTPortfolio::SMTPortfolio(map<h256, string> const& _smtlib2Responses)
|
|||||||
|
|
||||||
void SMTPortfolio::reset()
|
void SMTPortfolio::reset()
|
||||||
{
|
{
|
||||||
|
m_assertions.clear();
|
||||||
for (auto const& s: m_solvers)
|
for (auto const& s: m_solvers)
|
||||||
s->reset();
|
s->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMTPortfolio::push()
|
void SMTPortfolio::push()
|
||||||
{
|
{
|
||||||
|
m_assertions.push_back(Expression(true));
|
||||||
for (auto const& s: m_solvers)
|
for (auto const& s: m_solvers)
|
||||||
s->push();
|
s->push();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMTPortfolio::pop()
|
void SMTPortfolio::pop()
|
||||||
{
|
{
|
||||||
|
m_assertions.pop_back();
|
||||||
for (auto const& s: m_solvers)
|
for (auto const& s: m_solvers)
|
||||||
s->pop();
|
s->pop();
|
||||||
}
|
}
|
||||||
@ -67,10 +70,23 @@ void SMTPortfolio::declareVariable(string const& _name, Sort const& _sort)
|
|||||||
|
|
||||||
void SMTPortfolio::addAssertion(Expression const& _expr)
|
void SMTPortfolio::addAssertion(Expression const& _expr)
|
||||||
{
|
{
|
||||||
|
if (m_assertions.empty())
|
||||||
|
m_assertions.push_back(_expr);
|
||||||
|
else
|
||||||
|
m_assertions.back() = _expr && move(m_assertions.back());
|
||||||
|
|
||||||
for (auto const& s: m_solvers)
|
for (auto const& s: m_solvers)
|
||||||
s->addAssertion(_expr);
|
s->addAssertion(_expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Expression SMTPortfolio::assertions()
|
||||||
|
{
|
||||||
|
if (m_assertions.empty())
|
||||||
|
return Expression(true);
|
||||||
|
|
||||||
|
return m_assertions.back();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Broadcasts the SMT query to all solvers and returns a single result.
|
* Broadcasts the SMT query to all solvers and returns a single result.
|
||||||
* This comment explains how this result is decided.
|
* This comment explains how this result is decided.
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
void declareVariable(std::string const&, Sort const&) override;
|
void declareVariable(std::string const&, Sort const&) override;
|
||||||
|
|
||||||
void addAssertion(Expression const& _expr) override;
|
void addAssertion(Expression const& _expr) override;
|
||||||
|
|
||||||
|
Expression assertions();
|
||||||
|
|
||||||
std::pair<CheckResult, std::vector<std::string>> check(std::vector<Expression> const& _expressionsToEvaluate) override;
|
std::pair<CheckResult, std::vector<std::string>> check(std::vector<Expression> const& _expressionsToEvaluate) override;
|
||||||
|
|
||||||
std::vector<std::string> unhandledQueries() override;
|
std::vector<std::string> unhandledQueries() override;
|
||||||
@ -60,6 +63,8 @@ private:
|
|||||||
static bool solverAnswered(CheckResult result);
|
static bool solverAnswered(CheckResult result);
|
||||||
|
|
||||||
std::vector<std::unique_ptr<smt::SolverInterface>> m_solvers;
|
std::vector<std::unique_ptr<smt::SolverInterface>> m_solvers;
|
||||||
|
|
||||||
|
std::vector<Expression> m_assertions;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user