9 unsigned *q,
unsigned *r) {
45 unsigned b,
unsigned c) {
59 if (a != other && b != other && c != other)
65 solver->resolve_gate =
true;
70 unsigned b,
unsigned c) {
73 if (other != b && other != c)
75 solver->resolve_gate =
true;
79 return match_ternary_ref (
solver, ref, a, b, c);
84 uint64_t *steps,
unsigned a,
85 unsigned b,
unsigned c) {
89 for (
const watch *
p = begin;
p != end;
p++) {
91 if (match_ternary_watch (
solver, *
p, a, b, c))
106 uint64_t large_clauses = 0;
107 for (
const watch *
p = begin;
p != end;
p++)
110 const uint64_t limit =
GET_OPTION (eliminateocclim);
111 if (large_clauses * large_clauses > limit)
113 const watch *
const last = end - 1;
115 for (
const watch *p1 = begin; steps < limit && p1 != last; p1++) {
120 if (!get_ternary_clause (
solver, p1->large.ref, &
a1, &
b1, &c1))
127 for (
const watch *p2 = p1 + 1; steps < limit && p2 != end; p2++) {
132 if (!get_ternary_clause (
solver, p2->large.ref, &a2, &b2, &c2))
135 SWAP (
unsigned, a2, b2);
137 SWAP (
unsigned, a2, c2);
140 SWAP (
unsigned, b2, c2);
143 const unsigned not_b2 =
NOT (b2);
146 solver->resolve_gate =
false;
147 const unsigned not_lit =
NOT (
lit);
148 const unsigned not_c1 =
NOT (c1);
149 const watch *
const p3 =
150 find_ternary_clause (
solver, &steps, not_lit,
b1, not_c1);
153 const unsigned not_c2 =
NOT (c2);
154 const watch *
const p4 =
155 find_ternary_clause (
solver, &steps, not_lit, b2, not_c2);
158 watch w3 = p3 < p4 ? *p3 : *p4;
159 watch w4 = p3 < p4 ? *p4 : *p3;
162 LOGWATCH (not_lit, w3,
"3rd if-then-else");
163 LOGWATCH (not_lit, w4,
"4th if-then-else");
164 LOG (
"found if-then-else gate %s = (%s ? %s : %s)",
LOGLIT (
lit),
171 INC (if_then_else_extracted);
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START typedef signed char value
void kissat_eliminate_clause(kissat *solver, clause *c, unsigned lit)
#define GATE_ELIMINATED(...)
bool kissat_find_if_then_else_gate(kissat *solver, unsigned lit, unsigned negative)
#define all_literals_in_clause(LIT, C)
#define KISSAT_assert(ignore)
ABC_NAMESPACE_HEADER_START typedef unsigned reference
#define BEGIN_WATCHES(WS)