Skip to content

Commit 786f797

Browse files
authored
Merge pull request #3640 from diffblue/smt2-bound-symbols
smt2: fix exists/forall
2 parents 9f1aa87 + e70471b commit 786f797

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

scripts/delete_failing_smt2_solver_tests

-3
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ rm Pointer_byte_extract9/test.desc
5353
rm Promotion3/test.desc
5454
rm Quantifiers-assertion/test.desc
5555
rm Quantifiers-assignment/test.desc
56-
rm Quantifiers-if/test.desc
57-
rm Quantifiers-initialisation2/test.desc
5856
rm Quantifiers-invalid-var-range/test.desc
59-
rm Quantifiers-not/test.desc
6057
rm Quantifiers-type/test.desc
6158
rm Struct_Bytewise2/test.desc
6259
rm Union_Initialization1/test.desc

src/solvers/smt2/smt2_conv.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -4175,6 +4175,19 @@ void smt2_convt::find_symbols(const exprt &expr)
41754175
// recursive call on type
41764176
find_symbols(expr.type());
41774177

4178+
if(expr.id() == ID_exists || expr.id() == ID_forall)
4179+
{
4180+
// do not declare the quantified symbol, but record
4181+
// as 'bound symbol'
4182+
const auto &q_expr = to_quantifier_expr(expr);
4183+
const auto identifier = q_expr.symbol().get_identifier();
4184+
identifiert &id = identifier_map[identifier];
4185+
id.type = q_expr.symbol().type();
4186+
id.is_bound = true;
4187+
find_symbols(q_expr.where());
4188+
return;
4189+
}
4190+
41784191
// recursive call on operands
41794192
forall_operands(it, expr)
41804193
find_symbols(*it);

src/solvers/smt2/smt2_conv.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,11 @@ class smt2_convt:public prop_convt
284284
// keeps track of all non-Boolean symbols and their value
285285
struct identifiert
286286
{
287+
bool is_bound;
287288
typet type;
288289
exprt value;
289290

290-
identifiert()
291+
identifiert() : is_bound(false)
291292
{
292293
type.make_nil();
293294
value.make_nil();

0 commit comments

Comments
 (0)