mirror of
https://github.com/Z3Prover/z3
synced 2026-06-29 03:48:51 +00:00
feat(seq::bisim): hoist all ITEs to top in bisim derivative leaves
In the bisimulation equivalence path, derivative leaves are now extracted via the new seq_rewriter::brz_derivative_cofactors (derive::derivative_cofactors), which computes the symbolic derivative and enumerates its reachable leaves in fully ITE-hoisted normal form: every if-then-else over the input character (including ones previously buried under a concat or union) is hoisted to the top via decompose_ite, infeasible minterms are pruned, and unions are kept intact as single states. Each leaf is therefore a ground regex free of (:var 0), so its nullability is always decidable. This replaces collect_leaves (which only split top-level ITEs and left buried (:var 0) ITEs inside leaves), the root cause of bisim returning l_undef and falling through to the slow theory solver. Validation on the regex-equivalence corpus (1523 files, -T:5, 8 workers): - vs master: total solved 1394 vs 1378 (+16), soft_timeouts 129 vs 145, 0 soundness disagreements (was 18 -> 5 -> 0). - vs derive: +242 solved (1394 vs 1152), 25.4% faster on commonly-solved files, fixes 18 soundness disagreements, only 6 regressions. - corpus wall time halved (172s vs 332s/349s). - All 91 unit tests pass, including seq_regex_bisim. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
a2b73b0ee6
commit
ee20c9963b
5 changed files with 52 additions and 42 deletions
|
|
@ -204,6 +204,25 @@ namespace seq {
|
|||
*/
|
||||
void get_cofactors(expr* ele, expr* r, expr_ref_pair_vector& result);
|
||||
|
||||
/**
|
||||
* Compute the symbolic derivative of r and enumerate its reachable
|
||||
* leaves in fully ITE-hoisted normal form.
|
||||
*
|
||||
* Concretely this returns, for every feasible minterm (character
|
||||
* class) of δ(r), a pair (path_condition, target_regex). Every
|
||||
* if-then-else over the input character (including ones that would
|
||||
* otherwise be buried under a concat/union) is hoisted to the top
|
||||
* via the same path/interval pruning used by the derivative engine,
|
||||
* so each target_regex is free of (:var 0) and its nullability is
|
||||
* always decidable. Unions are kept intact as single leaves (a
|
||||
* union leaf denotes a single bisimulation state). Infeasible
|
||||
* minterms are pruned, so all returned leaves are reachable.
|
||||
*
|
||||
* This is the entry point the regex_bisim equivalence procedure
|
||||
* uses: it consumes the target_regex of each pair and ignores the
|
||||
* (redundant) path condition.
|
||||
*/
|
||||
void derivative_cofactors(expr* r, expr_ref_pair_vector& result);
|
||||
|
||||
void set_antimirov(bool flag) {
|
||||
m_antimirov_derivative = flag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue