3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-12-25 05:26:51 +00:00
Commit graph

2694 commits

Author SHA1 Message Date
Copilot
042b6d92b1
Add GitHub Actions workflow to publish JavaScript/TypeScript API documentation (#8084)
* Initial plan

* Add GitHub Actions workflow to build and publish documentation

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

* Refine documentation workflow to use mk_api_doc.py and install doxygen

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

* Clarify documentation generation step name

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-12-15 22:57:46 +00:00
Chris Cowan
ebe8b5dea5
Typescript typedef and doc fixes take 2 (#8078)
* Fix Typescript typedef to allow `new Context`

* fix init() tsdoc example using nonexistent sat import
2025-12-15 20:31:20 +00:00
Nikolaj Bjorner
77cb70a082
Revert "Typescript typedef and doc fixes (#8073)" (#8077)
This reverts commit 6cfbcd19df.
2025-12-15 17:38:04 +00:00
Chris Cowan
6cfbcd19df
Typescript typedef and doc fixes (#8073)
* Fix Typescript typedef to allow `new Context`

* fix init() tsdoc example using nonexistent sat import
2025-12-15 17:03:41 +00:00
Copilot
313be1ca1b
Implement Z3_optimize_translate for context translation (#8072)
* Initial plan

* Implement Z3_optimize_translate functionality

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

* Fix compilation errors and add tests for optimize translate

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

* Revert changes to opt_solver.cpp as requested

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-12-13 05:12:08 +00:00
Nikolaj Bjorner
ab227c83b2 remove deprecated set_has_size
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-27 15:11:59 -08:00
Nikolaj Bjorner
8ba77dfc6b remove deprecated set_has_size
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-27 15:10:20 -08:00
Nikolaj Bjorner
682865df24 remove deprecated set_has_size
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-27 15:07:27 -08:00
Nikolaj Bjorner
449ce1a012 remove deprecated set_has_size
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-27 15:04:40 -08:00
Josh Berdine
aecf10b3ac
Fix _in vs _out def_API param for Z3_solver_get_levels (#8050)
Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-27 15:00:38 -08:00
Nikolaj Bjorner
28dc71c75e fix second byref to bool 2025-11-26 14:40:11 -08:00
Nikolaj Bjorner
ed8b92411e remove references to set_has_size 2025-11-26 13:57:24 -08:00
Nikolaj Bjorner
fab414a7ab use c_bool instead of c_int for sign 2025-11-26 13:55:06 -08:00
Nikolaj Bjorner
8298302358 python type fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-26 09:35:07 -08:00
Nikolaj Bjorner
55fc9cb9e1 fix dotnet build errors
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-26 09:29:59 -08:00
Nikolaj Bjorner
1c3fb49878 port dotnet to use bool sorts from API
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-25 21:44:41 -08:00
Nikolaj Bjorner
eecd052730 port to BoolPtr
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-25 21:08:43 -08:00
Nikolaj Bjorner
8346bb6679 open_log returns bool
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-25 20:48:57 -08:00
Nikolaj Bjorner
bcf2c0b3a9 update doc test string
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-25 20:15:48 -08:00
Josh Berdine
239e0949db
Return bool instead of int in extra_API for Z3_open_log (#8048)
The C declaration returns `bool`.

Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-25 18:11:38 -08:00
Josh Berdine
4af83e8501
Return sign from Z3_fpa_get_numeral_sign as bool instead of int (#8047)
The underlying `mpf_manager::sgn` function returns a `bool`, and functions
such as `Z3_mk_fpa_numeral_int_uint` take the sign as a `bool`.

Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-25 18:10:38 -08:00
Josh Berdine
4401abbb4a
Return bool instead of int from Z3_rcf_interval (#8046)
In the underlying realclosure implementation, the interval operations for
{`lower`,`upper`}`_is_`{`inf`,`open`} return `bool` results. Currently these
are cast to `int` when surfacing them to the API. This patch keeps them at
type `bool` through to `Z3_rcf_interval`.

Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-25 18:08:17 -08:00
Nikolaj Bjorner
bf6ff56fd6 update package lock
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-15 16:56:18 -08:00
Josh Berdine
28b31cfe91
Add Z3_fpa_is_numeral to the API (#8026)
This is analogous to Z3_fpa_is_numeral_nan, Z3_fpa_is_numeral_inf, etc. and
can be needed to check that inputs are valid before calling those functions.

Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-15 16:21:08 -08:00
Josh Berdine
43525481f0
Add check that argument of Z3_is_algebraic_number is_expr (#8027)
To make sure that the `to_expr` cast is safe.

Signed-off-by: Josh Berdine <josh@berdine.net>
2025-11-15 16:19:39 -08:00
Copilot
fc7660d0b5
Add missing string replace operations to Java API (#8011)
* Initial plan

* Add C API and Java bindings for str.replace_all, str.replace_re, str.replace_all_re

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

* Add test for new Java string replace operations

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

* Remove author field from test file header

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

* Delete examples/java/StringReplaceTest.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-11-04 09:48:20 -08:00
Nikolaj Bjorner
c88295a7c7 fix C++ example and add polymorphic interface for C++
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-29 03:08:49 -07:00
Copilot
3570073c29
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-28 15:46:48 -07:00
Nelson Elhage
9a2867aeb7
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-21 21:16:54 +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
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
Wael Boutglay
391880b6fc
Add missing ::z3::sdiv to z3++.h (#7947) 2025-09-25 22:04:15 +03:00
Nikolaj Bjorner
6e767795db set status to unknown 2025-09-14 13:43:10 -07:00
Nikolaj Bjorner
928a2e7cf2 update python doc tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-14 10:56:26 -07:00
Copilot
294f0578b0
Fix Java API mkString to properly handle Unicode surrogate pairs (#7865)
* Initial plan

* Fix Java API mkString to properly handle surrogate pairs

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-09-11 11:13:31 -07:00
Copilot
b2acbaa0c9
Fix .NET performance issues by reducing multiple enumerations in constraint methods (#7854)
* Initial plan

* Fix .NET performance issues by reducing multiple enumerations in constraint methods

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

* Refactor MkApp and related methods for null checks

* Update null checks for MkApp method arguments

* Fix assertion condition for MkApp method

---------

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-09-07 16:43:13 -07:00
Copilot
90e610eb23
Fix performance issue in MkAnd(IEnumerable) and eliminate code duplication (#7851)
* Initial plan

* Fix performance issue in MkAnd(IEnumerable<BoolExpr>) method

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

* Refactor IEnumerable methods to call params array variants

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-09-06 19:50:38 -07:00
Karlheinz Friedberger
3e216dbb20
Fix method signature for onBindingWrapper, again (#7829)
#7828
2025-08-28 18:21:51 -07:00
Nikolaj Bjorner
a5609364dd
Fix method signature for onBindingWrapper
#7828
2025-08-28 13:04:04 -07:00
Shiwei Weng 翁士伟
894c0e9fbe
Bugfix: post-build sanity check when an old version of ocaml-z3 is installed (#7815)
* fix: add generating META for ocamlfind.

* Patch macos. We need to keep the `@rpath` and use environment var to enable the test because we need to leave it to be fixed by package managers.

* Trigger CI.

* Debug.

* Debug.

* Debug.

* Debug.

* Debug.

* Debug.

* Hacky fix for ocaml building warning.

* Fix typo and rename variables.

* Fix cmake for ocaml test, using local libz3 explicit.
2025-08-24 20:49:04 -07:00
Nikolaj Bjorner
12563c6963 clean up a little of the handling of VERSION.txt
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-24 16:38:15 -07:00
Copilot
300e0ae69e
Move VERSION.txt to scripts directory and update all references (#7811)
* Initial plan

* Move VERSION.txt to scripts/ and update all references

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-08-24 16:36:05 -07:00
Nikolaj Bjorner
287464567b copy VERSION from SRC_DIR
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-24 15:10:49 -07:00
Nikolaj Bjorner
116e1eca8b print dirs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-24 15:02:50 -07:00
Nikolaj Bjorner
be22111df5 more output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-24 14:49:56 -07:00
Nikolaj Bjorner
867bc6aee6 remove extra characters
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-24 14:36:23 -07:00
Nikolaj Bjorner
438b41acbf try other dir
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-23 18:27:26 -07:00
Nikolaj Bjorner
1987b3dde1 try src_dir_repo
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-23 18:20:32 -07:00
Nikolaj Bjorner
778b9a57c3 try diferennt dirs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-23 18:13:18 -07:00
Nikolaj Bjorner
3b036369f9 add more logging to setup.py
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-08-23 16:37:06 -07:00