Ejemplo n.º 1
0
long build_rw_system(ClauseSet_p demods, ClauseSet_p spec)
{
   long count=0;
   Clause_p handle;

   while((handle = ClauseSetExtractFirst(spec)))
   {
      if(ClauseIsDemodulator(handle))
      {         
         SysDateInc(&(demods->date));
         handle->date = demods->date;
         EqnSetProp(handle->literals, EPIsOriented);
         ClauseSetPDTIndexedInsert(demods, handle);
         count++;
      }
      else
      {         
         fprintf(stderr, "%s: Clause is not a rewrite rule: ", NAME);
         ClausePrint(stderr, handle, true);
         fprintf(stderr, " -- ignoring\n");
         ClauseFree(handle);
      }
   }
   return count;
}
Ejemplo n.º 2
0
void ProofStateResetProcessedSet(ProofState_p state,  
                                 ProofControl_p control, 
                                 ClauseSet_p set)
{
   Clause_p handle;
   
   while((handle = ClauseSetExtractFirst(set)))
   {
      if(ClauseQueryProp(handle, CPIsGlobalIndexed))
      {
         GlobalIndicesDeleteClause(&(state->gindices), handle);
      }

      ClauseKillChildren(handle); /* Should be none, but better be safe */

      if(BuildProofObject)
      {
         Clause_p tmpclause = ClauseFlatCopy(handle);
         ClausePushDerivation(tmpclause, DCCnfQuote, handle, NULL);
         ClauseSetInsert(state->archive, handle);
         handle = tmpclause;
      }     
      HCBClauseEvaluate(control->hcb, handle);
      ClauseDelProp(handle, CPIsOriented);
      DocClauseQuoteDefault(6, handle, "move_eval");
      
      if(control->heuristic_parms.prefer_initial_clauses)
      {
	 EvalListChangePriority(handle->evaluations, -PrioLargestReasonable);
      }      
      ClauseSetInsert(state->unprocessed, handle);
   }
}
Ejemplo n.º 3
0
void simplify_watchlist(ProofState_p state, ProofControl_p control,
			Clause_p clause)
{
   ClauseSet_p tmp_set;
   Clause_p handle;
   long     removed_lits;
   
   if(!ClauseIsDemodulator(clause))
   {
      return;
   }
   tmp_set = ClauseSetAlloc();

   RemoveRewritableClauses(control->ocb, state->watchlist,
			   tmp_set, state->archive,
                           clause, clause->date,
                           &(state->wlindices));
   while((handle = ClauseSetExtractFirst(tmp_set)))
   {
      ClauseComputeLINormalform(control->ocb,
				state->terms, 
				handle,
				state->demods,
				control->heuristic_parms.forward_demod,
				control->heuristic_parms.prefer_general);      
      removed_lits = ClauseRemoveSuperfluousLiterals(handle);
      if(removed_lits)
      {
	 DocClauseModificationDefault(handle, inf_minimize, NULL);
      }
      if(control->ac_handling_active)
      {
	 ClauseRemoveACResolved(handle);
      }
      ClauseSubsumeOrderSortLits(handle);
      ClauseSetIndexedInsertClause(state->watchlist, handle);
      GlobalIndicesInsertClause(&(state->wlindices), handle);
   }   
   ClauseSetFree(tmp_set);
}
Ejemplo n.º 4
0
static Clause_p insert_new_clauses(ProofState_p state, ProofControl_p control)
{
   Clause_p handle;
   long     clause_count;

   state->generated_count+=state->tmp_store->members;	 
   state->generated_lit_count+=state->tmp_store->literals;
   while((handle = ClauseSetExtractFirst(state->tmp_store)))
   {
      /* printf("Inserting: ");
         ClausePrint(stdout, handle, true);
         printf("\n"); */
      if(ClauseQueryProp(handle,CPIsIRVictim))
      {         
         assert(ClauseQueryProp(handle, CPLimitedRW));
         ForwardModifyClause(state, control, handle, 
                             control->heuristic_parms.forward_context_sr_aggressive||
                             (control->heuristic_parms.backward_context_sr&&
                              ClauseQueryProp(handle,CPIsProcessed)),
                             control->heuristic_parms.condensing_aggressive,
                             FullRewrite);
         ClauseDelProp(handle,CPIsIRVictim);
      }
      ForwardModifyClause(state, control, handle, 
			  control->heuristic_parms.forward_context_sr_aggressive||
			  (control->heuristic_parms.backward_context_sr&&
			   ClauseQueryProp(handle,CPIsProcessed)),
                          control->heuristic_parms.condensing_aggressive,
			  control->heuristic_parms.forward_demod);


      if(ClauseIsTrivial(handle))
      {
	 assert(!handle->children);
	 ClauseDetachParents(handle);
	 ClauseFree(handle);
	 continue;
      }
      if(state->watchlist)
      {
	 check_watchlist(&(state->wlindices), state->watchlist, 
                         handle, state->archive);
      }
      if(ClauseIsEmpty(handle))
      {
	 return handle;	 
      }
      if(control->heuristic_parms.er_aggressive &&
	 control->heuristic_parms.er_varlit_destructive &&
	 (clause_count = 
          ClauseERNormalizeVar(state->terms,
                               handle,
                               state->tmp_store,
                               state->freshvars,
                               control->heuristic_parms.er_strong_destructive)))
      {
	 state->other_redundant_count += clause_count;
	 state->resolv_count += clause_count;
	 state->generated_count += clause_count;
	 continue;
      }
      if(control->heuristic_parms.split_aggressive &&
	 (clause_count = ControlledClauseSplit(state->definition_store,
                                               handle,
					       state->tmp_store,
					       control->heuristic_parms.split_clauses,
					       control->heuristic_parms.split_method,
                                               control->heuristic_parms.split_fresh_defs)))
      {
	 state->generated_count += clause_count;
	 continue;
      }
      state->non_trivial_generated_count++;
      ClauseDelProp(handle, CPIsOriented);
      if(!control->heuristic_parms.select_on_proc_only)
      {
	 DoLiteralSelection(control, handle); 
      }
      else
      {
	 EqnListDelProp(handle->literals, EPIsSelected);
      }
      handle->create_date = state->proc_non_trivial_count;
      HCBClauseEvaluate(control->hcb, handle);
      ClauseDelProp(handle, CPIsOriented);
      DocClauseQuoteDefault(6, handle, "eval");
      
      ClauseSetInsert(state->unprocessed, handle);
   }
   return NULL;
}