@@ -251,41 +251,6 @@ static std::vector<exprt> generate_instantiations(
251
251
return lemmas;
252
252
}
253
253
254
- // / Remove functions applications and create the necessary axioms.
255
- // / \param expr: an expression possibly containing function applications
256
- // / \param generator: generator for the string constraints
257
- // / \return an expression containing no function application
258
- static void substitute_function_applications (
259
- exprt &expr,
260
- string_constraint_generatort &generator)
261
- {
262
- for (auto it = expr.depth_begin (), itend = expr.depth_end ();
263
- it != itend;) // No ++it
264
- {
265
- if (it->id () == ID_function_application)
266
- {
267
- it.mutate () =
268
- generator.add_axioms_for_function_application (
269
- to_function_application_expr (expr));
270
- it.next_sibling_or_parent ();
271
- }
272
- else
273
- ++it;
274
- }
275
- }
276
-
277
- // / Remove functions applications and create the necessary axioms.
278
- // / \param equations: vector of equations
279
- // / \param generator: generator for the string constraints
280
- // / \return vector of equations where function application have been replaced
281
- static void substitute_function_applications_in_equations (
282
- std::vector<equal_exprt> &equations,
283
- string_constraint_generatort &generator)
284
- {
285
- for (auto &eq : equations)
286
- substitute_function_applications (eq.rhs (), generator);
287
- }
288
-
289
254
// / Fill the array_pointer correspondence and replace the right hand sides of
290
255
// / the corresponding equations
291
256
static void make_char_array_pointer_associations (
@@ -680,17 +645,22 @@ decision_proceduret::resultt string_refinementt::dec_solve()
680
645
output_equations (debug (), equations, ns);
681
646
#endif
682
647
683
- debug () << " dec_solve: compute dependency graph:" << eom;
684
- for (const equal_exprt &eq : equations)
685
- add_node (dependencies, eq, generator.array_pool );
648
+ debug () << " dec_solve: compute dependency graph and remove function "
649
+ << " applications captured by the dependencies:" << eom;
650
+ const auto new_equation_end = std::remove_if (
651
+ equations.begin (), equations.end (), [&](const equal_exprt &eq) { // NOLINT
652
+ return add_node (dependencies, eq, generator.array_pool );
653
+ });
654
+ equations.erase (new_equation_end, equations.end ());
686
655
687
656
#ifdef DEBUG
688
657
dependencies.output_dot (debug ());
689
658
#endif
690
659
691
- debug () << " dec_solve: Replace function applications " << eom;
660
+ debug () << " dec_solve: add constraints " << eom;
692
661
// Generator is also used by get, that's why we use a class member
693
- substitute_function_applications_in_equations (equations, generator);
662
+ dependencies.add_constraints (generator);
663
+
694
664
#ifdef DEBUG
695
665
output_equations (debug (), equations, ns);
696
666
#endif
0 commit comments