@@ -37,7 +37,6 @@ static bool is_valid_string_constraint(
3737
3838static optionalt<exprt> find_counter_example (
3939 const namespacet &ns,
40- ui_message_handlert::uit ui,
4140 const exprt &axiom,
4241 const symbol_exprt &var);
4342
@@ -63,9 +62,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
6362 const std::function<exprt(const exprt &)> &get,
6463 messaget::mstreamt &stream,
6564 const namespacet &ns,
66- std::size_t max_string_length,
6765 bool use_counter_example,
68- ui_message_handlert::uit ui,
6966 const union_find_replacet &symbol_resolve);
7067
7168static void initial_index_set (
@@ -119,7 +116,6 @@ static std::vector<exprt> instantiate(
119116static optionalt<exprt> get_array (
120117 const std::function<exprt(const exprt &)> &super_get,
121118 const namespacet &ns,
122- const std::size_t max_string_length,
123119 messaget::mstreamt &stream,
124120 const array_string_exprt &arr);
125121
@@ -171,7 +167,6 @@ string_refinementt::string_refinementt(const infot &info, bool)
171167 : supert(info),
172168 config_(info),
173169 loop_bound_(info.refinement_bound),
174- max_string_length(info.max_string_length),
175170 generator(*info.ns)
176171{
177172}
@@ -232,7 +227,6 @@ static void display_index_set(
232227// / for details)
233228static std::vector<exprt> generate_instantiations (
234229 messaget::mstreamt &stream,
235- const namespacet &ns,
236230 const string_constraint_generatort &generator,
237231 const index_set_pairt &index_set,
238232 const string_axiomst &axioms)
@@ -532,16 +526,17 @@ union_find_replacet string_identifiers_resolution_from_equations(
532526 return result;
533527}
534528
529+ #ifdef DEBUG
535530// / Output a vector of equations to the given stream, used for debugging.
536- void output_equations (
531+ static void output_equations (
537532 std::ostream &output,
538- const std::vector<equal_exprt> &equations,
539- const namespacet &ns)
533+ const std::vector<equal_exprt> &equations)
540534{
541535 for (std::size_t i = 0 ; i < equations.size (); ++i)
542536 output << " [" << i << " ] " << format (equations[i].lhs ())
543537 << " == " << format (equations[i].rhs ()) << std::endl;
544538}
539+ #endif
545540
546541// / Main decision procedure of the solver. Looks for a valuation of variables
547542// / compatible with the constraints that have been given to `set_to` so far.
@@ -611,7 +606,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
611606{
612607#ifdef DEBUG
613608 debug () << " dec_solve: Initial set of equations" << eom;
614- output_equations (debug (), equations, ns );
609+ output_equations (debug (), equations);
615610#endif
616611
617612 debug () << " dec_solve: Build symbol solver from equations" << eom;
@@ -650,7 +645,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
650645 make_char_array_pointer_associations (generator, equations);
651646
652647#ifdef DEBUG
653- output_equations (debug (), equations, ns );
648+ output_equations (debug (), equations);
654649#endif
655650
656651 debug () << " dec_solve: compute dependency graph and remove function "
@@ -671,7 +666,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
671666 dependencies.add_constraints (generator);
672667
673668#ifdef DEBUG
674- output_equations (debug (), equations, ns );
669+ output_equations (debug (), equations);
675670#endif
676671
677672#ifdef DEBUG
@@ -744,9 +739,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
744739 get,
745740 debug (),
746741 ns,
747- max_string_length,
748742 config_.use_counter_example ,
749- supert::config_.ui ,
750743 symbol_resolve);
751744 if (satisfied)
752745 {
@@ -767,7 +760,6 @@ decision_proceduret::resultt string_refinementt::dec_solve()
767760 for (const auto &instance :
768761 generate_instantiations (
769762 debug (),
770- ns,
771763 generator,
772764 index_sets,
773765 axioms))
@@ -788,9 +780,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
788780 get,
789781 debug (),
790782 ns,
791- max_string_length,
792783 config_.use_counter_example ,
793- supert::config_.ui ,
794784 symbol_resolve);
795785 if (satisfied)
796786 {
@@ -830,7 +820,6 @@ decision_proceduret::resultt string_refinementt::dec_solve()
830820 for (const auto &instance :
831821 generate_instantiations (
832822 debug (),
833- ns,
834823 generator,
835824 index_sets,
836825 axioms))
@@ -899,14 +888,12 @@ void string_refinementt::add_lemma(
899888// / \param super_get: function returning the valuation of an expression
900889// / in a model
901890// / \param ns: namespace
902- // / \param max_string_length: maximum length of strings to analyze
903891// / \param stream: output stream for warning messages
904892// / \param arr: expression of type array representing a string
905893// / \return an optional array expression or array_of_exprt
906894static optionalt<exprt> get_array (
907895 const std::function<exprt(const exprt &)> &super_get,
908896 const namespacet &ns,
909- const std::size_t max_string_length,
910897 messaget::mstreamt &stream,
911898 const array_string_exprt &arr)
912899{
@@ -975,14 +962,12 @@ static std::string string_of_array(const array_exprt &arr)
975962// / `super_get` and concretize unknown characters.
976963// / \param super_get: give a valuation to variables
977964// / \param ns: namespace
978- // / \param max_string_length: limit up to which we concretize strings
979965// / \param stream: output stream
980966// / \param arr: array expression
981967// / \return expression corresponding to `arr` in the model
982968static exprt get_char_array_and_concretize (
983969 const std::function<exprt(const exprt &)> &super_get,
984970 const namespacet &ns,
985- const std::size_t max_string_length,
986971 messaget::mstreamt &stream,
987972 const array_string_exprt &arr)
988973{
@@ -991,7 +976,7 @@ static exprt get_char_array_and_concretize(
991976 stream << " - " << format (arr) << " :\n " ;
992977 stream << indent << indent << " - type: " << format (arr.type ()) << eom;
993978 const auto arr_model_opt =
994- get_array (super_get, ns, max_string_length, stream, arr);
979+ get_array (super_get, ns, stream, arr);
995980 if (arr_model_opt)
996981 {
997982 stream << indent << indent << " - char_array: " << format (*arr_model_opt)
@@ -1003,7 +988,7 @@ static exprt get_char_array_and_concretize(
1003988 << eom;
1004989 if (
1005990 const auto concretized_array = get_array (
1006- super_get, ns, max_string_length, stream, to_array_string_expr (simple)))
991+ super_get, ns, stream, to_array_string_expr (simple)))
1007992 {
1008993 stream << indent << indent
1009994 << " - concretized_char_array: " << format (*concretized_array)
@@ -1032,7 +1017,6 @@ void debug_model(
10321017 const string_constraint_generatort &generator,
10331018 messaget::mstreamt &stream,
10341019 const namespacet &ns,
1035- const std::size_t max_string_length,
10361020 const std::function<exprt(const exprt &)> &super_get,
10371021 const std::vector<symbol_exprt> &boolean_symbols,
10381022 const std::vector<symbol_exprt> &index_symbols)
@@ -1044,7 +1028,7 @@ void debug_model(
10441028 {
10451029 const auto arr = pointer_array.second ;
10461030 const exprt model = get_char_array_and_concretize (
1047- super_get, ns, max_string_length, stream, arr);
1031+ super_get, ns, stream, arr);
10481032
10491033 stream << " - " << format (arr) << " :\n "
10501034 << indent << " - pointer: " << format (pointer_array.first ) << " \n "
@@ -1243,7 +1227,6 @@ static exprt negation_of_not_contains_constraint(
12431227template <typename T>
12441228static void debug_check_axioms_step (
12451229 messaget::mstreamt &stream,
1246- const namespacet &ns,
12471230 const T &axiom,
12481231 const T &axiom_in_model,
12491232 const exprt &negaxiom,
@@ -1269,9 +1252,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
12691252 const std::function<exprt(const exprt &)> &get,
12701253 messaget::mstreamt &stream,
12711254 const namespacet &ns,
1272- std::size_t max_string_length,
12731255 bool use_counter_example,
1274- ui_message_handlert::uit ui,
12751256 const union_find_replacet &symbol_resolve)
12761257{
12771258 const auto eom=messaget::eom;
@@ -1297,7 +1278,6 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
12971278 generator,
12981279 stream,
12991280 ns,
1300- max_string_length,
13011281 get,
13021282 generator.get_boolean_symbols (),
13031283 generator.get_index_symbols ());
@@ -1324,11 +1304,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
13241304 const exprt with_concretized_arrays =
13251305 substitute_array_access (negaxiom, gen_symbol, true );
13261306 debug_check_axioms_step (
1327- stream, ns, axiom, axiom_in_model, negaxiom, with_concretized_arrays);
1307+ stream, axiom, axiom_in_model, negaxiom, with_concretized_arrays);
13281308
13291309 if (
13301310 const auto &witness =
1331- find_counter_example (ns, ui, with_concretized_arrays, axiom.univ_var ))
1311+ find_counter_example (ns, with_concretized_arrays, axiom.univ_var ))
13321312 {
13331313 stream << indent2 << " - violated_for: " << format (axiom.univ_var ) << " ="
13341314 << format (*witness) << eom;
@@ -1354,11 +1334,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
13541334
13551335 stream << indent << i << " .\n " ;
13561336 debug_check_axioms_step (
1357- stream, ns, nc_axiom, nc_axiom, negated_axiom, negated_axiom);
1337+ stream, nc_axiom, nc_axiom, negated_axiom, negated_axiom);
13581338
13591339 if (
13601340 const auto witness =
1361- find_counter_example (ns, ui, negated_axiom, univ_var))
1341+ find_counter_example (ns, negated_axiom, univ_var))
13621342 {
13631343 stream << indent2 << " - violated_for: " << univ_var.get_identifier ()
13641344 << " =" << format (*witness) << eom;
@@ -2051,7 +2031,7 @@ exprt string_refinementt::get(const exprt &expr) const
20512031
20522032 if (
20532033 const auto arr_model_opt =
2054- get_array (super_get, ns, max_string_length, debug (), arr))
2034+ get_array (super_get, ns, debug (), arr))
20552035 return *arr_model_opt;
20562036
20572037 if (generator.get_created_strings ().count (arr))
@@ -2073,14 +2053,12 @@ exprt string_refinementt::get(const exprt &expr) const
20732053// / is SAT, then true is returned and the given evaluation of `var` is stored
20742054// / in `witness`. If UNSAT, then what witness is is undefined.
20752055// / \param ns: namespace
2076- // / \param ui: message handler
20772056// / \param [in] axiom: the axiom to be checked
20782057// / \param [in] var: the variable whose evaluation will be stored in witness
20792058// / \return: the witness of the satisfying assignment if one
20802059// / exists. If UNSAT, then behaviour is undefined.
20812060static optionalt<exprt> find_counter_example (
20822061 const namespacet &ns,
2083- const ui_message_handlert::uit ui,
20842062 const exprt &axiom,
20852063 const symbol_exprt &var)
20862064{
0 commit comments