abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
satInter.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "satStore.h"

Go to the source code of this file.

Data Structures

struct  Int_Man_t_
 

Functions

static unsigned * Int_ManTruthRead (Int_Man_t *p, Sto_Cls_t *pCls)
 
static void Int_ManTruthClear (unsigned *p, int nWords)
 
static void Int_ManTruthFill (unsigned *p, int nWords)
 
static void Int_ManTruthCopy (unsigned *p, unsigned *q, int nWords)
 
static void Int_ManTruthAnd (unsigned *p, unsigned *q, int nWords)
 
static void Int_ManTruthOr (unsigned *p, unsigned *q, int nWords)
 
static void Int_ManTruthOrNot (unsigned *p, unsigned *q, int nWords)
 
static int Int_ManProofGet (Int_Man_t *p, Sto_Cls_t *pCls)
 
static void Int_ManProofSet (Int_Man_t *p, Sto_Cls_t *pCls, int n)
 
Int_Man_tInt_ManAlloc ()
 FUNCTION DEFINITIONS ///. More...
 
int * Int_ManSetGlobalVars (Int_Man_t *p, int nGloVars)
 
int Int_ManGlobalVars (Int_Man_t *p)
 
void Int_ManResize (Int_Man_t *p)
 
void Int_ManFree (Int_Man_t *p)
 
void Int_ManPrintClause (Int_Man_t *p, Sto_Cls_t *pClause)
 
void Int_ManPrintResolvent (lit *pResLits, int nResLits)
 
void Extra_PrintBinary__ (FILE *pFile, unsigned Sign[], int nBits)
 
void Int_ManPrintInterOne (Int_Man_t *p, Sto_Cls_t *pClause)
 
static void Int_ManWatchClause (Int_Man_t *p, Sto_Cls_t *pClause, lit Lit)
 
static int Int_ManEnqueue (Int_Man_t *p, lit Lit, Sto_Cls_t *pReason)
 
static void Int_ManCancelUntil (Int_Man_t *p, int Level)
 
static Sto_Cls_tInt_ManPropagateOne (Int_Man_t *p, lit Lit)
 
Sto_Cls_tInt_ManPropagate (Int_Man_t *p, int Start)
 
void Int_ManProofWriteOne (Int_Man_t *p, Sto_Cls_t *pClause)
 
int Int_ManProofTraceOne (Int_Man_t *p, Sto_Cls_t *pConflict, Sto_Cls_t *pFinal)
 
int Int_ManProofRecordOne (Int_Man_t *p, Sto_Cls_t *pClause)
 
int Int_ManProcessRoots (Int_Man_t *p)
 
void Int_ManPrepareInter (Int_Man_t *p)
 
int Int_ManInterpolate (Int_Man_t *p, Sto_Man_t *pCnf, int fVerbose, unsigned **ppResult)
 

Variables

static
ABC_NAMESPACE_IMPL_START const
lit 
LIT_UNDEF = 0xffffffff
 DECLARATIONS ///. More...
 

Function Documentation

void Extra_PrintBinary__ ( FILE *  pFile,
unsigned  Sign[],
int  nBits 
)

Function*************************************************************

Synopsis [Records the proof.]

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file satInter.c.

348 {
349  int Remainder, nWords;
350  int w, i;
351 
352  Remainder = (nBits%(sizeof(unsigned)*8));
353  nWords = (nBits/(sizeof(unsigned)*8)) + (Remainder>0);
354 
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) );
358 }
int nWords
Definition: abcNpn.c:127
Int_Man_t* Int_ManAlloc ( )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Allocate proof manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file satInter.c.

