Exemplo n.º 1
0
void Be_Cnf_RemoveDuplicateLiterals(Be_Cnf_ptr self)
{
  int i, j;
  Siter iter;
  int * clause = (int *)NULL;
  hash_ptr lits = (hash_ptr)NULL;

  nusmv_assert(self != NULL);

  lits = new_assoc();

  for (iter = Slist_first(Be_Cnf_GetClausesList(self));
       !Siter_is_end(iter);
       iter = Siter_next(iter)) {

    clause = (int*) Siter_element(iter);

    i = 0;
    while (clause[i] != 0) {
      if (Nil != find_assoc(lits, NODE_FROM_INT(clause[i]))) {
        j = i+1;
        while (clause[j] != 0) {
          clause[j-1] = clause[j];
          j++;
        }
      }
      else {
        insert_assoc(lits, NODE_FROM_INT(clause[i]), NODE_FROM_INT(1));
      }
      i++;
    }

    /* this clear the hash */
    clear_assoc(lits);
  }

  free_assoc(lits);
}
Exemplo n.º 2
0
/**Function********************************************************************

   Synopsis           [Clears the memoization hash of the wff2nff
   conversion function]

   Description        [Clears the memoization hash of the wff2nff
   conversion function]

   SideEffects        []

   SeeAlso            []

******************************************************************************/
void w2w_clear_wff2nnf_memoization()
{
  nusmv_assert(wff2nnf_hash == (hash_ptr) NULL);
  clear_assoc(wff2nnf_hash);
}