Abstract function smtchecker natspec

This commit is contained in:
Leonardo Alt
2021-05-11 15:30:19 +02:00
committed by Leo Alt
parent eb99177506
commit 4b2ccf2f37
4 changed files with 82 additions and 11 deletions
+21
View File
@@ -70,6 +70,11 @@ public:
/// the constructor.
std::vector<std::string> unhandledQueries() const;
enum class CHCNatspecOption
{
AbstractFunctionNondet
};
private:
/// Visitor functions.
//@{
@@ -123,6 +128,19 @@ private:
std::set<unsigned> transactionVerificationTargetsIds(ASTNode const* _txRoot);
//@}
/// SMT Natspec and abstraction helpers.
//@{
/// @returns a CHCNatspecOption enum if _option is a valid SMTChecker Natspec value
/// or nullopt otherwise.
static std::optional<CHCNatspecOption> natspecOptionFromString(std::string const& _option);
/// @returns which SMTChecker options are enabled by @a _function's Natspec via
/// `@custom:smtchecker <option>` or nullopt if none is used.
std::set<CHCNatspecOption> smtNatspecTags(FunctionDefinition const& _function);
/// @returns true if _function is Natspec annotated to be abstracted by
/// nondeterministic values.
bool abstractAsNondet(FunctionDefinition const& _function);
//@}
/// Sort helpers.
//@{
smtutil::SortPointer sort(FunctionDefinition const& _function);
@@ -183,6 +201,9 @@ private:
std::vector<smtutil::Expression> currentStateVariables();
std::vector<smtutil::Expression> currentStateVariables(ContractDefinition const& _contract);
/// @returns \bigwedge currentValue(_vars[i]) == initialState(_var[i])
smtutil::Expression currentEqualInitialVarsConstraints(std::vector<VariableDeclaration const*> const& _vars) const;
/// @returns the predicate name for a given node.
std::string predicateName(ASTNode const* _node, ContractDefinition const* _contract = nullptr);
/// @returns a predicate application after checking the predicate's type.