@@ -293,7 +293,7 @@ void theory_user_propagator::pop_scope_eh(unsigned num_scopes) {
293
293
}
294
294
295
295
bool theory_user_propagator::can_propagate () {
296
- return m_qhead < m_prop.size () || m_to_add_qhead < m_to_add.size ();
296
+ return m_qhead < m_prop.size () || m_to_add_qhead < m_to_add.size () || m_replay_qhead < m_clauses_to_replay. size () ;
297
297
}
298
298
299
299
void theory_user_propagator::propagate_consequence (prop_info const & prop) {
@@ -321,12 +321,10 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) {
321
321
ctx.set_conflict (js);
322
322
}
323
323
else {
324
- #if 1
325
324
for (auto & lit : m_lits)
326
325
lit.neg ();
327
326
for (auto const & [a,b] : m_eqs)
328
327
m_lits.push_back (~mk_eq (a->get_expr (), b->get_expr(), false));
329
- #endif
330
328
331
329
literal lit;
332
330
if (has_quantifiers(prop.m_conseq)) {
@@ -340,19 +338,17 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) {
340
338
lit = mk_literal (prop.m_conseq );
341
339
ctx.mark_as_relevant (lit);
342
340
343
- #if 0
344
- justification* js =
345
- ctx.mk_justification(
346
- ext_theory_propagation_justification(
347
- get_id(), ctx, m_lits.size(), m_lits.data(), m_eqs.size(), m_eqs.data(), lit));
348
-
349
- ctx.assign(lit, js);
350
- #endif
351
-
352
- #if 1
353
341
m_lits.push_back (lit);
354
- ctx.mk_th_lemma (get_id (), m_lits);
355
- #endif
342
+ if (ctx.get_fparams ().m_up_persist_clauses ) {
343
+ ctx.mk_th_axiom (get_id (), m_lits);
344
+ expr_ref_vector clause (m);
345
+ for (auto lit : m_lits)
346
+ clause.push_back (ctx.literal2expr (lit));
347
+ m_clauses_to_replay.push_back (clause);
348
+ }
349
+ else {
350
+ ctx.mk_th_lemma (get_id (), m_lits);
351
+ }
356
352
TRACE (" user_propagate" , ctx.display (tout););
357
353
}
358
354
}
@@ -363,12 +359,20 @@ void theory_user_propagator::propagate_new_fixed(prop_info const& prop) {
363
359
364
360
365
361
void theory_user_propagator::propagate () {
366
- if (m_qhead == m_prop.size () && m_to_add_qhead == m_to_add.size ())
362
+ if (m_qhead == m_prop.size () && m_to_add_qhead == m_to_add.size () && m_replay_qhead == m_clauses_to_replay. size () )
367
363
return ;
368
364
TRACE (" user_propagate" , tout << " propagating queue head: " << m_qhead << " prop queue: " << m_prop.size () << " \n " );
369
365
force_push ();
370
366
371
- unsigned qhead = m_to_add_qhead;
367
+ unsigned qhead = m_replay_qhead;
368
+ if (qhead < m_clauses_to_replay.size ()) {
369
+ for (; qhead < m_clauses_to_replay.size () && !ctx.inconsistent (); ++qhead)
370
+ replay_clause (m_clauses_to_replay.get (qhead));
371
+ ctx.push_trail (value_trail<unsigned >(m_replay_qhead));
372
+ m_replay_qhead = qhead;
373
+ }
374
+
375
+ qhead = m_to_add_qhead;
372
376
if (qhead < m_to_add.size ()) {
373
377
for (; qhead < m_to_add.size (); ++qhead)
374
378
add_expr (m_to_add.get (qhead), true );
@@ -391,6 +395,13 @@ void theory_user_propagator::propagate() {
391
395
}
392
396
393
397
398
+ void theory_user_propagator::replay_clause (expr_ref_vector const & clause) {
399
+ m_lits.reset ();
400
+ for (expr* e : clause)
401
+ m_lits.push_back (mk_literal (e));
402
+ ctx.mk_th_axiom (get_id (), m_lits);
403
+ }
404
+
394
405
bool theory_user_propagator::internalize_atom (app* atom, bool gate_ctx) {
395
406
return internalize_term (atom);
396
407
}
0 commit comments