3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-02 13:26:10 +00:00

Refactor seq_derive: inline path pruning with ACI normalization

Replace simplify_ite_rec post-hoc pass with inline path pruning:
- push/pop API with lbool return (l_true=implied, l_undef=pushed, l_false=contradicts)
- apply_ite hoists ITE through union/inter/complement with path-aware pruning
- Path-aware caching for mk_union, mk_inter, mk_complement
- Incremental path expression maintenance for cache keys
- Complement always pushes through ITE for same-condition merge
- ACI normalization (flatten/sort/deduplicate) for union base case
- is_subset subsumption prevents unbounded union growth
- Prefix factoring (a·x ∪ a·y = a·(x ∪ y)) for loop derivatives
- seq_rewriter passed as reference to derive class
- Depth-limited single-ITE hoisting (path_stack.size() < 8)
- pred_implies with signed atoms avoids mk_not allocations
- extract_char_range properly checks m_ele identity

Results: 0 timeouts on regression suite (vs 2 on master).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Nikolaj Bjorner 2026-06-08 20:43:43 -07:00
parent 13d0de42bc
commit ff8a1034d6
3 changed files with 498 additions and 695 deletions

View file

@ -129,6 +129,8 @@ class seq_rewriter {
void insert(decl_kind op, expr* a, expr* b, expr* c, expr* r);
};
friend class seq::derive;
seq_util m_util;
seq_subset m_subset;
arith_util m_autil;
@ -137,14 +139,8 @@ class seq_rewriter {
// re2automaton m_re2aut;
op_cache m_op_cache;
expr_ref_vector m_es, m_lhs, m_rhs;
<<<<<<< HEAD
bool m_coalesce_chars;
bool m_in_bisim { false };
=======
bool m_coalesce_chars;
unsigned m_re_deriv_depth { 0 };
static const unsigned m_max_re_deriv_depth = 512;
>>>>>>> 1f28fd0e6 (Add seq::derive class for symbolic regex derivatives)
enum length_comparison {
shorter_c,
@ -342,7 +338,11 @@ class seq_rewriter {
public:
seq_rewriter(ast_manager & m, params_ref const & p = params_ref()):
<<<<<<< HEAD
m_util(m), m_subset(m_util.re), m_autil(m), m_br(m, p), m_derive(m), // m_re2aut(m),
=======
m_util(m), m_autil(m), m_br(m, p), m_derive(m, *this), // m_re2aut(m),
>>>>>>> 8deac03ca (Refactor seq_derive: inline path pruning with ACI normalization)
m_op_cache(m), m_es(m),
m_lhs(m), m_rhs(m) {
}