CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
enumerative_loop_contracts_synthesizer.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Enumerative Loop Contracts Synthesizer
4
5Author: Qinheping Hu
6
7\*******************************************************************/
8
11
12// NOLINTNEXTLINE(whitespace/line_length)
13#ifndef CPROVER_GOTO_SYNTHESIZER_ENUMERATIVE_LOOP_CONTRACTS_SYNTHESIZER_H
14// NOLINTNEXTLINE(whitespace/line_length)
15#define CPROVER_GOTO_SYNTHESIZER_ENUMERATIVE_LOOP_CONTRACTS_SYNTHESIZER_H
16
17#include <util/options.h>
18
19#include "cegis_verifier.h"
21
22class messaget;
23class goto_modelt;
24
32{
33public:
44
48 exprt synthesize(loop_idt loop_id) override;
49
50 std::map<loop_idt, std::set<exprt>> get_assigns_map() const
51 {
52 return assigns_map;
53 }
54
57
58private:
60 void init_candidates();
61
64 void build_tmp_post_map();
65
68 std::set<symbol_exprt> compute_dependent_symbols(
70 const exprt &new_clause,
71 const std::set<exprt> &live_vars);
72
74 exprt synthesize_range_predicate(const exprt &violated_predicate);
75
78 exprt synthesize_same_object_predicate(const exprt &checked_pointer);
79
82 const std::vector<exprt> terminal_symbols,
85 const std::vector<cext> &cexs);
86
89 const exprt &checked_pointer,
90 const std::list<loop_idt> cause_loop_ids);
91
97
99 std::map<loop_idt, std::set<exprt>> assigns_map;
100
102 std::unordered_map<exprt, exprt, irep_hash> tmp_post_map;
103
106};
107
108// NOLINTNEXTLINE(whitespace/line_length)
109#endif // CPROVER_GOTO_SYNTHESIZER_ENUMERATIVE_LOOP_CONTRACTS_SYNTHESIZER_H
Verifier for Counterexample-Guided Synthesis.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
std::map< loop_idt, std::set< exprt > > get_assigns_map() const
std::map< loop_idt, std::set< exprt > > assigns_map
Synthesized assigns clauses.
invariant_mapt synthesize_all() override
This synthesizer guarantees that, with the synthesized loop contracts, all checks in the annotated GO...
exprt synthesize(loop_idt loop_id) override
Synthesize loop invariant for a specified loop in the goto_model.
exprt synthesize_range_predicate(const exprt &violated_predicate)
Synthesize range predicate for OOB violation with violated_predicate.
const symbol_tablet original_symbol_table
Symbol table of the input goto model.
enumerative_loop_contracts_synthesizert(goto_modelt &goto_model, const optionst &options, messaget &log)
std::set< symbol_exprt > compute_dependent_symbols(const loop_idt &cause_loop_id, const exprt &new_clause, const std::set< exprt > &live_vars)
Compute the dependent symbols for a loop with invariant-not-preserved violation which happen after ne...
invariant_mapt in_invariant_clause_map
Synthesize invariant of form (in_inv || !guard) && (!guard -> pos_inv)
void build_tmp_post_map()
Scan all ASSIGN instructions to build the map from tmp_post variables to their original variables.
std::unordered_map< exprt, exprt, irep_hash > tmp_post_map
Map from tmp_post variables to their original variables.
void init_candidates()
Initialize invariants as true for all unannotated loops.
void synthesize_assigns(const exprt &checked_pointer, const std::list< loop_idt > cause_loop_ids)
Synthesize assigns target and update assigns_map.
exprt synthesize_strengthening_clause(const std::vector< exprt > terminal_symbols, const loop_idt &cause_loop_id, const irep_idt &violation_id, const std::vector< cext > &cexs)
Synthesize strengthening clause for invariant-not-preserved violation.
exprt synthesize_same_object_predicate(const exprt &checked_pointer)
Synthesize same object predicate for null-pointer violation for checked_pointer.
Base class for all expressions.
Definition expr.h:56
A base class for loop contracts synthesizers.
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
The symbol table.
Loop Contracts Synthesizer Interface.
Options.
Loop id used to identify loops.
Definition loop_ids.h:28
std::map< loop_idt, exprt > invariant_mapt
Definition utils.h:32