3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-31 19:52:29 +00:00
Commit graph

20157 commits

Author SHA1 Message Date
dependabot[bot]
fd9bb2ec5b Bump actions/upload-artifact from 4 to 5 (#7998)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  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-30 02:57:53 -07:00
dependabot[bot]
543ee38682 Bump actions/download-artifact from 5 to 6 (#7999)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  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-30 02:57:52 -07:00
Copilot
a692994434 Add missing mkLastIndexOf method and CharSort case to Java API (#8002)
* Initial plan

* Add mkLastIndexOf method and CharSort support to Java API

- Added mkLastIndexOf method to Context.java for extracting last index of sub-string
- Added Z3_CHAR_SORT case to Sort.java's create() method switch statement
- Added test file to verify both fixes work correctly

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

* Fix author field in test file

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

* Delete examples/java/TestJavaAPICompleteness.java

---------

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-30 02:57:52 -07:00
Nikolaj Bjorner
61e3e98e2e disable centos build until resolved
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-30 02:57:15 -07:00
Nikolaj Bjorner
454a8c3406 Revert "Add finite_set_value_factory for creating finite set values in model …" (#7985)
This reverts commit 05ffc0a77b.
2025-10-30 02:57:11 -07:00
Copilot
c8e849b063 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-30 02:55:59 -07:00
Nikolaj Bjorner
ba28e85f04 add sketch for incremental algorithm
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-30 02:53:29 -07:00
Copilot
450412c854
[WIP] Add finite set operators to Z3_decl_kind enumeration (#8004)
* Initial plan

* Add Z3_decl_kind enumeration for finite_set operators

- Added Z3_OP_FINITE_SET_* enumeration values (0xc000 range) to z3_api.h
- Added documentation for all 13 finite_set operators
- Added translation cases in api_ast.cpp for mapping internal finite_set
  enum values to external Z3_decl_kind values
- All operators tested and working correctly

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

* Improve documentation for Z3_OP_FINITE_SET_EXT and Z3_OP_FINITE_SET_MAP_INVERSE

- Clarified that Z3_OP_FINITE_SET_EXT returns a witness element demonstrating
  two sets are different (extensionality)
- Clarified that Z3_OP_FINITE_SET_MAP_INVERSE relates to pre-image reasoning

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-29 16:52:38 -07:00
Nikolaj Bjorner
4536985bf7 enable post setup parameter tweaking in theory solvers, update azure-pipeline
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-28 15:11:35 -07:00
Nikolaj Bjorner
b8cadfac56 don't add boolean disequality . 2025-10-27 14:08:12 -07:00
Nikolaj Bjorner
a82af886eb formatting 2025-10-27 14:01:30 -07:00
Nikolaj Bjorner
2f06bcc731 add finite_set to quantifieed theories in smt_setup, fix type signature for map-inverse axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 20:34:13 +01:00
Nikolaj Bjorner
c0ca3b5a0a streamline axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 18:58:45 +01:00
Nikolaj Bjorner
4464ab9431 fix empty set declaration, add axioms and rewrites
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 18:18:46 +01:00
Nikolaj Bjorner
4630373a97 add finite sets to datatype recursion, delay initialize finite_set plugin, fix bugs in are_distinct and equality simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 10:37:19 +01:00
Nikolaj Bjorner
d847a28589 bug fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 05:51:42 +01:00
Nikolaj Bjorner
c832802183 disable tracking literals, they are not used
added trivial rewrites for set.size
2025-10-26 16:21:33 +01:00
Nikolaj Bjorner
a66cb88c78 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 15:35:59 +01:00
Lev Nachmanson
e980f92a9e enable always add all coeffs in nlsat
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:35:25 +01:00
Lev Nachmanson
7b095ca733 throttle grobner method more actively
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:35:25 +01:00
Lev Nachmanson
a15b21bc62 try exponential delay in grobner
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:35:25 +01:00
hwisungi
ba03d35957 Enabling Control Flow Guard (CFG) by default for MSVC on Windows, with options to disable CFG. (#7988)
* Enabling Control Flow Guard by default for MSVC on Windows, with options to disable it.

* Fix configuration error for non-MSVC compilers.

* Reviewed and updated configuration for Python build and added comment for CFG.
2025-10-26 15:35:25 +01:00
dependabot[bot]
06d142119f Bump actions/setup-node from 5 to 6 (#7994)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  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-26 15:35:25 +01:00
Nelson Elhage
afaf0e3dd7 Add a fast-path to _coerce_exprs. (#7995)
When the inputs are already the same sort, we can skip most of the
coercion logic and just return.

Currently, `_coerce_exprs` is by far the most expensive part of
building up many common Z3 ASTs, so this fast-path is a substantial
speedup for many use-cases.
2025-10-26 15:35:24 +01:00
Lev Nachmanson
0d285a9b41 add the "noexcept" keyword to value_score=(value_score&&) declaration 2025-10-26 15:35:24 +01:00
Nikolaj Bjorner
0ae54c34fd disable manylinux until segfault is resolved
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 15:35:24 +01:00
Nikolaj Bjorner
1477ce2a99 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 15:35:24 +01:00
Nikolaj Bjorner
39913667c6 add explicit constructors for nightly mac build failure
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 15:35:24 +01:00
Nikolaj Bjorner
90d36ed915 Revert "Add finite_set_value_factory for creating finite set values in model …" (#7985)
This reverts commit 05ffc0a77b.
2025-10-26 15:35:15 +01:00
Copilot
85e1a39c09 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-26 15:34:09 +01:00
Lev Nachmanson
351c0401fb restore the method behavior
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:21 +01:00
Lev Nachmanson
d9ca739499 restore single cell
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:21 +01:00
Nikolaj Bjorner
f324c5286c trim parametric datatype test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 15:32:21 +01:00
Copilot
0d85b86334 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-26 15:32:21 +01:00
dependabot[bot]
64295b5876 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-26 15:32:20 +01:00
Lev Nachmanson
23ce6917c5 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
6bca12d399 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
e75da050d2 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
4f93fc7b2a parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
5a3d33a615 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
6146fe9ff8 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
0a2328af1d parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:20 +01:00
Lev Nachmanson
0fbf4010a5 param eval order 2025-10-26 15:32:20 +01:00
Lev Nachmanson
b22f4d8802 param eval 2025-10-26 15:32:20 +01:00
Lev Nachmanson
e113d39aa8 parameter evaluation order 2025-10-26 15:32:20 +01:00
Lev Nachmanson
28c625a170 parameter eval order 2025-10-26 15:32:19 +01:00
Lev Nachmanson
1aaf2f8448 param order evaluation 2025-10-26 15:32:19 +01:00
Lev Nachmanson
97bb035416 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:19 +01:00
Lev Nachmanson
74c28532f4 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-26 15:32:19 +01:00
Nikolaj Bjorner
f8b2268424 base implementation for cardinality constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 10:35:37 +01:00