83 static inline void Int_ManTruthCopy(
unsigned *
p,
unsigned * q,
int nWords ) {
int i;
for ( i = nWords - 1; i >= 0; i-- ) p[i] = q[i]; }
84 static inline void Int_ManTruthAnd(
unsigned *
p,
unsigned * q,
int nWords ) {
int i;
for ( i = nWords - 1; i >= 0; i-- ) p[i] &= q[i]; }
85 static inline void Int_ManTruthOr(
unsigned *
p,
unsigned * q,
int nWords ) {
int i;
for ( i = nWords - 1; i >= 0; i-- ) p[i] |= q[i]; }
86 static inline void Int_ManTruthOrNot(
unsigned *
p,
unsigned * q,
int nWords ) {
int i;
for ( i = nWords - 1; i >= 0; i-- ) p[i] |= ~q[i]; }
160 for ( v = 0; v < (int)pClause->
nLits; v++ )
177 for ( v = 0; v < (int)pClause->
nLits; v++ )
310 printf(
"Clause ID = %d. Proof = %d. {", pClause->
Id,
Int_ManProofGet(p, pClause) );
311 for ( i = 0; i < (int)pClause->
nLits; i++ )
312 printf(
" %d", pClause->
pLits[i] );
330 printf(
"Resolvent: {" );
331 for ( i = 0; i < nResLits; i++ )
332 printf(
" %d", pResLits[i] );
352 Remainder = (nBits%(
sizeof(unsigned)*8));
353 nWords = (nBits/(
sizeof(unsigned)*8)) + (Remainder>0);
355 for ( w = nWords-1; w >= 0; w-- )
356 for ( i = ((w == nWords-1 && Remainder)? Remainder-1: 31); i >= 0; i-- )
357 fprintf( pFile,
"%c",
'0' + (
int)((Sign[w] & (1<<i)) > 0) );
373 printf(
"Clause %2d : ", pClause->
Id );
394 if ( pClause->
pLits[0] == Lit )
443 for ( i = p->
nTrailSize - 1; i >= Level; i-- )
472 for ( pCur = p->
pWatches[Lit]; pCur; pCur = *ppPrev )
475 if ( pCur->
pLits[0] == LitF )
478 pCur->
pLits[1] = LitF;
493 for ( i = 2; i < (int)pCur->
nLits; i++ )
500 pCur->
pLits[i] = LitF;
507 if ( i < (
int)pCur->
nLits )
572 for ( v = 0; v < (int)pClause->
nLits; v++ )
574 fprintf( p->
pFile,
" 0 0\n" );
592 int i, v,
Var, PrevId;
605 for ( v = 0; v < (int)pConflict->
nLits; v++ )
627 if ( pReason == NULL )
632 for ( v = 1; v < (int)pReason->
nLits; v++ )
658 for ( v1 = 0; v1 < p->
nResLits; v1++ )
662 printf(
"Recording clause %d: Cannot find variable %d in the temporary resolvent.\n", pFinal->
Id, Var );
664 printf(
"Recording clause %d: The resolved variable %d is in the wrong polarity.\n", pFinal->
Id, Var );
671 for ( v2 = 1; v2 < (int)pReason->
nLits; v2++ )
673 for ( v1 = 0; v1 < p->
nResLits; v1++ )
680 printf(
"Recording clause %d: Ran out of space for intermediate resolvent.\n", pFinal->
Id );
688 printf(
"Recording clause %d: Trying to resolve the clause with more than one opposite literal.\n", pFinal->
Id );
708 for ( v1 = 0; v1 < p->
nResLits; v1++ )
710 for ( v2 = 0; v2 < (int)pFinal->
nLits; v2++ )
713 if ( v2 < (
int)pFinal->
nLits )
717 if ( v1 < p->nResLits )
719 printf(
"Recording clause %d: The final resolvent is wrong.\n", pFinal->
Id );
730 for ( v1 = 0; v1 < (int)pFinal->
nLits; v1++ )
732 for ( v2 = 0; v2 < p->
nResLits; v2++ )
735 if ( v2 < p->nResLits )
739 for ( v2 = v1; v2 < (int)pFinal->
nLits; v2++ )
777 if ( pClause->
nLits == 0 )
778 printf(
"Error: Empty clause is attempted.\n" );
786 for ( i = 0; i < (int)pClause->
nLits; i++ )
790 for ( i = 0; i < (int)pClause->
nLits; i++ )
799 if ( pConflict == NULL )
810 for ( i = 0; i < (int)pConflict->
nLits; i++ )
812 for ( j = 0; j < (int)pClause->
nLits; j++ )
813 if ( pConflict->
pLits[i] == pClause->
pLits[j] )
815 if ( j == (
int)pClause->
nLits )
818 if ( i == (
int)pConflict->
nLits )
833 if ( pClause->
nLits > 1 )
855 printf(
"Found last conflict after adding unit clause number %d!\n", pClause->
Id );
898 if ( pClause->
nLits > 1 )
904 if ( pClause->
nLits != 1 )
916 printf(
"Found root level conflict!\n" );
928 printf(
"Found root level conflict!\n" );
951 unsigned uTruths[8][8] = {
952 { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
953 { 0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC },
954 { 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
955 { 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
956 { 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
957 { 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
958 { 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
959 { 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
976 for ( v = 0; v < (int)pClause->
nLits; v++ )
982 assert( VarAB >= 0 && VarAB < p->nVarsAB );
1027 p->
pFile = fopen(
"proof.cnf_",
"w" );
1041 if ( pClause->
fRoot )
1060 printf(
"Vars = %d. Roots = %d. Learned = %d. Resol steps = %d. Ave = %.2f. Mem = %.2f MB\n",
void Extra_PrintBinary__(FILE *pFile, unsigned Sign[], int nBits)
int Sto_ManMemoryReport(Sto_Man_t *p)
static int lit_check(lit l, int n)
int Int_ManInterpolate(Int_Man_t *p, Sto_Man_t *pCnf, int fVerbose, unsigned **ppResult)
static void Int_ManTruthOr(unsigned *p, unsigned *q, int nWords)
static void Int_ManTruthCopy(unsigned *p, unsigned *q, int nWords)
static void Int_ManTruthOrNot(unsigned *p, unsigned *q, int nWords)
#define ABC_REALLOC(type, obj, num)
static int lit_var(lit l)
Sto_Cls_t * Int_ManPropagate(Int_Man_t *p, int Start)
static void Int_ManTruthAnd(unsigned *p, unsigned *q, int nWords)
static int Int_ManProofGet(Int_Man_t *p, Sto_Cls_t *pCls)
static void Int_ManWatchClause(Int_Man_t *p, Sto_Cls_t *pClause, lit Lit)
#define ABC_ALLOC(type, num)
static void Int_ManTruthFill(unsigned *p, int nWords)
static abctime Abc_Clock()
for(p=first;p->value< newval;p=p->next)
Int_Man_t * Int_ManAlloc()
FUNCTION DEFINITIONS ///.
void Int_ManResize(Int_Man_t *p)
void Int_ManPrintInterOne(Int_Man_t *p, Sto_Cls_t *pClause)
static lit lit_neg(lit l)
void Int_ManPrepareInter(Int_Man_t *p)
static unsigned * Int_ManTruthRead(Int_Man_t *p, Sto_Cls_t *pCls)
void Int_ManPrintClause(Int_Man_t *p, Sto_Cls_t *pClause)
int Int_ManProofRecordOne(Int_Man_t *p, Sto_Cls_t *pClause)
int Int_ManProcessRoots(Int_Man_t *p)
static ABC_NAMESPACE_IMPL_START const lit LIT_UNDEF
DECLARATIONS ///.
static void Int_ManTruthClear(unsigned *p, int nWords)
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
void Int_ManPrintResolvent(lit *pResLits, int nResLits)
int * Int_ManSetGlobalVars(Int_Man_t *p, int nGloVars)
void Int_ManFree(Int_Man_t *p)
static int lit_sign(lit l)
static Sto_Cls_t * Int_ManPropagateOne(Int_Man_t *p, lit Lit)
#define Sto_ManForEachClause(p, pCls)
static void Int_ManCancelUntil(Int_Man_t *p, int Level)
static void Int_ManProofSet(Int_Man_t *p, Sto_Cls_t *pCls, int n)
#define Sto_ManForEachClauseRoot(p, pCls)
int Int_ManProofTraceOne(Int_Man_t *p, Sto_Cls_t *pConflict, Sto_Cls_t *pFinal)
static int Int_ManEnqueue(Int_Man_t *p, lit Lit, Sto_Cls_t *pReason)
int Int_ManGlobalVars(Int_Man_t *p)
void Int_ManProofWriteOne(Int_Man_t *p, Sto_Cls_t *pClause)
static int lit_print(lit l)