* t0
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t1
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t2
* scaffoldin
* scaffolding
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* closer to the paper
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* more scaffolding
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* define symbolic_interval
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* use std::map instead of std::unordered_map
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* more accurate init of the relation between polynomial properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* pass anum_manager to levelwise, crash on sign
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* pass pmanager
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* create free function display functions
* use new display functions
* pass nlsat::solver to levelwise
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add trace tag for levelwise
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* define indexed root expression
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refact lws
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refact lws
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor lws
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* trying to figure out right indices
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* rename explain::main_operator to compute_conflict_explanation
* preprocess the input of levelwise to drop a level
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* ttt
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* renaming
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* rename
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* work on seed_properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* work on seed_properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* work on seed_properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* move a comment
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simplify
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simplify
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* debug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor and assert _irreducible
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add a display method
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simplify
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simplify
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove erase_from_Q
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* ignore holds properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* got a section
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* introdure mk_prop
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove a parameter
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add parameter to suppress/enable levelwise
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* comment
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fixing factoring and hitting NOT_IMPLEMENTED on ir_ord
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* adding ir_ord
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* produce more literals but creating sat lemmas
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* try iterative factoring
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* new file
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* create irreducible polynomials on init
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add a guard on m_fail
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* process level 0 as well
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove a warning
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* debug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* prepare to fill the relation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* filling the relation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* separate the lower and upper bound root functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix an assert statement
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* create a better queue on properties
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* normalize before pushing
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* relax an assert
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* rebase with master
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add stats to track levelwise calls
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* catch and fail on an exception
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix a bug in Rule 4.2
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove debug instruction
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* call levelwise on a correct set of polynomials
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* cosmetics
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* use polynomial_ref instead of poly*
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* do not refactor again multivariate polynomials
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* canonicalize polinomals in todo_set
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* canonicalize polynomials in nlsat
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
* normalize polynomials
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* try not to fail in add_sgn_inv_leading_coeff_for
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* use the cache consistently
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* unsound state
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* unsound state
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* handle the zero case in add_ord_inv_resultant
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* optimizations by using cached psc
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* make normalize optional
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Revert "make normalize optional"
This reverts commit c80cfb0b8e.
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* cleanup and more caching
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* better sort of root functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* index bug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* with resultant calculation ignore one of p and q with a common root
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix the duplicate bug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
* simplify by removing back propagation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* hook up different relation build strategies for lws
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* introduce isolate_root_closest
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix a bug with non-adding ldcf
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simple choice of non-vanishing
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* restore choose_non_zero_coeff
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* efficient sort of root functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* avoid ldcf with the projective theorem
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* omit some disc
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* use std_vector more
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* avoid a compare call
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* try optimizing build_interval_and_relation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* discard a discriminant only in the section case
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* refactor
* refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* cache the polynomial roots
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Revert "cache the polynomial roots"
This reverts commit aefcd16aaa.
* ignore const non-null witnesses
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* toward more like SMT-RAT split
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* align with SMT-RAT
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* disables some heuristics in section
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Implement chain noLdcf optimization matching SMT-RAT
Add find_partition_boundary() helper to locate the boundary between
lower and upper root partitions in m_rfunc.
Implement compute_omit_lc_sector_chain() and compute_omit_lc_section_chain()
following SMT-RAT's OneCellCAD.h logic:
- Omit ldcf for extreme of lower chain (index 0) if it appears on upper side
- Omit ldcf for extreme of upper chain (last index) if it appears on lower side
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Restrict noDisc optimization to section_lowest_degree only
Match SMT-RAT behavior: noDisc (discriminant omission for leaves
connected only to section polynomial) is only applied for
sectionHeuristic == 3 (lowest_degree), not for biggest_cell or chain.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Cache partition boundary to avoid repeated algebraic number comparisons
Store the partition boundary (index of first root > sample) in
relation_E after sorting root functions. Use this cached value
in compute_omit_lc_sector_chain() and compute_omit_lc_section_chain()
instead of recomputing via algebraic number comparisons.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor levelwise: consolidate partition indices into m_l_rf/m_u_rf
Replace scattered local l_index/u_index parameters and m_partition_boundary
with two impl members:
- m_l_rf: position of lower bound in m_rel.m_rfunc
- m_u_rf: position of upper bound in m_rel.m_rfunc (UINT_MAX in section case)
This simplifies the code by:
- Removing parameter passing through multiple function calls
- Removing redundant m_partition_boundary from relation_E
- Making the partition state explicit in impl
Also clean up nlsat_explain.cpp to trust root_function_interval invariants:
- Section case: assert l and l_index are valid instead of defensive check
- Sector bounds: !l_inf()/!u_inf() implies valid polynomial and index
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor levelwise: use member variables for per-level state
Replace local variables and function parameters with member variables:
- m_level_ps: polynomials at current level (owned)
- m_level_tags: tags for each polynomial (owned)
- m_witnesses: non-zero coefficient witnesses
- m_poly_has_roots: which polynomials have roots
- m_todo: pointer to todo_set
Functions now use these member variables directly:
- extract_max_tagged() fills m_level_ps/m_level_tags and sets m_level
- process_level() and process_top_level() are now parameterless
- All helper functions use member variables instead of parameters
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor levelwise: change m_todo from pointer to member
- Change m_todo from todo_set* to todo_set
- Initialize m_todo in constructor initializer list
- Use m_todo.reset() in single_cell_work instead of creating local todo_set
- Replace pointer access (m_todo->) with member access (m_todo.)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add dynamic heuristic selection for levelwise projection
Implement weight-based dynamic selection of projection heuristics in
levelwise CAD. The weight function w(p, level) = deg(p, level) estimates
projection complexity, with w(res(a,b)) ≈ w(a) + w(b).
At each level, all three heuristics (biggest_cell, chain, lowest_degree)
are evaluated and the one with minimum estimated resultant weight is
selected. When fewer than 2 root functions exist, the default heuristic
is used since all produce equivalent results.
Add parameter nlsat.lws_dynamic_heuristic (default: true) to enable or
disable dynamic selection. When disabled, the static heuristic from
lws_sector_rel_mode/lws_section_rel_mode is used.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* local optimization
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* call omit_lc only when both bounds are present
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* use std_vector
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove m_level_tags
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* count added lcs in the heuriistic estimates
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add both side spanning tree heuristic
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Fix nlsat projection bug: ensure polynomials with assumptions are also projected
When polynomials are added as assumptions (via add_assumption or ensure_sign),
they must also be added to the projection set (m_todo) to ensure proper cell
construction. Previously, assumptions were added without corresponding projection,
leading to unsound lemmas.
Fixes:
1. In normalize(): collect lower-stage polynomials in m_lower_stage_polys and
add them to m_ps in main() before projection.
2. In ensure_sign(): call insert_fresh_factors_in_todo(p) after adding assumption.
3. In project_cdcac(): when levelwise fails, use flet to set m_add_all_coeffs=true
for the fallback projection.
* Remove deprecated project_original and cell_sample parameter
- Remove project_original() function from nlsat_explain.cpp
- Remove m_sample_cell_project member variable
- Simplify project() to just call project_cdcac()
- Remove cell_sample parameter from nlsat_params.pyg
- Update nlsat_solver.cpp to remove cell_sample() references
- Update nlsat_explain.h constructor signature
* Enforce bound polynomial LC protection in compute_omit_lc functions
Move the invariant that bound-defining polynomials must never have their
LC omitted from add_level_projections_sector() into the source functions:
- compute_omit_lc_both_sides()
- compute_omit_lc_chain_extremes()
This centralizes the protection and removes the redundant override check.
* fix the build
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* bug fixes
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* restore a deleted function
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove sector/section stats
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Simplify levelwise: remove chain/lowest_degree heuristics, unify relation
mode
- Remove chain and lowest_degree heuristics, keep only biggest_cell and spanning_tree
- Unify m_sector_relation_mode and m_section_relation_mode into single m_rel_mode
- Remove lws_rel_mode, lws_sector_rel_mode, lws_section_rel_mode, lws_dynamic_heuristic params
- lws_spt_threshold < 2 now disables spanning tree (single tuning parameter)
- Restore noDisc optimization for spanning_tree leaves connected to boundary
- Add noDisc for sector with same_boundary_poly (treat like section case)
- Significant code reduction (~390 lines removed)
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix bug with skipping too many discriminants
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* simplifications and bug fixes in lws, use static_tree only with sector + different bound polynomials, otherwise us biggest cell
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* bug fixes and cleanup
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add the discriminant in degenerated case
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix a bug with skipping a vanishing discriminant
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove the unsound optimization
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fiddle with heuristics
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* preserve random seed in nlsat_solver::check_lemma
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix a typo in poly_has_roots
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* add lc(p) and disc(p) for a rootless p in section case
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* remove warnings
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* untracking .beads
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix the explosion in m_todo with lws.false
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* fix issue 8397
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* set default to nlsat.lws=false for the merge with master
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* set nlsat.lws=true by default, enable levelwise
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
---------
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Initial plan
* Add std::initializer_list overloads for BV and arith functions
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Update call sites to use initializer_list format for BV and arith functions
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>
* preserve the initial state of the solver with push/pop for multiple objectives
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
* Fix memory corruption in Z3_polynomial_subresultants
The API function had a memory corruption bug where allocating the result
vector while the default_expr2polynomial converter was still in scope
could corrupt the converter's internal expr2var mapping.
Fixed by restructuring the code to:
1. Complete all polynomial computation in a scoped block
2. Store results in a temporary expr_ref_vector
3. Let the converter go out of scope
4. Then allocate and populate the result vector
Also improved the test to:
- Use randomized testing with 20 iterations
- Test both cases: variable in polynomials and variable not in polynomials
- Use proper reference counting (inc_ref before dec_ref)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Initial plan
* Refactor mk_and and mk_app to use std::span
- Made mk_and(unsigned num_args, expr * const * args) private
- Added new public mk_and(std::span<expr* const> args) method
- Added new public mk_app(family_id fid, decl_kind k, std::span<expr* const> args) method
- Updated all convenience overloads to use std::span version
- Updated all external call sites to use the new std::span API
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Fix remaining test files to use std::span API
- Updated src/test/sorting_network.cpp
- Updated src/test/ho_matcher.cpp with explicit cast to resolve ambiguity
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Revert overlapping changes superseded by PR #8286
Reverted 30 files to match the state from PR #8286 (commit ebc0688) which refactored mk_and/mk_or call sites to use vector overloads. This supersedes the std::span changes in those files.
Retained std::span changes in files unique to this PR:
- Core API changes (ast.h, ast.cpp)
- Files not affected by PR #8286 (api_context.cpp, ast_util.cpp, bool_rewriter.h, datatype_rewriter.cpp, dom_simplifier.cpp, factor_rewriter.cpp, pb2bv_rewriter.cpp, quant_hoist.cpp, spacer_cluster_util.cpp, sortmax.cpp, array_axioms.cpp, smtfd_solver.cpp, goal.cpp, ho_matcher.cpp, qe_arith.cpp, sorting_network.cpp)
- Special case in hnf.cpp where both PRs modified different lines
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>
* Initial plan
* Refactor mk_and and mk_or call sites to use overloaded methods
Changed 130 call sites across 64 files to use vector overloads directly instead of manually passing .size() and .data()/.c_ptr()
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Revert mk_or changes for ptr_buffer/ptr_vector (no overload exists in ast_util.h)
* Fix compilation errors from mk_and/mk_or refactoring
Fixed type mismatches by:
- Removing m parameter for expr_ref_vector (ast_util.h has mk_and/mk_or(expr_ref_vector) overloads)
- Reverting changes for ref_buffer types (no overload exists in ast_util.h, only in ast.h for m.mk_and)
- Verified build succeeds and Z3 works correctly
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Fix test files to use correct mk_and/mk_or overloads
Changed test/doc.cpp and test/udoc_relation.cpp to use mk_and(expr_ref_vector) and mk_or(expr_ref_vector) without m parameter
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>
* Initial plan
* Fix DEL character encoding in string literals
Change condition from `ch >= 128` to `ch >= 127` to include the DEL
character (U+007F, 127) in escaped output. This ensures that the
non-printable DEL control character is properly escaped as \u{7f}
instead of being printed directly.
Also add test cases for DEL and other control characters.
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>
* Initial plan
* Update Z3_mk_datatype_sort API to accept array of parameters
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Update language bindings for parametric datatype sort API
- Python: Updated DatatypeSort() to accept optional params list
- OCaml: Added mk_sort_ref_p/mk_sort_ref_ps for parametric datatypes
- .NET: Added MkDatatypeSortRef() methods with optional params
- Java: Added mkDatatypeSortRef() methods with optional params
- All changes maintain backward compatibility
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Fix .NET build error - rename params to parameters
The 'params' keyword is reserved in C#, causing compilation errors.
Renamed parameter from 'params' to 'parameters' in MkDatatypeSortRef methods.
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Add unit test for parametric datatypes
Added test_parametric_datatype.cpp to demonstrate polymorphic datatypes.
The test creates two concrete instantiations of a generic pair concept:
- pair_int_real with fields (first:Int, second:Real)
- pair_real_int with fields (first:Real, second:Int)
Then verifies that accessors work correctly and type checking is enforced.
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Implement polymorphic type variables support for parametric datatypes
- Modified datatype_decl_plugin to allow type variables as parameters
- Updated mk_datatype_decl to extract type variables from field sorts
- Type variables are collected in order of first appearance
- Revised unit test to use Z3_mk_type_variable for polymorphic datatypes
- Test creates pair datatype with type variables alpha and beta
- Successfully instantiates with concrete types (pair Int Real) and (pair Real Int)
- Verifies accessor types match and equality terms are well-typed
- All tests pass
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Add Z3_mk_polymorphic_datatype API and refactor datatype creation
- Added new API Z3_mk_polymorphic_datatype to z3_api.h
- Renamed static mk_datatype_decl to api_datatype_decl in api_datatype.cpp
- Modified api_datatype_decl to accept explicit type parameters
- Updated all callers to use renamed function
- Added test_polymorphic_datatype_api demonstrating new API usage
- Both tests pass successfully
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Remove type variable collection logic from constructors
Removed the logic for collecting type variables from field sorts based on constructors.
* Update comments on parameter handling in api_datatype.cpp
Clarify usage of parameters in API documentation.
* Fix OCaml build error - use list instead of array for mk_datatype_sort
Changed mk_sort_ref to pass empty list [] instead of empty array [||].
Changed mk_sort_ref_p to pass params list directly instead of converting to array.
Z3native.mk_datatype_sort expects a list, not an array.
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Add polymorphic datatype example to C++ examples
Added polymorphic_datatype_example() demonstrating:
- Creating type variables alpha and beta with Z3_mk_type_variable
- Defining parametric Pair datatype with fields of type alpha and beta
- Instantiating with concrete types (Pair Int Real) and (Pair Real Int)
- Getting constructors and accessors from instantiated datatypes
- Creating constants and expressions using the polymorphic types
- Verifying type correctness with equality (= (first p1) (second p2))
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>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* Add comprehensive API special relations tests
- Implement tests for all 5 special relations API functions:
* Z3_mk_linear_order - Linear order relation
* Z3_mk_partial_order - Partial order relation
* Z3_mk_piecewise_linear_order - Piecewise linear order relation
* Z3_mk_tree_order - Tree order relation
* Z3_mk_transitive_closure - Transitive closure of a relation
- Test coverage achieved: 100% (5/5 lines) in src/api/api_special_relations.cpp
- Added comprehensive test cases covering:
* Basic functionality with different sorts
* Different index parameters
* Expression creation and integration
* Edge cases and variations
🤖 Generated with Claude Code
* staged files
* remove files
---------
Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
* Add comprehensive API polynomial subresultants tests
- Add tests for Z3_polynomial_subresultants function in api_polynomial.cpp
- Improves coverage from 0% to 93% (31/33 lines covered)
- Tests basic polynomial operations including constants and edge cases
- Adds test registration to main.cpp and CMakeLists.txt
* staged files
* remove files
---------
Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Added comprehensive test coverage for Z3's pseudo-boolean constraint API functions, improving coverage from 0% to 100% for src/api/api_pb.cpp.
- Created comprehensive test suite in src/test/api_pb.cpp
- Added test registration in src/test/main.cpp and src/test/CMakeLists.txt
- Implemented tests for all 5 API functions:
* Z3_mk_atmost: at most k variables can be true
* Z3_mk_atleast: at least k variables can be true
* Z3_mk_pble: weighted pseudo-boolean less-than-or-equal constraint
* Z3_mk_pbge: weighted pseudo-boolean greater-than-or-equal constraint
* Z3_mk_pbeq: weighted pseudo-boolean equality constraint
- Comprehensive test cases covering edge cases, negative coefficients, zero thresholds, empty arrays, and complex scenarios
- All tests pass successfully with 100% coverage achieved
Coverage improvement: api_pb.cpp went from 0% (0/64 lines) to 100% (64/64 lines)
Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This addresses issue #1163 by removing the #ifdef _WINDOWS guard from
src/test/hashtable.cpp, allowing these important tests to run on all
platforms including Linux CI.
Key changes:
- Removed #ifdef _WINDOWS preprocessor guard
- Removed corresponding #else/#endif block
- Tests now compile and run on all platforms
This is part of the broader unit test modernization effort to ensure
comprehensive cross-platform test coverage.
Co-authored-by: Daily Backlog Burner <github-actions[bot]@users.noreply.github.com>
* Daily Test Coverage Improver: Add comprehensive API Datalog tests
This commit adds comprehensive test coverage for Z3's Datalog/fixedpoint API functions, improving coverage from 0% to 17% (84/486 lines) in src/api/api_datalog.cpp.
Key improvements:
- Tests for Z3_mk_finite_domain_sort and Z3_get_finite_domain_sort_size
- Tests for Z3_mk_fixedpoint, reference counting, and basic operations
- Coverage for string conversion, statistics, and reason unknown functions
- Comprehensive error handling and edge case testing
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* staged files
* remove files
---------
Co-authored-by: Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* Initial plan
* Add comprehensive test coverage for math/lp and math/polynomial modules
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Finalize test coverage improvements with corrected implementations
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Fix compilation errors in test files
- Fix algebraic_numbers.cpp: Simplified tests to use basic algebraic operations without polynomial manager dependencies
- Fix polynomial_factorization.cpp: Corrected upolynomial::factors usage and API calls
- Fix nla_intervals.cpp: Changed 'solver' to 'nla::core' and fixed lar_solver constructor
- Fix monomial_bounds.cpp: Updated class names and method calls to match current NLA API
These changes address the scoped_numeral compilation errors and other API mismatches identified in the build.
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* Fix monomial bounds test assertions to use consistent values
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>
* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros
* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md
* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled
* trace: improve trace tag handling system with hierarchical tagging
- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
(class names and descriptions to be refined in a future update)
* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals
* trace : add cstring header
* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py
* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.
* trace : Add TODO comment for future implementation of tag_class activation
* trace : Disable code related to tag_class until implementation is ready (#7663).