@@ -37,7 +37,6 @@ static bool is_valid_string_constraint(
37
37
38
38
static optionalt<exprt> find_counter_example (
39
39
const namespacet &ns,
40
- ui_message_handlert::uit ui,
41
40
const exprt &axiom,
42
41
const symbol_exprt &var);
43
42
@@ -63,9 +62,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
63
62
const std::function<exprt(const exprt &)> &get,
64
63
messaget::mstreamt &stream,
65
64
const namespacet &ns,
66
- std::size_t max_string_length,
67
65
bool use_counter_example,
68
- ui_message_handlert::uit ui,
69
66
const union_find_replacet &symbol_resolve);
70
67
71
68
static void initial_index_set (
@@ -119,7 +116,6 @@ static std::vector<exprt> instantiate(
119
116
static optionalt<exprt> get_array (
120
117
const std::function<exprt(const exprt &)> &super_get,
121
118
const namespacet &ns,
122
- const std::size_t max_string_length,
123
119
messaget::mstreamt &stream,
124
120
const array_string_exprt &arr);
125
121
@@ -171,7 +167,6 @@ string_refinementt::string_refinementt(const infot &info, bool)
171
167
: supert(info),
172
168
config_(info),
173
169
loop_bound_(info.refinement_bound),
174
- max_string_length(info.max_string_length),
175
170
generator(*info.ns)
176
171
{
177
172
}
@@ -232,7 +227,6 @@ static void display_index_set(
232
227
// / for details)
233
228
static std::vector<exprt> generate_instantiations (
234
229
messaget::mstreamt &stream,
235
- const namespacet &ns,
236
230
const string_constraint_generatort &generator,
237
231
const index_set_pairt &index_set,
238
232
const string_axiomst &axioms)
@@ -532,16 +526,17 @@ union_find_replacet string_identifiers_resolution_from_equations(
532
526
return result;
533
527
}
534
528
529
+ #ifdef DEBUG
535
530
// / Output a vector of equations to the given stream, used for debugging.
536
- void output_equations (
531
+ static void output_equations (
537
532
std::ostream &output,
538
- const std::vector<equal_exprt> &equations,
539
- const namespacet &ns)
533
+ const std::vector<equal_exprt> &equations)
540
534
{
541
535
for (std::size_t i = 0 ; i < equations.size (); ++i)
542
536
output << " [" << i << " ] " << format (equations[i].lhs ())
543
537
<< " == " << format (equations[i].rhs ()) << std::endl;
544
538
}
539
+ #endif
545
540
546
541
// / Main decision procedure of the solver. Looks for a valuation of variables
547
542
// / compatible with the constraints that have been given to `set_to` so far.
@@ -611,7 +606,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
611
606
{
612
607
#ifdef DEBUG
613
608
debug () << " dec_solve: Initial set of equations" << eom;
614
- output_equations (debug (), equations, ns );
609
+ output_equations (debug (), equations);
615
610
#endif
616
611
617
612
debug () << " dec_solve: Build symbol solver from equations" << eom;
@@ -650,7 +645,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
650
645
make_char_array_pointer_associations (generator, equations);
651
646
652
647
#ifdef DEBUG
653
- output_equations (debug (), equations, ns );
648
+ output_equations (debug (), equations);
654
649
#endif
655
650
656
651
debug () << " dec_solve: compute dependency graph and remove function "
@@ -671,7 +666,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
671
666
dependencies.add_constraints (generator);
672
667
673
668
#ifdef DEBUG
674
- output_equations (debug (), equations, ns );
669
+ output_equations (debug (), equations);
675
670
#endif
676
671
677
672
#ifdef DEBUG
@@ -744,9 +739,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
744
739
get,
745
740
debug (),
746
741
ns,
747
- max_string_length,
748
742
config_.use_counter_example ,
749
- supert::config_.ui ,
750
743
symbol_resolve);
751
744
if (satisfied)
752
745
{
@@ -767,7 +760,6 @@ decision_proceduret::resultt string_refinementt::dec_solve()
767
760
for (const auto &instance :
768
761
generate_instantiations (
769
762
debug (),
770
- ns,
771
763
generator,
772
764
index_sets,
773
765
axioms))
@@ -788,9 +780,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
788
780
get,
789
781
debug (),
790
782
ns,
791
- max_string_length,
792
783
config_.use_counter_example ,
793
- supert::config_.ui ,
794
784
symbol_resolve);
795
785
if (satisfied)
796
786
{
@@ -830,7 +820,6 @@ decision_proceduret::resultt string_refinementt::dec_solve()
830
820
for (const auto &instance :
831
821
generate_instantiations (
832
822
debug (),
833
- ns,
834
823
generator,
835
824
index_sets,
836
825
axioms))
@@ -899,14 +888,12 @@ void string_refinementt::add_lemma(
899
888
// / \param super_get: function returning the valuation of an expression
900
889
// / in a model
901
890
// / \param ns: namespace
902
- // / \param max_string_length: maximum length of strings to analyze
903
891
// / \param stream: output stream for warning messages
904
892
// / \param arr: expression of type array representing a string
905
893
// / \return an optional array expression or array_of_exprt
906
894
static optionalt<exprt> get_array (
907
895
const std::function<exprt(const exprt &)> &super_get,
908
896
const namespacet &ns,
909
- const std::size_t max_string_length,
910
897
messaget::mstreamt &stream,
911
898
const array_string_exprt &arr)
912
899
{
@@ -975,14 +962,12 @@ static std::string string_of_array(const array_exprt &arr)
975
962
// / `super_get` and concretize unknown characters.
976
963
// / \param super_get: give a valuation to variables
977
964
// / \param ns: namespace
978
- // / \param max_string_length: limit up to which we concretize strings
979
965
// / \param stream: output stream
980
966
// / \param arr: array expression
981
967
// / \return expression corresponding to `arr` in the model
982
968
static exprt get_char_array_and_concretize (
983
969
const std::function<exprt(const exprt &)> &super_get,
984
970
const namespacet &ns,
985
- const std::size_t max_string_length,
986
971
messaget::mstreamt &stream,
987
972
const array_string_exprt &arr)
988
973
{
@@ -991,7 +976,7 @@ static exprt get_char_array_and_concretize(
991
976
stream << " - " << format (arr) << " :\n " ;
992
977
stream << indent << indent << " - type: " << format (arr.type ()) << eom;
993
978
const auto arr_model_opt =
994
- get_array (super_get, ns, max_string_length, stream, arr);
979
+ get_array (super_get, ns, stream, arr);
995
980
if (arr_model_opt)
996
981
{
997
982
stream << indent << indent << " - char_array: " << format (*arr_model_opt)
@@ -1003,7 +988,7 @@ static exprt get_char_array_and_concretize(
1003
988
<< eom;
1004
989
if (
1005
990
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)))
1007
992
{
1008
993
stream << indent << indent
1009
994
<< " - concretized_char_array: " << format (*concretized_array)
@@ -1032,7 +1017,6 @@ void debug_model(
1032
1017
const string_constraint_generatort &generator,
1033
1018
messaget::mstreamt &stream,
1034
1019
const namespacet &ns,
1035
- const std::size_t max_string_length,
1036
1020
const std::function<exprt(const exprt &)> &super_get,
1037
1021
const std::vector<symbol_exprt> &boolean_symbols,
1038
1022
const std::vector<symbol_exprt> &index_symbols)
@@ -1044,7 +1028,7 @@ void debug_model(
1044
1028
{
1045
1029
const auto arr = pointer_array.second ;
1046
1030
const exprt model = get_char_array_and_concretize (
1047
- super_get, ns, max_string_length, stream, arr);
1031
+ super_get, ns, stream, arr);
1048
1032
1049
1033
stream << " - " << format (arr) << " :\n "
1050
1034
<< indent << " - pointer: " << format (pointer_array.first ) << " \n "
@@ -1243,7 +1227,6 @@ static exprt negation_of_not_contains_constraint(
1243
1227
template <typename T>
1244
1228
static void debug_check_axioms_step (
1245
1229
messaget::mstreamt &stream,
1246
- const namespacet &ns,
1247
1230
const T &axiom,
1248
1231
const T &axiom_in_model,
1249
1232
const exprt &negaxiom,
@@ -1269,9 +1252,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1269
1252
const std::function<exprt(const exprt &)> &get,
1270
1253
messaget::mstreamt &stream,
1271
1254
const namespacet &ns,
1272
- std::size_t max_string_length,
1273
1255
bool use_counter_example,
1274
- ui_message_handlert::uit ui,
1275
1256
const union_find_replacet &symbol_resolve)
1276
1257
{
1277
1258
const auto eom=messaget::eom;
@@ -1297,7 +1278,6 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1297
1278
generator,
1298
1279
stream,
1299
1280
ns,
1300
- max_string_length,
1301
1281
get,
1302
1282
generator.get_boolean_symbols (),
1303
1283
generator.get_index_symbols ());
@@ -1324,11 +1304,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1324
1304
const exprt with_concretized_arrays =
1325
1305
substitute_array_access (negaxiom, gen_symbol, true );
1326
1306
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);
1328
1308
1329
1309
if (
1330
1310
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 ))
1332
1312
{
1333
1313
stream << indent2 << " - violated_for: " << format (axiom.univ_var ) << " ="
1334
1314
<< format (*witness) << eom;
@@ -1354,11 +1334,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1354
1334
1355
1335
stream << indent << i << " .\n " ;
1356
1336
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);
1358
1338
1359
1339
if (
1360
1340
const auto witness =
1361
- find_counter_example (ns, ui, negated_axiom, univ_var))
1341
+ find_counter_example (ns, negated_axiom, univ_var))
1362
1342
{
1363
1343
stream << indent2 << " - violated_for: " << univ_var.get_identifier ()
1364
1344
<< " =" << format (*witness) << eom;
@@ -2051,7 +2031,7 @@ exprt string_refinementt::get(const exprt &expr) const
2051
2031
2052
2032
if (
2053
2033
const auto arr_model_opt =
2054
- get_array (super_get, ns, max_string_length, debug (), arr))
2034
+ get_array (super_get, ns, debug (), arr))
2055
2035
return *arr_model_opt;
2056
2036
2057
2037
if (generator.get_created_strings ().count (arr))
@@ -2073,14 +2053,12 @@ exprt string_refinementt::get(const exprt &expr) const
2073
2053
// / is SAT, then true is returned and the given evaluation of `var` is stored
2074
2054
// / in `witness`. If UNSAT, then what witness is is undefined.
2075
2055
// / \param ns: namespace
2076
- // / \param ui: message handler
2077
2056
// / \param [in] axiom: the axiom to be checked
2078
2057
// / \param [in] var: the variable whose evaluation will be stored in witness
2079
2058
// / \return: the witness of the satisfying assignment if one
2080
2059
// / exists. If UNSAT, then behaviour is undefined.
2081
2060
static optionalt<exprt> find_counter_example (
2082
2061
const namespacet &ns,
2083
- const ui_message_handlert::uit ui,
2084
2062
const exprt &axiom,
2085
2063
const symbol_exprt &var)
2086
2064
{
0 commit comments