@@ -108,7 +108,6 @@ void axiomst::live_object_fc()
108108 {
109109 if (a_it->state () != b_it->state ())
110110 continue ;
111- auto a_op = a_it->address ();
112111 auto operands_equal = same_object (a_it->address (), b_it->address ());
113112 auto implication =
114113 implies_exprt (operands_equal, equal_exprt (*a_it, *b_it));
@@ -118,6 +117,27 @@ void axiomst::live_object_fc()
118117 }
119118}
120119
120+ void axiomst::is_dynamic_object_fc ()
121+ {
122+ // quadratic
123+ for (auto a_it = is_dynamic_object_exprs.begin ();
124+ a_it != is_dynamic_object_exprs.end ();
125+ a_it++)
126+ {
127+ for (auto b_it = std::next (a_it); b_it != is_dynamic_object_exprs.end ();
128+ b_it++)
129+ {
130+ if (a_it->state () != b_it->state ())
131+ continue ;
132+ auto operands_equal = same_object (a_it->address (), b_it->address ());
133+ auto implication =
134+ implies_exprt (operands_equal, equal_exprt (*a_it, *b_it));
135+ std::cout << " IS_DYNAMIC_OBJECT: " << format (implication) << ' \n ' ;
136+ dest << replace (implication);
137+ }
138+ }
139+ }
140+
121141void axiomst::object_size ()
122142{
123143 for (const auto &src : object_size_exprs)
@@ -182,6 +202,7 @@ exprt axiomst::replace(exprt src)
182202
183203 if (
184204 src.id () == ID_evaluate || src.id () == ID_state_is_cstring ||
205+ src.id () == ID_state_is_dynamic_object ||
185206 src.id () == ID_state_object_size || src.id () == ID_state_live_object ||
186207 src.id () == ID_state_r_ok || src.id () == ID_state_w_ok ||
187208 src.id () == ID_state_rw_ok || src.id () == ID_allocate)
@@ -275,6 +296,11 @@ void axiomst::node(const exprt &src)
275296 dest << instance;
276297 }
277298 }
299+ else if (src.id () == ID_state_is_dynamic_object)
300+ {
301+ const auto &is_dynamic_object_expr = to_state_is_dynamic_object_expr (src);
302+ is_dynamic_object_exprs.insert (is_dynamic_object_expr);
303+ }
278304 else if (src.id () == ID_allocate)
279305 {
280306 const auto &allocate_expr = to_allocate_expr (src);
@@ -299,10 +325,19 @@ void axiomst::node(const exprt &src)
299325
300326 // pointer_offset(allocate(ς, s)) = 0
301327 auto pointer_offset_expr = pointer_offset (allocate_expr);
328+ // pointer_offset_exprs.insert(pointer_offset_expr);
302329 auto instance3 =
303330 replace (equal_exprt (pointer_offset_expr, from_integer (0 , pointer_offset_expr.type ())));
304331 std::cout << " ALLOCATE3: " << format (instance3) << " \n " ;
305332 dest << instance3;
333+
334+ // is_dynamic_object(ς, allocate(ς, s))
335+ auto is_dynamic_object_expr =
336+ state_is_dynamic_object_exprt (allocate_expr.state (), allocate_expr);
337+ is_dynamic_object_exprs.insert (is_dynamic_object_expr);
338+ auto instance4 = replace (is_dynamic_object_expr);
339+ std::cout << " ALLOCATE4: " << format (instance4) << " \n " ;
340+ dest << instance4;
306341 }
307342 else if (src.id () == ID_deallocate_state)
308343 {
@@ -407,4 +442,5 @@ void axiomst::emit()
407442 ok_fc ();
408443 live_object_fc ();
409444 object_size_fc ();
445+ is_dynamic_object_fc ();
410446}
0 commit comments