@@ -22,7 +22,6 @@ Author: Daniel Kroening, dkr@amazon.com
2222#include " bv_pointers_wide.h"
2323#include " console.h"
2424#include " counterexample_found.h"
25- #include " free_symbols.h"
2625#include " propagate.h"
2726#include " report_properties.h"
2827#include " report_traces.h"
@@ -35,171 +34,6 @@ Author: Daniel Kroening, dkr@amazon.com
3534#include < map>
3635#include < set>
3736
38- frame_mapt build_frame_map (const std::vector<framet> &frames)
39- {
40- frame_mapt frame_map;
41-
42- for (std::size_t i = 0 ; i < frames.size (); i++)
43- frame_map[frames[i].symbol ] = frame_reft (i);
44-
45- return frame_map;
46- }
47-
48- void framet::add_invariant (exprt invariant)
49- {
50- if (invariant.id () == ID_and)
51- {
52- for (const auto &conjunct : to_and_expr (invariant).operands ())
53- add_invariant (conjunct);
54- }
55- else
56- invariants.push_back (std::move (invariant));
57- }
58-
59- void framet::add_auxiliary (exprt invariant)
60- {
61- if (invariant.id () == ID_and)
62- {
63- for (const auto &conjunct : to_and_expr (invariant).operands ())
64- add_auxiliary (conjunct);
65- }
66- else
67- auxiliaries.push_back (std::move (invariant));
68- }
69-
70- std::vector<framet> setup_frames (const std::vector<exprt> &constraints)
71- {
72- std::set<symbol_exprt> states_set;
73- std::vector<framet> frames;
74-
75- for (auto &c : constraints)
76- {
77- auto &location = c.source_location ();
78- free_symbols (c, [&states_set, &location, &frames](const symbol_exprt &s) {
79- auto insert_result = states_set.insert (s);
80- if (insert_result.second )
81- frames.emplace_back (s, location, frame_reft (frames.size ()));
82- });
83- }
84-
85- return frames;
86- }
87-
88- void find_implications (
89- const std::vector<exprt> &constraints,
90- std::vector<framet> &frames)
91- {
92- const auto frame_map = build_frame_map (frames);
93-
94- for (const auto &c : constraints)
95- {
96- // look for ∀ ς : state . Sxx(ς) ⇒ Syy(...)
97- // and ∀ ς : state . Sxx(ς) ⇒ ...
98- if (c.id () == ID_forall && to_forall_expr (c).where ().id () == ID_implies)
99- {
100- auto &implication = to_implies_expr (to_forall_expr (c).where ());
101-
102- if (
103- implication.rhs ().id () == ID_function_application &&
104- to_function_application_expr (implication.rhs ()).function ().id () ==
105- ID_symbol)
106- {
107- auto &rhs_symbol = to_symbol_expr (
108- to_function_application_expr (implication.rhs ()).function ());
109- auto s_it = frame_map.find (rhs_symbol);
110- if (s_it != frame_map.end ())
111- {
112- frames[s_it->second .index ].implications .emplace_back (
113- implication.lhs (), to_function_application_expr (implication.rhs ()));
114- }
115- }
116- }
117- }
118- }
119-
120- frame_reft
121- find_frame (const frame_mapt &frame_map, const symbol_exprt &frame_symbol)
122- {
123- auto entry = frame_map.find (frame_symbol);
124-
125- if (entry == frame_map.end ())
126- PRECONDITION (false );
127-
128- return entry->second ;
129- }
130-
131- std::vector<propertyt> find_properties (
132- const std::vector<exprt> &constraints,
133- const std::vector<framet> &frames)
134- {
135- const auto frame_map = build_frame_map (frames);
136- std::vector<propertyt> properties;
137-
138- for (const auto &c : constraints)
139- {
140- // look for ∀ ς : state . Sxx(ς) ⇒ ...
141- if (c.id () == ID_forall && to_forall_expr (c).where ().id () == ID_implies)
142- {
143- auto &implication = to_implies_expr (to_forall_expr (c).where ());
144-
145- if (
146- implication.rhs ().id () != ID_function_application &&
147- implication.lhs ().id () == ID_function_application &&
148- to_function_application_expr (implication.lhs ()).function ().id () ==
149- ID_symbol)
150- {
151- auto &lhs_symbol = to_symbol_expr (
152- to_function_application_expr (implication.lhs ()).function ());
153- auto lhs_frame = find_frame (frame_map, lhs_symbol);
154- properties.emplace_back (
155- c.source_location (), lhs_frame, implication.rhs ());
156- }
157- }
158- }
159-
160- return properties;
161- }
162-
163- exprt property_predicate (const implies_exprt &src)
164- {
165- // Sxx(ς) ⇒ p(ς)
166- return src.rhs ();
167- }
168-
169- void dump (
170- const std::vector<framet> &frames,
171- const propertyt &property,
172- bool values,
173- bool implications)
174- {
175- for (const auto &f : frames)
176- {
177- std::cout << " FRAME: " << format (f.symbol ) << ' \n ' ;
178-
179- if (implications)
180- {
181- for (auto &c : f.implications )
182- {
183- std::cout << " implication: " ;
184- std::cout << format (c.lhs ) << " -> " << format (c.rhs );
185- std::cout << ' \n ' ;
186- }
187- }
188-
189- if (values)
190- {
191- for (auto &i : f.invariants )
192- std::cout << " invariant: " << format (i) << ' \n ' ;
193-
194- for (auto &i : f.auxiliaries )
195- std::cout << " auxiliary: " << format (i) << ' \n ' ;
196- }
197-
198- if (property.frame == f.ref )
199- std::cout << " property: " << format (property.condition ) << ' \n ' ;
200- }
201- }
202-
20337bool is_subsumed (
20438 const std::vector<exprt> &a1,
20539 const std::vector<exprt> &a2,
0 commit comments