Skip to content

Commit

Permalink
revert change to setup_context that delays it until there are assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Dec 21, 2024
1 parent db9f45d commit da6a5fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/smt/smt_consequences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ namespace smt {
lbool context::preferred_sat(expr_ref_vector const& asms, vector<expr_ref_vector>& cores) {
pop_to_base_lvl();
cores.reset();
setup_context(false, !asms.empty());
setup_context(false);
internalize_assertions();
if (m_asserted_formulas.inconsistent() || inconsistent()) {
return l_false;
Expand Down
17 changes: 7 additions & 10 deletions src/smt/smt_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ namespace smt {
dst_ctx.assert_expr(fml1);
}

dst_ctx.setup_context(dst_ctx.m_fparams.m_auto_config, true);
dst_ctx.setup_context(dst_ctx.m_fparams.m_auto_config);
dst_ctx.internalize_assertions();

dst_ctx.copy_user_propagator(src_ctx, true);
Expand Down Expand Up @@ -2908,7 +2908,7 @@ namespace smt {
user_propagator::push_eh_t& push_eh,
user_propagator::pop_eh_t& pop_eh,
user_propagator::fresh_eh_t& fresh_eh) {
setup_context(false, true);
setup_context(false);
m_user_propagator = alloc(theory_user_propagator, *this);
m_user_propagator->add(ctx, push_eh, pop_eh, fresh_eh);
for (unsigned i = m_scopes.size(); i-- > 0; )
Expand Down Expand Up @@ -3004,7 +3004,7 @@ namespace smt {

void context::push() {
pop_to_base_lvl();
setup_context(false, false);
setup_context(false);
bool was_consistent = !inconsistent();
try {
internalize_assertions(); // internalize assertions before invoking m_asserted_formulas.push_scope
Expand Down Expand Up @@ -3611,7 +3611,7 @@ namespace smt {
if (!check_preamble(reset_cancel)) return l_undef;
SASSERT(m_scope_lvl == 0);
SASSERT(!m_setup.already_configured());
setup_context(m_fparams.m_auto_config, false);
setup_context(m_fparams.m_auto_config);

if (m_fparams.m_threads > 1 && !m.has_trace_stream()) {
parallel p(*this);
Expand Down Expand Up @@ -3644,10 +3644,7 @@ namespace smt {
return CFG_LOGIC;
}

void context::setup_context(bool use_static_features, bool has_assumptions) {
unsigned nf = m_asserted_formulas.get_num_formulas();
if (nf == 0 && !has_assumptions)
return;
void context::setup_context(bool use_static_features) {
if (m_setup.already_configured() || inconsistent()) {
m_relevancy_lvl = std::min(m_fparams.m_relevancy_lvl, m_relevancy_lvl);
return;
Expand Down Expand Up @@ -3680,7 +3677,7 @@ namespace smt {
lbool context::check(unsigned num_assumptions, expr * const * assumptions, bool reset_cancel) {
if (!check_preamble(reset_cancel)) return l_undef;
SASSERT(at_base_level());
setup_context(false, num_assumptions > 0);
setup_context(false);
if (m_fparams.m_threads > 1 && !m.has_trace_stream()) {
expr_ref_vector asms(m, num_assumptions, assumptions);
parallel p(*this);
Expand Down Expand Up @@ -3710,7 +3707,7 @@ namespace smt {
lbool context::check(expr_ref_vector const& cube, vector<expr_ref_vector> const& clauses) {
if (!check_preamble(true)) return l_undef;
TRACE("before_search", display(tout););
setup_context(false, !cube.empty() || !clauses.empty());
setup_context(false);
lbool r = l_undef;
do {
pop_to_base_lvl();
Expand Down
2 changes: 1 addition & 1 deletion src/smt/smt_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ namespace smt {
void init();
void flush();
config_mode get_config_mode(bool use_static_features) const;
virtual void setup_context(bool use_static_features, bool has_assumptions);
virtual void setup_context(bool use_static_features);
void setup_components();
void pop_to_base_lvl();
void pop_to_search_lvl();
Expand Down

0 comments on commit da6a5fa

Please sign in to comment.