3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-26 23:39:50 +00:00
Commit graph

16965 commits

Author SHA1 Message Date
Nikolaj Bjorner
2578218b6f add new option for adding tangent lemmas for integer monomials
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-20 11:30:07 -08:00
Nikolaj Bjorner
fc96f827a1 updates
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-20 10:32:51 -08:00
Nikolaj Bjorner
823800541e updates
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-19 14:02:27 -08:00
Nikolaj Bjorner
5d316a51d1 enable bound tracking
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-19 10:53:42 -08:00
Nikolaj Bjorner
5de01e5d1d add stubs for bounds refinement
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-19 10:42:28 -08:00
Nikolaj Bjorner
179601ffac testing model repair
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-18 14:14:54 -08:00
Nikolaj Bjorner
4df7ee67f5 updated sketch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-17 22:06:29 -08:00
Nikolaj Bjorner
92bc39dab5 add toggle to use polynomial translation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-17 20:52:34 -08:00
Nikolaj Bjorner
33709d3abb add toggle to use polynomial translation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-17 17:28:28 -08:00
Nikolaj Bjorner
2eca05e59a fix crash
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-17 09:57:17 -08:00
Nikolaj Bjorner
12df8f593e reshuffle if conditions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-16 17:24:31 -08:00
Nikolaj Bjorner
e9905c05b1 fix crash
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-16 17:21:23 -08:00
Nikolaj Bjorner
711572e73c fix crash on arie branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-16 16:58:33 -08:00
Nikolaj Bjorner
b835bd4c92 self-contained tracking of values
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-16 12:55:58 -08:00
Nikolaj Bjorner
f347c24e04 fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-15 13:09:25 -08:00
Nikolaj Bjorner
072f1deccc update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-14 16:37:00 -08:00
Nikolaj Bjorner
d081321384 add substitution and division
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-14 16:26:10 -08:00
Nikolaj Bjorner
f55bdd923a remove mul saturate
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-13 15:43:44 -08:00
Nikolaj Bjorner
5ea25dcf60 v2 running
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-13 13:59:12 -08:00
Nikolaj Bjorner
c7084e9998 revamp stellensatz to use polynomals
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-12 20:21:42 -08:00
Nikolaj Bjorner
21b36868b5 revamping stellensatz
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-12 10:13:09 -08:00
Nikolaj Bjorner
b8f5e1d646 small rewrite update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-10 15:01:30 -08:00
Nikolaj Bjorner
9f848847c7 remove debug out from euf-completion 2025-11-07 08:06:13 -08:00
Nikolaj Bjorner
f4c5e14b6b add fold-unfold simplification
this substitutes solve-eqs by including fold-unfold reductions.
2025-11-07 08:04:41 -08:00
Nikolaj Bjorner
5d36f53cd3 add rewrite to eliminate quot-rem tautologies 2025-11-07 08:04:03 -08:00
Nikolaj Bjorner
a3ec6a0f1b add delayed diseq check 2025-11-07 08:03:37 -08:00
Nikolaj Bjorner
daf66e63c6 add more pre-processing for band
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-04 09:45:40 -08:00
Nikolaj Bjorner
4828ed97be tweak bound propagation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-03 12:41:33 -08:00
Nikolaj Bjorner
88269edd4b fixup bv operators
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-03 07:56:42 -08:00
Nikolaj Bjorner
919ac515bc fix crash
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-02 16:05:09 -08:00
Nikolaj Bjorner
e709885e72 gcd reduce and use c().val for sign constraints 2025-10-31 08:43:46 -07:00
Nikolaj Bjorner
018cb3c734 generate more proper proof format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:41:14 -07:00
Nikolaj Bjorner
fdac93fff3 v0.1 of nla saturation 2025-10-31 08:36:15 -07:00
Nikolaj Bjorner
bc28de931b fix C++ example and add polymorphic interface for C++
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:32 -07:00
Nikolaj Bjorner
d8862f8f6a fix build break introduced when adding support for polymorphic datatypes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-31 08:32:32 -07:00
Copilot
0ebc1070da 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-31 08:32:32 -07:00
Lev Nachmanson
bfd896cd35 enable always add all coeffs in nlsat
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-31 08:32:31 -07:00
Lev Nachmanson
bb005a9ccf throttle grobner method more actively
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-31 08:32:31 -07:00
Lev Nachmanson
b21d48ee23 try exponential delay in grobner
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2025-10-31 08:32:31 -07:00
Nelson Elhage
4717e61012 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-31 08:32:31 -07:00
Lev Nachmanson
aad55de04b add the "noexcept" keyword to value_score=(value_score&&) declaration 2025-10-31 08:32:31 -07:00
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