3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-18 06:39:02 +00:00
Commit graph

2297 commits

Author SHA1 Message Date
Kevin Gibbons 0d4169533a
fix js distributable (#6139) 2022-07-06 10:59:01 -07:00
Nikolaj Bjorner 02a92fb9e9 revert to use GCHandle for UserPropagator
avoids using a global static array
2022-07-03 17:00:40 -07:00
Nikolaj Bjorner bb966776b8
Update UserPropagator.cs 2022-07-02 13:15:05 -07:00
Nikolaj Bjorner d37ed4171d
Update Expr.cs
Add a Dup functionality that allows extending the life-time of expressions that are passed by the UserPropagator callbacks (or other code).
2022-07-02 13:12:54 -07:00
Nikolaj Bjorner 54b16f0496
Update NativeStatic.txt
not so automatically generated
2022-07-02 13:04:09 -07:00
Nikolaj Bjorner 4d23f2801c ml pre
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-01 20:35:47 -07:00
Nikolaj Bjorner 815518dc02 add facility for incremental parsing #6123
Adding new API object to maintain state between calls to parser.
The state is incremental: all declarations of sorts and functions are valid in the next parse. The parser produces an ast-vector of assertions that are parsed in the current calls.

The following is a unit test:

```
from z3 import *

pc = ParserContext()

A = DeclareSort('A')

pc.add_sort(A)
print(pc.from_string("(declare-const x A) (declare-const y A) (assert (= x y))"))
print(pc.from_string("(declare-const z A) (assert (= x z))"))

print(parse_smt2_string("(declare-const x Int) (declare-const y Int) (assert (= x y))"))

s = Solver()
s.from_string("(declare-sort A)")
s.from_string("(declare-const x A)")
s.from_string("(declare-const y A)")
s.from_string("(assert (= x y))")
print(s.assertions())
s.from_string("(declare-const z A)")
print(s.assertions())
s.from_string("(assert (= x z))")
print(s.assertions())
```

It produces results of the form

```
[x == y]
[x == z]
[x == y]
[x == y]
[x == y]
[x == y, x == z]
```
Thus, the set of assertions returned by a parse call is just the set of assertions added.
The solver maintains state between parser calls so that declarations made in a previous call are still available when declaring the constant 'z'.
The same holds for the parser_context_from_string function: function and sort declarations either added externally or declared using SMTLIB2 command line format as strings are valid for later calls.
2022-07-01 20:27:18 -07:00
Nikolaj Bjorner 3c94083a23 fix doc errors
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-01 15:29:44 -07:00
Max Levatich 12e7b4c3d6
fix gc'ed callbacks in .NET propagator api (#6118)
Co-authored-by: Maxwell Levatich <t-mlevatich@microsoft.com>
2022-06-28 19:22:41 -07:00
Nikolaj Bjorner 79778767b0 add doc string 2022-06-28 14:25:43 -07:00
Nikolaj Bjorner 798a4ee86e use IEnumerator and format 2022-06-28 14:24:05 -07:00
Nikolaj Bjorner 556f0d7b5f use static list to connect managed and unmanaged objects 2022-06-28 14:09:22 -07:00
Nikolaj Bjorner 820c782b5e pinned semantics 2022-06-28 13:03:52 -07:00
Nikolaj Bjorner 9836d5e6fc missing public 2022-06-28 12:46:29 -07:00
Kevin Gibbons 352666b19f
JS api: fix type for from (#6103)
* JS api: fix type for from

* whitespace
2022-06-22 14:51:40 -07:00
Kevin Gibbons c15a000d9b
Make high-level JS API more idiomatic/type-safe (#6101)
* make JS api more idiomatic

* make JS api type-safe by default

* use strings, not symbols, for results

* add toString

* add miracle sudoku example

* ints should be ints

* add error handling

* add missing Cond to Context

* fewer side-effecting getters
2022-06-22 09:26:44 -07:00
Nikolaj Bjorner 8234eeae40 unbreak
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-22 09:03:32 -07:00
Nikolaj Bjorner 3189544050 next split
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-22 09:03:32 -07:00
Nikolaj Bjorner f24c5ca99a #6095
arrays that are interpreted using as-array should be reflected back to store expressions
2022-06-21 12:42:44 -07:00
Nikolaj Bjorner d792d30e88 Update NativeContext.cs
TraceToFile does not correspond to the functionality of enable_trace. Z3_enable_trace tags a trace tag as input. It can be invoked multiple times with different tags. The debug tracing then shows logs with the corresponding tags.
2022-06-21 09:09:42 -07:00
Nikolaj Bjorner b254f4086b Separate out native static content for Java
Make it easier to add native methods for callbacks (for user propagator) #6097

The Java User propagator wrapper should define a base class with virtual methods that can be invoked from functions defined in NativeStatic.txt
2022-06-21 09:09:42 -07:00
Clemens Eisenhofer 2fa60aa43c
Added function to select the next variable to split on (User-Propagator) (#6096)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int
2022-06-19 10:49:25 -07:00
Nuno Lopes 73a24ca0a9 remove '#include <iostream>' from headers and from unneeded places
It's harmful to have iostream everywhere as it injects functions in the compiled files
2022-06-17 14:10:19 +01:00
Olaf Tomalka 7fdcbbaee9
Add high level bindings for js (#6048)
* [Draft] Added unfinished code for high level bindings for js

* * Rewrote structure of js api files
* Added more high level apis

* Minor fixes

* Fixed wasm github action

* Fix JS test

* Removed ContextOptions type

* * Added Ints to JS Api
* Added tests to JS Api

* Added run-time checks for contexts

* Removed default contexts

* Merged Context and createContext so that the api behaves the sames as in other constructors

* Added a test for Solver

* Added Reals

* Added classes for IntVals and RealVals

* Added abillity to specify logic for solver

* Try to make CI tests not fail

* Changed APIs after a round of review

* Fix test

* Added BitVectors

* Made sort into getter

* Added initial JS docs

* Added more coercible types

* Removed done TODOs
2022-06-14 09:55:58 -07:00
Dominic Steinhöfel 46bc726391
Better error message for mismatching sorts in substitutions in z3.substitute (#6093) 2022-06-13 13:46:30 -07:00
Nikolaj Bjorner e468386359 #5656
guard __del__ operator by checking if library was unloaded.
2022-06-08 09:59:29 -07:00
Nikolaj Bjorner 51ed13f96a update topological sort to use arrays instead of hash tables, expose Context over Z3Object for programmability
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-08 06:28:24 -07:00
Christoph M. Wintersteiger 33454193d4
Change FP default rounding mode in the Python API 2022-06-04 08:45:52 +01:00
Nikolaj Bjorner 15c47808d6 #6059
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-30 11:03:50 -07:00
Nikolaj Bjorner 7da9f12521 expose description of global parameters #6048
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-27 08:50:40 -04:00
Nikolaj Bjorner 127af83c53 remove ad-hoc diagnostics 2022-05-21 10:27:37 -04:00
Nikolaj Bjorner 363b69f588 fix #6034 2022-05-16 16:44:13 -07:00
Nikolaj Bjorner f6b2874d7c update to take effect of def_API for callback functions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-16 10:30:54 -07:00
Nikolaj Bjorner b1aa6b260b disable normalize
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-11 13:31:35 -07:00
Nikolaj Bjorner 6deb4dee37 disable normalize
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-11 13:30:50 -07:00
John Jones 361888f299
Generate bdist wheels for musllinux_1_1 (#6025) 2022-05-09 14:13:08 -07:00
Nikolaj Bjorner 6670cf0b65 na 2022-05-09 09:16:05 -07:00
Nikolaj Bjorner fbf5e322dc js
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-09 08:49:02 -07:00
Nikolaj Bjorner 4549ec7331 misc 2022-05-09 08:38:35 -07:00
Nikolaj Bjorner da9ed82889 add decide callback
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-08 15:31:05 -07:00
Nikolaj Bjorner 8218f25222 add decide callback
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-08 15:30:03 -07:00
Nikolaj Bjorner c8d12975c9 fixes for fresh 2022-05-08 12:49:04 -07:00
Nikolaj Bjorner 506f8f88aa add user propagator functionality 2022-05-08 12:43:46 -07:00
Nikolaj Bjorner e2625cb760 safe
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-07 13:53:37 -07:00
Nikolaj Bjorner 3bf09b114a safe
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-07 13:53:07 -07:00
Nikolaj Bjorner 04b0b3690d js
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-07 12:46:52 -07:00
Nikolaj Bjorner 1e586888c9 patch js for fnptr
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-07 11:18:19 -07:00
Nikolaj Bjorner 14214c5a07 exposing user propagators over .Net
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-07 11:08:40 -07:00
Sacha Ayoun ffbabf251d
enhance ocaml seq api (#6010)
Signed-off-by: Sacha Ayoun <sachaayoun@gmail.com>
2022-05-04 12:03:22 -07:00
Nikolaj Bjorner b3e0213cab missing object ref
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-02 12:35:28 -07:00