return psi;
} //End of SINGLETON()
- ClauseList* CNFMgr::UNION(const ClauseList& varphi1, const ClauseList& varphi2)
+ ClauseList* CNFMgr::UNION(const ClauseList& varphi1,
+ const ClauseList& varphi2)
{
ClauseList* psi1 = COPY(varphi1);
ClauseList* psi2 = COPY(varphi2);
return psi1;
} //End of UNION()
- void CNFMgr::INPLACE_UNION(ClauseList* varphi1, const ClauseList& varphi2)
+ void CNFMgr::INPLACE_UNION(ClauseList* varphi1,
+ const ClauseList& varphi2)
{
ClauseList* psi2 = COPY(varphi2);
varphi1->insert(varphi1->end(), psi2->begin(), psi2->end());
delete psi2;
} //End of INPLACE_UNION()
- void CNFMgr::NOCOPY_INPLACE_UNION(ClauseList* varphi1, ClauseList* varphi2)
+ void CNFMgr::NOCOPY_INPLACE_UNION(ClauseList* varphi1,
+ ClauseList* varphi2)
{
varphi1->insert(varphi1->end(), varphi2->begin(), varphi2->end());
delete varphi2;
} //End of NOCOPY_INPLACE_UNION
- ClauseList* CNFMgr::PRODUCT(const ClauseList& varphi1, const ClauseList& varphi2)
+ ClauseList* CNFMgr::PRODUCT(const ClauseList& varphi1,
+ const ClauseList& varphi2)
{
ClauseList* psi = new ClauseList();
psi->reserve(varphi1.size() * varphi2.size());
//########################################
//main switch for individual cnf conversion cases
- void CNFMgr::convertFormulaToCNFPosCases(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosCases(const ASTNode& varphi,
+ ClauseList* defs)
{
if (isPred(varphi))
{
}
default:
{
- fprintf(stderr, "convertFormulaToCNFPosCases: doesn't handle kind %d\n", k);
+ fprintf(stderr, "convertFormulaToCNFPosCases: "\
+ "doesn't handle kind %d\n", k);
FatalError("");
}
}
} //End of convertFormulaToCNFPosCases()
- void CNFMgr::convertFormulaToCNFNegCases(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegCases(const ASTNode& varphi,
+ ClauseList* defs)
{
if (isPred(varphi))
}
default:
{
- fprintf(stderr, "convertFormulaToCNFNegCases: doesn't handle kind %d\n", k);
+ fprintf(stderr, "convertFormulaToCNFNegCases: "\
+ "doesn't handle kind %d\n", k);
FatalError("");
}
}
//########################################
// individual cnf conversion cases
- void CNFMgr::convertFormulaToCNFPosPred(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosPred(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTVec psis;
psis.push_back(*(info[*it]->termforcnf));
}
- info[varphi]->clausespos = SINGLETON(bm->CreateNode(varphi.GetKind(), psis));
+ info[varphi]->clausespos =
+ SINGLETON(bm->CreateNode(varphi.GetKind(), psis));
} //End of convertFormulaToCNFPosPred()
- void CNFMgr::convertFormulaToCNFPosFALSE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosFALSE(const ASTNode& varphi,
+ ClauseList* defs)
{
- ASTNode dummy_false_var = bm->CreateNode(NOT, bm->CreateSymbol("*TrueDummy*"));
+ ASTNode dummy_false_var =
+ bm->CreateNode(NOT, bm->CreateSymbol("*TrueDummy*"));
info[varphi]->clausespos = SINGLETON(dummy_false_var);
} //End of convertFormulaToCNFPosFALSE()
- void CNFMgr::convertFormulaToCNFPosTRUE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosTRUE(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTNode dummy_true_var = bm->CreateSymbol("*TrueDummy*");
info[varphi]->clausespos = SINGLETON(dummy_true_var);
} //End of convertFormulaToCNFPosTRUE
- void CNFMgr::convertFormulaToCNFPosBVGETBIT(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosBVGETBIT(const ASTNode& varphi,
+ ClauseList* defs)
{
info[varphi]->clausespos = SINGLETON(varphi);
}//End of convertFormulaToCNFPosBVGETBIT()
- void CNFMgr::convertFormulaToCNFPosSYMBOL(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosSYMBOL(const ASTNode& varphi,
+ ClauseList* defs)
{
info[varphi]->clausespos = SINGLETON(varphi);
} //End of convertFormulaToCNFPosSYMBOL()
- void CNFMgr::convertFormulaToCNFPosNOT(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosNOT(const ASTNode& varphi,
+ ClauseList* defs)
{
convertFormulaToCNF(varphi[0], defs);
info[varphi]->clausespos = COPY(*(info[varphi[0]]->clausesneg));
reduceMemoryFootprintNeg(varphi[0]);
} //End of convertFormulaToCNFPosNOT()
- void CNFMgr::convertFormulaToCNFPosAND(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosAND(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (pos) AND ~> UNION
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFPosAND()
- void CNFMgr::convertFormulaToCNFPosNAND(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosNAND(const ASTNode& varphi,
+ ClauseList* defs)
{
bool renamesibs = false;
ClauseList* clauses;
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFPosNAND()
- void CNFMgr::convertFormulaToCNFPosOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosOR(const ASTNode& varphi,
+ ClauseList* defs)
{
bool renamesibs = false;
ClauseList* clauses;
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFPosOR()
- void CNFMgr::convertFormulaToCNFPosNOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosNOR(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (pos) NOR ~> UNION NOT
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFPosNOR()
- void CNFMgr::convertFormulaToCNFPosIMPLIES(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosIMPLIES(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (pos) IMPLIES ~> PRODUCT NOT [0] ; [1]
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFPosIMPLIES()
- void CNFMgr::convertFormulaToCNFPosITE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosITE(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (pos) ITE ~> UNION (PRODUCT NOT [0] ; [1])
info[varphi]->clausespos = psi1;
} //End of convertFormulaToCNFPosITE()
- void CNFMgr::convertFormulaToCNFPosXOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFPosXOR(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTVec::const_iterator it = varphi.GetChildren().begin();
for (; it != varphi.GetChildren().end(); it++)
}
} //End of convertFormulaToCNFPosXOR()
- ClauseList* CNFMgr::convertFormulaToCNFPosXORAux(const ASTNode& varphi, unsigned int idx, ClauseList* defs)
+ ClauseList* CNFMgr::convertFormulaToCNFPosXORAux(const ASTNode& varphi,
+ unsigned int idx,
+ ClauseList* defs)
{
bool renamesibs;
// (PRODUCT [idx] ; [idx+1])
// ; (PRODUCT NOT [idx] ; NOT [idx+1])
//****************************************
- renamesibs = (info[varphi[idx]]->clausespos)->size() > 1 ? true : false;
+ renamesibs =
+ (info[varphi[idx]]->clausespos)->size() > 1 ? true : false;
if (renamesibs)
{
setDoSibRenamingPos(*info[varphi[idx + 1]]);
}
- renamesibs = (info[varphi[idx]]->clausesneg)->size() > 1 ? true : false;
+ renamesibs =
+ (info[varphi[idx]]->clausesneg)->size() > 1 ? true : false;
if (renamesibs)
{
setDoSibRenamingNeg(*info[varphi[idx + 1]]);
}
- psi1 = PRODUCT(*(info[varphi[idx]]->clausespos), *(info[varphi[idx + 1]]->clausespos));
- psi2 = PRODUCT(*(info[varphi[idx]]->clausesneg), *(info[varphi[idx + 1]]->clausesneg));
+ psi1 =
+ PRODUCT(*(info[varphi[idx]]->clausespos),
+ *(info[varphi[idx + 1]]->clausespos));
+ psi2 =
+ PRODUCT(*(info[varphi[idx]]->clausesneg),
+ *(info[varphi[idx + 1]]->clausesneg));
NOCOPY_INPLACE_UNION(psi1, psi2);
psi = psi1;
return psi;
} //End of convertFormulaToCNFPosXORAux()
- void CNFMgr::convertFormulaToCNFNegPred(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegPred(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTVec psis;
psis.push_back(*(info[*it]->termforcnf));
}
- info[varphi]->clausesneg = SINGLETON(bm->CreateNode(NOT, bm->CreateNode(varphi.GetKind(), psis)));
+ info[varphi]->clausesneg =
+ SINGLETON(bm->CreateNode(NOT,
+ bm->CreateNode(varphi.GetKind(), psis)));
} //End of convertFormulaToCNFNegPred()
- void CNFMgr::convertFormulaToCNFNegFALSE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegFALSE(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTNode dummy_true_var = bm->CreateSymbol("*TrueDummy*");
info[varphi]->clausesneg = SINGLETON(dummy_true_var);
} //End of convertFormulaToCNFNegFALSE()
- void CNFMgr::convertFormulaToCNFNegTRUE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegTRUE(const ASTNode& varphi,
+ ClauseList* defs)
{
- ASTNode dummy_false_var = bm->CreateNode(NOT, bm->CreateSymbol("*TrueDummy*"));
+ ASTNode dummy_false_var =
+ bm->CreateNode(NOT, bm->CreateSymbol("*TrueDummy*"));
info[varphi]->clausesneg = SINGLETON(dummy_false_var);
} //End of convertFormulaToCNFNegTRUE()
- void CNFMgr::convertFormulaToCNFNegBVGETBIT(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegBVGETBIT(const ASTNode& varphi,
+ ClauseList* defs)
{
ClauseList* psi = SINGLETON(bm->CreateNode(NOT, varphi));
info[varphi]->clausesneg = psi;
} //End of convertFormulaToCNFNegBVGETBIT()
- void CNFMgr::convertFormulaToCNFNegSYMBOL(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegSYMBOL(const ASTNode& varphi,
+ ClauseList* defs)
{
info[varphi]->clausesneg = SINGLETON(bm->CreateNode(NOT, varphi));
} //End of convertFormulaToCNFNegSYMBOL()
- void CNFMgr::convertFormulaToCNFNegNOT(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegNOT(const ASTNode& varphi,
+ ClauseList* defs)
{
convertFormulaToCNF(varphi[0], defs);
info[varphi]->clausesneg = COPY(*(info[varphi[0]]->clausespos));
reduceMemoryFootprintPos(varphi[0]);
} //End of convertFormulaToCNFNegNOT()
- void CNFMgr::convertFormulaToCNFNegAND(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegAND(const ASTNode& varphi,
+ ClauseList* defs)
{
bool renamesibs = false;
ClauseList* clauses;
info[varphi]->clausesneg = psi;
} //End of convertFormulaToCNFNegAND()
- void CNFMgr::convertFormulaToCNFNegNAND(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegNAND(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (neg) NAND ~> UNION
info[varphi]->clausespos = psi;
} //End of convertFormulaToCNFNegNAND()
- void CNFMgr::convertFormulaToCNFNegOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegOR(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (neg) OR ~> UNION NOT
info[varphi]->clausesneg = psi;
} //End of convertFormulaToCNFNegOR()
- void CNFMgr::convertFormulaToCNFNegNOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegNOR(const ASTNode& varphi,
+ ClauseList* defs)
{
bool renamesibs = false;
ClauseList* clauses;
info[varphi]->clausesneg = psi;
} //End of convertFormulaToCNFNegNOR()
- void CNFMgr::convertFormulaToCNFNegIMPLIES(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegIMPLIES(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (neg) IMPLIES ~> UNION [0] ; NOT [1]
reduceMemoryFootprintNeg(varphi[1]);
} //End of convertFormulaToCNFNegIMPLIES()
- void CNFMgr::convertFormulaToCNFNegITE(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegITE(const ASTNode& varphi,
+ ClauseList* defs)
{
//****************************************
// (neg) ITE ~> UNION (PRODUCT NOT [0] ; NOT [1])
info[varphi]->clausesneg = psi1;
} //End of convertFormulaToCNFNegITE()
- void CNFMgr::convertFormulaToCNFNegXOR(const ASTNode& varphi, ClauseList* defs)
+ void CNFMgr::convertFormulaToCNFNegXOR(const ASTNode& varphi,
+ ClauseList* defs)
{
ASTVec::const_iterator it = varphi.GetChildren().begin();
for (; it != varphi.GetChildren().end(); it++)
}
} //End of convertFormulaToCNFNegXOR()
- ClauseList* CNFMgr::convertFormulaToCNFNegXORAux(const ASTNode& varphi, unsigned int idx, ClauseList* defs)
+ ClauseList* CNFMgr::convertFormulaToCNFNegXORAux(const ASTNode& varphi,
+ unsigned int idx,
+ ClauseList* defs)
{
bool renamesibs;
ClauseList* psi;
// ; (PRODUCT [idx] ; NOT [idx+1])
//****************************************
convertFormulaToCNF(varphi[idx], defs);
- renamesibs = (info[varphi[idx]]->clausesneg)->size() > 1 ? true : false;
+ renamesibs =
+ (info[varphi[idx]]->clausesneg)->size() > 1 ? true : false;
if (renamesibs)
{
setDoSibRenamingPos(*info[varphi[idx + 1]]);
}
convertFormulaToCNF(varphi[idx], defs);
- renamesibs = (info[varphi[idx]]->clausespos)->size() > 1 ? true : false;
+ renamesibs =
+ (info[varphi[idx]]->clausespos)->size() > 1 ? true : false;
if (renamesibs)
{
setDoSibRenamingNeg(*info[varphi[idx + 1]]);
}
- psi1 = PRODUCT(*(info[varphi[idx]]->clausesneg), *(info[varphi[idx + 1]]->clausespos));
- psi2 = PRODUCT(*(info[varphi[idx]]->clausespos), *(info[varphi[idx + 1]]->clausesneg));
+ psi1 =
+ PRODUCT(*(info[varphi[idx]]->clausesneg),
+ *(info[varphi[idx + 1]]->clausespos));
+ psi2 =
+ PRODUCT(*(info[varphi[idx]]->clausespos),
+ *(info[varphi[idx + 1]]->clausesneg));
NOCOPY_INPLACE_UNION(psi1, psi2);
psi = psi1;
{
delete info[varphi]->clausespos;
CNFInfo* toDelete = info[varphi]; // get the thing to delete.
- info.erase(varphi); // remove it from the hashtable
+ info.erase(varphi); // remove it from the hashtable
delete toDelete;
void CNFMgr::PrintClauseList(ostream& os, ClauseList& cll)
{
int num_clauses = cll.size();
- os << "Clauses: " << endl << "=========================================" << endl;
+ os << "Clauses: "
+ << endl
+ << "=========================================" << endl;
for (int i = 0; i < num_clauses; i++)
{
- os << "Clause " << i << endl << "-------------------------------------------" << endl;
+ os << "Clause "
+ << i << endl
+ << "-------------------------------------------" << endl;
LispPrintVecSpecial(os, *cll[i], 0);
- os << endl << "-------------------------------------------" << endl;
+ os << endl
+ << "-------------------------------------------" << endl;
}
} //end of PrintClauseList()
} // end namespace BEEV
void NOCOPY_INPLACE_UNION(ClauseList* varphi1, ClauseList* varphi2);
- ClauseList* PRODUCT(const ClauseList& varphi1, const ClauseList& varphi2);
+ ClauseList* PRODUCT(const ClauseList& varphi1,
+ const ClauseList& varphi2);
//########################################
//########################################
//########################################
//main switch for individual cnf conversion cases
- void convertFormulaToCNFPosCases(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFPosCases(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFNegCases(const ASTNode& varphi, ClauseList* defs);
//########################################
//########################################
// individual cnf conversion cases
- void convertFormulaToCNFPosPred(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosFALSE(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosTRUE(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosBVGETBIT(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosSYMBOL(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFPosPred(const ASTNode& varphi, ClauseList* defs);
+ void convertFormulaToCNFPosFALSE(const ASTNode& varphi, ClauseList* defs);
+ void convertFormulaToCNFPosTRUE(const ASTNode& varphi, ClauseList* defs);
+ void convertFormulaToCNFPosBVGETBIT(const ASTNode& varphi,
+ ClauseList* defs);
+ void convertFormulaToCNFPosSYMBOL(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFPosNOT(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFPosAND(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosNAND(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFPosNAND(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFPosOR(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFPosNOR(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFPosIMPLIES(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFPosIMPLIES(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFPosITE(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFPosXOR(const ASTNode& varphi, ClauseList* defs);
-
- ClauseList* convertFormulaToCNFPosXORAux(const ASTNode& varphi, unsigned int idx, ClauseList* defs);
-
- void convertFormulaToCNFNegPred(const ASTNode& varphi, ClauseList* defs);
-
+ ClauseList* convertFormulaToCNFPosXORAux(const ASTNode& varphi,
+ unsigned int idx,
+ ClauseList* defs);
+ void convertFormulaToCNFNegPred(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFNegFALSE(const ASTNode& varphi, ClauseList* defs);
-
-
- void convertFormulaToCNFNegTRUE(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFNegBVGETBIT(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFNegSYMBOL(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFNegTRUE(const ASTNode& varphi, ClauseList* defs);
+ void convertFormulaToCNFNegBVGETBIT(const ASTNode& varphi,
+ ClauseList* defs);
+ void convertFormulaToCNFNegSYMBOL(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFNegNOT(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFNegAND(const ASTNode& varphi, ClauseList* defs);
-
- void convertFormulaToCNFNegNAND(const ASTNode& varphi, ClauseList* defs);
-
+ void convertFormulaToCNFNegNAND(const ASTNode& varphi, ClauseList* defs);
void convertFormulaToCNFNegOR(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFNegNOR(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFNegIMPLIES(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFNegITE(const ASTNode& varphi, ClauseList* defs);
-
void convertFormulaToCNFNegXOR(const ASTNode& varphi, ClauseList* defs);
-
- ClauseList* convertFormulaToCNFNegXORAux(const ASTNode& varphi, unsigned int idx, ClauseList* defs);
+ ClauseList* convertFormulaToCNFNegXORAux(const ASTNode& varphi,
+ unsigned int idx,
+ ClauseList* defs);
//########################################
//########################################
// utilities for reclaiming memory.
void reduceMemoryFootprintPos(const ASTNode& varphi);
-
void reduceMemoryFootprintNeg(const ASTNode& varphi);
//########################################