CBMC
enumerative_loop_invariant_synthesizer.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Enumerative Loop Invariant Synthesizer
4 
5 Author: Qinheping Hu
6 
7 \*******************************************************************/
8 
11 
13 
15 {
16  for(auto &function_p : goto_model.goto_functions.function_map)
17  {
18  natural_loopst natural_loops;
19  natural_loops(function_p.second.body);
20 
21  // Initialize invariants for unannotated loops as true
22  for(const auto &loop_head_and_content : natural_loops.loop_map)
23  {
26  loop_head_and_content.first, loop_head_and_content.second);
27 
28  loop_idt new_id(function_p.first, loop_end->loop_number);
29 
30  // we only synthesize invariants for unannotated loops
31  if(loop_end->condition().find(ID_C_spec_loop_invariant).is_nil())
32  {
34  }
35  }
36  }
37 }
38 
40 {
42 
43  // Now this method only generate true for all unnotated loops.
44  // The implementation will be added later.
46 }
47 
49 {
50  return true_exprt();
51 }
enumerative_loop_invariant_synthesizert::synthesize
exprt synthesize(loop_idt loop_id) override
Synthesize loop invariant for a specified loop in the goto_model.
Definition: enumerative_loop_invariant_synthesizer.cpp:48
exprt
Base class for all expressions.
Definition: expr.h:55
enumerative_loop_invariant_synthesizert::synthesize_all
invariant_mapt synthesize_all() override
This synthesizer guarantees that, with the synthesized loop invariants, all checks in the annotated G...
Definition: enumerative_loop_invariant_synthesizer.cpp:39
get_loop_end_from_loop_head_and_content
goto_programt::const_targett get_loop_end_from_loop_head_and_content(const goto_programt::const_targett &loop_head, const loop_templatet< goto_programt::const_targett > &loop)
Definition: synthesizer_utils.cpp:11
goto_functionst::function_map
function_mapt function_map
Definition: goto_functions.h:29
natural_loopst
A concretized version of natural_loops_templatet<const goto_programt, goto_programt::const_targett>
Definition: natural_loops.h:83
invariant_mapt
std::map< loop_idt, exprt > invariant_mapt
Definition: synthesizer_utils.h:19
goto_modelt::goto_functions
goto_functionst goto_functions
GOTO functions.
Definition: goto_model.h:33
enumerative_loop_invariant_synthesizer.h
enumerative_loop_invariant_synthesizert::invariant_candiate_map
invariant_mapt invariant_candiate_map
Definition: enumerative_loop_invariant_synthesizer.h:48
goto_programt::const_targett
instructionst::const_iterator const_targett
Definition: goto_program.h:587
loop_invariant_synthesizer_baset::goto_model
const goto_modelt & goto_model
Definition: loop_invariant_synthesizer_base.h:51
true_exprt
The Boolean constant true.
Definition: std_expr.h:3007
loop_idt
Loop id used to identify loops.
Definition: loop_ids.h:27
loop_analysist::loop_map
loop_mapt loop_map
Definition: loop_analysis.h:88
enumerative_loop_invariant_synthesizert::init_candidates
void init_candidates()
Initialize invariants as true for all unannotated loops.
Definition: enumerative_loop_invariant_synthesizer.cpp:14