const bool V3VrfMPDR::removeFromProof(V3MPDRTimedCube& timedCube, const bool& pushForward) { // This function can ONLY be called after UNSAT of (R ^ T ^ cube') // Generate UNSAT Source from Solver if Possible V3SvrDataVec coreProofVars; coreProofVars.clear(); _pdrSvr->getDataConflict(coreProofVars); if (!coreProofVars.size()) return false; // Solver does not Support Analyze Conflict V3SvrDataSet coreProofVarSet; coreProofVarSet.clear(); for (uint32_t i = 0; i < coreProofVars.size(); ++i) coreProofVarSet.insert(coreProofVars[i]); const bool isSvrDataInvolved = coreProofVarSet.end() != coreProofVarSet.find(_pdrSvrData); // Get Generalized State from Solver Proof assert (!existInitial(timedCube.second->getState())); resolveInitial(timedCube.second, coreProofVarSet); assert (!existInitial(timedCube.second->getState())); if (!pushForward) return isSvrDataInvolved; // Return the Smallest Activity Index Used uint32_t i = timedCube.first; for (; i < getPDRFrame(); ++i) if (coreProofVarSet.find(_pdrFrame[i - 1]->getActivator()) != coreProofVarSet.end()) { timedCube.first = i; break; } if (i == getPDRFrame()) { if (coreProofVarSet.find(_pdrFrame[getPDRDepth()]->getActivator()) == coreProofVarSet.end()) timedCube.first = getPDRFrame(); else timedCube.first = getPDRDepth(); } assert (!checkReachability(timedCube.first, timedCube.second->getState())); return isSvrDataInvolved; }
const bool V3SVrfIPDR::removeFromProof2(V3SIPDRTimedCube& timedCube) { // This function can ONLY be called after UNSAT of (R ^ T ^ cube') // Generate UNSAT Source from Solver if Possible V3SvrDataVec coreProofVars; coreProofVars.clear(); assert (timedCube.first < _pdrSvr.size()); assert (timedCube.first); _pdrSvr[timedCube.first - 1]->getDataConflict(coreProofVars); if (!coreProofVars.size()) return false; // Solver does not Support Analyze Conflict V3SvrDataSet coreProofVarSet; coreProofVarSet.clear(); for (uint32_t i = 0; i < coreProofVars.size(); ++i) coreProofVarSet.insert(coreProofVars[i]); const bool isSvrDataInvolved = coreProofVarSet.end() != coreProofVarSet.find(_pdrSvrData); // not used var // Get Proof Related State Variables in UNSAT core assert (!existInitial2(timedCube.second->getState())); const V3NetVec& state = timedCube.second->getState(); // Remove Variables to Form New State assert (!existInitial2(state)); bool conflictInitial = false; V3NetId conflictId = V3NetUD; uint32_t pos = 0; V3NetVec newState; newState.reserve(state.size()); for (uint32_t i = 0; i < state.size(); ++i) { if (coreProofVarSet.end() != coreProofVarSet.find( _pdrSvr[timedCube.first - 1]->getFormula(_vrfNtk->getLatch(state[i].id), 1))) { newState.push_back(state[i]); //OrzOrz if (!conflictInitial && (_pdrInitValue[state[i].id] ^ state[i].cp)) { assert (!existInitial2(newState)); conflictInitial = true; } } else if (!conflictInitial && V3NetUD == conflictId) { if (_pdrInitValue[state[i].id] ^ state[i].cp) { conflictId = state[i]; assert (V3NetUD != conflictId); pos = newState.size(); } } } // Resolve Intersection with Initial State if (!conflictInitial && V3NetUD != conflictId) { newState.insert(newState.begin() + pos, conflictId); } else if( !conflictInitial ) cerr << "GGGG in removing UNSATCore" << endl; if (newState.size() < state.size()) timedCube.second->setState(newState); //checkCubeSorted(newState); assert (!existInitial2(timedCube.second->getState())); assert (!checkReachability(timedCube.first, timedCube.second->getState())); return isSvrDataInvolved; }
const size_t V3SvrBoolector::setImplyIntersection(const V3SvrDataVec& Exps) { if (Exps.size() == 0) return 0; vector<size_t>::const_iterator it = Exps.begin(); assert (*it); BtorExp *aExp = (isNegFormula(*it) ? boolector_not(_Solver, getOriExp(*it)) : boolector_copy(_Solver, getOriExp(*it))); BtorExp *bExp, *oExp; ++it; for (; it != Exps.end(); ++it) { assert (*it); assert (aExp); bExp = (isNegFormula(*it) ? boolector_not(_Solver, getOriExp(*it)) : boolector_copy(_Solver, getOriExp(*it))); oExp = boolector_and(_Solver, aExp, bExp); assert (oExp); boolector_release(_Solver, aExp); boolector_release(_Solver, bExp); aExp = oExp; } bExp = boolector_var(_Solver, 1, NULL); oExp = boolector_implies(_Solver, bExp, aExp); boolector_assert(_Solver, oExp); boolector_release(_Solver, oExp); boolector_release(_Solver, aExp); assert (!isNegFormula(getPosExp(bExp))); assert (bExp); return getPosExp(bExp); }