3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-19 11:33:09 +00:00

Implement Parameter integration for theory_nseq (smt.nseq.max_depth)

Co-authored-by: CEisenhofer <56730610+CEisenhofer@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-04 15:45:55 +00:00
parent 47836e6f5b
commit 5003cece9d
7 changed files with 92 additions and 0 deletions

View file

@ -556,8 +556,14 @@ namespace seq {
// iterative deepening: 6 iterations starting at depth 10, doubling
// mirrors ZIPT's NielsenGraph.Check()
// If m_max_search_depth is set, clamp the initial bound and stop
// once the bound has hit the cap (further iterations are identical).
m_depth_bound = 10;
if (m_max_search_depth > 0 && m_depth_bound > m_max_search_depth)
m_depth_bound = m_max_search_depth;
for (unsigned iter = 0; iter < 6; ++iter, m_depth_bound *= 2) {
if (m_max_search_depth > 0 && m_depth_bound > m_max_search_depth)
m_depth_bound = m_max_search_depth;
inc_run_idx();
search_result r = search_dfs(m_root, 0);
if (r == search_result::sat) {
@ -569,6 +575,9 @@ namespace seq {
return r;
}
// depth limit hit increase bound and retry
// if already at max, no further growth is possible
if (m_max_search_depth > 0 && m_depth_bound >= m_max_search_depth)
break;
}
++m_stats.m_num_unknown;
return search_result::unknown;

View file

@ -541,6 +541,7 @@ namespace seq {
nielsen_node* m_root = nullptr;
unsigned m_run_idx = 0;
unsigned m_depth_bound = 0;
unsigned m_max_search_depth = 0;
unsigned m_next_mem_id = 0;
unsigned m_fresh_cnt = 0;
unsigned m_num_input_eqs = 0;
@ -580,6 +581,10 @@ namespace seq {
unsigned depth_bound() const { return m_depth_bound; }
void set_depth_bound(unsigned d) { m_depth_bound = d; }
// maximum overall search depth (0 = unlimited)
unsigned max_search_depth() const { return m_max_search_depth; }
void set_max_search_depth(unsigned d) { m_max_search_depth = d; }
// generate next unique regex membership id
unsigned next_mem_id() { return m_next_mem_id++; }