64 #define Proof_ForeachClauseVec( pVec, p, pNode, i ) \
65 for ( i = 0; (i < Vec_IntSize(pVec)) && ((pNode) = Proof_ClauseRead(p, Vec_IntEntry(pVec,i))); i++ )
66 #define Proof_ForeachNodeVec( pVec, p, pNode, i ) \
67 for ( i = 0; (i < Vec_IntSize(pVec)) && ((pNode) = Proof_NodeRead(p, Vec_IntEntry(pVec,i))); i++ )
68 #define Proof_ForeachNodeVec1( pVec, p, pNode, i ) \
69 for ( i = 1; (i < Vec_IntSize(pVec)) && ((pNode) = Proof_NodeRead(p, Vec_IntEntry(pVec,i))); i++ )
72 #define Proof_NodeForeachFanin( pProof, pNode, pFanin, i ) \
73 for ( i = 0; (i < (int)pNode->nEnts) && (((pFanin) = (pNode->pEnts[i] & 1) ? NULL : Proof_NodeRead(pProof, pNode->pEnts[i] >> 2)), 1); i++ )
138 if ( pNext && !pNext->Id )
141 Vec_IntPush( vStack, (pNode->pEnts[i] >> 2) << 1 );
150 int i, Entry, iPrev = 0;
167 if ( iPrev >= Entry )
168 printf(
"Out of topological order!!!\n" );
195 if ( pNext && !pNext->Id )
229 if ( pNext && !pNext->Id )
379 assert( (pNode->pEnts[k] >> 2) );
391 satset * pNode, * pFanin, * pPivot;
392 int i, j, k, hTemp, nSize;
408 if ( pNode->Id == 0 )
415 if ( (pNode->pEnts[k] & 1) == 0 )
418 pNode->pEnts[k] = (pFanin->Id << 2) | (pNode->pEnts[k] & 2);
433 hTemp = pNode->Id; pNode->Id = 0;
435 if ( pPivot && pPivot <= pNode )
448 printf(
"The proof was reduced from %6.2f MB to %6.2f MB (by %6.2f %%) ",
478 int h, i, k,
Var = -1, Count = 0;
480 for ( i = 0; i < (int)c1->nEnts; i++ )
481 for ( k = 0; k < (int)c2->nEnts; k++ )
482 if ( (c1->pEnts[i] ^ c2->pEnts[k]) == 1 )
484 Var = (c1->pEnts[i] >> 1);
489 printf(
"Cannot find resolution variable\n" );
494 printf(
"Found more than 1 resolution variables\n" );
501 for ( i = 0; i < (int)c1->nEnts; i++ )
502 if ( (c1->pEnts[i] >> 1) !=
Var )
504 for ( i = 0; i < (int)c2->nEnts; i++ )
505 if ( (c2->pEnts[i] >> 1) !=
Var )
530 return Proof_ClauseRead( vClauses, iAnt >> 2 );
555 satset * pSet, * pSet0 = NULL, * pSet1;
556 int i, k, hRoot, Handle,
Counter = 0;
570 pSet0 = Sat_ProofCheckReadOne( vClauses, vProof, vResolves, pSet->pEnts[0] );
571 for ( k = 1; k < (int)pSet->nEnts; k++ )
573 pSet1 = Sat_ProofCheckReadOne( vClauses, vProof, vResolves, pSet->pEnts[k] );
574 Handle = Sat_ProofCheckResolveOne( vResolves, pSet0, pSet1, vTemp );
584 printf(
"Used %6.2f MB for resolvents.\n", 1.0 *
Vec_SetMemory(vResolves) / (1<<20) );
585 if ( pSet0->nEnts > 0 )
586 printf(
"Derived clause with %d lits instead of the empty clause. ", pSet0->nEnts );
588 printf(
"Proof verification successful. " );
612 int i, k, MaxCla = 0;
616 if ( pFanin == NULL )
617 MaxCla =
Abc_MaxInt( MaxCla, pNode->pEnts[k] >> 2 );
624 if ( pFanin == NULL )
626 int Entry = (pNode->pEnts[k] >> 2);
654 int i, k, Entry, * pMask;
658 sat_solver_foreach_clause( s, c, i )
659 for ( k = 0; k < (
int)c->nEnts; k++ )
665 assert( *pMask >= 0 && *pMask <= 3 );
666 Counts[(*pMask & 3)]++;
676 printf( "Warning: %6d variables listed as global do not appear in clauses (this is normal)\n", Counts[0] );
678 printf( "Warning: %6d variables listed as global appear only in A-clauses (this is a BUG)\n", Counts[1] );
680 printf( "Warning: %6d variables listed as global appear only in B-clauses (this is a BUG)\n", Counts[2] );
682 printf( "Warning: %6d (out of %d) variables listed as global appear in both A- and B-clauses (this is normal)\n", Counts[3],
Vec_IntSize(vGloVars) );
684 printf( "Warning: %6d variables not listed as global appear in both A- and B-clauses (this is a BUG)\n", Counts[4] );
703 Vec_Int_t Roots = { 1, 1, &s->hProofLast }, * vRoots = &Roots;
704 Vec_Int_t * vUsed, * vCore, * vCoreNums, * vVarMap;
708 int i, k, iVar, Lit, Entry, hRoot;
712 hRoot = s->hProofLast;
716 Sat_ProofInterpolantCheckVars( s, vGlobVars );
742 satset_foreach_lit( pNode, Lit, k, 0 )
758 assert( pNode->nEnts > 1 );
759 Proof_NodeForeachFaninLeaf( vProof, vClauses, pNode, pFanin, k )
764 else if ( pNode->pEnts[k] & 2 )
806 Vec_Int_t Roots = { 1, 1, &s->hProofLast }, * vRoots = &Roots;
807 Vec_Int_t * vUsed, * vCore, * vCoreNums, * vVarMap;
811 int nWords = (nVars < 6) ? 1 : (1 << (nVars-6));
813 int i, k, iVar, Lit, Entry, hRoot;
814 assert( nVars > 0 && nVars <= 16 );
815 hRoot = s->hProofLast;
819 Sat_ProofInterpolantCheckVars( s, vGlobVars );
843 satset_foreach_lit( pNode, Lit, k, 0 )
862 assert( pNode->nEnts > 1 );
863 Proof_NodeForeachFaninLeaf( vProof, vClauses, pNode, pFanin, k )
870 else if ( pNode->pEnts[k] & 2 )
915 Vec_Int_t Roots = { 1, 1, &hRoot }, * vRoots = &Roots;
void Proof_CleanCollected(Vec_Set_t *vProof, Vec_Int_t *vUsed)
FUNCTION DEFINITIONS ///.
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
static int * Vec_IntArray(Vec_Int_t *p)
static void Vec_SetShrinkS(Vec_Set_t *p, int h)
void Tru_ManFree(Tru_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Vec_SetAppendS(Vec_Set_t *p, int nSize)
static void Vec_SetShrinkLimits(Vec_Set_t *p)
Tru_Man_t * Tru_ManAlloc(int nVars)
FUNCTION DECLARATIONS ///.
void Proof_CollectUsed_iter(Vec_Set_t *vProof, int hNode, Vec_Int_t *vUsed, Vec_Int_t *vStack)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
static void Vec_SetFree(Vec_Set_t *p)
void Sat_ProofCheck(sat_solver2 *s)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_InfoHasBit(unsigned *p, int i)
#define Vec_SetForEachEntry(Type, pVec, nSize, pSet, p, s)
static int lit_var(lit l)
void * Proof_DeriveCore(Vec_Set_t *vProof, int hRoot)
static void Vec_SetWriteEntryNum(Vec_Set_t *p, int i)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
static Vec_Set_t * Vec_SetAlloc(int nPageSize)
static int Vec_SetHandCurrent(Vec_Set_t *p)
void Proof_CollectUsed_rec(Vec_Set_t *vProof, int hNode, Vec_Int_t *vUsed)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
static word * Tru_ManOrNotCond(word *pOut, word *pIn, int nWords, int fCompl)
#define ABC_ALLOC(type, num)
void * Sat_ProofInterpolant(sat_solver2 *s, void *pGloVars)
static abctime Abc_Clock()
static word * Vec_SetEntry(Vec_Set_t *p, int h)
static int Abc_MaxInt(int a, int b)
static int Vec_SetAppend(Vec_Set_t *p, int *pArray, int nSize)
static int Vec_PtrSize(Vec_Ptr_t *p)
static satset * Proof_NodeRead(Vec_Set_t *p, int h)
DECLARATIONS ///.
Vec_Int_t * Proof_CollectUsedRec(Vec_Set_t *vProof, Vec_Int_t *vRoots)
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
static Vec_Int_t * Vec_IntStartFull(int nSize)
typedefABC_NAMESPACE_IMPL_START struct satset_t satset
#define Proof_ForeachNodeVec(pVec, p, pNode, i)
for(p=first;p->value< newval;p=p->next)
static word * Tru_ManAndNotCond(word *pOut, word *pIn, int nWords, int fCompl)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
int Proof_MarkUsed_rec(Vec_Set_t *vProof, int hNode)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static int Vec_SetWordNum(int nSize)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
void Abc_MergeSort(int *pInput, int nSize)
static Vec_Int_t * Vec_IntStart(int nSize)
static void Vec_SetShrink(Vec_Set_t *p, int h)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Proof_ClauseSetEnts(Vec_Set_t *p, int h, int nEnts)
static Aig_Obj_t * Aig_ObjFromLit(Aig_Man_t *p, int iLit)
void Sat_ProofCheck0(Vec_Set_t *vProof)
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
static int Vec_IntEntry(Vec_Int_t *p, int i)
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Proof_ForeachClauseVec(pVec, p, pNode, i)
static int Vec_SetMemory(Vec_Set_t *p)
typedefABC_NAMESPACE_HEADER_START struct Tru_Man_t_ Tru_Man_t
INCLUDES ///.
word * Tru_ManFunc(Tru_Man_t *p, int h)
static int Aig_ManObjNumMax(Aig_Man_t *p)
int Tru_ManInsert(Tru_Man_t *p, word *pTruth)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
#define Proof_NodeForeachFanin(pProof, pNode, pFanin, i)
static void Abc_InfoSetBit(unsigned *p, int i)
static int Aig_ObjToLit(Aig_Obj_t *pObj)
static int Proof_NodeWordNum(int nEnts)
static int Vec_IntSize(Vec_Int_t *p)
static int Vec_SetHandCurrentS(Vec_Set_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Set_t_ Vec_Set_t
INCLUDES ///.
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int lit_sign(lit l)
static word * Tru_ManClear(word *pOut, int nWords)
int Proof_MarkUsedRec(Vec_Set_t *vProof, Vec_Int_t *vRoots)
static word * Tru_ManCopyNotCond(word *pOut, word *pIn, int nWords, int fCompl)
static word * Tru_ManFill(word *pOut, int nWords)
#define ABC_CALLOC(type, num)
static int Vec_SetMemoryS(Vec_Set_t *p)
Vec_Int_t * Proof_CollectUsedIter(Vec_Set_t *vProof, Vec_Int_t *vRoots, int fSort)
static int Abc_BitWordNum(int nBits)
word * Sat_ProofInterpolantTruth(sat_solver2 *s, void *pGloVars)
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
#define Proof_ForeachNodeVec1(pVec, p, pNode, i)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Vec_IntPushUnique(Vec_Int_t *p, int Entry)
static void Vec_IntClear(Vec_Int_t *p)
char * Abc_UtilStrsav(char *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Sat_ProofReduce(Vec_Set_t *vProof, void *pRoots, int hProofPivot)
int Aig_ManCleanup(Aig_Man_t *p)
Vec_Int_t * Sat_ProofCollectCore(Vec_Set_t *vProof, Vec_Int_t *vUsed)
static void Vec_PtrFree(Vec_Ptr_t *p)
word * Tru_ManVar(Tru_Man_t *p, int v)