3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-02 21:36:09 +00:00

Add new string repair heuristic (#7496)

* Fixed spurious counterexamples in seq-sls. Updates might not be identity mapping

* Removed debug code

* One check was missing

* Trying different update generation function

* Renamed function

* Added parameter to select string update function
This commit is contained in:
Clemens Eisenhofer 2024-12-30 17:49:07 +01:00 committed by GitHub
parent e002c57aa2
commit 19c95f8561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 64 additions and 14 deletions

View file

@ -42,13 +42,19 @@ namespace sls {
ptr_vector<expr> lhs, rhs;
};
enum edit_distance_strategy {
EDIT_CHAR,
EDIT_SUBSTR,
};
seq_util seq;
arith_util a;
seq_rewriter rw;
th_rewriter thrw;
scoped_ptr_vector<eval> m_values;
indexed_uint_set m_chars; // set of characters in the problem
bool m_initialized = false;
bool m_initialized = false;
edit_distance_strategy m_str_update_strategy;
struct str_update {
expr* e;
@ -122,6 +128,8 @@ namespace sls {
unsigned edit_distance_with_updates(string_instance const& a, string_instance const& b);
unsigned edit_distance(zstring const& a, zstring const& b);
void add_edit_updates(ptr_vector<expr> const& w, zstring const& val, zstring const& val_other, uint_set const& chars);
void add_char_edit_updates(ptr_vector<expr> const& w, zstring const& val, zstring const& val_other, uint_set const& chars);
void add_substr_edit_updates(ptr_vector<expr> const& w, zstring const& val, zstring const& val_other, uint_set const& chars);
// regex functionality