17 LOG (
"connecting proof to internal solver");
35 bool finalize_clauses) {
42 proof->connect (tracer);
48 bool finalize_clauses) {
56 proof->connect (tracer);
61 bool finalize_clauses) {
69 proof->connect (tracer);
74 bool finalize_clauses) {
82 proof->connect (tracer);
91 proof->disconnect (tracer);
102 proof->disconnect (tracer);
113 proof->disconnect (tracer);
120 tracers.erase (std::remove (tracers.begin (), tracers.end (), t),
128 LOG (
"PROOF connecting VeriPB tracer");
129 bool antecedents =
opts.veripb == 1 ||
opts.veripb == 2;
130 bool deletions =
opts.veripb == 2 ||
opts.veripb == 4;
134 }
else if (
opts.frat) {
135 LOG (
"PROOF connecting FRAT tracer");
136 bool antecedents =
opts.frat == 1;
141 }
else if (
opts.lrat) {
142 LOG (
"PROOF connecting LRAT tracer");
145 }
else if (
opts.idrup) {
146 LOG (
"PROOF connecting IDRUP tracer");
149 }
else if (
opts.lidrup) {
150 LOG (
"PROOF connecting LIDRUP tracer");
154 LOG (
"PROOF connecting DRAT tracer");
164 if (
opts.checkproof > 1) {
168 LOG (
"PROOF connecting LRAT proof checker");
172 proof->connect (lratchecker);
176 if (
opts.checkproof == 1 ||
opts.checkproof == 3) {
179 LOG (
"PROOF connecting proof checker");
180 proof->connect (checker);
190 tracer->close (print);
197 tracer->flush (print);
208inline void Proof::add_literal (
int internal_lit) {
209 const int external_lit = internal->
externalize (internal_lit);
210 clause.push_back (external_lit);
213inline void Proof::add_literals (Clause *c) {
214 for (
auto const &
lit : *c)
218inline void Proof::add_literals (
const vector<int> &c) {
219 for (
auto const &
lit : c)
225void Proof::add_original_clause (int64_t
id,
bool r,
const vector<int> &c) {
226 LOG (c,
"PROOF adding original internal clause");
230 add_original_clause ();
238 for (
auto const &
lit : c)
239 clause.push_back (
lit);
242 add_original_clause (restore);
249 for (
auto const &
lit : c)
250 clause.push_back (
lit);
258 LOG (
"PROOF adding empty clause");
261 for (
const auto &cid : chain)
262 proof_chain.push_back (cid);
265 add_derived_clause ();
270 LOG (
"PROOF adding unit clause %d", internal_unit);
273 add_literal (internal_unit);
274 for (
const auto &cid : chain)
275 proof_chain.push_back (cid);
278 add_derived_clause ();
284 LOG (c,
"PROOF adding to proof derived");
288 for (
const auto &cid : chain)
289 proof_chain.push_back (cid);
292 add_derived_clause ();
295void Proof::add_derived_clause (int64_t
id,
bool r,
const vector<int> &c,
297 LOG (c,
"PROOF adding derived clause");
300 for (
const auto &
lit : c)
302 for (
const auto &cid : chain)
303 proof_chain.push_back (cid);
306 add_derived_clause ();
309void Proof::add_assumption_clause (int64_t
id,
const vector<int> &c,
314 for (
const auto &
lit : c)
315 clause.push_back (
lit);
316 for (
const auto &cid : chain)
317 proof_chain.push_back (cid);
319 add_assumption_clause ();
322void Proof::add_assumption (
int a) {
326 clause.push_back (a);
334 for (
const auto &
lit : c)
335 clause.push_back (
lit);
339void Proof::add_assumption_clause (int64_t
id,
int lit,
343 clause.push_back (
lit);
344 for (
const auto &cid : chain)
345 proof_chain.push_back (cid);
347 add_assumption_clause ();
351 LOG (c,
"PROOF deleting from proof");
359void Proof::delete_clause (int64_t
id,
bool r,
const vector<int> &c) {
360 LOG (c,
"PROOF deleting from proof");
369 LOG (c,
"PROOF weaken minus of");
377 LOG (c,
"PROOF deleting from proof");
390 weaken_minus (
id, c);
391 delete_clause (
id,
false, c);
395 LOG (
"PROOF deleting unit from proof %d",
lit);
404 LOG (c,
"PROOF finalizing clause");
412 LOG (c,
"PROOF finalizing clause");
414 for (
const auto &
lit : c)
421 LOG (
"PROOF finalizing clause %d",
lit);
429 LOG (
"PROOF finalizing clause %d",
lit);
431 clause.push_back (
lit);
443 LOG (c,
"PROOF flushing falsified literals in");
445 const bool antecedents = (internal->lrat || internal->frat);
446 for (
int i = 0; i < c->
size; i++) {
448 if (internal->fixed (internal_lit) < 0) {
450 int64_t
id = internal->unit_id (-internal_lit);
451 proof_chain.push_back (
id);
455 add_literal (internal_lit);
457 proof_chain.push_back (c->
id);
459 int64_t
id = ++internal->clause_id;
461 add_derived_clause ();
474 LOG (c,
"PROOF strengthen by removing %d in", remove);
476 for (
int i = 0; i < c->
size; i++) {
478 if (internal_lit == remove)
480 add_literal (internal_lit);
482 int64_t
id = ++internal->clause_id;
485 for (
const auto &cid : chain)
486 proof_chain.push_back (cid);
487 add_derived_clause ();
494 LOG (c,
"PROOF otfs strengthen");
496 for (
int i = 0; i < c->
size; i++) {
498 add_literal (internal_lit);
500 int64_t
id = ++internal->clause_id;
503 for (
const auto &cid : chain)
504 proof_chain.push_back (cid);
505 add_derived_clause ();
510void Proof::strengthen (int64_t
id) {
517void Proof::add_original_clause (
bool restore) {
518 LOG (
clause,
"PROOF adding original external clause");
521 for (
auto &tracer : tracers) {
522 tracer->add_original_clause (clause_id,
false,
clause, restore);
528void Proof::add_derived_clause () {
529 LOG (clause,
"PROOF adding derived external clause (redundant: %d)",
532 for (
auto &tracer : tracers) {
533 tracer->add_derived_clause (clause_id, redundant, clause, proof_chain);
535 proof_chain.clear ();
540void Proof::delete_clause () {
541 LOG (clause,
"PROOF deleting external clause");
542 for (
auto &tracer : tracers) {
543 tracer->delete_clause (clause_id, redundant, clause);
549void Proof::demote_clause () {
550 LOG (clause,
"PROOF demoting external clause");
552 for (
auto &tracer : tracers) {
553 tracer->demote_clause (clause_id, clause);
559void Proof::weaken_minus () {
560 LOG (clause,
"PROOF marking as clause to restore");
561 for (
auto &tracer : tracers) {
562 tracer->weaken_minus (clause_id, clause);
568void Proof::strengthen () {
569 LOG (
"PROOF strengthen clause with id %" PRId64, clause_id);
570 for (
auto &tracer : tracers) {
571 tracer->strengthen (clause_id);
576void Proof::finalize_clause () {
577 for (
auto &tracer : tracers) {
578 tracer->finalize_clause (clause_id, clause);
584void Proof::add_assumption_clause () {
585 LOG (clause,
"PROOF adding assumption clause");
586 for (
auto &tracer : tracers) {
587 tracer->add_assumption_clause (clause_id, clause, proof_chain);
589 proof_chain.clear ();
594void Proof::add_assumption () {
595 LOG (clause,
"PROOF adding assumption");
597 for (
auto &tracer : tracers) {
598 tracer->add_assumption (clause.back ());
603void Proof::add_constraint () {
604 LOG (clause,
"PROOF adding constraint");
605 for (
auto &tracer : tracers) {
606 tracer->add_constraint (clause);
612 LOG (
"PROOF reset assumptions");
613 for (
auto &tracer : tracers) {
614 tracer->reset_assumptions ();
619 LOG (
"PROOF reporting status %d", status);
620 for (
auto &tracer : tracers) {
621 tracer->report_status (status,
id);
626 LOG (clause,
"PROOF begin proof");
627 for (
auto &tracer : tracers) {
628 tracer->begin_proof (
id);
633 LOG (clause,
"PROOF solve query");
634 for (
auto &tracer : tracers) {
635 tracer->solve_query ();
641 LOG (clause,
"PROOF conclude unsat");
642 for (
auto &tracer : tracers) {
643 tracer->conclude_unsat (con, conclusion);
648 LOG (clause,
"PROOF conclude sat");
649 for (
auto &tracer : tracers) {
650 tracer->conclude_sat (model);
655 LOG (clause,
"PROOF conclude unknown");
656 for (
auto &tracer : tracers) {
657 tracer->conclude_unknown (trail);
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
void disconnect(Tracer *t)
void finalize_unit(int64_t, int)
void delete_unit_clause(int64_t id, const int lit)
void conclude_unknown(const vector< int > &trace)
void weaken_plus(int64_t, const vector< int > &)
void strengthen_clause(Clause *, int, const vector< int64_t > &)
void begin_proof(int64_t)
void delete_external_original_clause(int64_t, bool, const vector< int > &)
void finalize_external_unit(int64_t, int)
void otfs_strengthen_clause(Clause *, const vector< int > &, const vector< int64_t > &)
void add_derived_unit_clause(int64_t, int unit, const vector< int64_t > &)
void report_status(int, int64_t)
void add_derived_empty_clause(int64_t, const vector< int64_t > &)
void flush_clause(Clause *)
void conclude_sat(const vector< int > &model)
void conclude_unsat(ConclusionType, const vector< int64_t > &)
void add_external_original_clause(int64_t, bool, const vector< int > &, bool restore=false)
virtual void connect_internal(Internal *)
void flush_trace(bool stats=false)
vector< StatTracer * > stat_tracers
void new_proof_on_demand()
vector< int64_t > unit_clauses_idx
void close_trace(bool stats=false)
vector< Tracer * > tracers
bool disconnect_proof_tracer(Tracer *tracer)
void resize_unit_clauses_idx()
void connect_proof_tracer(Tracer *tracer, bool antecedents, bool finalize_clauses=false)
vector< FileTracer * > file_tracers