abc/src/sat/msat/msatClause.c
/**Function*************************************************************

  Synopsis    [Propages the assignment.]

  Description [The literal that has become true (Lit) is given to this 
  procedure. The array of current variable assignments is given for
  efficiency. The output literal (pLit_out) can be the second watched
  literal (if TRUE is returned) or the conflict literal (if FALSE is 
  returned). This messy interface is used to improve performance.
  This procedure accounts for ~50% of the runtime of the solver.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Propages the assignment.]

Description [The literal that has become true (Lit) is given to this
procedure. The array of current variable assignments is given for
efficiency. The output literal (pLit_out) can be the second watched
literal (if TRUE is returned) or the conflict literal (if FALSE is
returned). This messy interface is used to improve performance.
This procedure accounts for ~50% of the runtime of the solver.]




Function Synopsis [ Propages the assignment . ] Description [ The literal that has become true ( Lit ) is given to this procedure . The array of current variable assignments is given for efficiency . The output literal ( pLit_out ) can be the second watched literal ( if TRUE is returned ) or the conflict literal ( if FALSE is returned ) . This messy interface is used to improve performance . This procedure accounts for ~50% of the runtime of the solver . ]
int  Msat_ClausePropagate( Msat_Clause_t * pC, Msat_Lit_t Lit, int * pAssigns, Msat_Lit_t * pLit_out )
{
    Msat_Lit_t LitF = MSAT_LITNOT(Lit);
    if ( pC->pData[0] == LitF )
         pC->pData[0] = pC->pData[1], pC->pData[1] = LitF;
    assert( pC->pData[1] == LitF );
    if ( pAssigns[MSAT_LIT2VAR(pC->pData[0])] == pC->pData[0] )
        return 1; 
    if ( pC->nSize > 2 )
    {
        int i;
        for ( i = 2; i < (int)pC->nSize; i++ )
            if ( pAssigns[MSAT_LIT2VAR(pC->pData[i])] != MSAT_LITNOT(pC->pData[i]) )
            {
                pC->pData[1] = pC->pData[i], pC->pData[i] = LitF;
                *pLit_out = MSAT_LITNOT(pC->pData[1]);
                return 1; 
            }
    }
    *pLit_out = pC->pData[0];
    return 0;
}
int Msat_ClausePropagate ( Msat_Clause_t * pC , Msat_Lit_t Lit , int * pAssigns , Msat_Lit_t * pLit_out ) { Msat_Lit_t LitF = MSAT_LITNOT ( Lit ) ; if ( pC -> pData [ 0 ] == LitF ) pC -> pData [ 0 ] = pC -> pData [ 1 ] , pC -> pData [ 1 ] = LitF ; assert ( pC -> pData [ 1 ] == LitF ) ; if ( pAssigns [ MSAT_LIT2VAR ( pC -> pData [ 0 ] ) ] == pC -> pData [ 0 ] ) return 1 ; if ( pC -> nSize > 2 ) { int i ; for ( i = 2 ; i < ( int ) pC -> nSize ; i ++ ) if ( pAssigns [ MSAT_LIT2VAR ( pC -> pData [ i ] ) ] != MSAT_LITNOT ( pC -> pData [ i ] ) ) { pC -> pData [ 1 ] = pC -> pData [ i ] , pC -> pData [ i ] = LitF ; * pLit_out = MSAT_LITNOT ( pC -> pData [ 1 ] ) ; return 1 ; } } * pLit_out = pC -> pData [ 0 ] ; return 0 ; }
Function
Synopsis    [Propages the assignment.]
Function Synopsis [ Propages the assignment . ]
// make sure the false literal is pC->pData[1] // if the 0-th watch is true, clause is already satisfied // look for a new watch // clause is unit under assignment