@@ -73,8 +73,8 @@ std::vector<exprt> construct_terminals(const std::set<symbol_exprt> &symbols)
73
73
unary_exprt (ID_loop_entry, e, e.type ()), size_type ()));
74
74
}
75
75
}
76
- result.push_back (from_integer (1 , unsigned_int_type ()));
77
- result.push_back (from_integer (1 , unsigned_long_int_type ()));
76
+ result.push_back (from_integer (1 , signed_short_int_type ()));
77
+ result.push_back (from_integer (0 , signed_short_int_type ()));
78
78
return result;
79
79
}
80
80
@@ -310,8 +310,11 @@ exprt enumerative_loop_contracts_synthesizert::synthesize_strengthening_clause(
310
310
invariant_mapt new_in_clauses = invariant_mapt (in_invariant_clause_map);
311
311
new_in_clauses[cause_loop_id] =
312
312
and_exprt (new_in_clauses[cause_loop_id], strengthening_candidate);
313
+ invariant_mapt new_pos_clauses = invariant_mapt (pos_invariant_clause_map);
314
+ new_pos_clauses[cause_loop_id] =
315
+ and_exprt (new_pos_clauses[cause_loop_id], strengthening_candidate);
313
316
const auto &combined_invariant = combine_in_and_post_invariant_clauses (
314
- new_in_clauses, pos_invariant_clause_map , neg_guards);
317
+ new_in_clauses, new_pos_clauses , neg_guards);
315
318
316
319
// The verifier we use to check current invariant candidates.
317
320
cegis_verifiert verifier (
@@ -326,7 +329,9 @@ exprt enumerative_loop_contracts_synthesizert::synthesize_strengthening_clause(
326
329
(verifier.properties .at (violation_id).status !=
327
330
property_statust::FAIL &&
328
331
return_cex->violation_type !=
329
- cext::violation_typet::cex_not_hold_upon_entry))
332
+ cext::violation_typet::cex_not_hold_upon_entry &&
333
+ return_cex->violation_type !=
334
+ cext::violation_typet::cex_not_preserved))
330
335
{
331
336
return strengthening_candidate;
332
337
}
@@ -374,6 +379,17 @@ invariant_mapt enumerative_loop_contracts_synthesizert::synthesize_all()
374
379
synthesize_same_object_predicate (return_cex->checked_pointer );
375
380
break ;
376
381
382
+ case cext::violation_typet::cex_assignable:
383
+ synthesize_assigns (
384
+ return_cex->checked_pointer , return_cex->cause_loop_ids );
385
+ break ;
386
+
387
+ case cext::violation_typet::cex_other:
388
+ // Update the dependent symbols.
389
+ dependent_symbols = compute_dependent_symbols (
390
+ return_cex->cause_loop_ids .front (),
391
+ new_invariant_clause,
392
+ return_cex->live_variables );
377
393
case cext::violation_typet::cex_not_preserved:
378
394
terminal_symbols = construct_terminals (dependent_symbols);
379
395
new_invariant_clause = synthesize_strengthening_clause (
@@ -382,12 +398,7 @@ invariant_mapt enumerative_loop_contracts_synthesizert::synthesize_all()
382
398
verifier.target_violation_id );
383
399
break ;
384
400
385
- case cext::violation_typet::cex_assignable:
386
- synthesize_assigns (
387
- return_cex->checked_pointer , return_cex->cause_loop_ids );
388
- break ;
389
401
case cext::violation_typet::cex_not_hold_upon_entry:
390
- case cext::violation_typet::cex_other:
391
402
INVARIANT (false , " unsupported violation type" );
392
403
break ;
393
404
}
0 commit comments