void CNFMgr::convertFormulaToCNFNegCases(const ASTNode& varphi, ClauseList* defs) { if (varphi.isPred()) { convertFormulaToCNFNegPred(varphi, defs); return; } Kind k = varphi.GetKind(); switch (k) { case FALSE: { convertFormulaToCNFNegFALSE(varphi, defs); break; } case TRUE: { convertFormulaToCNFNegTRUE(varphi, defs); break; } case BVGETBIT: { convertFormulaToCNFNegBVGETBIT(varphi, defs); break; } case SYMBOL: { convertFormulaToCNFNegSYMBOL(varphi, defs); break; } case NOT: { convertFormulaToCNFNegNOT(varphi, defs); break; } case AND: { convertFormulaToCNFNegAND(varphi, defs); break; } case NAND: { convertFormulaToCNFNegNAND(varphi, defs); break; } case OR: { convertFormulaToCNFNegOR(varphi, defs); break; } case NOR: { convertFormulaToCNFNegNOR(varphi, defs); break; } case XOR: { convertFormulaToCNFNegXOR(varphi, defs); break; } case IMPLIES: { convertFormulaToCNFNegIMPLIES(varphi, defs); break; } case ITE: { convertFormulaToCNFNegITE(varphi, defs); break; } default: { fprintf(stderr, "convertFormulaToCNFNegCases: "\ "doesn't handle kind %d\n", k); FatalError(""); } } } //convertFormulaToCNFNegCases()
void CNFMgr::scanFormula(const ASTNode& varphi, bool isPos, bool isXorChild) { CNFInfo* x; Kind k = varphi.GetKind(); //######################################## // step 1, get the info associated with this node //######################################## if (info.find(varphi) == info.end()) { x = new CNFInfo(); info[varphi] = x; } else { x = info[varphi]; } #if defined CRYPTOMINISAT__2 if(isXorChild) { setDoRenamePos(*x); } #endif //######################################## // step 2, we only need to know if shares >= 2 //######################################## if (isPos && sharesPos(*x) == 2) { return; } if (!isPos && sharesNeg(*x) == 2) { return; } //######################################## // step 3, set appropriate information fields //######################################## if (isPos) { incrementSharesPos(*x); } if (!isPos) { incrementSharesNeg(*x); } //######################################## // step 4, recurse over children //######################################## if (varphi.isAtom()) { return; } else if (varphi.isPred()) { for (unsigned int i = 0; i < varphi.GetChildren().size(); i++) { scanTerm(varphi[i]); } } else { for (unsigned int i = 0; i < varphi.GetChildren().size(); i++) { if (onChildDoPos(varphi, i)) { scanFormula(varphi[i], isPos, k == XOR); } if (onChildDoNeg(varphi, i)) { scanFormula(varphi[i], !isPos, false); } } } } //End of ScanFormula()