Skip to content

Commit 1f15033

Browse files
authored
z3str3: remove legacy code (#4215)
* z3str3: remove legacy fixed-length overlap testing parameter smt.str.fixed_length_overlap_models has been deprecated * z3str3: remove legacy length/value testing algorithm and binary search heuristic the following parameters are deprecated: smt.str.use_binary_search smt.str.binary_search_start smt.str.fixed_length_models (the fixed-length model construction is now always used) * z3str3: remove legacy regex unroll methods * z3str3: remove unused methods and member variables
1 parent 691759c commit 1f15033

8 files changed

+68
-2576
lines changed

src/ast/seq_decl_plugin.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ void seq_decl_plugin::init() {
553553
sort* str2TintT[3] = { strT, strT, intT };
554554
sort* seqAintT[2] = { seqA, intT };
555555
sort* seq3A[3] = { seqA, seqA, seqA };
556-
sort* reTintT[2] = { reT, intT };
557556
m_sigs.resize(LAST_SEQ_OP);
558557
// TBD: have (par ..) construct and load parameterized signature from premable.
559558
m_sigs[OP_SEQ_UNIT] = alloc(psig, m, "seq.unit", 1, 1, &A, seqA);
@@ -604,7 +603,6 @@ void seq_decl_plugin::init() {
604603
m_sigs[_OP_REGEXP_EMPTY] = alloc(psig, m, "re.nostr", 0, 0, nullptr, reT);
605604
m_sigs[_OP_REGEXP_FULL_CHAR] = alloc(psig, m, "re.allchar", 0, 0, nullptr, reT);
606605
m_sigs[_OP_STRING_SUBSTR] = alloc(psig, m, "str.substr", 0, 3, strTint2T, strT);
607-
m_sigs[_OP_RE_UNROLL] = alloc(psig, m, "_re.unroll", 0, 2, reTintT, strT);
608606
}
609607

610608
void seq_decl_plugin::set_manager(ast_manager* m, family_id id) {
@@ -772,11 +770,6 @@ func_decl * seq_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters,
772770
default:
773771
m.raise_exception("Incorrect number of arguments passed to loop. Expected 1 regular expression and two integer parameters");
774772
}
775-
776-
case _OP_RE_UNROLL:
777-
m_has_re = true;
778-
match(*m_sigs[k], arity, domain, range, rng);
779-
return m.mk_func_decl(m_sigs[k]->m_name, arity, domain, rng, func_decl_info(m_family_id, k));
780773

781774
case OP_STRING_CONST:
782775
if (!(num_parameters == 1 && arity == 0 && parameters[0].is_symbol())) {

src/ast/seq_decl_plugin.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ enum seq_op_kind {
8686
_OP_REGEXP_EMPTY,
8787
_OP_REGEXP_FULL_CHAR,
8888
_OP_SEQ_SKOLEM,
89-
_OP_RE_UNROLL,
9089
LAST_SEQ_OP
9190
};
9291

@@ -415,7 +414,6 @@ class seq_util {
415414
bool is_loop(expr const* n, expr*& body, unsigned& lo);
416415
bool is_loop(expr const* n, expr*& body, expr*& lo, expr*& hi);
417416
bool is_loop(expr const* n, expr*& body, expr*& lo);
418-
bool is_unroll(expr const* n) const { return is_app_of(n, m_fid, _OP_RE_UNROLL); }
419417
};
420418
str str;
421419
re re;

src/smt/params/smt_params_helper.pyg

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,13 @@ def_module_params(module_name='smt',
100100
('str.fast_length_tester_cache', BOOL, False, 'cache length tester constants instead of regenerating them'),
101101
('str.fast_value_tester_cache', BOOL, True, 'cache value tester constants instead of regenerating them'),
102102
('str.string_constant_cache', BOOL, True, 'cache all generated string constants generated from anywhere in theory_str'),
103-
('str.use_binary_search', BOOL, False, 'use a binary search heuristic for finding concrete length values for free variables in theory_str (set to False to use linear search)'),
104-
('str.binary_search_start', UINT, 64, 'initial upper bound for theory_str binary search'),
105103
('theory_aware_branching', BOOL, False, 'Allow the context to use extra information from theory solvers regarding literal branching prioritization.'),
106-
('str.finite_overlap_models', BOOL, False, 'attempt a finite model search for overlapping variables instead of completely giving up on the arrangement'),
107104
('str.overlap_priority', DOUBLE, -0.1, 'theory-aware priority for overlapping variable cases; use smt.theory_aware_branching=true'),
108-
('str.regex_automata', BOOL, True, 'use automata-based reasoning for regular expressions (Z3str3 only)'),
109105
('str.regex_automata_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex automata heuristics'),
110106
('str.regex_automata_intersection_difficulty_threshold', UINT, 1000, 'difficulty threshold for regex intersection heuristics'),
111107
('str.regex_automata_failed_automaton_threshold', UINT, 10, 'number of failed automaton construction attempts after which a full automaton is automatically built'),
112108
('str.regex_automata_failed_intersection_threshold', UINT, 10, 'number of failed automaton intersection attempts after which intersection is always computed'),
113109
('str.regex_automata_length_attempt_threshold', UINT, 10, 'number of length/path constraint attempts before checking unsatisfiability of regex terms'),
114-
('str.fixed_length_models', BOOL, True, 'use fixed-length equation solver to construct models (Z3str3 only)'),
115110
('str.fixed_length_refinement', BOOL, False, 'use abstraction refinement in fixed-length equation solver (Z3str3 only)'),
116111
('str.fixed_length_naive_cex', BOOL, True, 'construct naive counterexamples when fixed-length model construction fails for a given length assignment (Z3str3 only)'),
117112
('core.minimize', BOOL, False, 'minimize unsat core produced by SMT context'),

src/smt/params/theory_str_params.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,12 @@ void theory_str_params::updt_params(params_ref const & _p) {
2727
m_UseFastLengthTesterCache = p.str_fast_length_tester_cache();
2828
m_UseFastValueTesterCache = p.str_fast_value_tester_cache();
2929
m_StringConstantCache = p.str_string_constant_cache();
30-
m_FiniteOverlapModels = p.str_finite_overlap_models();
31-
m_UseBinarySearch = p.str_use_binary_search();
32-
m_BinarySearchInitialUpperBound = p.str_binary_search_start();
3330
m_OverlapTheoryAwarePriority = p.str_overlap_priority();
34-
m_RegexAutomata = p.str_regex_automata();
3531
m_RegexAutomata_DifficultyThreshold = p.str_regex_automata_difficulty_threshold();
3632
m_RegexAutomata_IntersectionDifficultyThreshold = p.str_regex_automata_intersection_difficulty_threshold();
3733
m_RegexAutomata_FailedAutomatonThreshold = p.str_regex_automata_failed_automaton_threshold();
3834
m_RegexAutomata_FailedIntersectionThreshold = p.str_regex_automata_failed_intersection_threshold();
3935
m_RegexAutomata_LengthAttemptThreshold = p.str_regex_automata_length_attempt_threshold();
40-
m_FixedLengthModels = p.str_fixed_length_models();
4136
m_FixedLengthRefinement = p.str_fixed_length_refinement();
4237
m_FixedLengthNaiveCounterexamples = p.str_fixed_length_naive_cex();
4338
}
@@ -52,15 +47,11 @@ void theory_str_params::display(std::ostream & out) const {
5247
DISPLAY_PARAM(m_UseFastLengthTesterCache);
5348
DISPLAY_PARAM(m_UseFastValueTesterCache);
5449
DISPLAY_PARAM(m_StringConstantCache);
55-
DISPLAY_PARAM(m_UseBinarySearch);
56-
DISPLAY_PARAM(m_BinarySearchInitialUpperBound);
5750
DISPLAY_PARAM(m_OverlapTheoryAwarePriority);
58-
DISPLAY_PARAM(m_RegexAutomata);
5951
DISPLAY_PARAM(m_RegexAutomata_DifficultyThreshold);
6052
DISPLAY_PARAM(m_RegexAutomata_IntersectionDifficultyThreshold);
6153
DISPLAY_PARAM(m_RegexAutomata_FailedAutomatonThreshold);
6254
DISPLAY_PARAM(m_RegexAutomata_FailedIntersectionThreshold);
6355
DISPLAY_PARAM(m_RegexAutomata_LengthAttemptThreshold);
64-
DISPLAY_PARAM(m_FixedLengthModels);
6556
DISPLAY_PARAM(m_FixedLengthNaiveCounterexamples);
6657
}

src/smt/params/theory_str_params.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,8 @@ struct theory_str_params {
6868
*/
6969
bool m_StringConstantCache;
7070

71-
/*
72-
* If FiniteOverlapModels is set to true,
73-
* arrangements that result in overlapping variables will generate a small number of models
74-
* to test instead of completely giving up on the case.
75-
*/
76-
bool m_FiniteOverlapModels;
77-
78-
bool m_UseBinarySearch;
79-
unsigned m_BinarySearchInitialUpperBound;
80-
8171
double m_OverlapTheoryAwarePriority;
8272

83-
/*
84-
* If RegexAutomata is set to true,
85-
* Z3str3 will use automata-based methods to reason about
86-
* regular expression constraints.
87-
*/
88-
bool m_RegexAutomata;
89-
9073
/*
9174
* RegexAutomata_DifficultyThreshold is the lowest difficulty above which Z3str3
9275
* will not eagerly construct an automaton for a regular expression term.
@@ -116,13 +99,6 @@ struct theory_str_params {
11699
* before which we begin checking unsatisfiability of a regex term.
117100
*/
118101
unsigned m_RegexAutomata_LengthAttemptThreshold;
119-
120-
/*
121-
* If FixedLengthModels is true, Z3str3 will use a fixed-length equation solver to construct models in final_check.
122-
* If false, Z3str3 will use the legacy length tester and value tester procedure.
123-
*/
124-
bool m_FixedLengthModels;
125-
126102
/*
127103
* If FixedLengthRefinement is true and the fixed-length equation solver is enabled,
128104
* Z3str3 will use abstraction refinement to handle formulas that would result in disjunctions or expensive
@@ -145,17 +121,12 @@ struct theory_str_params {
145121
m_UseFastLengthTesterCache(false),
146122
m_UseFastValueTesterCache(true),
147123
m_StringConstantCache(true),
148-
m_FiniteOverlapModels(false),
149-
m_UseBinarySearch(false),
150-
m_BinarySearchInitialUpperBound(64),
151124
m_OverlapTheoryAwarePriority(-0.1),
152-
m_RegexAutomata(true),
153125
m_RegexAutomata_DifficultyThreshold(1000),
154126
m_RegexAutomata_IntersectionDifficultyThreshold(1000),
155127
m_RegexAutomata_FailedAutomatonThreshold(10),
156128
m_RegexAutomata_FailedIntersectionThreshold(10),
157129
m_RegexAutomata_LengthAttemptThreshold(10),
158-
m_FixedLengthModels(true),
159130
m_FixedLengthRefinement(false),
160131
m_FixedLengthNaiveCounterexamples(true)
161132
{

0 commit comments

Comments
 (0)