3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-07 22:04:53 +00:00
Commit graph

3633 commits

Author SHA1 Message Date
copilot-swe-agent[bot]
8e94cad8ab Fix static analysis findings: uninitialized vars, bitwise shift UB, garbage values
- nla_core.cpp: Initialize j = null_lpvar in is_octagon_term
- bit2int.cpp: Initialize sign_p, sign_n, sz_p, sz_n
- act_cache.cpp: Initialize debug vars to nullptr
- enum2bv_rewriter.cpp: Use unsigned literal in 1u << idx
- bit_matrix.cpp: Use unsigned literal in 1u << (n-1)
- bit_util.cpp: Guard against bit_shift == 0 in shl/shr
- mpff.cpp: Cast exp to unsigned before shifting
- sorting_network.h: Guard against bits == 0
- dl_sparse_table.h: Use >= 64 instead of == 64

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-02 00:13:55 +00:00
Nikolaj Bjorner
d906a0cc2d fix bug reported by Maria Novoszel
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-27 12:02:55 -08:00
Lev Nachmanson
5ff5b075b2
Merge pull request #8789 from Z3Prover/succ_int_mult
Fix #7507: simplify (>= product_of_consecutive_ints 0) to true
2026-02-27 09:45:26 -10:00
Lev Nachmanson
21c23e78db Fix #7507: simplify (>= product_of_consecutive_ints 0) to true
The arith rewriter now recognizes that x * (x + 1) >= 0 for all
integers, since no integer lies strictly between -1 and 0.

Two changes:
1. is_non_negative: detect products where unpaired factors are
   consecutive integer expressions (differ by exactly 1), handling
   both +1 and -1 offsets and n-ary additions
2. is_separated: return true for (>= non_negative_mul 0), restricted
   to multiplication expressions to avoid disrupting other theories

Also adds regression tests for the new simplification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-27 06:37:07 -10:00
Nikolaj Bjorner
828e4a7ef7
Merge pull request #8779 from Z3Prover/copilot/convert-bv1-blast-to-simplifier
Convert bv1-blast tactic to a dependent_expr_simplifier
2026-02-26 15:52:18 -08:00
Nikolaj Bjorner
c70f902b53
Merge pull request #8780 from Z3Prover/copilot/convert-blast-term-ite-to-simplifier
Convert `blast-term-ite` tactic to a `dependent_expr_simplifier`
2026-02-26 15:51:30 -08:00
copilot-swe-agent[bot]
ff7cc0f59e Remove old blast-term-ite tactic class, rename blast-term-ite2 to blast-term-ite
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-26 20:07:42 +00:00
Nikolaj Bjorner
070f760501
Merge pull request #8748 from Z3Prover/copilot/fix-floating-point-model-validation
Fix fp.to_real bitvector encoding for denormal floating-point values
2026-02-26 02:21:20 -08:00
copilot-swe-agent[bot]
033ea50a5d Convert bv1-blast tactic to a simplifier
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-26 04:01:11 +00:00
copilot-swe-agent[bot]
7390a9b856 Convert blast-term-ite tactic to also expose as a simplifier
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-26 03:51:42 +00:00
Nikolaj Bjorner
fba1e4b648
Merge pull request #8737 from Z3Prover/copilot/fix-refutational-soundness-bug
Fix soundness bug: RNE/RNA overflow to ±infinity in symbolic Real-to-FP conversion
2026-02-25 13:34:59 -08:00
Nikolaj Bjorner
aaa62efc90
Merge pull request #8725 from Z3Prover/copilot/convert-factor-to-simplifier
Convert `factor` tactic to a `dependent_expr_simplifier`
2026-02-24 08:42:30 -08:00
copilot-swe-agent[bot]
de3cf18899 Fix fp.to_real encoding for denormal floating-point values
The mk_to_real function in fpa2bv_converter.cpp was missing the
normalization shift adjustment (lz) when computing the real-valued
exponent for denormal floating-point numbers.

When unpack(x, sgn, sig, exp, lz, normalize=true) normalizes a denormal
by shifting the significand left by lz positions, the returned exp does
not account for this shift. All other callers (mk_mul, mk_div, mk_fma)
correctly subtract lz from the exponent, but mk_to_real was missing this.

The fix subtracts zero-extended lz from the sign-extended exp to get the
true exponent, matching the convention used by other FP operations.

