void AdmWithLevels::sortIntoKnownsAndUnknowns(const VariableSet & x, VariableSet & knowns,VariableSet & unknowns) const { knowns.clear(); unknowns.clear(); Variable v; bool b = x.firstVariable(v); while(b) { if(d_knowns.present(v)) { knowns.insert(v); } else { unknowns.insert(v); }; b = x.nextVariable(v); }; };
/** * Takes formula, the prefix, and converts it to the set of sets of second * order variables, according to the variable map; * * @param formula: formula corresponding to the prefix * @return: list of lists of second-order variables */ PrefixListType convertPrefixFormulaToList(ASTForm* formula) { PrefixListType list; VariableSet set; unsigned int quantifiedSize; unsigned int value; bool isFirstNeg = true; // empty prefix is just one empty list if (formula->kind == aTrue) { list.push_front(set); return list; } ASTForm* iterator = formula; // while we are not at the end of the prefix while (iterator->kind != aTrue) { //iterator->dump(); //std::cout << "\n"; // Add to set if (iterator->kind == aEx2) { ASTForm_Ex2* exf = (ASTForm_Ex2*) iterator; quantifiedSize = (exf->vl)->size(); for (unsigned i = 0; i < quantifiedSize; ++i) { value = (exf->vl)->get(i); //std::cout << value << " -> " << varMap[value] << "\n"; set.push_back(varMap[value]); } iterator = exf->f; isFirstNeg = false; // Create new set } else if (iterator->kind == aNot) { if (!isFirstNeg) { list.push_front(set); set.clear(); } else { isFirstNeg = false; } ASTForm_Not* notf = (ASTForm_Not*) iterator; iterator = notf->f; // Fail, should not happen } else { assert(false); } } if (set.size() != 0) { list.push_front(set); } return list; }