Skip to content

Commit 6c0b581

Browse files
committed
Simplify incremental solver using CBMC's push and pop
Signed-off-by: František Nečas <[email protected]>
1 parent 032d871 commit 6c0b581

File tree

2 files changed

+5
-61
lines changed

2 files changed

+5
-61
lines changed

src/domains/incremental_solver.cpp

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,9 @@ void incremental_solvert::new_context()
2929
#endif
3030

3131
#else
32-
33-
literalt activation_literal=
34-
solver->convert(
35-
symbol_exprt(
36-
"goto_symex::\\act$"+
37-
std::to_string(activation_literal_counter++), bool_typet()));
38-
32+
solver->push();
3933
#ifdef DEBUG_OUTPUT
40-
debug() << "new context: " << activation_literal<< eom;
41-
#endif
42-
43-
activation_literals.push_back(activation_literal);
44-
solver->set_assumptions(activation_literals);
45-
46-
#if 0
47-
return !activation_literals.back(); // not to be used anymore
34+
debug() << "new context" << eom;
4835
#endif
4936
#endif
5037
}
@@ -62,45 +49,10 @@ void incremental_solvert::pop_context()
6249

6350
#else
6451

65-
assert(!activation_literals.empty());
66-
literalt activation_literal=activation_literals.back();
67-
activation_literals.pop_back();
68-
#ifndef DEBUG_FORMULA
69-
solver->set_to_false(literal_exprt(activation_literal));
70-
#else
71-
formula.push_back(!activation_literal);
72-
#endif
73-
52+
solver->pop();
7453
#ifdef DEBUG_OUTPUT
75-
debug() << "pop context: " << activation_literal << eom;
54+
debug() << "pop context" << eom;
7655
#endif
77-
78-
solver->set_assumptions(activation_literals);
79-
#endif
80-
}
81-
82-
void incremental_solvert::make_context_permanent()
83-
{
84-
#ifdef NON_INCREMENTAL
85-
assert(contexts.size()>=2);
86-
contextst::iterator c_it=contexts.end(); c_it--; c_it--;
87-
c_it->insert(c_it->end(), contexts.back().begin(), contexts.back().end());
88-
contexts.pop_back();
89-
#else
90-
assert(!activation_literals.empty());
91-
literalt activation_literal=activation_literals.back();
92-
activation_literals.pop_back();
93-
#ifndef DEBUG_FORMULA
94-
solver->set_to_true(literal_exprt(activation_literal));
95-
#else
96-
formula.push_back(activation_literal);
97-
#endif
98-
99-
#ifdef DEBUG_OUTPUT
100-
debug() << "make context permanent: " << activation_literal<< eom;
101-
#endif
102-
103-
solver->set_assumptions(activation_literals);
10456
#endif
10557
}
10658

src/domains/incremental_solver.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,11 @@ class incremental_solvert:public messaget
126126

127127
void new_context();
128128
void pop_context();
129-
void make_context_permanent();
130129

131130
// for debugging
132131
bvt formula;
133132
void debug_add_to_formula(const exprt &expr);
134133

135-
// context assumption literals
136-
bvt activation_literals;
137-
138134
// non-incremental solving
139135
contextst contexts;
140136

@@ -192,11 +188,7 @@ static inline incremental_solvert &operator<<(
192188
dest.contexts.back().push_back(src);
193189
#else
194190
#ifndef DEBUG_FORMULA
195-
if(!dest.activation_literals.empty())
196-
*dest.solver <<
197-
or_exprt(src, literal_exprt(!dest.activation_literals.back()));
198-
else
199-
*dest.solver << src;
191+
*dest.solver << src;
200192
#else
201193
if(!dest.activation_literals.empty())
202194
{

0 commit comments

Comments
 (0)