mirror of
https://github.com/Z3Prover/z3
synced 2026-06-09 02:20:57 +00:00
nseq: port ZIPT regex pre-check to fix benchmark discrepancy on regex-only problems (#8994)
* Initial plan * Port ZIPT regex pre-check and DFS node budget to address nseq benchmark discrepancy Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
2212f59704
commit
d53846d501
8 changed files with 140 additions and 0 deletions
|
|
@ -2172,6 +2172,10 @@ namespace seq {
|
|||
if (m_cancel_fn && m_cancel_fn())
|
||||
return search_result::unknown;
|
||||
|
||||
// check DFS node budget (0 = unlimited)
|
||||
if (m_max_nodes > 0 && m_stats.m_num_dfs_nodes > m_max_nodes)
|
||||
return search_result::unknown;
|
||||
|
||||
// revisit detection: if already visited this run, return cached status.
|
||||
// mirrors ZIPT's NielsenNode.GraphExpansion() evalIdx check.
|
||||
if (node->eval_idx() == m_run_idx) {
|
||||
|
|
|
|||
|
|
@ -734,6 +734,7 @@ namespace seq {
|
|||
unsigned m_run_idx = 0;
|
||||
unsigned m_depth_bound = 0;
|
||||
unsigned m_max_search_depth = 0;
|
||||
unsigned m_max_nodes = 0; // 0 = unlimited
|
||||
bool m_parikh_enabled = true;
|
||||
unsigned m_next_mem_id = 0;
|
||||
unsigned m_fresh_cnt = 0;
|
||||
|
|
@ -821,6 +822,9 @@ namespace seq {
|
|||
|
||||
// maximum overall search depth (0 = unlimited)
|
||||
void set_max_search_depth(unsigned d) { m_max_search_depth = d; }
|
||||
|
||||
// maximum total DFS nodes per solve() call (0 = unlimited)
|
||||
void set_max_nodes(unsigned n) { m_max_nodes = n; }
|
||||
|
||||
// enable/disable Parikh image verification constraints
|
||||
void set_parikh_enabled(bool e) { m_parikh_enabled = e; }
|
||||
|
|
|
|||
|
|
@ -438,6 +438,12 @@ namespace seq {
|
|||
// Only handle ground regexes; non-ground can't be fully explored
|
||||
if (!re->is_ground())
|
||||
return l_undef;
|
||||
// s_other snodes (unrecognized regex kinds, e.g. re.+) cannot be
|
||||
// efficiently explored: the alphabet partition is trivially {∅} and
|
||||
// derivative computations may be slow. Report l_undef and let the
|
||||
// caller fall back to a more capable procedure.
|
||||
if (re->kind() == euf::snode_kind::s_other)
|
||||
return l_undef;
|
||||
|
||||
// BFS over the Brzozowski derivative automaton.
|
||||
// Each state is a derivative regex snode identified by its id.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue