3 #include "../Formula.h"
30 template<
typename Poly>
40 subs.push_back(
to_pnf(sub, prefix, used_vars,
false));
46 subs.push_back(
to_pnf(sub, prefix, used_vars,
true));
57 sub1.push_back(
to_pnf(sub, prefix, used_vars,
true));
58 sub2.push_back(
to_pnf(sub, prefix, used_vars,
false));
62 auto lhs =
to_pnf(f, prefix, used_vars,
false);
86 if (used_vars.contains(v)) {
88 std::stringstream ss; ss << v.name() <<
"_" << new_v.id();
95 prefix.push_back(std::make_pair(q, v));
97 return to_pnf(sub, prefix, used_vars, negated);
106 return Formula<Poly>(
FormulaType::ITE, {
to_pnf(f.
condition(), prefix, used_vars, negated),
to_pnf(f.
first_case(), prefix, used_vars, negated),
to_pnf(f.
second_case(), prefix, used_vars, negated)});
115 template<
typename Poly>
116 void free_variables(
const Formula<Poly>& f, boost::container::flat_set<Variable>& current_quantified_vars, boost::container::flat_set<Variable>& free_vars) {
133 if (!current_quantified_vars.contains(v)) {
145 auto old = current_quantified_vars;
148 current_quantified_vars = old;
172 template<
typename Poly>
174 boost::container::flat_set<Variable> current_quantified_vars;
175 boost::container::flat_set<Variable> free_vars;
185 template<
typename Poly>
188 boost::container::flat_set<Variable> used_vars =
free_variables(f);
189 auto m =
to_pnf(f, p, used_vars,
false);
190 return std::make_pair(p, m);
193 template<
typename Poly>
196 for (
auto p = prefix.rbegin(); p != prefix.rend(); p++) {
carl is the main namespace for the library.
std::vector< std::pair< Quantifier, carl::Variable > > QuantifierPrefix
void free_variables(const Formula< Poly > &f, boost::container::flat_set< Variable > ¤t_quantified_vars, boost::container::flat_set< Variable > &free_vars)
Formula< Poly > to_pnf(const Formula< Poly > &f, QuantifierPrefix &prefix, boost::container::flat_set< Variable > &used_vars, bool negated=false)
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
Formula< Poly > to_formula(const QuantifierPrefix &prefix, const Formula< Poly > &matrix)
std::vector< Formula< Poly > > Formulas
Variable fresh_variable(VariableType vt) noexcept
Coeff substitute(const Monomial &m, const std::map< Variable, Coeff > &substitutions)
Applies the given substitutions to a monomial.
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
Formula< Pol > connectPrecedingSubformulas(const Formula< Pol > &f)
[Auxiliary method]
void set_name(Variable v, const std::string &name)
Add a name for a given Variable.
static VariablePool & getInstance()
Returns the single instance of this class by reference.
const Formula & subformula() const
const Formula & premise() const
const Formula & conclusion() const
const Formula & quantified_formula() const
const std::vector< carl::Variable > & quantified_variables() const
const Formulas< Pol > & subformulas() const
const Formula & first_case() const
const Formula & second_case() const
const Formula & condition() const