15 std::vector<Subquery> blocks;
16 std::vector<int> ccs(
vars.size(), -1);
17 std::vector<bool> constraint_used(constraints.size(),
false);
19 std::vector<std::size_t> pending;
21 for (std::size_t i = 0; i <
vars.size();) {
25 while (!pending.empty()) {
26 std::size_t v = pending.back();
28 if (ccs[v] != -1)
continue;
29 assert(blocks.size() > 0);
30 ccs[v] =
static_cast<int>(blocks.size()) - 1;
31 blocks.back().elimination_vars.push_back(
vars[v]);
32 for (std::size_t k = 0; k < constraints.size(); ++k) {
33 if (constraint_used[k])
continue;
34 auto vars_c = carl::variables(constraints[k]);
35 if (vars_c.has(
vars[v])) {
36 for (std::size_t v_other = 0; v_other <
vars.size(); ++v_other) {
37 if (v != v_other && vars_c.has(
vars[v_other])) {
38 pending.push_back(v_other);
41 constraint_used[k] =
true;
42 blocks.back().constraints.push_back(constraints[k]);
46 while (i <
vars.size() && ccs[i] != -1) ++i;
std::vector< Subquery > split_quantifiers(const FormulasT &constraints, const std::vector< carl::Variable > &vars)
std::vector< carl::Variable > vars(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
carl::Formulas< Poly > FormulasT
std::vector< carl::Variable > elimination_vars
Subquery(const FormulasT &fs, const std::vector< carl::Variable > vs)