/**Function******************************************************************** Synopsis [Existentially Abstracts all the variables in cube from f.] Description [Abstracts all the variables in cube from f by summing over all possible values taken by the variables. Returns the abstracted ADD.] SideEffects [None] SeeAlso [Cudd_addUnivAbstract Cudd_bddExistAbstract Cudd_addOrAbstract] ******************************************************************************/ DdNode * Cudd_addExistAbstract( DdManager * manager, DdNode * f, DdNode * cube) { DdNode *res; two = cuddUniqueConst(manager,(CUDD_VALUE_TYPE) 2); if (two == NULL) return(NULL); cuddRef(two); if (addCheckPositiveCube(manager, cube) == 0) { (void) fprintf(manager->err,"Error: Can only abstract cubes"); return(NULL); } do { manager->reordered = 0; res = cuddAddExistAbstractRecur(manager, f, cube); } while (manager->reordered == 1); if (res == NULL) { Cudd_RecursiveDeref(manager,two); return(NULL); } cuddRef(res); Cudd_RecursiveDeref(manager,two); cuddDeref(res); return(res); } /* end of Cudd_addExistAbstract */
/**Function******************************************************************** Synopsis [Checks whether cube is an ADD representing the product of positive literals.] Description [Checks whether cube is an ADD representing the product of positive literals. Returns 1 in case of success; 0 otherwise.] SideEffects [None] SeeAlso [] ******************************************************************************/ static int addCheckPositiveCube( DdManager * manager, DdNode * cube) { if (Cudd_IsComplement(cube)) return(0); if (cube == DD_ONE(manager)) return(1); if (cuddIsConstant(cube)) return(0); if (cuddE(cube) == DD_ZERO(manager)) { return(addCheckPositiveCube(manager, cuddT(cube))); } return(0); } /* end of addCheckPositiveCube */
/**Function******************************************************************** Synopsis [Disjunctively abstracts all the variables in cube from the 0-1 ADD f.] Description [Abstracts all the variables in cube from the 0-1 ADD f by taking the disjunction over all possible values taken by the variables. Returns the abstracted ADD if successful; NULL otherwise.] SideEffects [None] SeeAlso [Cudd_addUnivAbstract Cudd_addExistAbstract] ******************************************************************************/ DdNode * Cudd_addOrAbstract( DdManager * manager, DdNode * f, DdNode * cube) { DdNode *res; if (addCheckPositiveCube(manager, cube) == 0) { (void) fprintf(manager->err,"Error: Can only abstract cubes"); return(NULL); } do { manager->reordered = 0; res = cuddAddOrAbstractRecur(manager, f, cube); } while (manager->reordered == 1); return(res); } /* end of Cudd_addOrAbstract */
/** @brief Disjunctively abstracts all the variables in cube from the 0-1 %ADD f. @details Abstracts all the variables in cube from the 0-1 %ADD f by taking the disjunction over all possible values taken by the variables. @return the abstracted %ADD if successful; NULL otherwise. @sideeffect None @see Cudd_addUnivAbstract Cudd_addExistAbstract */ DdNode * Cudd_addOrAbstract( DdManager * manager, DdNode * f, DdNode * cube) { DdNode *res; if (addCheckPositiveCube(manager, cube) == 0) { (void) fprintf(manager->err,"Error: Can only abstract cubes"); return(NULL); } do { manager->reordered = 0; res = cuddAddOrAbstractRecur(manager, f, cube); } while (manager->reordered == 1); if (manager->errorCode == CUDD_TIMEOUT_EXPIRED && manager->timeoutHandler) { manager->timeoutHandler(manager, manager->tohArg); } return(res); } /* end of Cudd_addOrAbstract */