3#include <unordered_map>
5#include "storm-config.h"
27 declaredVariables.emplace_back(std::set<std::string>());
37 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"functionality not (yet) implemented");
50 return "(" + carl::toString(relation) +
" (/ " + leftHandSide.nominator().toString(
false, useReadableVarNames) +
" " +
51 leftHandSide.denominator().toString(
false, useReadableVarNames) +
") (/ " + rightHandSide.nominator().toString(
false, useReadableVarNames) +
52 " " + rightHandSide.denominator().toString(
false, useReadableVarNames) +
") " +
")";
63 ss <<
"(" << relation <<
" " << leftHandSide.toString(
false, useReadableVarNames) <<
" " <<
"0 " <<
")";
74 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"functionality not (yet) implemented");
84 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"functionality not (yet) implemented");
88 for (uint_fast64_t i = 0; i < n; ++i) {
89 declaredVariables.emplace_back(std::set<std::string>());
94 STORM_LOG_THROW(declaredVariables.size() >= n, storm::exceptions::InvalidArgumentException,
"Scope increased too much. Too many calls of pop()?");
95 for (uint_fast64_t i = 0; i < n; ++i) {
96 declaredVariables.pop_back();
104 std::vector<std::string> result;
105 carl::VariablePool& vPool = carl::VariablePool::getInstance();
107 std::string
const& variableString = vPool.getName(variableToCheck, useReadableVarNames);
109 bool alreadyDeclared =
false;
110 for (std::set<std::string>
const& variables : declaredVariables) {
111 if (variables.find(variableString) != variables.end()) {
112 alreadyDeclared =
true;
117 if (!alreadyDeclared) {
119 declaredVariables.back().insert(variableString);
120 std::string varDeclaration =
"( declare-fun " + variableString +
" () ";
121 switch (variableToCheck.type()) {
122 case carl::VariableType::VT_BOOL:
123 varDeclaration +=
"Bool";
125 case carl::VariableType::VT_REAL:
126 varDeclaration +=
"Real";
128 case carl::VariableType::VT_INT:
129 varDeclaration +=
"Int";
132 STORM_LOG_THROW(
false, storm::exceptions::InvalidTypeException,
"The type of the variable is not supported");
134 varDeclaration +=
" )";
135 result.push_back(varDeclaration);
145 bool useReadableVarNames;
147 std::vector<std::set<std::string>> declaredVariables;
std::string translateExpression(storm::expressions::Expression const &)
Translates the given expression to an equivalent expression for Smt2.
std::vector< std::string > const checkForUndeclaredVariables(std::set< storm::RationalFunctionVariable > const &variables)
Checks whether the variables in the given set are already declared and creates them if necessary.
std::string translateExpression(storm::expressions::Variable const &)
Translates the given variable to an equivalent expression for Smt2.
void decreaseScope(uint_fast64_t n=1)
std::string translateExpression(storm::RationalFunction const &leftHandSide, storm::CompareRelation const &relation)
Translates the given constraint "leftHandSide relation 0" to an equivalent expression for Smt2.
std::string translateExpression(storm::RationalFunction const &leftHandSide, storm::CompareRelation const &relation, storm::RationalFunction const &rightHandSide)
Translates the given constraint "leftHandSide relation rightHandSide" to an equivalent expression for...
void increaseScope(uint_fast64_t n=1)
Smt2ExpressionAdapter(storm::expressions::ExpressionManager &, bool useReadableVarNames)
Creates an expression adapter that can translate expressions to the format of Smt2.
storm::expressions::Variable const & getVariable(std::string const &)
Finds the counterpart to the given smt2 variable declaration.
This class is responsible for managing a set of typed variables and all expressions using these varia...
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_THROW(cond, exception, message)
carl::Relation CompareRelation
carl::Variable RationalFunctionVariable