Fixes incorrect model with (_ FloatingPoint 2 24) and fp.to_real.

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-24 05:22:54 +00:00
copilot-swe-agent[bot]
c0fd3513a2 Fix RNE/RNA overflow-to-infinity in Real-to-FP conversion (soundness bug)
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-23 04:34:58 +00:00
Nikolaj Bjorner
8fbc4ed26d
Merge pull request #8727 from Z3Prover/copilot/expose-max-bv-sharing-simplifier
Expose max-bv-sharing as a registered simplifier
2026-02-22 19:40:35 -08:00
copilot-swe-agent[bot]
c78b3d872d Convert der tactic to simplifier: add der_simplifier.h and update der_tactic.h
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-21 23:49:05 +00:00
copilot-swe-agent[bot]
42d3a13ddf Add factor_simplifier and factor2 tactic wrapping the simplifier
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-21 23:45:51 +00:00
copilot-swe-agent[bot]
ce905f91c3 Register max_bv_sharing simplifier via ADD_SIMPLIFIER
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-21 23:26:47 +00:00
copilot-swe-agent[bot]
e5d7319670 Code simplifications for finite set plugin
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-21 02:08:04 +00:00
Nikolaj Bjorner
a1d43f5fb9 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 21:03:19 -08:00
Nuno Lopes
3b89789438 delete dead code 2026-02-18 21:02:30 -08:00
copilot-swe-agent[bot]
d5ba26e754 Fix C4267 build warnings in ast.h by adding static_cast for size_t to unsigned conversions
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 21:02:29 -08:00
copilot-swe-agent[bot]
d958036711 Add initializer_list overloads and update all call sites
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 21:02:26 -08:00
copilot-swe-agent[bot]
d414646975 Add std::initializer_list overloads for update_quantifier and update call sites
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 21:02:26 -08:00
Nuno Lopes
f6f8beaf78 Remove copies (#8583) 2026-02-18 21:02:22 -08:00
Nikolaj Bjorner
776976cbd1 fix #8572
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 21:02:20 -08:00
Nikolaj Bjorner
c8cd205207 fix build warnings and scoop up after Nuno's leaks 2026-02-18 21:02:18 -08:00
Nuno Lopes
a3e7bbb92f replace some copies with moves 2026-02-18 21:02:17 -08:00
Copilot
3a8b688008 Store rational by value in parameter variant (#8518)
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
2026-02-18 20:58:07 -08:00
Nuno Lopes
e73c897bd4 constructor 2026-02-18 20:58:07 -08:00
copilot-swe-agent[bot]
38661f25e4 Fix build warnings: cast size_t to unsigned in arith_decl_plugin.h and bv_decl_plugin.h
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 20:58:07 -08:00
copilot-swe-agent[bot]
999a92e3e6 Revert prexpr to non-static for debugging availability
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
2026-02-18 20:58:05 -08:00
copilot-swe-agent[bot]
21fd199062 Add static linkage to internal functions
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
2026-02-18 20:58:05 -08:00
Copilot
adf72f2a66 Modern C++: Add std::span overload for mk_or, adopt std::clamp, optimize stream output (#8507)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 20:58:05 -08:00
Copilot
73f6dae095 Refactor mk_concat call sites to use std::initializer_list (#8494)
* Initial plan

* Refactor mk_concat call sites to use std::initializer_list

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>
2026-02-18 20:58:03 -08:00
Copilot
957d548bdb Add std::initializer_list overloads for BV and arith operations (#8467)
* 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>
2026-02-18 20:58:02 -08:00
Copilot
9758b7646f Remove redundant explicit default constructors (#8470)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-02-18 20:58:01 -08:00
Copilot
17c8958d70 Remove redundant default constructors when they're the only constructor (#8461)
* Initial plan

* Modernize C++ constructors to use C++11 default member initialization - Phase 1

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix theory_pb.h struct definition - move reset() back inside struct

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 2

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix opt_solver.h - revert rational initialization (complex type)

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 3

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix sparse_matrix.h - explicitly initialize union member in default constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Remove unnecessary default constructors when they're the only constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
2026-02-18 20:58:01 -08:00
Copilot
31e4945922 Remove redundant non-virtual destructors with = default (#8462)
* Initial plan

* Remove 6 non-virtual destructors with no code (= default)

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
2026-02-18 20:58:01 -08:00
Copilot
abbc76b7ae Refactor expr_stat to use structured bindings for traversal pairs (#8441)
* Initial plan

* Refactor expr_stat.cpp to use C++17 structured bindings

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix structured binding inside DEBUG_CODE macro in smt_justification.cpp

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>
2026-02-18 20:58:00 -08:00
Nuno Lopes
1f505788c2 remove another use of rational::power_of_two() 2026-02-18 20:58:00 -08:00
Nuno Lopes
152db47275 minor simplification 2026-02-18 20:58:00 -08:00
Nuno Lopes
6c3f9a3540 optimize has_sign_bit and mod2k to not compute powers of two
this is very useful for bitvectors of large bitwidths
2026-02-18 20:58:00 -08:00
Copilot
1853cdeb3d Refactor der.cpp topological sort to use structured bindings (#8401)
* Initial plan

* Refactor der.cpp to use structured bindings for expression/index pairs

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix comment to refer to 'e' instead of 't' after structured binding refactor

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>
2026-02-18 20:57:59 -08:00
Nikolaj Bjorner
78cb28d0cd address #8376
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:57:58 -08:00
Copilot
64c436d959 Refactor bound_manager to use C++17 structured bindings (#8404)
* Initial plan

* Refactor bound_manager to use C++17 structured bindings

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>
2026-02-18 20:57:58 -08:00
Copilot
307982b67e Refactor seq_rewriter to use C++17 structured bindings (#8381)
* Initial plan

* Refactor seq_rewriter.cpp to use C++17 structured bindings

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Address code review feedback - move pair declaration inside loop

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>
2026-02-18 20:57:58 -08:00
Copilot
aab17272f1 Refactor pb_rewriter to use structured bindings for expression/coefficient pairs (#8380)
* Initial plan

* Refactor pb_rewriter to use C++17 structured bindings

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>
2026-02-18 20:57:57 -08:00
Copilot
29c583397f Expose timestamp method in sls_context (#8347)
* Initial plan

* Expose timestamp method in sls_context

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>
2026-02-18 20:57:56 -08:00
Nikolaj Bjorner
382b3d9a97 Reset timestamp for variables in sat_ddfw.cpp 2026-02-18 20:57:55 -08:00