-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
4,153 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,66 @@ | ||
# This file is machine-generated - editing it directly is not advised | ||
|
||
[[Artifacts]] | ||
julia_version = "1.10.2" | ||
manifest_format = "2.0" | ||
project_hash = "14b75dad56524e3f944ed54bc1b89c3d3937a1cd" | ||
|
||
[[deps.Artifacts]] | ||
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" | ||
|
||
[[Base64]] | ||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | ||
[[deps.CEnum]] | ||
git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc" | ||
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" | ||
version = "0.5.0" | ||
|
||
[[CompilerSupportLibraries_jll]] | ||
[[deps.CompilerSupportLibraries_jll]] | ||
deps = ["Artifacts", "Libdl"] | ||
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" | ||
version = "1.1.0+0" | ||
|
||
[[CxxWrap]] | ||
deps = ["Libdl", "MacroTools", "libcxxwrap_julia_jll"] | ||
git-tree-sha1 = "da92e7373c4327274951b117a25db3867b4b30ca" | ||
uuid = "1f15a43c-97ca-5a2a-ae31-89f07a497df4" | ||
version = "0.15.0" | ||
|
||
[[Dates]] | ||
[[deps.Dates]] | ||
deps = ["Printf"] | ||
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
|
||
[[GMP_jll]] | ||
[[deps.GMP_jll]] | ||
deps = ["Artifacts", "Libdl"] | ||
uuid = "781609d7-10c4-51f6-84f2-b8444358ff6d" | ||
version = "6.2.1+6" | ||
|
||
[[JLLWrappers]] | ||
[[deps.JLLWrappers]] | ||
deps = ["Artifacts", "Preferences"] | ||
git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" | ||
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" | ||
version = "1.5.0" | ||
|
||
[[Libdl]] | ||
[[deps.Libdl]] | ||
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" | ||
|
||
[[MacroTools]] | ||
deps = ["Markdown", "Random"] | ||
git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" | ||
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | ||
version = "0.5.13" | ||
|
||
[[Markdown]] | ||
deps = ["Base64"] | ||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
|
||
[[Preferences]] | ||
[[deps.Preferences]] | ||
deps = ["TOML"] | ||
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" | ||
uuid = "21216c6a-2e73-6563-6e65-726566657250" | ||
version = "1.4.3" | ||
|
||
[[Printf]] | ||
[[deps.Printf]] | ||
deps = ["Unicode"] | ||
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
|
||
[[Random]] | ||
deps = ["SHA"] | ||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
|
||
[[SHA]] | ||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" | ||
version = "0.7.0" | ||
|
||
[[TOML]] | ||
[[deps.TOML]] | ||
deps = ["Dates"] | ||
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" | ||
version = "1.0.3" | ||
|
||
[[Unicode]] | ||
[[deps.Unicode]] | ||
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" | ||
|
||
[[libcxxwrap_julia_jll]] | ||
[[deps.libcxxwrap_julia_jll]] | ||
deps = ["Artifacts", "JLLWrappers", "Libdl"] | ||
git-tree-sha1 = "023e054df9239d7e9a847d331c9df4eae1f9c221" | ||
git-tree-sha1 = "0f10092db771939e29fd13a67967f5c63212fdfe" | ||
uuid = "3eaa8342-bff7-56a5-9981-c04077f7cee7" | ||
version = "0.12.2+0" | ||
version = "0.12.3+0" | ||
|
||
[[z3_jll]] | ||
[[deps.z3_jll]] | ||
deps = ["Artifacts", "CompilerSupportLibraries_jll", "GMP_jll", "JLLWrappers", "Libdl", "libcxxwrap_julia_jll"] | ||
git-tree-sha1 = "67f75aaace9f9868756bdefb062e6d05d6688c03" | ||
git-tree-sha1 = "94c97c83e0221ac868b46dc88052f5f8bc7b2cea" | ||
uuid = "1bc4e1ec-7839-5212-8f2f-0d16b7bd09bc" | ||
version = "4.13.0+0" | ||
version = "4.13.0+1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
name = "Z3" | ||
uuid = "06b161dc-0161-11ea-0f74-41f836f4024b" | ||
authors = ["Andreas Humenberger <ahumenberger@gmail.com>"] | ||
version = "0.4.4" | ||
version = "1.0.0" | ||
|
||
[deps] | ||
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4" | ||
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" | ||
z3_jll = "1bc4e1ec-7839-5212-8f2f-0d16b7bd09bc" | ||
|
||
[compat] | ||
CxxWrap = "0.15.0" | ||
CEnum = "0.5.0" | ||
julia = "1.6" | ||
z3_jll = "4.13.0" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823" | ||
|
||
[targets] | ||
test = ["Test"] | ||
test = ["ReTestItems"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,10 @@ | ||
# Z3.jl | ||
|
||
[](https://travis-ci.com/ahumenberger/Z3.jl) | ||
|
||
This package provides an interface to the [Z3 Theorem Prover](https://github.com/Z3Prover/z3) by wrapping the [C++ API](https://z3prover.github.io/api/html/namespacez3.html) of Z3 using [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl). | ||
|
||
```julia | ||
ctx = Context() | ||
x = real_const(ctx, "x") | ||
y = real_const(ctx, "y") | ||
|
||
s = Solver(ctx, "QF_NRA") | ||
add(s, x == y^2) | ||
add(s, x > 1) | ||
|
||
res = check(s) | ||
@assert res == Z3.sat | ||
|
||
m = get_model(s) | ||
|
||
for (k, v) in consts(m) | ||
println("$k = $v") | ||
end | ||
``` | ||
|
||
## C++ API vs. Julia API | ||
|
||
This package wraps the [C++ API](https://z3prover.github.io/api/html/namespacez3.html) of Z3. As such Z3's types are available in Julia by using its camel case name variant, e.g. `z3::func_entry` is available as `FuncEntry`. Furthermore, member functions are called with the object as its first argument, that is, `real_const(ctx, "x")` would be the Julia equivalent of `ctx.real_const("x")` for an object `ctx` of type `Context`. | ||
|
||
See [z3jl.cpp](https://github.com/Z3Prover/z3/blob/master/src/api/julia/z3jl.cpp) for an exact list of exposed types and methods. | ||
|
||
## Development | ||
|
||
When possible, reuse C++ types and methods from Z3 instead of duplicating the same code in Julia. See [Julia bindings README](https://github.com/Z3Prover/z3/tree/master/src/api/julia) in Z3's repository for details on how to change the bindings and propagate the change to the Julia side. | ||
Uses [Clang.jl](https://github.com/JuliaInterop/Clang.jl) to wrap | ||
around Z3's [C API](https://z3prover.github.io/api/html/group__capi.html), | ||
and [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl) to build the Z3 binary | ||
(build script [here](https://github.com/JuliaPackaging/Yggdrasil/blob/master/Z/z3/build_tarballs.jl)). | ||
|
||
Design follows [Z3Py](https://ericpony.github.io/z3py-tutorial/guide-examples.htm). | ||
In particular, we provide an implicit global `Context`, and overload operators (like `+`,`-`,`*`, `/`) | ||
to create Z3 expressions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Clang.Generators | ||
using z3_jll | ||
|
||
cd(@__DIR__) | ||
|
||
include_dir = normpath(z3_jll.artifact_dir, "include") | ||
|
||
options = load_options(joinpath(@__DIR__, "generator.toml")) | ||
|
||
args = get_default_args() # Note you must call this function firstly and then append your own flags | ||
push!(args, "-I$include_dir") | ||
|
||
headers = [joinpath(include_dir, "z3.h")] | ||
# headers = [joinpath(include_dir, header) for header in readdir(include_dir) if endswith(header, ".h")] | ||
# there is also an experimental `detect_headers` function for auto-detecting top-level headers in the directory | ||
# headers = detect_headers(include_dir, args) | ||
|
||
# create context | ||
ctx = create_context(headers, args, options) | ||
|
||
# run generator | ||
build!(ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[general] | ||
library_name = "libz3" | ||
output_file_path = "./src/libz3.jl" | ||
module_name = "Libz3" | ||
jll_pkg_name = "z3_jll" | ||
export_symbol_prefixes = ["Z3_"] |
Oops, something went wrong.
bd2201c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
bd2201c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/107900
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: