20#include "dlinear/parser/Driver.h"
21#include "dlinear/parser/vnnlib/FunctionDefinition.h"
22#include "dlinear/parser/vnnlib/Term.h"
23#include "dlinear/parser/vnnlib/scanner.h"
24#include "dlinear/solver/Context.h"
25#include "dlinear/util/ScopedUnorderedMap.hpp"
47 static void error(
const location &l,
const std::string &m);
71 void DefineFun(
const std::string &name,
const std::vector<Variable> ¶meters,
Sort return_type,
const Term &body);
97 void GetValue(
const std::vector<Term> &term_list)
const;
105 std::variant<const Expression *, const Variable *>
LookupDefinedName(
const std::string &name)
const;
128 Term LookupFunction(
const std::string &name,
const std::vector<Term> &arguments)
const;
134 std::string MakeUniqueName(
const std::string &name);
Context class that holds the set of constraints and provide Assert/Push/Pop/CheckSat functionalities.
The Driver is the base class for all the parsers.
const Context & context() const
Get read-only access to the enabled of the Driver.
Represents a symbolic form of an expression.
Represents a symbolic variable.
Represents a set of variables.
Generic term that can be either an expression or a formula.
The VnnlibDriver class brings together all components.
static Formula EliminateBooleanVariables(const Variables &vars, const Formula &f)
Eliminate Boolean variables vars from f.
ScopedUnorderedMap< std::string, Expression > scope_constants_
Scoped map from a name to a constant.
Variable DeclareLocalVariable(const std::string &name, Sort sort)
Declare a new variable with label name that is globally unique and cannot occur in an SMT-LIBv2 file.
const Expression & LookupConstant(const std::string &name) const
Lookup a constant expression associated with a name name.
VnnlibScanner * scanner()
Pointer to the current scanner instance, this is used to connect the parser to the scanner.
int64_t nextUniqueId_
Sequential value concatenated to names to make them unique.
bool ParseStreamCore(std::istream &in) override
Parse the stream.
void DefineFun(const std::string &name, const std::vector< Variable > ¶meters, Sort return_type, const Term &body)
Called by the define-fun command in the SMT-2 file.
const Variable & LookupVariable(const std::string &name) const
Lookup a variable associated with a name name.
Term LookupFunction(const std::string &name, const std::vector< Term > &arguments) const
Lookup a function with name name and run it with arguments, producing a new term.
Variable DeclareVariable(const std::string &name, Sort sort)
Declare a variable with name name and sort sort.
static void error(const location &l, const std::string &m)
Error handling with associated line number.
ScopedUnorderedMap< std::string, Variable > scope_variables_
Scoped map from a name to a Variable.
std::variant< const Expression *, const Variable * > LookupDefinedName(const std::string &name) const
Lookup a variable or constant expression associated with a name name.
void DefineLocalConstant(const std::string &name, const Expression &value)
Define a constant within the current scope.
VnnlibScanner * scanner_
The scanner producing the tokens for the parser.
ScopedUnorderedMap< std::string, FunctionDefinition > scope_functions_
Scoped map from a name to a Function.
Variable RegisterVariable(const std::string &name, Sort sort)
Register a variable with name name and sort s in the scope.
VnnlibDriver(Context &context)
construct a new parser driver context
void GetValue(const std::vector< Term > &term_list) const
Get the value of all the terms in term_list.
VnnlibScanner is a derived class to add some extra function to the scanner class.
Namespace for the VNNLIB parser of the dlinear library.