@@ -43,8 +43,7 @@ static optionalt<exprt> find_counter_example(
43
43
const symbol_exprt &var);
44
44
45
45
static std::pair<bool , std::vector<exprt>> check_axioms (
46
- const std::vector<string_constraintt> &universal_axioms,
47
- const std::vector<string_not_contains_constraintt> ¬_contains_axioms,
46
+ const string_axiomst &axioms,
48
47
string_constraint_generatort &generator,
49
48
const std::function<exprt(const exprt &)> &get,
50
49
messaget::mstreamt &stream,
@@ -67,8 +66,7 @@ static void initial_index_set(
67
66
static void initial_index_set (
68
67
index_set_pairt &index_set,
69
68
const namespacet &ns,
70
- const std::vector<string_constraintt> &string_axioms,
71
- const std::vector<string_not_contains_constraintt> &nc_axioms);
69
+ const string_axiomst &axioms);
72
70
73
71
exprt simplify_sum (const exprt &f);
74
72
@@ -237,19 +235,18 @@ static std::vector<exprt> generate_instantiations(
237
235
const namespacet &ns,
238
236
string_constraint_generatort &generator,
239
237
const index_set_pairt &index_set,
240
- const std::vector<string_constraintt> &universal_axioms,
241
- const std::vector<string_not_contains_constraintt> ¬_contains_axioms)
238
+ const string_axiomst &axioms)
242
239
{
243
240
std::vector<exprt> lemmas;
244
241
for (const auto &i : index_set.current )
245
242
{
246
- for (const auto &univ_axiom : universal_axioms )
243
+ for (const auto &univ_axiom : axioms. universal )
247
244
{
248
245
for (const auto &j : i.second )
249
246
lemmas.push_back (instantiate (stream, univ_axiom, i.first , j));
250
247
}
251
248
}
252
- for (const auto &nc_axiom : not_contains_axioms )
249
+ for (const auto &nc_axiom : axioms. not_contains )
253
250
{
254
251
for (const auto &instance :
255
252
instantiate (nc_axiom, index_set, generator))
@@ -684,7 +681,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
684
681
is_valid_string_constraint (error (), ns, univ_axiom),
685
682
string_refinement_invariantt (
686
683
" string constraints satisfy their invariant" ));
687
- universal_axioms .push_back (univ_axiom);
684
+ axioms. universal .push_back (univ_axiom);
688
685
}
689
686
else if (axiom.id ()==ID_string_not_contains_constraint)
690
687
{
@@ -696,7 +693,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
696
693
array_typet witness_type (index_type, infinity_exprt (index_type));
697
694
generator.witness [nc_axiom]=
698
695
generator.fresh_symbol (" not_contains_witness" , witness_type);
699
- not_contains_axioms .push_back (nc_axiom);
696
+ axioms. not_contains .push_back (nc_axiom);
700
697
}
701
698
else
702
699
{
@@ -716,8 +713,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
716
713
bool satisfied;
717
714
std::vector<exprt> counter_examples;
718
715
std::tie (satisfied, counter_examples)=check_axioms (
719
- universal_axioms,
720
- not_contains_axioms,
716
+ axioms,
721
717
generator,
722
718
get,
723
719
debug (),
@@ -752,8 +748,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
752
748
initial_index_set (
753
749
index_sets,
754
750
ns,
755
- universal_axioms,
756
- not_contains_axioms);
751
+ axioms);
757
752
update_index_set (index_sets, ns, current_constraints);
758
753
display_index_set (debug (), ns, index_sets);
759
754
current_constraints.clear ();
@@ -763,8 +758,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
763
758
ns,
764
759
generator,
765
760
index_sets,
766
- universal_axioms,
767
- not_contains_axioms))
761
+ axioms))
768
762
add_lemma (instance);
769
763
770
764
while ((loop_bound_--)>0 )
@@ -776,8 +770,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
776
770
bool satisfied;
777
771
std::vector<exprt> counter_examples;
778
772
std::tie (satisfied, counter_examples)=check_axioms (
779
- universal_axioms,
780
- not_contains_axioms,
773
+ axioms,
781
774
generator,
782
775
get,
783
776
debug (),
@@ -825,8 +818,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
825
818
ns,
826
819
generator,
827
820
index_sets,
828
- universal_axioms,
829
- not_contains_axioms))
821
+ axioms))
830
822
add_lemma (instance);
831
823
}
832
824
else
@@ -1343,8 +1335,7 @@ exprt concretize_arrays_in_expression(exprt expr, std::size_t string_max_length)
1343
1335
// / return true if the current model satisfies all the axioms
1344
1336
// / \return a Boolean
1345
1337
static std::pair<bool , std::vector<exprt>> check_axioms (
1346
- const std::vector<string_constraintt> &universal_axioms,
1347
- const std::vector<string_not_contains_constraintt> ¬_contains_axioms,
1338
+ const string_axiomst &axioms,
1348
1339
string_constraint_generatort &generator,
1349
1340
const std::function<exprt(const exprt &)> &get,
1350
1341
messaget::mstreamt &stream,
@@ -1370,11 +1361,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1370
1361
// Maps from indexes of violated universal axiom to a witness of violation
1371
1362
std::map<size_t , exprt> violated;
1372
1363
1373
- stream << " string_refinement::check_axioms: " << universal_axioms .size ()
1364
+ stream << " string_refinement::check_axioms: " << axioms. universal .size ()
1374
1365
<< " universal axioms:" << eom;
1375
- for (size_t i=0 ; i<universal_axioms .size (); i++)
1366
+ for (size_t i=0 ; i<axioms. universal .size (); i++)
1376
1367
{
1377
- const string_constraintt &axiom=universal_axioms [i];
1368
+ const string_constraintt &axiom=axioms. universal [i];
1378
1369
const symbol_exprt &univ_var=axiom.univ_var ();
1379
1370
const exprt &bound_inf=axiom.lower_bound ();
1380
1371
const exprt &bound_sup=axiom.upper_bound ();
@@ -1418,11 +1409,11 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1418
1409
// Maps from indexes of violated not_contains axiom to a witness of violation
1419
1410
std::map<std::size_t , exprt> violated_not_contains;
1420
1411
1421
- stream << " there are " << not_contains_axioms .size ()
1412
+ stream << " there are " << axioms. not_contains .size ()
1422
1413
<< " not_contains axioms" << eom;
1423
- for (size_t i=0 ; i<not_contains_axioms .size (); i++)
1414
+ for (size_t i=0 ; i<axioms. not_contains .size (); i++)
1424
1415
{
1425
- const string_not_contains_constraintt &nc_axiom=not_contains_axioms [i];
1416
+ const string_not_contains_constraintt &nc_axiom=axioms. not_contains [i];
1426
1417
const exprt &univ_bound_inf=nc_axiom.univ_lower_bound ();
1427
1418
const exprt &univ_bound_sup=nc_axiom.univ_upper_bound ();
1428
1419
const exprt &prem=nc_axiom.premise ();
@@ -1496,7 +1487,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1496
1487
{
1497
1488
const exprt &val=v.second ;
1498
1489
const string_not_contains_constraintt &axiom=
1499
- not_contains_axioms [v.first ];
1490
+ axioms. not_contains [v.first ];
1500
1491
1501
1492
const exprt func_val=generator.get_witness_of (axiom, val);
1502
1493
const exprt comp_val=simplify_sum (plus_exprt (val, func_val));
@@ -1721,12 +1712,11 @@ static bool find_qvar(const exprt &index, const symbol_exprt &qvar)
1721
1712
static void initial_index_set (
1722
1713
index_set_pairt &index_set,
1723
1714
const namespacet &ns,
1724
- const std::vector<string_constraintt> &string_axioms,
1725
- const std::vector<string_not_contains_constraintt> &nc_axioms)
1715
+ const string_axiomst &axioms)
1726
1716
{
1727
- for (const auto &axiom : string_axioms )
1717
+ for (const auto &axiom : axioms. universal )
1728
1718
initial_index_set (index_set, ns, axiom);
1729
- for (const auto &axiom : nc_axioms )
1719
+ for (const auto &axiom : axioms. not_contains )
1730
1720
initial_index_set (index_set, ns, axiom);
1731
1721
}
1732
1722
0 commit comments