23 if(invariant.
id() == ID_and)
25 for(
const auto &conjunct :
to_and_expr(invariant).operands())
37 if(invariant.
id() == ID_and)
39 for(
const auto &conjunct :
to_and_expr(invariant).operands())
51 if(obligation.
id() == ID_and)
53 for(
const auto &conjunct :
to_and_expr(obligation).operands())
67 for(std::size_t i = 0; i < frames.size(); i++)
73 std::vector<framet>
setup_frames(
const std::vector<exprt> &constraints)
75 std::set<symbol_exprt> states_set;
76 std::vector<framet> frames;
78 for(
auto &c : constraints)
80 auto &location = c.source_location();
82 auto insert_result = states_set.insert(s);
83 if(insert_result.second)
84 frames.emplace_back(s, location,
frame_reft(frames.size()));
92 const std::vector<exprt> &constraints,
93 std::vector<framet> &frames)
97 for(
const auto &c : constraints)
101 if(c.id() == ID_forall &&
to_forall_expr(c).where().
id() == ID_implies)
112 auto s_it = frame_map.find(rhs_symbol);
113 if(s_it != frame_map.end())
115 frames[s_it->second.index].implications.emplace_back(
126 auto entry = frame_map.find(frame_symbol);
128 if(entry == frame_map.end())
131 return entry->second;
135 const std::vector<exprt> &constraints,
136 const std::vector<framet> &frames)
139 std::vector<propertyt> properties;
141 for(
const auto &c : constraints)
144 if(c.id() == ID_forall &&
to_forall_expr(c).where().
id() == ID_implies)
156 auto lhs_frame =
find_frame(frame_map, lhs_symbol);
157 properties.emplace_back(
158 c.source_location(), lhs_frame,
implication.rhs());
173 const std::vector<framet> &frames,
178 for(
const auto &f : frames)
180 std::cout <<
"FRAME: " <<
format(f.symbol) <<
'\n';
184 for(
auto &c : f.implications)
186 std::cout <<
" implication: ";
194 for(
auto &i : f.invariants)
195 std::cout <<
" invariant: " <<
format(i) <<
'\n';
197 for(
auto &i : f.obligations)
198 std::cout <<
" obligation: " <<
format(i) <<
'\n';
200 for(
auto &i : f.auxiliaries)
201 std::cout <<
" auxiliary: " <<
format(i) <<
'\n';
204 if(property.
frame == f.ref)
Base class for all expressions.
std::unordered_set< exprt, irep_hash > invariants_set
std::vector< exprt > obligations
std::unordered_set< exprt, irep_hash > auxiliaries_set
void add_invariant(exprt)
void add_auxiliary(exprt)
std::unordered_set< exprt, irep_hash > obligations_set
std::vector< exprt > auxiliaries
void add_obligation(exprt)
std::vector< exprt > invariants
const irep_idt & id() const
Expression to hold a symbol (variable)
void free_symbols(const exprt &expr, const std::function< void(const symbol_exprt &)> &f)
static exprt implication(exprt lhs, exprt rhs)
const function_application_exprt & to_function_application_expr(const exprt &expr)
Cast an exprt to a function_application_exprt.
const forall_exprt & to_forall_expr(const exprt &expr)
frame_reft find_frame(const frame_mapt &frame_map, const symbol_exprt &frame_symbol)
std::vector< propertyt > find_properties(const std::vector< exprt > &constraints, const std::vector< framet > &frames)
frame_mapt build_frame_map(const std::vector< framet > &frames)
void find_implications(const std::vector< exprt > &constraints, std::vector< framet > &frames)
std::vector< framet > setup_frames(const std::vector< exprt > &constraints)
exprt property_predicate(const implies_exprt &src)
void dump(const std::vector< framet > &frames, const propertyt &property, bool values, bool implications)
std::unordered_map< symbol_exprt, frame_reft, irep_hash > frame_mapt
#define PRECONDITION(CONDITION)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const and_exprt & to_and_expr(const exprt &expr)
Cast an exprt to a and_exprt.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.