12static inline unsigned occurrences_literal (
kissat *
solver,
unsigned lit,
19 LOG (
"literal %s has %zu watches",
LOGLIT (
lit), size_watches);
21 const unsigned clslim =
GET_OPTION (eliminateclslim);
33 const watch head = *q++ = *
p++;
49 else if (c->
size > clslim) {
50 LOG (
"literal %s watches too long clause of size %u",
LOGLIT (
lit),
65 LOG (
"literal %s actually occurs only %u times",
LOGLIT (
lit), res);
82 res = (
struct clause *) (arena + ref);
91 statches *
const watches0,
92 statches *
const watches1,
93 uint64_t *
const resolved_ptr,
95 const unsigned not_lit =
NOT (
lit);
96 unsigned resolved = *resolved_ptr;
100 memset (&tmp0, 0,
sizeof tmp0);
101 memset (&tmp1, 0,
sizeof tmp1);
108 const unsigned clslim =
GET_OPTION (eliminateclslim);
118 bool first_antecedent_satisfied =
false;
127 first_antecedent_satisfied =
true;
134 if (first_antecedent_satisfied)
146 watch_to_clause (
solver, arena, &tmp1, not_lit, watch1);
156 bool resolvent_satisfied_or_tautological =
false;
159 INC (eliminate_resolutions);
162 if (other == not_lit)
166 LOG2 (
"dropping falsified literal %s",
LOGLIT (other));
172 resolvent_satisfied_or_tautological =
true;
176 LOG2 (
"dropping repeated %s literal",
LOGLIT (other));
179 const unsigned not_other =
NOT (other);
180 if (marks[not_other]) {
181 LOG (
"resolvent tautological on %s and %s "
182 "with second %s antecedent",
184 resolvent_satisfied_or_tautological =
true;
187 LOG2 (
"including unassigned literal %s",
LOGLIT (other));
191 if (resolvent_satisfied_or_tautological) {
196 if (++resolved > limit) {
197 LOG (
"limit of %" PRIu64
" resolvent exceeded", limit);
208 LOG2 (
"dropping falsified literal %s",
LOGLIT (other));
218 if (!size_resolvent) {
220 solver->inconsistent =
true;
221 LOG (
"resolved empty clause");
228 if (size_resolvent == 1) {
230 INC (eliminate_units);
233 if (marks[unit] <= 0)
235 LOGCLS (c,
"first antecedent becomes satisfied");
236 first_antecedent_satisfied =
true;
237 (void) first_antecedent_satisfied;
241 if (size_resolvent > clslim) {
242 LOG (
"resolvent size limit exceeded");
261 *resolved_ptr = resolved;
269 unsigned not_lit =
NOT (
lit);
276 unsigned pos_count = occurrences_literal (
solver,
lit, &update);
277 unsigned neg_count = occurrences_literal (
solver, not_lit, &update);
279 if (pos_count > neg_count) {
281 SWAP (
size_t, pos_count, neg_count);
284 const unsigned occlim =
GET_OPTION (eliminateocclim);
285 limit = pos_count + (uint64_t) neg_count;
287 if (pos_count && limit > occlim) {
288 LOG (
"no elimination of variable %u "
289 "since it has %" PRIu64
" > %u occurrences",
295 const uint64_t bound =
solver->bounds.eliminate.additional_clauses;
297 LOG (
"trying to eliminate %s "
298 "limit %" PRIu64
" bound %" PRIu64,
299 LOGVAR (idx), limit, bound);
301 LOG (
"eliminating pure literal %s thus its variable %u",
LOGLIT (
lit),
309 INC (eliminate_attempted);
315 statches *
const gates0 = &
solver->gates[0];
316 statches *
const gates1 = &
solver->gates[1];
326 uint64_t resolved = 0;
329 statches *
const antecedents0 = &
solver->antecedents[0];
330 statches *
const antecedents1 = &
solver->antecedents[1];
333 LOG (
"resolving gates[0] against antecedents[1] clauses");
334 if (!generate_resolvents (
solver,
lit, gates0, antecedents1, &resolved,
338 LOG (
"resolving gates[1] against antecedents[0] clauses");
339 if (!generate_resolvents (
solver, not_lit, gates1, antecedents0,
342 }
else if (
solver->resolve_gate) {
343 LOG (
"need to resolved gates[0] against gates[1] too");
344 if (!generate_resolvents (
solver,
lit, gates0, gates1, &resolved,
350 LOG (
"no gate extracted thus resolving all clauses");
351 if (!generate_resolvents (
solver,
lit, antecedents0, antecedents1,
360 LOG (
"elimination of %s failed", LOGVAR (
IDX (
lit)));
366 LOG (
"resolved %" PRIu64
" resolvents", resolved);
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_HEADER_START typedef word ward
void kissat_learned_unit(kissat *solver, unsigned lit)
#define RESIZE_STACK(S, NEW_SIZE)
#define all_stack(T, E, S)
ABC_NAMESPACE_IMPL_START typedef signed char value
#define CHECK_AND_ADD_EMPTY(...)
void kissat_eliminate_clause(kissat *solver, clause *c, unsigned lit)
void kissat_update_variable_score(kissat *solver, unsigned idx)
void kissat_eliminate_binary(kissat *solver, unsigned lit, unsigned other)
bool kissat_find_gates(kissat *solver, unsigned lit)
void kissat_get_antecedents(kissat *solver, unsigned lit)
#define all_literals_in_clause(LIT, C)
#define KISSAT_assert(ignore)
#define kissat_extremely_verbose(...)
#define ADD_EMPTY_TO_PROOF(...)
ABC_NAMESPACE_HEADER_START typedef unsigned reference
bool kissat_generate_resolvents(kissat *solver, unsigned idx, unsigned *lit_ptr)
#define BEGIN_WATCHES(WS)
#define SET_END_OF_WATCHES(WS, P)