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

20128 commits

Author SHA1 Message Date
Lev Nachmanson
1921260c42 restore single cell
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-15 16:44:13 -07:00
Nikolaj Bjorner
3b565bb284 trim parametric datatype test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-15 21:39:39 +02:00
Copilot
5163411f9b
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-15 20:51:21 +02:00
dependabot[bot]
e669fbe557
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-14 18:08:27 +02:00
Nikolaj Bjorner
c5d65cdedd fix build issues
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-12 06:56:15 +02:00
Nikolaj Bjorner
94cdbe5d87
Fix formatting issues in search_tree.h 2025-10-11 21:30:41 -07:00
Nikolaj Bjorner
287825366f
Refactor close_with_core to use current node in lambda 2025-10-11 21:27:58 -07:00
Nikolaj Bjorner
e95162b054 apply formatting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-12 01:00:41 +02:00
Nikolaj Bjorner
e4cc27810f
Refactor search tree closure and resolution logic
Refactor close_with_core to simplify logic and remove unnecessary parameters. Update sibling resolvent computation and try_resolve_upwards for clarity.
2025-10-11 15:42:20 -07:00
Ilana Shapiro
52fd59df1b
Add cube tree optimization about resolving cores recursively up the path, to prune. Also integrate asms into the tree so they're not tracked separately (#7960)
* draft attempt at optimizing cube tree with resolvents. have not tested/ran yet

* adding comments

* fix bug about needing to bubble resolvent upwards to highest ancestor

* fix bug where we need to cover the whole resolvent in the path when bubbling up

* clean up comments

* close entire tree when sibling resolvent is empty

* integrate asms directly into cube tree, remove separate tracking

* try to fix bug about redundant resolutions, merging close and try_resolve_upwards into once function

* separate the logic again to avoid mutual recursion
2025-10-11 06:58:14 -07:00
Lev Nachmanson
641741f3a8 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:30:58 -07:00
Lev Nachmanson
8af9a20e01 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:26:40 -07:00
Lev Nachmanson
6a9520bdc2 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:21:09 -07:00
Lev Nachmanson
8ccf4cd8f7 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:19:24 -07:00
Lev Nachmanson
40b980079b parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:14:02 -07:00
Lev Nachmanson
a41549eee6 parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 10:06:43 -07:00
Lev Nachmanson
2b3068d85f parameter eval order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-07 09:17:12 -07:00
Lev Nachmanson
3a2bbf4802 param eval order 2025-10-07 09:13:21 -07:00
Lev Nachmanson
6e52b9584c param eval 2025-10-07 09:04:24 -07:00
Lev Nachmanson
93ff8c76db parameter evaluation order 2025-10-07 08:53:49 -07:00
Lev Nachmanson
00f1e6af7e parameter eval order 2025-10-07 08:40:24 -07:00
Lev Nachmanson
c154b9df90 param order evaluation 2025-10-07 08:34:56 -07:00
Lev Nachmanson
77c70bf812 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-06 15:52:09 -07:00
Lev Nachmanson
63bb367a10 param order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-06 15:52:09 -07:00
Nikolaj Bjorner
e9a2766e6c remove AI slop
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-06 13:53:37 -07:00
Lev Nachmanson
5a9663247b fix the order of parameter evaluation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-06 13:44:19 -07:00
Lev Nachmanson
5ae858f66b fixing the order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-06 13:44:19 -07:00
Lev Nachmanson
aa5645b54b fixing the order
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-06 13:44:19 -07:00
Nikolaj Bjorner
542e015550
Remove unused variable 'first' in mpz.cpp
Removed unused variable 'first' from the function.
2025-10-06 13:39:27 -07:00
Copilot
cd1ceb6efe
[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-06 13:38:18 -07:00
Ilana Shapiro
b9fb032a67 separate the logic again to avoid mutual recursion 2025-10-05 15:43:27 -07:00
Ilana Shapiro
21422fab8b try to fix bug about redundant resolutions, merging close and try_resolve_upwards into once function 2025-10-05 13:52:27 -07:00
Ilana Shapiro
e2432b0d50 integrate asms directly into cube tree, remove separate tracking 2025-10-05 11:41:00 -07:00
Ilana Shapiro
f75d137911 close entire tree when sibling resolvent is empty 2025-10-04 09:18:22 -07:00
dependabot[bot]
3ce8aca411
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-04 01:22:52 -07:00
Ilana Shapiro
5143ba0118 clean up comments 2025-10-03 16:39:32 -07:00
Ilana Shapiro
b42db215c4 fix bug where we need to cover the whole resolvent in the path when bubbling up 2025-10-03 13:38:02 -07:00
Nikolaj Bjorner
c8bdbd2dc4 remove directory
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-03 11:58:57 -07:00
Ilana Shapiro
279c7d4d46 fix bug about needing to bubble resolvent upwards to highest ancestor 2025-10-03 10:48:47 -07:00
Ilana Shapiro
0898813f8c adding comments 2025-10-03 09:45:54 -07:00
Nikolaj Bjorner
e137aaa249 add user propagators to opt_solver 2025-10-02 19:44:22 -07:00
Nikolaj Bjorner
0e6b3a922a 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-02 10:47:10 -07:00
Nikolaj Bjorner
5d8fcaa3ee update clang format 2025-10-02 10:39:37 -07:00
Nikolaj Bjorner
72c89e1a4e 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-09-30 15:58:48 -07:00
Nikolaj Bjorner
0881a71ed2 update format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-30 15:42:01 -07:00
Nikolaj Bjorner
65c9a18c3a fix #7956
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-30 15:41:49 -07:00
Ilana Shapiro
6da167ec09 draft attempt at optimizing cube tree with resolvents. have not tested/ran yet 2025-09-30 11:35:00 -07:00
Ruijie Fang
339f0cd5f9
Correctly distinguish between Lambda and Quantifier in Z3 Java API (#7955)
* Distinguish between Quantifier and Lambda in AST.java

* Distinguish betwee Lambda and Quantifier in Expr.java

* Make things compile
2025-09-30 09:55:14 -07:00
Nikolaj Bjorner
253a7245d0 add analysis
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-28 13:05:04 +03:00
Nikolaj Bjorner
b5f79da76a add analysis
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-28 13:03:31 +03:00