3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-20 01:03:20 +00:00
Commit graph

20488 commits

Author SHA1 Message Date
Lev Nachmanson
18553c8288 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>
2026-01-17 16:06:42 -10:00
Lev Nachmanson
cc688ea69d 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>
2026-01-17 13:47:51 -10:00
Lev Nachmanson
6425dab00d 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>
2026-01-17 06:29:47 -10:00
Lev Nachmanson
ce0067ca67 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>
2026-01-16 19:18:15 -10:00
Lev Nachmanson
9d22786649 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>
2026-01-16 10:50:26 -10:00
Lev Nachmanson
e0be8a8f8d 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>
2026-01-16 10:36:56 -10:00
Lev Nachmanson
7bf9fc1f87 disables some heuristics in section
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-16 09:37:38 -10:00
Lev Nachmanson
02a3a2a445 t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-16 08:10:18 -10:00
Lev Nachmanson
90971bc356 align with SMT-RAT
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-15 10:13:12 -10:00
Lev Nachmanson
22a7c50e0c toward more like SMT-RAT split
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-15 09:06:45 -10:00
Lev Nachmanson
57d1763809 ignore const non-null witnesses
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-15 06:58:04 -10:00
Lev Nachmanson
8dc0e5bef1 Revert "cache the polynomial roots"
This reverts commit aefcd16aaa.
2026-01-14 19:04:22 -10:00
Lev Nachmanson
aefcd16aaa cache the polynomial roots
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 15:30:44 -10:00
Lev Nachmanson
ec05852805 refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:15 -10:00
Lev Nachmanson
2ac311c174 refactor 2026-01-14 07:45:15 -10:00
Lev Nachmanson
6698721f24 refactor
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
7d9000664d discard a discriminant only in the section case
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
87535daf7e try optimizing build_interval_and_relation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
1bd32ab02a avoid a compare call
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
0e38c6c543 use std_vector more
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
ca7d3ca90a omit some disc
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
326963bb69 avoid ldcf with the projective theorem
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
623c5363d8 efficient sort of root functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
6c64d271c8 restore choose_non_zero_coeff
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
f0c6336606 simple choice of non-vanishing
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
a75f878c4a fix a bug with non-adding ldcf
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
60507d5692 introduce isolate_root_closest
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
d87d1d009f hook up different relation build strategies for lws
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
946f209b4c t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
29d306ec66 t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
8661b68380 t 2026-01-14 07:45:14 -10:00
Lev Nachmanson
84bef9c5b5 simplify by removing back propagation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
27c319327c t 2026-01-14 07:45:14 -10:00
Lev Nachmanson
f6dde3e5f9 fix the duplicate bug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
5ee9262cdb with resultant calculation ignore one of p and q with a common root
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
66c0aae3df index bug
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
af16e7e143 better sort of root functions
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
8e3a28ac82 t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
da74549d9d cleanup and more caching
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
4a05e82e7a t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
7c14b5eebb Revert "make normalize optional"
This reverts commit c80cfb0b8e.
2026-01-14 07:45:14 -10:00
Lev Nachmanson
cc56749e84 make normalize optional
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
e542a5e520 t
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
aa436bd5dd optimizations by using cached psc
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
8a90e2c0d8 handle the zero case in add_ord_inv_resultant
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
cf52acb2ce unsound state
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
107b4027d2 unsound state
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
239d3981ef use the cache consistently
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
5a69942895 try not to fail in add_sgn_inv_leading_coeff_for
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00
Lev Nachmanson
52476bf1d7 normalize polynomials
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-01-14 07:45:14 -10:00