@@ -13,6 +13,7 @@ Author: Qinheping Hu
13
13
14
14
#include < util/arith_tools.h>
15
15
#include < util/c_types.h>
16
+ #include < util/expr_iterator.h>
16
17
#include < util/find_symbols.h>
17
18
#include < util/format_expr.h>
18
19
#include < util/pointer_predicates.h>
@@ -31,6 +32,21 @@ Author: Qinheping Hu
31
32
32
33
#include < iostream>
33
34
35
+ static bool contains_tmp_symbol (const exprt &expr)
36
+ {
37
+ for (auto it = expr.depth_begin (), itend = expr.depth_end (); it != itend; ++it)
38
+ {
39
+ if (
40
+ it->id () == ID_symbol &&
41
+ id2string (to_symbol_expr (*it).get_identifier ()).find (" $tmp::" ) !=
42
+ std::string::npos)
43
+ {
44
+ return true ;
45
+ }
46
+ }
47
+ return false ;
48
+ }
49
+
34
50
// substitute all tmp_post variables with their origins in `expr`
35
51
void replace_tmp_post (
36
52
exprt &dest,
@@ -257,8 +273,11 @@ enumerative_loop_contracts_synthesizert::compute_dependent_symbols(
257
273
// the original symbol table.
258
274
for (auto it = result.begin (); it != result.end ();)
259
275
{
260
- if (original_symbol_table.lookup (it->get_identifier ()) == nullptr )
276
+ if (
277
+ contains_tmp_symbol (*it) ||
278
+ original_symbol_table.lookup (it->get_identifier ()) == nullptr )
261
279
{
280
+ std::cout << format (*it) << " erased\n " ;
262
281
it = result.erase (it);
263
282
}
264
283
else
@@ -323,7 +342,8 @@ exprt enumerative_loop_contracts_synthesizert::synthesize_strengthening_clause(
323
342
ID_plus,
324
343
start_ph,
325
344
start_ph,
326
- [](const partitiont &partition) {
345
+ [](const partitiont &partition)
346
+ {
327
347
if (partition.size () <= 1 )
328
348
return true ;
329
349
return partition.front () == 1 ;
@@ -376,13 +396,11 @@ exprt enumerative_loop_contracts_synthesizert::synthesize_strengthening_clause(
376
396
new_in_clauses, new_pos_clauses, neg_guards);
377
397
378
398
log .progress () << " Verifying candidate: "
379
- << format (combined_invariant.at (cause_loop_id))
380
- << messaget::eom;
399
+ << format (strengthening_candidate) << messaget::eom;
381
400
382
401
// Quick filter:
383
402
// Rule out a candidate if its evaluation is inconsistent with examples.
384
- cegis_evaluator evaluator (
385
- combined_invariant.at (cause_loop_id), cexs, log );
403
+ cegis_evaluator evaluator (strengthening_candidate, cexs, log );
386
404
count_all++;
387
405
if (!evaluator.evaluate ())
388
406
{
0 commit comments