3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-05 05:49:13 +00:00
Commit graph

20113 commits

Author SHA1 Message Date
Nikolaj Bjorner
3d9da872c8 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:30 -07:00
Nikolaj Bjorner
061934b648 add explicit constructors for nightly mac build failure
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:30 -07:00
Nikolaj Bjorner
c9f1576319 Update arith_rewriter.cpp
fix memory leak introduced by update to ensure determinism
2025-10-31 08:32:30 -07:00
Nikolaj Bjorner
85de57c448 Revert "Add finite_set_value_factory for creating finite set values in model …" (#7985)
This reverts commit 05ffc0a77b.
2025-10-31 08:32:30 -07:00
Copilot
4fd7087e04 Add finite_set_value_factory for creating finite set values in model generation (#7981)
* Initial plan

* Add finite_set_value_factory implementation

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

* Remove unused dl_decl_plugin variable and include

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

* Update copyright and add TODOs in finite_set_value_factory

Updated copyright information and added TODO comments for handling in finite_set_value_factory methods.

* Update copyright information in finite_set_value_factory.h

Updated copyright year from 2006 to 2025.

* Implement finite_set_value_factory using array_util to create singleton sets

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

* Simplify empty set creation in finite_set_value_factory

Refactor finite_set_value_factory to simplify empty set handling and remove array-specific logic.

* Change family ID for finite_set_value_factory

* Fix build error by restoring array_decl_plugin include and implementation

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

* Update finite_set_value_factory.h

* Add SASSERT for finite set check in factory

Added assertion to check if the sort is a finite set.

* Rename member variable from m_util to u

* Refactor finite_set_value_factory for value handling

* Use register_value instead of direct set insertion

Replaced direct insertion into set with register_value calls.

* Update finite_set_value_factory.cpp

---------

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>
2025-10-31 08:32:30 -07:00
Lev Nachmanson
321ac8fe57 restore the method behavior
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-31 08:32:30 -07:00
Lev Nachmanson
6673cbf133 restore single cell
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-31 08:32:30 -07:00
Nikolaj Bjorner
2bf1d5b113 trim parametric datatype test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:29 -07:00
Copilot
df334cb54c Update Z3_mk_datatype_sort API to accept array of sort parameters and add Z3_mk_polymorphic_datatype (#7966)
* 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>
2025-10-31 08:32:29 -07:00
dependabot[bot]
493481a27e Bump github/codeql-action from 3 to 4 (#7971)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-31 08:32:29 -07:00
Nikolaj Bjorner
8d0c229f91 update clang format 2025-10-31 08:32:29 -07:00
Nikolaj Bjorner
ec66d8c9c7 update format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:25 -07:00
Nikolaj Bjorner
5e4882d731 propagate value initialization to atoms 2025-10-31 08:31:09 -07:00
Nikolaj Bjorner
706aff74ff fixup comparison with bounds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-30 08:26:13 -07:00
Nikolaj Bjorner
6ba4ba142f separate bounds introduction 2025-10-29 14:16:34 -07:00
Nikolaj Bjorner
cf54e985e8 separate out bounds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-29 11:19:10 -07:00
Nikolaj Bjorner
1657fc6ebf add hash-table to avoid duplicate derived inequalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-28 20:10:43 -07:00
Nikolaj Bjorner
e13e85c4ab swap signs of coefficients compared to sign of variables. They are on different sides of inequality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-28 03:16:12 -07:00
Nikolaj Bjorner
ef500de2d2 fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-11 03:11:49 -07:00
Nikolaj Bjorner
07bda4d629 bugfix
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 19:29:23 -07:00
Nikolaj Bjorner
ff975e49f2 use model-based FM strategy for saturation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 16:34:58 -07:00
Nikolaj Bjorner
ce614ac26d gcd reduce and use c().val for sign constraints 2025-10-10 16:34:05 -07:00
Nikolaj Bjorner
6aeca8253b generate more proper proof format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 16:31:08 -07:00
Nikolaj Bjorner
df3847a379 v0.1 of nla saturation 2025-10-10 16:28:22 -07:00
Lev Nachmanson
94ff926477 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:55 -07:00
Lev Nachmanson
779cb7f1c9 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:55 -07:00
Lev Nachmanson
5ae7bb078a parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:55 -07:00
Lev Nachmanson
52e55854a4 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:55 -07:00
Lev Nachmanson
a8d772f22b parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:54 -07:00
Lev Nachmanson
a4777a00c8 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:54 -07:00
Lev Nachmanson
f8fb0351af parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:54 -07:00
Lev Nachmanson
748b004e0d param eval order 2025-10-10 15:36:53 -07:00
Lev Nachmanson
82ded52bd7 param eval 2025-10-10 15:36:53 -07:00
Lev Nachmanson
3601930985 parameter evaluation order 2025-10-10 15:36:53 -07:00
Lev Nachmanson
5c4edc233f parameter eval order 2025-10-10 15:36:53 -07:00
Lev Nachmanson
8feb8fa951 param order evaluation 2025-10-10 15:36:52 -07:00
Lev Nachmanson
427c774961 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:52 -07:00
Lev Nachmanson
25014d3257 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:52 -07:00
Nikolaj Bjorner
2d65034ae8 remove AI slop
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 15:36:52 -07:00
Lev Nachmanson
cf275a481d fix the order of parameter evaluation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:51 -07:00
Lev Nachmanson
92b995c6cb fixing the order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:51 -07:00
Lev Nachmanson
4c71451e8b fixing the order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-10 15:36:51 -07:00
Nikolaj Bjorner
a84ec5e397 Remove unused variable 'first' in mpz.cpp
Removed unused variable 'first' from the function.
2025-10-10 15:36:51 -07:00
Copilot
59dfcdfc4e [WIP] Add a mutex to warning.cpp to ensure that warning messages from different threads don't interfere (#7963)
* Initial plan

* Add mutex to warning.cpp for thread safety

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>
2025-10-10 15:36:50 -07:00
dependabot[bot]
bd56607ea5 Bump actions/checkout from 4 to 5 (#7954)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 15:36:50 -07:00
Nikolaj Bjorner
ef3803a3cf remove directory
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 15:36:50 -07:00
Nikolaj Bjorner
45f088c89b add user propagators to opt_solver 2025-10-10 15:36:49 -07:00
Nikolaj Bjorner
f5c217e15b Add commands for forcing preferences during search
Add commands:

(prefer <formula>)
- will instruct case split queue to assign formula to true.
- prefer commands added within a scope are forgotten after leaving the scope.

(reset-preferences)
- resets asserted preferences. Has to be invoked at base level.

This provides functionality related to MathSAT and based on an ask by Tomáš Kolárik who is integrating the functionality with OpenSMT2
2025-10-10 15:36:49 -07:00
Nikolaj Bjorner
670df87460 update clang format 2025-10-10 15:36:43 -07:00
Nikolaj Bjorner
82b28202b2 fix #7952 - make auto-selector detect large bit-vectors so it does't use the datalog engine for hopelessly large tables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-10 15:36:24 -07:00