3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-09 06:44:53 +00:00
Commit graph

3 commits

Author SHA1 Message Date
Nikolaj Bjorner
f48040d809 Add Phase 3: Nielsen transformation engine and equation solving
- New nseq_nielsen.h/cpp in src/ast/rewriter/: self-contained Nielsen
  transformation engine for word equations
  - simplify(): strip common prefix/suffix, empty elimination, variable
    stripping, single-var assignment detection
  - split(): case analysis for var vs constant, var vs var
  - is_conflict(): mismatch detection (different constants, one side
    has constants while other is empty)

- Wire Nielsen into theory_nseq:
  - solve_eqs()/solve_eq(): process word equations using Nielsen
    transformations with e-graph canonization
  - branch_eq()/branch_var_prefix(): binary empty/non-empty decisions
    and prefix enumeration (no fresh variable creation)
  - canonize(): rewrite equation sides using current e-graph equivalences
  - all_eqs_solved(): check if all equations are satisfied
  - mk_value(): basic model generation (walk e-class for string constants)

- Passes basic tests: simple equalities, concat equations, unsat detection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 18:01:08 -08:00
Nikolaj Bjorner
58b57b2632 Add Phase 2: core data structures for theory_nseq
- nseq_constraint.h: constraint types (nseq_eq, nseq_ne, nseq_mem,
  nseq_pred) with dependency tracking via scoped_dependency_manager
- nseq_state.h/cpp: backtrackable state management with scoped_vector
  collections, axiom queue, length tracking, linearization for
  conflict/propagation justifications, statistics, display
- theory_nseq.h/cpp: full internalization (term/atom/bool), equality
  and disequality handling with union-find, literal assignment dispatch
  (prefix/suffix/contains/in_re), axiom management, propagation
  helpers (propagate_eq/lit, set_conflict), scope push/pop wired
  to nseq_state

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 17:26:10 -08:00
Nikolaj Bjorner
c325c56de4 Add theory_nseq skeleton: new string solver selectable via smt.string_solver=nseq
Phase 1 of the theory_nseq implementation: a stub theory solver for
strings based on Nielsen transformations and lazy regex membership.

- New files: theory_nseq.h/cpp with all required theory virtual methods
- Add 'nseq' to smt.string_solver parameter validation and documentation
- Wire into smt_setup.cpp dispatch (setup_QF_S, setup_seq_str, setup_nseq)
- Currently returns FC_GIVEUP for non-trivial string constraints

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 17:00:59 -08:00