5 #include <carl-arith/extended/MultivariateRoot.h>
6 #include <carl-arith/poly/Conversion.h>
7 #include <carl-arith/constraint/Conversion.h>
8 #include <carl-arith/extended/Conversion.h>
12 #include <carl-formula/formula/functions/NNF.h>
19 for (
const auto& disjunction : dnf) {
20 std::vector<FormulaT> tmp;
21 for (
const auto& f : disjunction) {
22 if (std::holds_alternative<cadcells::Constraint>(f)) {
23 tmp.push_back(
FormulaT(
ConstraintT(carl::convert<Poly>(std::get<cadcells::Constraint>(f)))));
24 }
else if (std::holds_alternative<cadcells::VariableComparison>(f)) {
25 auto constraint = carl::as_constraint(std::get<cadcells::VariableComparison>(f));
27 tmp.push_back(
FormulaT(carl::convert<Poly>(std::get<cadcells::VariableComparison>(f))));
42 return FormulaT(carl::FormulaType::FALSE);
44 assert(tree.
status || boost::indeterminate(tree.
status));
46 FormulaT children_formula(carl::FormulaType::TRUE);
47 if (boost::indeterminate(tree.
status)) {
49 for (
const auto& child : tree.
children) {
55 FormulaT interval_formula(carl::FormulaType::TRUE);
64 FormulaT children_formula(carl::FormulaType::TRUE);
65 if (boost::indeterminate(tree.
status)) {
66 auto num_pos = std::count_if(tree.
children.begin(), tree.
children.end(), [](
const auto& child) { return (bool) child.status; });
67 auto num_neg = std::count_if(tree.
children.begin(), tree.
children.end(), [](
const auto& child) { return (bool) !child.status; });
68 if (num_pos <= num_neg) {
70 for (
const auto& child : tree.
children) {
71 if (boost::indeterminate(child.status)) {
73 }
else if (child.status) {
78 if (!positive) children_formula = carl::to_nnf(children_formula.negated());
81 for (
const auto& child : tree.
children) {
82 if (boost::indeterminate(child.status)) {
84 }
else if (!child.status) {
89 if (positive) children_formula = carl::to_nnf(children_formula.negated());
93 FormulaT interval_formula(carl::FormulaType::TRUE);
103 return FormulaT(carl::FormulaType::TRUE);
104 }
else if (!tree.
status) {
105 return FormulaT(carl::FormulaType::FALSE);
A symbolic interal whose bounds are defined by indexed root expressions.
DNF to_formula(const datastructures::PolyPool &pool, carl::Variable main_var, const datastructures::SymbolicInterval &c)
Converts a datastructures::SymbolicInterval to a DNF.
FormulaT to_formula_alternate(const cadcells::datastructures::PolyPool &pool, const covering_ng::ParameterTree &tree, bool positive)
FormulaT to_formula_true_only(const cadcells::datastructures::PolyPool &pool, const covering_ng::ParameterTree &tree)
FormulaT to_formula(const cadcells::datastructures::PolyPool &pool, carl::Variable variable, const cadcells::datastructures::SymbolicInterval &interval)
carl::Formula< Poly > FormulaT
carl::Constraint< Poly > ConstraintT
carl::Formulas< Poly > FormulasT
std::vector< ParameterTree > children
std::optional< cadcells::datastructures::SymbolicInterval > interval
std::optional< carl::Variable > variable