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; }
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); }
static long remove_subsumed(GlobalIndices_p indices, FVPackedClause_p subsumer, ClauseSet_p set, ClauseSet_p archive) { Clause_p handle; long res; PStack_p stack = PStackAlloc(); res = ClauseSetFindFVSubsumedClauses(set, subsumer, stack); while(!PStackEmpty(stack)) { handle = PStackPopP(stack); if(ClauseQueryProp(handle, CPWatchOnly)) { DocClauseQuote(GlobalOut, OutputLevel, 6, handle, "extract_wl_subsumed", subsumer->clause); } else { DocClauseQuote(GlobalOut, OutputLevel, 6, handle, "subsumed", subsumer->clause); } ClauseKillChildren(handle); GlobalIndicesDeleteClause(indices, handle); if(BuildProofObject||ClauseIsDemodulator(handle)) { ClauseSetExtractEntry(handle); ClauseSetInsert(archive, handle); } else { ClauseSetDeleteEntry(handle); } } PStackFree(stack); return res; }
static bool eliminate_backward_rewritten_clauses(ProofState_p state, ProofControl_p control, Clause_p clause, SysDate *date) { long old_lit_count = state->tmp_store->literals, old_clause_count= state->tmp_store->members; bool min_rw = false; PERF_CTR_ENTRY(BWRWTimer); if(ClauseIsDemodulator(clause)) { SysDateInc(date); if(state->gindices.bw_rw_index) { min_rw = RemoveRewritableClausesIndexed(control->ocb, state->tmp_store, state->archive, clause, *date, &(state->gindices)); } else { min_rw = RemoveRewritableClauses(control->ocb, state->processed_pos_rules, state->tmp_store, state->archive, clause, *date, &(state->gindices)) ||min_rw; min_rw = RemoveRewritableClauses(control->ocb, state->processed_pos_eqns, state->tmp_store, state->archive, clause, *date, &(state->gindices)) ||min_rw; min_rw = RemoveRewritableClauses(control->ocb, state->processed_neg_units, state->tmp_store, state->archive, clause, *date, &(state->gindices)) ||min_rw; min_rw = RemoveRewritableClauses(control->ocb, state->processed_non_units, state->tmp_store, state->archive, clause, *date, &(state->gindices)) ||min_rw; } state->backward_rewritten_lit_count+= (state->tmp_store->literals-old_lit_count); state->backward_rewritten_count+= (state->tmp_store->members-old_clause_count); if(control->heuristic_parms.detsort_bw_rw) { ClauseSetSort(state->tmp_store, ClauseCmpByStructWeight); } } PERF_CTR_EXIT(BWRWTimer); /*printf("# Removed %ld clauses\n", (state->tmp_store->members-old_clause_count)); */ return min_rw; }