108 {
109  Int_Man_t * p;
110  // allocate the manager
111  p = (Int_Man_t *)ABC_ALLOC( char, sizeof(Int_Man_t) );
112  memset( p, 0, sizeof(Int_Man_t) );
113  // verification
114  p->nResLitsAlloc = (1<<16);
115  p->pResLits = ABC_ALLOC( lit, p->nResLitsAlloc );
116  // parameters
117  p->fProofWrite = 0;
118  p->fProofVerif = 1;
119  return p;
120 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nResLitsAlloc
Definition: satInter.c:72
int fProofWrite
Definition: satInter.c:48
int lit
Definition: satVec.h:130
int fProofVerif
Definition: satInter.c:47
lit * pResLits
Definition: satInter.c:70
static void Int_ManCancelUntil ( Int_Man_t p,
int  Level 
)
inlinestatic

Function*************************************************************

Synopsis [Records implication.]

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file satInter.c.

440 {
441  lit Lit;
442  int i, Var;
443  for ( i = p->nTrailSize - 1; i >= Level; i-- )
444  {
445  Lit = p->pTrail[i];
446  Var = lit_var( Lit );
447  p->pReasons[Var] = NULL;
448  p->pAssigns[Var] = LIT_UNDEF;
449 //printf( "cancelling var %d\n", Var );
450  }
451  p->nTrailSize = Level;
452 }
static int lit_var(lit l)
Definition: satVec.h:145
int lit
Definition: satVec.h:130
int nTrailSize
Definition: satInter.c:53
static ABC_NAMESPACE_IMPL_START const lit LIT_UNDEF
DECLARATIONS ///.
Definition: satInter.c:36
Sto_Cls_t ** pReasons
Definition: satInter.c:57
lit * pAssigns
Definition: satInter.c:55
lit * pTrail
Definition: satInter.c:54
int Var
Definition: SolverTypes.h:42
static int Int_ManEnqueue ( Int_Man_t p,
lit  Lit,
Sto_Cls_t pReason 
)
inlinestatic

Function*************************************************************

Synopsis [Records implication.]

Description []

SideEffects []

SeeAlso []

Definition at line 416 of file satInter.c.

417 {
418  int Var = lit_var(Lit);
419  if ( p->pAssigns[Var] != LIT_UNDEF )
420  return p->pAssigns[Var] == Lit;
421  p->pAssigns[Var] = Lit;
422  p->pReasons[Var] = pReason;
423  p->pTrail[p->nTrailSize++] = Lit;
424 //printf( "assigning var %d value %d\n", Var, !lit_sign(Lit) );
425  return 1;
426 }
static int lit_var(lit l)
Definition: satVec.h:145
int nTrailSize
Definition: satInter.c:53
static ABC_NAMESPACE_IMPL_START const lit LIT_UNDEF
DECLARATIONS ///.
Definition: satInter.c:36
Sto_Cls_t ** pReasons
Definition: satInter.c:57
lit * pAssigns
Definition: satInter.c:55
lit * pTrail
Definition: satInter.c:54
int Var
Definition: SolverTypes.h:42
void Int_ManFree ( Int_Man_t p)

Function*************************************************************

Synopsis [Deallocate proof manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 273 of file satInter.c.

274 {
275 /*
276  printf( "Runtime stats:\n" );
277 ABC_PRT( "BCP ", p->timeBcp );
278 ABC_PRT( "Trace ", p->timeTrace );
279 ABC_PRT( "TOTAL ", p->timeTotal );
280 */
281  ABC_FREE( p->pInters );
282  ABC_FREE( p->pProofNums );
283  ABC_FREE( p->pTrail );
284  ABC_FREE( p->pAssigns );
285  ABC_FREE( p->pSeens );
286  ABC_FREE( p->pVarTypes );
287  ABC_FREE( p->pReasons );
288  ABC_FREE( p->pWatches );
289  ABC_FREE( p->pResLits );
290  ABC_FREE( p );
291 }
int * pVarTypes
Definition: satInter.c:61
char * pSeens
Definition: satInter.c:56
Sto_Cls_t ** pReasons
Definition: satInter.c:57
lit * pAssigns
Definition: satInter.c:55
lit * pTrail
Definition: satInter.c:54
int * pProofNums
Definition: satInter.c:67
#define ABC_FREE(obj)
Definition: abc_global.h:232
lit * pResLits
Definition: satInter.c:70
Sto_Cls_t ** pWatches
Definition: satInter.c:58
unsigned * pInters
Definition: satInter.c:62
int Int_ManGlobalVars ( Int_Man_t p)

Function*************************************************************

Synopsis [Count common variables in the clauses of A and B.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file satInter.c.

151 {
152  Sto_Cls_t * pClause;
153  int Var, nVarsAB, v;
154 
155  // mark the variable encountered in the clauses of A
156  Sto_ManForEachClauseRoot( p->pCnf, pClause )
157  {
158  if ( !pClause->fA )
159  break;
160  for ( v = 0; v < (int)pClause->nLits; v++ )
161  p->pVarTypes[lit_var(pClause->pLits[v])] = 1;
162  }
163 
164  if ( p->nGloVars )
165  {
166  for ( v = 0; v < p->nGloVars; v++ )
167  p->pVarTypes[ p->pGloVars[v] ] = - v - 1;
168  return p->nGloVars;
169  }
170 
171  // check variables that appear in clauses of B
172  nVarsAB = 0;
173  Sto_ManForEachClauseRoot( p->pCnf, pClause )
174  {
175  if ( pClause->fA )
176  continue;
177  for ( v = 0; v < (int)pClause->nLits; v++ )
178  {
179  Var = lit_var(pClause->pLits[v]);
180  if ( p->pVarTypes[Var] == 1 ) // var of A
181  {
182  // change it into a global variable
183  nVarsAB++;
184  p->pVarTypes[Var] = -1;
185  }
186  }
187  }
188 
189  // order global variables
190  nVarsAB = 0;
191  for ( v = 0; v < p->pCnf->nVars; v++ )
192  if ( p->pVarTypes[v] == -1 )
193  p->pVarTypes[v] -= nVarsAB++;
194 //printf( "There are %d global variables.\n", nVarsAB );
195  return nVarsAB;
196 }
Sto_Man_t * pCnf
Definition: satInter.c:42
int nVars
Definition: satStore.h:85
static int lit_var(lit l)
Definition: satVec.h:145
lit pLits[0]
Definition: satStore.h:78
int * pVarTypes
Definition: satInter.c:61
unsigned nLits
Definition: satStore.h:77
int pGloVars[16]
Definition: satInter.c:43
int Var
Definition: SolverTypes.h:42
#define Sto_ManForEachClauseRoot(p, pCls)
Definition: satStore.h:100
int nGloVars
Definition: satInter.c:44
unsigned fA
Definition: satStore.h:74
int Int_ManInterpolate ( Int_Man_t p,
Sto_Man_t pCnf,
int  fVerbose,
unsigned **  ppResult 
)

Function*************************************************************

Synopsis [Computes interpolant for the given CNF.]

Description [Returns the number of common variable found and interpolant. Returns 0, if something did not work.]

SideEffects []

SeeAlso []

Definition at line 1005 of file satInter.c.

1006 {
1007  Sto_Cls_t * pClause;
1008  int RetValue = 1;
1009  abctime clkTotal = Abc_Clock();
1010 
1011  // check that the CNF makes sense
1012  assert( pCnf->nVars > 0 && pCnf->nClauses > 0 );
1013  p->pCnf = pCnf;
1014  p->fVerbose = fVerbose;
1015  *ppResult = NULL;
1016 
1017  // adjust the manager
1018  Int_ManResize( p );
1019 
1020  // prepare the interpolant computation
1021  Int_ManPrepareInter( p );
1022 
1023  // construct proof for each clause
1024  // start the proof
1025  if ( p->fProofWrite )
1026  {
1027  p->pFile = fopen( "proof.cnf_", "w" );
1028  p->Counter = 0;
1029  }
1030 
1031  // write the root clauses
1032  Sto_ManForEachClauseRoot( p->pCnf, pClause )
1033  Int_ManProofWriteOne( p, pClause );
1034 
1035  // propagate root level assignments
1036  if ( Int_ManProcessRoots( p ) )
1037  {
1038  // if there is no conflict, consider learned clauses
1039  Sto_ManForEachClause( p->pCnf, pClause )
1040  {
1041  if ( pClause->fRoot )
1042  continue;
1043  if ( !Int_ManProofRecordOne( p, pClause ) )
1044  {
1045  RetValue = 0;
1046  break;
1047  }
1048  }
1049  }
1050 
1051  // stop the proof
1052  if ( p->fProofWrite )
1053  {
1054  fclose( p->pFile );
1055  p->pFile = NULL;
1056  }
1057 
1058  if ( fVerbose )
1059  {
1060  printf( "Vars = %d. Roots = %d. Learned = %d. Resol steps = %d. Ave = %.2f. Mem = %.2f MB\n",
1061  p->pCnf->nVars, p->pCnf->nRoots, p->pCnf->nClauses-p->pCnf->nRoots, p->Counter,
1062  1.0*(p->Counter-p->pCnf->nRoots)/(p->pCnf->nClauses-p->pCnf->nRoots),
1063  1.0*Sto_ManMemoryReport(p->pCnf)/(1<<20) );
1064 p->timeTotal += Abc_Clock() - clkTotal;
1065  }
1066 
1067  *ppResult = Int_ManTruthRead( p, p->pCnf->pTail );
1068  return p->nVarsAB;
1069 }
int Sto_ManMemoryReport(Sto_Man_t *p)
Definition: satStore.c:97
Sto_Man_t * pCnf
Definition: satInter.c:42
int nVars
Definition: satStore.h:85
static abctime Abc_Clock()
Definition: abc_global.h:279
int fProofWrite
Definition: satInter.c:48
void Int_ManResize(Int_Man_t *p)
Definition: satInter.c:209
int fVerbose
Definition: satInter.c:46
void Int_ManPrepareInter(Int_Man_t *p)
Definition: satInter.c:948
static unsigned * Int_ManTruthRead(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:80
int Int_ManProofRecordOne(Int_Man_t *p, Sto_Cls_t *pClause)
Definition: satInter.c:770
int Int_ManProcessRoots(Int_Man_t *p)
Definition: satInter.c:875
if(last==0)
Definition: sparse_int.h:34
int nClauses
Definition: satStore.h:87
FILE * pFile
Definition: satInter.c:68
int Counter
Definition: satInter.c:66
#define assert(ex)
Definition: util_old.h:213
#define Sto_ManForEachClause(p, pCls)
Definition: satStore.h:99
#define Sto_ManForEachClauseRoot(p, pCls)
Definition: satStore.h:100
ABC_INT64_T abctime
Definition: abc_global.h:278
void Int_ManProofWriteOne(Int_Man_t *p, Sto_Cls_t *pClause)
Definition: satInter.c:564
void Int_ManPrepareInter ( Int_Man_t p)

Function*************************************************************

Synopsis [Records the proof.]

Description []

SideEffects []

SeeAlso []

Definition at line 948 of file satInter.c.

949 {
950  // elementary truth tables
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 }
960  };
961  Sto_Cls_t * pClause;
962  int Var, VarAB, v;
963  assert( p->nVarsAB <= 8 );
964 
965  // set interpolants for root clauses
966  Sto_ManForEachClauseRoot( p->pCnf, pClause )
967  {
968  if ( !pClause->fA ) // clause of B
969  {
970  Int_ManTruthFill( Int_ManTruthRead(p, pClause), p->nWords );
971 // Int_ManPrintInterOne( p, pClause );
972  continue;
973  }
974  // clause of A
975  Int_ManTruthClear( Int_ManTruthRead(p, pClause), p->nWords );
976  for ( v = 0; v < (int)pClause->nLits; v++ )
977  {
978  Var = lit_var(pClause->pLits[v]);
979  if ( p->pVarTypes[Var] < 0 ) // global var
980  {
981  VarAB = -p->pVarTypes[Var]-1;
982  assert( VarAB >= 0 && VarAB < p->nVarsAB );
983  if ( lit_sign(pClause->pLits[v]) ) // negative var
984  Int_ManTruthOrNot( Int_ManTruthRead(p, pClause), uTruths[VarAB], p->nWords );
985  else
986  Int_ManTruthOr( Int_ManTruthRead(p, pClause), uTruths[VarAB], p->nWords );
987  }
988  }
989 // Int_ManPrintInterOne( p, pClause );
990  }
991 }
static void Int_ManTruthOr(unsigned *p, unsigned *q, int nWords)
Definition: satInter.c:85
Sto_Man_t * pCnf
Definition: satInter.c:42
static void Int_ManTruthOrNot(unsigned *p, unsigned *q, int nWords)
Definition: satInter.c:86
static int lit_var(lit l)
Definition: satVec.h:145
lit pLits[0]
Definition: satStore.h:78
static void Int_ManTruthFill(unsigned *p, int nWords)
Definition: satInter.c:82
int * pVarTypes
Definition: satInter.c:61
unsigned nLits
Definition: satStore.h:77
static unsigned * Int_ManTruthRead(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:80
static void Int_ManTruthClear(unsigned *p, int nWords)
Definition: satInter.c:81
static int lit_sign(lit l)
Definition: satVec.h:146
int Var
Definition: SolverTypes.h:42
int nWords
Definition: satInter.c:64
#define assert(ex)
Definition: util_old.h:213
int nVarsAB
Definition: satInter.c:60
#define Sto_ManForEachClauseRoot(p, pCls)
Definition: satStore.h:100
unsigned fA
Definition: satStore.h:74
void Int_ManPrintClause ( Int_Man_t p,
Sto_Cls_t pClause 
)

Function*************************************************************

Synopsis [Prints the clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file satInter.c.

308 {
309  int i;
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] );
313  printf( " }\n" );
314 }
lit pLits[0]
Definition: satStore.h:78
static int Int_ManProofGet(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:89
unsigned nLits
Definition: satStore.h:77
int Id
Definition: satStore.h:73
void Int_ManPrintInterOne ( Int_Man_t p,
Sto_Cls_t pClause 
)

Function*************************************************************

Synopsis [Prints the interpolant for one clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 371 of file satInter.c.

372 {
373  printf( "Clause %2d : ", pClause->Id );
374  Extra_PrintBinary__( stdout, Int_ManTruthRead(p, pClause), (1 << p->nVarsAB) );
375  printf( "\n" );
376 }
void Extra_PrintBinary__(FILE *pFile, unsigned Sign[], int nBits)
Definition: satInter.c:347
static unsigned * Int_ManTruthRead(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:80
int Id
Definition: satStore.h:73
int nVarsAB
Definition: satInter.c:60
void Int_ManPrintResolvent ( lit pResLits,
int  nResLits 
)

Function*************************************************************

Synopsis [Prints the resolvent.]

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file satInter.c.

328 {
329  int i;
330  printf( "Resolvent: {" );
331  for ( i = 0; i < nResLits; i++ )
332  printf( " %d", pResLits[i] );
333  printf( " }\n" );
334 }
int Int_ManProcessRoots ( Int_Man_t p)

Function*************************************************************

Synopsis [Propagate the root clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 875 of file satInter.c.

876 {
877  Sto_Cls_t * pClause;
878  int Counter;
879 
880  // make sure the root clauses are preceeding the learnt clauses
881  Counter = 0;
882  Sto_ManForEachClause( p->pCnf, pClause )
883  {
884  assert( (int)pClause->fA == (Counter < (int)p->pCnf->nClausesA) );
885  assert( (int)pClause->fRoot == (Counter < (int)p->pCnf->nRoots) );
886  Counter++;
887  }
888  assert( p->pCnf->nClauses == Counter );
889 
890  // make sure the last clause if empty
891  assert( p->pCnf->pTail->nLits == 0 );
892 
893  // go through the root unit clauses
894  p->nTrailSize = 0;
895  Sto_ManForEachClauseRoot( p->pCnf, pClause )
896  {
897  // create watcher lists for the root clauses
898  if ( pClause->nLits > 1 )
899  {
900  Int_ManWatchClause( p, pClause, pClause->pLits[0] );
901  Int_ManWatchClause( p, pClause, pClause->pLits[1] );
902  }
903  // empty clause and large clauses
904  if ( pClause->nLits != 1 )
905  continue;
906  // unit clause
907  assert( lit_check(pClause->pLits[0], p->pCnf->nVars) );
908  if ( !Int_ManEnqueue( p, pClause->pLits[0], pClause ) )
909  {
910  // detected root level conflict
911 // printf( "Error in Int_ManProcessRoots(): Detected a root-level conflict too early!\n" );
912 // assert( 0 );
913  // detected root level conflict
914  Int_ManProofTraceOne( p, pClause, p->pCnf->pEmpty );
915  if ( p->fVerbose )
916  printf( "Found root level conflict!\n" );
917  return 0;
918  }
919  }
920 
921  // propagate the root unit clauses
922  pClause = Int_ManPropagate( p, 0 );
923  if ( pClause )
924  {
925  // detected root level conflict
926  Int_ManProofTraceOne( p, pClause, p->pCnf->pEmpty );
927  if ( p->fVerbose )
928  printf( "Found root level conflict!\n" );
929  return 0;
930  }
931 
932  // set the root level
933  p->nRootSize = p->nTrailSize;
934  return 1;
935 }
static int lit_check(lit l, int n)
Definition: satVec.h:149
Sto_Man_t * pCnf
Definition: satInter.c:42
unsigned fRoot
Definition: satStore.h:75
Sto_Cls_t * pEmpty
Definition: satStore.h:91
int nVars
Definition: satStore.h:85
lit pLits[0]
Definition: satStore.h:78
Sto_Cls_t * Int_ManPropagate(Int_Man_t *p, int Start)
Definition: satInter.c:534
static void Int_ManWatchClause(Int_Man_t *p, Sto_Cls_t *pClause, lit Lit)
Definition: satInter.c:391
int nClausesA
Definition: satStore.h:88
unsigned nLits
Definition: satStore.h:77
int fVerbose
Definition: satInter.c:46
int nRootSize
Definition: satInter.c:52
int nTrailSize
Definition: satInter.c:53
static int Counter
Sto_Cls_t * pTail
Definition: satStore.h:90
int nClauses
Definition: satStore.h:87
#define assert(ex)
Definition: util_old.h:213
#define Sto_ManForEachClause(p, pCls)
Definition: satStore.h:99
#define Sto_ManForEachClauseRoot(p, pCls)
Definition: satStore.h:100
int nRoots
Definition: satStore.h:86
int Int_ManProofTraceOne(Int_Man_t *p, Sto_Cls_t *pConflict, Sto_Cls_t *pFinal)
Definition: satInter.c:589
unsigned fA
Definition: satStore.h:74
static int Int_ManEnqueue(Int_Man_t *p, lit Lit, Sto_Cls_t *pReason)
Definition: satInter.c:416
static int Int_ManProofGet ( Int_Man_t p,
Sto_Cls_t pCls 
)
inlinestatic

Definition at line 89 of file satInter.c.

89 { return p->pProofNums[pCls->Id]; }
int Id
Definition: satStore.h:73
int * pProofNums
Definition: satInter.c:67
int Int_ManProofRecordOne ( Int_Man_t p,
Sto_Cls_t pClause 
)

Function*************************************************************

Synopsis [Records the proof for one clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 770 of file satInter.c.

771 {
772  Sto_Cls_t * pConflict;
773  int i;
774 
775  // empty clause never ends up there
776  assert( pClause->nLits > 0 );
777  if ( pClause->nLits == 0 )
778  printf( "Error: Empty clause is attempted.\n" );
779 
780  // add assumptions to the trail
781  assert( !pClause->fRoot );
782  assert( p->nTrailSize == p->nRootSize );
783 
784  // if any of the clause literals are already assumed
785  // it means that the clause is redundant and can be skipped
786  for ( i = 0; i < (int)pClause->nLits; i++ )
787  if ( p->pAssigns[lit_var(pClause->pLits[i])] == pClause->pLits[i] )
788  return 1;
789 
790  for ( i = 0; i < (int)pClause->nLits; i++ )
791  if ( !Int_ManEnqueue( p, lit_neg(pClause->pLits[i]), NULL ) )
792  {
793  assert( 0 ); // impossible
794  return 0;
795  }
796 
797  // propagate the assumptions
798  pConflict = Int_ManPropagate( p, p->nRootSize );
799  if ( pConflict == NULL )
800  {
801  assert( 0 ); // cannot prove
802  return 0;
803  }
804 
805  // skip the clause if it is weaker or the same as the conflict clause
806  if ( pClause->nLits >= pConflict->nLits )
807  {
808  // check if every literal of conflict clause can be found in the given clause
809  int j;
810  for ( i = 0; i < (int)pConflict->nLits; i++ )
811  {
812  for ( j = 0; j < (int)pClause->nLits; j++ )
813  if ( pConflict->pLits[i] == pClause->pLits[j] )
814  break;
815  if ( j == (int)pClause->nLits ) // literal pConflict->pLits[i] is not found
816  break;
817  }
818  if ( i == (int)pConflict->nLits ) // all lits are found
819  {
820  // undo to the root level
821  Int_ManCancelUntil( p, p->nRootSize );
822  return 1;
823  }
824  }
825 
826  // construct the proof
827  Int_ManProofTraceOne( p, pConflict, pClause );
828 
829  // undo to the root level
830  Int_ManCancelUntil( p, p->nRootSize );
831 
832  // add large clauses to the watched lists
833  if ( pClause->nLits > 1 )
834  {
835  Int_ManWatchClause( p, pClause, pClause->pLits[0] );
836  Int_ManWatchClause( p, pClause, pClause->pLits[1] );
837  return 1;
838  }
839  assert( pClause->nLits == 1 );
840 
841  // if the clause proved is unit, add it and propagate
842  if ( !Int_ManEnqueue( p, pClause->pLits[0], pClause ) )
843  {
844  assert( 0 ); // impossible
845  return 0;
846  }
847 
848  // propagate the assumption
849  pConflict = Int_ManPropagate( p, p->nRootSize );
850  if ( pConflict )
851  {
852  // construct the proof
853  Int_ManProofTraceOne( p, pConflict, p->pCnf->pEmpty );
854  if ( p->fVerbose )
855  printf( "Found last conflict after adding unit clause number %d!\n", pClause->Id );
856  return 0;
857  }
858 
859  // update the root level
860  p->nRootSize = p->nTrailSize;
861  return 1;
862 }
Sto_Man_t * pCnf
Definition: satInter.c:42
unsigned fRoot
Definition: satStore.h:75
Sto_Cls_t * pEmpty
Definition: satStore.h:91
static int lit_var(lit l)
Definition: satVec.h:145
lit pLits[0]
Definition: satStore.h:78
Sto_Cls_t * Int_ManPropagate(Int_Man_t *p, int Start)
Definition: satInter.c:534
static void Int_ManWatchClause(Int_Man_t *p, Sto_Cls_t *pClause, lit Lit)
Definition: satInter.c:391
unsigned nLits
Definition: satStore.h:77
int fVerbose
Definition: satInter.c:46
static lit lit_neg(lit l)
Definition: satVec.h:144
int nRootSize
Definition: satInter.c:52
int nTrailSize
Definition: satInter.c:53
lit * pAssigns
Definition: satInter.c:55
int Id
Definition: satStore.h:73
#define assert(ex)
Definition: util_old.h:213
static void Int_ManCancelUntil(Int_Man_t *p, int Level)
Definition: satInter.c:439
int Int_ManProofTraceOne(Int_Man_t *p, Sto_Cls_t *pConflict, Sto_Cls_t *pFinal)
Definition: satInter.c:589
static int Int_ManEnqueue(Int_Man_t *p, lit Lit, Sto_Cls_t *pReason)
Definition: satInter.c:416
static void Int_ManProofSet ( Int_Man_t p,
Sto_Cls_t pCls,
int  n 
)
inlinestatic

Definition at line 90 of file satInter.c.

90 { p->pProofNums[pCls->Id] = n; }
int Id
Definition: satStore.h:73
int * pProofNums
Definition: satInter.c:67
int Int_ManProofTraceOne ( Int_Man_t p,
Sto_Cls_t pConflict,
Sto_Cls_t pFinal 
)

Function*************************************************************

Synopsis [Traces the proof for one clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 589 of file satInter.c.

590 {
591  Sto_Cls_t * pReason;
592  int i, v, Var, PrevId;
593  int fPrint = 0;
594  abctime clk = Abc_Clock();
595 
596  // collect resolvent literals
597  if ( p->fProofVerif )
598  {
599  assert( (int)pConflict->nLits <= p->nResLitsAlloc );
600  memcpy( p->pResLits, pConflict->pLits, sizeof(lit) * pConflict->nLits );
601  p->nResLits = pConflict->nLits;
602  }
603 
604  // mark all the variables in the conflict as seen
605  for ( v = 0; v < (int)pConflict->nLits; v++ )
606  p->pSeens[lit_var(pConflict->pLits[v])] = 1;
607 
608  // start the anticedents
609 // pFinal->pAntis = Vec_PtrAlloc( 32 );
610 // Vec_PtrPush( pFinal->pAntis, pConflict );
611 
612  if ( p->pCnf->nClausesA )
613  Int_ManTruthCopy( Int_ManTruthRead(p, pFinal), Int_ManTruthRead(p, pConflict), p->nWords );
614 
615  // follow the trail backwards
616  PrevId = Int_ManProofGet(p, pConflict);
617  for ( i = p->nTrailSize - 1; i >= 0; i-- )
618  {
619  // skip literals that are not involved
620  Var = lit_var(p->pTrail[i]);
621  if ( !p->pSeens[Var] )
622  continue;
623  p->pSeens[Var] = 0;
624 
625  // skip literals of the resulting clause
626  pReason = p->pReasons[Var];
627  if ( pReason == NULL )
628  continue;
629  assert( p->pTrail[i] == pReason->pLits[0] );
630 
631  // add the variables to seen
632  for ( v = 1; v < (int)pReason->nLits; v++ )
633  p->pSeens[lit_var(pReason->pLits[v])] = 1;
634 
635 
636  // record the reason clause
637  assert( Int_ManProofGet(p, pReason) > 0 );
638  p->Counter++;
639  if ( p->fProofWrite )
640  fprintf( p->pFile, "%d * %d %d 0\n", p->Counter, PrevId, Int_ManProofGet(p, pReason) );
641  PrevId = p->Counter;
642 
643  if ( p->pCnf->nClausesA )
644  {
645  if ( p->pVarTypes[Var] == 1 ) // var of A
646  Int_ManTruthOr( Int_ManTruthRead(p, pFinal), Int_ManTruthRead(p, pReason), p->nWords );
647  else
648  Int_ManTruthAnd( Int_ManTruthRead(p, pFinal), Int_ManTruthRead(p, pReason), p->nWords );
649  }
650 
651  // resolve the temporary resolvent with the reason clause
652  if ( p->fProofVerif )
653  {
654  int v1, v2;
655  if ( fPrint )
657  // check that the var is present in the resolvent
658  for ( v1 = 0; v1 < p->nResLits; v1++ )
659  if ( lit_var(p->pResLits[v1]) == Var )
660  break;
661  if ( v1 == p->nResLits )
662  printf( "Recording clause %d: Cannot find variable %d in the temporary resolvent.\n", pFinal->Id, Var );
663  if ( p->pResLits[v1] != lit_neg(pReason->pLits[0]) )
664  printf( "Recording clause %d: The resolved variable %d is in the wrong polarity.\n", pFinal->Id, Var );
665  // remove this variable from the resolvent
666  assert( lit_var(p->pResLits[v1]) == Var );
667  p->nResLits--;
668  for ( ; v1 < p->nResLits; v1++ )
669  p->pResLits[v1] = p->pResLits[v1+1];
670  // add variables of the reason clause
671  for ( v2 = 1; v2 < (int)pReason->nLits; v2++ )
672  {
673  for ( v1 = 0; v1 < p->nResLits; v1++ )
674  if ( lit_var(p->pResLits[v1]) == lit_var(pReason->pLits[v2]) )
675  break;
676  // if it is a new variable, add it to the resolvent
677  if ( v1 == p->nResLits )
678  {
679  if ( p->nResLits == p->nResLitsAlloc )
680  printf( "Recording clause %d: Ran out of space for intermediate resolvent.\n", pFinal->Id );
681  p->pResLits[ p->nResLits++ ] = pReason->pLits[v2];
682  continue;
683  }
684  // if the variable is the same, the literal should be the same too
685  if ( p->pResLits[v1] == pReason->pLits[v2] )
686  continue;
687  // the literal is different
688  printf( "Recording clause %d: Trying to resolve the clause with more than one opposite literal.\n", pFinal->Id );
689  }
690  }
691 
692 // Vec_PtrPush( pFinal->pAntis, pReason );
693  }
694 
695  // unmark all seen variables
696 // for ( i = p->nTrailSize - 1; i >= 0; i-- )
697 // p->pSeens[lit_var(p->pTrail[i])] = 0;
698  // check that the literals are unmarked
699 // for ( i = p->nTrailSize - 1; i >= 0; i-- )
700 // assert( p->pSeens[lit_var(p->pTrail[i])] == 0 );
701 
702  // use the resulting clause to check the correctness of resolution
703  if ( p->fProofVerif )
704  {
705  int v1, v2;
706  if ( fPrint )
708  for ( v1 = 0; v1 < p->nResLits; v1++ )
709  {
710  for ( v2 = 0; v2 < (int)pFinal->nLits; v2++ )
711  if ( pFinal->pLits[v2] == p->pResLits[v1] )
712  break;
713  if ( v2 < (int)pFinal->nLits )
714  continue;
715  break;
716  }
717  if ( v1 < p->nResLits )
718  {
719  printf( "Recording clause %d: The final resolvent is wrong.\n", pFinal->Id );
720  Int_ManPrintClause( p, pConflict );
722  Int_ManPrintClause( p, pFinal );
723  }
724 
725  // if there are literals in the clause that are not in the resolvent
726  // it means that the derived resolvent is stronger than the clause
727  // we can replace the clause with the resolvent by removing these literals
728  if ( p->nResLits != (int)pFinal->nLits )
729  {
730  for ( v1 = 0; v1 < (int)pFinal->nLits; v1++ )
731  {
732  for ( v2 = 0; v2 < p->nResLits; v2++ )
733  if ( pFinal->pLits[v1] == p->pResLits[v2] )
734  break;
735  if ( v2 < p->nResLits )
736  continue;
737  // remove literal v1 from the final clause
738  pFinal->nLits--;
739  for ( v2 = v1; v2 < (int)pFinal->nLits; v2++ )
740  pFinal->pLits[v2] = pFinal->pLits[v2+1];
741  v1--;
742  }
743  assert( p->nResLits == (int)pFinal->nLits );
744  }
745  }
746 p->timeTrace += Abc_Clock() - clk;
747 
748  // return the proof pointer
749  if ( p->pCnf->nClausesA )
750  {
751 // Int_ManPrintInterOne( p, pFinal );
752  }
753  Int_ManProofSet( p, pFinal, p->Counter );
754  // make sure the same proof ID is not asssigned to two consecutive clauses
755  assert( p->pProofNums[pFinal->Id-1] != p->Counter );
756  return p->Counter;
757 }
static void Int_ManTruthOr(unsigned *p, unsigned *q, int nWords)
Definition: satInter.c:85
Sto_Man_t * pCnf
Definition: satInter.c:42
static void Int_ManTruthCopy(unsigned *p, unsigned *q, int nWords)
Definition: satInter.c:83
static int lit_var(lit l)
Definition: satVec.h:145
lit pLits[0]
Definition: satStore.h:78
static void Int_ManTruthAnd(unsigned *p, unsigned *q, int nWords)
Definition: satInter.c:84
static int Int_ManProofGet(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:89
char * memcpy()
int nClausesA
Definition: satStore.h:88
int nResLitsAlloc
Definition: satInter.c:72
static abctime Abc_Clock()
Definition: abc_global.h:279
int * pVarTypes
Definition: satInter.c:61
int fProofWrite
Definition: satInter.c:48
for(p=first;p->value< newval;p=p->next)
unsigned nLits
Definition: satStore.h:77
int lit
Definition: satVec.h:130
static lit lit_neg(lit l)
Definition: satVec.h:144
static unsigned * Int_ManTruthRead(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:80
char * pSeens
Definition: satInter.c:56
void Int_ManPrintClause(Int_Man_t *p, Sto_Cls_t *pClause)
Definition: satInter.c:307
int nTrailSize
Definition: satInter.c:53
Sto_Cls_t ** pReasons
Definition: satInter.c:57
int fProofVerif
Definition: satInter.c:47
int Id
Definition: satStore.h:73
abctime timeTrace
Definition: satInter.c:75
lit * pTrail
Definition: satInter.c:54
void Int_ManPrintResolvent(lit *pResLits, int nResLits)
Definition: satInter.c:327
int * pProofNums
Definition: satInter.c:67
FILE * pFile
Definition: satInter.c:68
int Var
Definition: SolverTypes.h:42
lit * pResLits
Definition: satInter.c:70
int Counter
Definition: satInter.c:66
int nWords
Definition: satInter.c:64
int nResLits
Definition: satInter.c:71
#define assert(ex)
Definition: util_old.h:213
static void Int_ManProofSet(Int_Man_t *p, Sto_Cls_t *pCls, int n)
Definition: satInter.c:90
ABC_INT64_T abctime
Definition: abc_global.h:278
void Int_ManProofWriteOne ( Int_Man_t p,
Sto_Cls_t pClause 
)

Function*************************************************************

Synopsis [Writes one root clause into a file.]

Description []

SideEffects []

SeeAlso []

Definition at line 564 of file satInter.c.

565 {
566  Int_ManProofSet( p, pClause, ++p->Counter );
567 
568  if ( p->fProofWrite )
569  {
570  int v;
571  fprintf( p->pFile, "%d", Int_ManProofGet(p, pClause) );
572  for ( v = 0; v < (int)pClause->nLits; v++ )
573  fprintf( p->pFile, " %d", lit_print(pClause->pLits[v]) );
574  fprintf( p->pFile, " 0 0\n" );
575  }
576 }
lit pLits[0]
Definition: satStore.h:78
static int Int_ManProofGet(Int_Man_t *p, Sto_Cls_t *pCls)
Definition: satInter.c:89
int fProofWrite
Definition: satInter.c:48
unsigned nLits
Definition: satStore.h:77
FILE * pFile
Definition: satInter.c:68
int Counter
Definition: satInter.c:66
static void Int_ManProofSet(Int_Man_t *p, Sto_Cls_t *pCls, int n)
Definition: satInter.c:90
static int lit_print(lit l)
Definition: satVec.h:147
Sto_Cls_t* Int_ManPropagate ( Int_Man_t p,
int  Start 
)

Function*************************************************************

Synopsis [Propagate the current assignments.]

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file satInter.c.

535 {
536  Sto_Cls_t * pClause;
537  int i;
538  abctime clk = Abc_Clock();
539  for ( i = Start; i < p->nTrailSize; i++ )
540  {
541  pClause = Int_ManPropagateOne( p, p->pTrail[i] );
542  if ( pClause )
543  {
544 p->timeBcp += Abc_Clock() - clk;
545  return pClause;
546  }
547  }
548 p->timeBcp += Abc_Clock() - clk;
549  return NULL;
550 }
static abctime Abc_Clock()
Definition: abc_global.h:279
int nTrailSize
Definition: satInter.c:53
abctime timeBcp
Definition: satInter.c:74
lit * pTrail
Definition: satInter.c:54
static Sto_Cls_t * Int_ManPropagateOne(Int_Man_t *p, lit Lit)
Definition: satInter.c:465
ABC_INT64_T abctime
Definition: abc_global.h:278
static Sto_Cls_t* Int_ManPropagateOne ( Int_Man_t p,
lit  Lit 
)
inlinestatic

Function*************************************************************

Synopsis [Propagate one assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 465 of file satInter.c.

466 {
467  Sto_Cls_t ** ppPrev, * pCur, * pTemp;
468  lit LitF = lit_neg(Lit);
469  int i;
470  // iterate through the literals
471  ppPrev = p->pWatches + Lit;
472  for ( pCur = p->pWatches[Lit]; pCur; pCur = *ppPrev )
473  {
474  // make sure the false literal is in the second literal of the clause
475  if ( pCur->pLits[0] == LitF )
476  {
477  pCur->pLits[0] = pCur->pLits[1];
478  pCur->pLits[1] = LitF;
479  pTemp = pCur->pNext0;
480  pCur->pNext0 = pCur->pNext1;
481  pCur->pNext1 = pTemp;
482  }
483  assert( pCur->pLits[1] == LitF );
484 
485  // if the first literal is true, the clause is satisfied
486  if ( pCur->pLits[0] == p->pAssigns[lit_var(pCur->pLits[0])] )
487  {
488  ppPrev = &pCur->pNext1;
489  continue;
490  }
491 
492  // look for a new literal to watch
493  for ( i = 2; i < (int)pCur->nLits; i++ )
494  {
495  // skip the case when the literal is false
496  if ( lit_neg(pCur->pLits[i]) == p->pAssigns[lit_var(pCur->pLits[i])] )
497  continue;
498  // the literal is either true or unassigned - watch it
499  pCur->pLits[1] = pCur->pLits[i];
500  pCur->pLits[i] = LitF;
501  // remove this clause from the watch list of Lit
502  *ppPrev = pCur->pNext1;
503  // add this clause to the watch list of pCur->pLits[i] (now it is pCur->pLits[1])
504  Int_ManWatchClause( p, pCur, pCur->pLits[1] );
505  break;
506  }
507  if ( i < (int)pCur->nLits ) // found new watch
508  continue;
509 
510  // clause is unit - enqueue new implication
511  if ( Int_ManEnqueue(p, pCur->pLits[0], pCur) )
512  {
513  ppPrev = &pCur->pNext1;
514  continue;
515  }
516 
517  // conflict detected - return the conflict clause
518  return pCur;
519  }
520  return NULL;
521 }
static int lit_var(lit l)
Definition: satVec.h:145
lit pLits[0]
Definition: satStore.h:78
Sto_Cls_t * pNext1
Definition: satStore.h:72
static void Int_ManWatchClause(Int_Man_t *p, Sto_Cls_t *pClause, lit Lit)
Definition: satInter.c:391
unsigned nLits
Definition: satStore.h:77
int lit
Definition: satVec.h:130
static lit lit_neg(lit l)
Definition: satVec.h:144
Sto_Cls_t * pNext0
Definition: satStore.h:71
lit * pAssigns
Definition: satInter.c:55
#define assert(ex)
Definition: util_old.h:213
Sto_Cls_t ** pWatches
Definition: satInter.c:58
static int Int_ManEnqueue(Int_Man_t *p, lit Lit, Sto_Cls_t *pReason)
Definition: satInter.c:416
void Int_ManResize ( Int_Man_t p)

Function*************************************************************

Synopsis [Resize proof manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file satInter.c.

210 {
211  // check if resizing is needed
212  if ( p->nVarsAlloc < p->pCnf->nVars )
213  {
214  // find the new size
215  if ( p->nVarsAlloc == 0 )
216  p->nVarsAlloc = 1;
217  while ( p->nVarsAlloc < p->pCnf->nVars )
218  p->nVarsAlloc *= 2;
219  // resize the arrays
220  p->pTrail = ABC_REALLOC(lit, p->pTrail, p->nVarsAlloc );
221  p->pAssigns = ABC_REALLOC(lit, p->pAssigns, p->nVarsAlloc );
222  p->pSeens = ABC_REALLOC(char, p->pSeens, p->nVarsAlloc );
223  p->pVarTypes = ABC_REALLOC(int, p->pVarTypes, p->nVarsAlloc );
225  p->pWatches = ABC_REALLOC(Sto_Cls_t *, p->pWatches, p->nVarsAlloc*2 );
226  }
227 
228  // clean the free space
229  memset( p->pAssigns , 0xff, sizeof(lit) * p->pCnf->nVars );
230  memset( p->pSeens , 0, sizeof(char) * p->pCnf->nVars );
231  memset( p->pVarTypes, 0, sizeof(int) * p->pCnf->nVars );
232  memset( p->pReasons , 0, sizeof(Sto_Cls_t *) * p->pCnf->nVars );
233  memset( p->pWatches , 0, sizeof(Sto_Cls_t *) * p->pCnf->nVars*2 );
234 
235  // compute the number of common variables
236  p->nVarsAB = Int_ManGlobalVars( p );
237  // compute the number of words in the truth table
238  p->nWords = (p->nVarsAB <= 5 ? 1 : (1 << (p->nVarsAB - 5)));
239 
240  // check if resizing of clauses is needed
241  if ( p->nClosAlloc < p->pCnf->nClauses )
242  {
243  // find the new size
244  if ( p->nClosAlloc == 0 )
245  p->nClosAlloc = 1;
246  while ( p->nClosAlloc < p->pCnf->nClauses )
247  p->nClosAlloc *= 2;
248  // resize the arrays
249  p->pProofNums = ABC_REALLOC(int, p->pProofNums, p->nClosAlloc );
250  }
251  memset( p->pProofNums, 0, sizeof(int) * p->pCnf->nClauses );
252 
253  // check if resizing of truth tables is needed
254  if ( p->nIntersAlloc < p->nWords * p->pCnf->nClauses )
255  {
256  p->nIntersAlloc = p->nWords * p->pCnf->nClauses;
257  p->pInters = ABC_REALLOC(unsigned, p->pInters, p->nIntersAlloc );
258  }
259 // memset( p->pInters, 0, sizeof(unsigned) * p->nWords * p->pCnf->nClauses );
260 }
char * memset()
Sto_Man_t * pCnf
Definition: satInter.c:42
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int nVars
Definition: satStore.h:85
int nClosAlloc
Definition: satInter.c:50
int * pVarTypes
Definition: satInter.c:61
int lit
Definition: satVec.h:130
int nIntersAlloc
Definition: satInter.c:63
char * pSeens
Definition: satInter.c:56
Sto_Cls_t ** pReasons
Definition: satInter.c:57
lit * pAssigns
Definition: satInter.c:55
lit * pTrail
Definition: satInter.c:54
int * pProofNums
Definition: satInter.c:67
int nClauses
Definition: satStore.h:87
int nVarsAlloc
Definition: satInter.c:49
int nWords
Definition: satInter.c:64
int nVarsAB
Definition: satInter.c:60
Sto_Cls_t ** pWatches
Definition: satInter.c:58
unsigned * pInters
Definition: satInter.c:62
int Int_ManGlobalVars(Int_Man_t *p)
Definition: satInter.c:150
int* Int_ManSetGlobalVars ( Int_Man_t p,
int  nGloVars 
)

Function*************************************************************

Synopsis [Allocate proof manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file satInter.c.

134 {
135  p->nGloVars = nGloVars;
136  return p->pGloVars;
137 }
int pGloVars[16]
Definition: satInter.c:43
int nGloVars
Definition: satInter.c:44
static void Int_ManTruthAnd ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 84 of file satInter.c.

84 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] &= q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Int_ManTruthClear ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 81 of file satInter.c.

81 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Int_ManTruthCopy ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 83 of file satInter.c.

83 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Int_ManTruthFill ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 82 of file satInter.c.

82 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = ~0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Int_ManTruthOr ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 85 of file satInter.c.

85 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] |= q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Int_ManTruthOrNot ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 86 of file satInter.c.

86 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] |= ~q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static unsigned* Int_ManTruthRead ( Int_Man_t p,
Sto_Cls_t pCls 
)
inlinestatic

Definition at line 80 of file satInter.c.

80 { return p->pInters + pCls->Id * p->nWords; }
int Id
Definition: satStore.h:73
int nWords
Definition: satInter.c:64
unsigned * pInters
Definition: satInter.c:62
static void Int_ManWatchClause ( Int_Man_t p,
Sto_Cls_t pClause,
lit  Lit 
)
inlinestatic

Function*************************************************************

Synopsis [Adds one clause to the watcher list.]

Description []

SideEffects []

SeeAlso []

Definition at line 391 of file satInter.c.

392 {
393  assert( lit_check(Lit, p->pCnf->nVars) );
394  if ( pClause->pLits[0] == Lit )
395  pClause->pNext0 = p->pWatches[lit_neg(Lit)];
396  else
397  {
398  assert( pClause->pLits[1] == Lit );
399  pClause->pNext1 = p->pWatches[lit_neg(Lit)];
400  }
401  p->pWatches[lit_neg(Lit)] = pClause;
402 }
static int lit_check(lit l, int n)
Definition: satVec.h:149
Sto_Man_t * pCnf
Definition: satInter.c:42
int nVars
Definition: satStore.h:85
lit pLits[0]
Definition: satStore.h:78
Sto_Cls_t * pNext1
Definition: satStore.h:72
static lit lit_neg(lit l)
Definition: satVec.h:144
Sto_Cls_t * pNext0
Definition: satStore.h:71
#define assert(ex)
Definition: util_old.h:213
Sto_Cls_t ** pWatches
Definition: satInter.c:58

Variable Documentation

ABC_NAMESPACE_IMPL_START const lit LIT_UNDEF = 0xffffffff
static

DECLARATIONS ///.

CFile****************************************************************

FileName [satInter.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT sat_solver.]

Synopsis [Interpolation package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
satInter.c,v 1.4 2005/09/16 22:55:03 casem Exp

]

Definition at line 36 of file satInter.c.