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
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
Nikolaj Bjorner
363b69f588
fix #6034
2022-05-16 16:44:13 -07:00
Nikolaj Bjorner
f4c500c519
fix build
...
reference types are not part of C
2022-04-16 15:16:53 +02:00
Clemens Eisenhofer
e11496bc65
Added decide-callback to user-propagator ( #5978 )
...
* Fixed registering expressions in push/pop
* Reused existing function
* Reverted reusing can_propagate
* Added decide-callback to user-propagator
* Refactoring
* Fixed index
2022-04-15 20:07:17 +02:00
Nikolaj Bjorner
3cc9d7f443
improve pre-processing
2022-04-15 12:55:26 +02:00
Clemens Eisenhofer
b0d8b27f37
Fixed registering expressions in push/pop ( #5964 )
...
* Fixed registering expressions in push/pop
* Reused existing function
2022-04-11 16:50:13 +02:00
Nikolaj Bjorner
2e00f2f32d
Propagator ( #5845 )
...
* user propagator without ids
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* user propagator without ids
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* fix signature
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* references #5818
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* fix c++ build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* switch to vs 2022
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* switch 2022
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* Update propagator example (I) (#5835 )
* fix #5829
* na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* switch to vs 2022
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* Adapted the example to the changes in the propagator
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* context goes out of scope in stack allocation, so can't used scoped context when passing objects around
* parameter check
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* add rewriter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* Fixed bug in user-propagator "created" (#5843 )
Co-authored-by: Clemens Eisenhofer <56730610+CEisenhofer@users.noreply.github.com>
2022-02-17 09:21:41 +02:00
Nikolaj Bjorner
a189ca8b60
truncation directive #5805
2022-01-31 10:50:46 -08:00
Nikolaj Bjorner
e84ddb0d9a
more #5746
2022-01-02 11:33:21 -08:00
Nikolaj Bjorner
88707f37e7
Better error reporting #5746
2022-01-02 11:31:50 -08:00
Nikolaj Bjorner
f0740bdf60
move user propagte declare to context level
...
declaration of user propagate functions are declared at context level instead of at solver scope.
2021-12-18 10:56:42 -08:00
Nikolaj Bjorner
4856581b68
na
2021-12-17 16:40:19 -08:00
Nikolaj Bjorner
8ca023d541
expose propagate created
2021-12-17 16:12:47 -08:00
Nikolaj Bjorner
773a2ae7bc
na
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-07 15:08:43 -08:00
Nikolaj Bjorner
1e95fb44d1
add ability to register expressions during callback
2021-12-07 09:47:05 -08:00
Nikolaj Bjorner
5857236f2f
introducing base namespace for user propagator
2021-11-29 19:41:30 -08:00
Nikolaj Bjorner
fee4821106
include thread
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-11-19 21:06:07 +01:00
Nikolaj Bjorner
a7d24788c3
wasm build issue
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-11-19 20:45:36 +01:00
Nikolaj Bjorner
ca2c2bb802
ensure smt2log works with multi-threaded consumers, ease scenarios around #5655
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-11-19 11:02:50 -08:00
Nikolaj Bjorner
f2fcbc7cb7
capture values not reference
2021-11-07 13:43:56 -08:00
Jamey Sharp
426306376f
CNF conversion refactoring ( #5547 )
...
* split sat2goal out of goal2sat
These two classes need different things out of the sat::solver class,
and separating them makes it easier to fiddle with their dependencies
independently.
I also fiddled with some headers to make it possible to include
sat_solver_core.h instead of sat_solver.h.
* limit solver_core methods to those needed by goal2sat
And switch sat2goal and sat_tactic over to relying on the derived
sat::solver class instead. There were no other uses of solver_core.
I'm hoping this makes it feasible to reuse goal2sat's CNF conversion
from places like the tseitin-cnf tactic, so they can be unified into a
single implementation.
2021-09-20 08:53:10 -07:00
Nuno Lopes
afdf80509a
remove api_context::m_search as it's always constant (false)
2021-04-13 17:32:17 +01:00
Nikolaj Bjorner
d91eac24b7
more missing nullptr flexibility #5156
2021-04-08 10:34:09 -07:00
Nikolaj Bjorner
d03fdf5fed
more descriptive naming convention
2021-03-15 15:48:33 -07:00
Nikolaj Bjorner
4b3fecc35e
remove dependency on ast from params
2021-03-15 15:40:41 -07:00
Nikolaj Bjorner
8412ecbdbf
fixes to new solver, add mode for using nlsat solver eagerly from nla_core
2021-03-14 13:57:04 -07:00
Nuno Lopes
30fd01b526
api: avoid copying param_refs whenever possible
2020-11-06 10:51:51 +00:00
Nikolaj Bjorner
367e5fdd52
delay internalize ( #4714 )
...
* adding array solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* use default in model construction
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* debug delay internalization
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* bv
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* arrays
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* get rid of implied values and bounds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* redo egraph
* remove out
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* remove files
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-28 19:24:16 -07:00
Nikolaj Bjorner
43db7df2b5
user solver ( #4709 )
...
* user solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
* na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-24 04:55:34 -07:00
Nikolaj Bjorner
f976b16e3f
add macros to model #4679
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-08 13:31:13 -07:00
Nikolaj Bjorner
629e981e01
fix regression in get-consequence on QF_FD
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-08 12:43:18 -07:00
Nikolaj Bjorner
872fd5e9ff
fix #4662
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-27 15:05:35 -07:00
Nikolaj Bjorner
666e835e08
na
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-23 09:39:36 -07:00
Nikolaj Bjorner
96f10b8c1c
user propagator
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-22 19:01:04 -07:00
Nikolaj Bjorner
2d5b749745
extend solver callbacks with methods
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-21 19:24:59 -07:00
Nikolaj Bjorner
080be7a2af
merge
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-21 12:14:28 -07:00
Nikolaj Bjorner
4857d60c99
user propagator over the API
2020-08-18 21:53:02 -07:00
Nikolaj Bjorner
0c93c7aa08
adding user propagation to API
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-18 10:30:10 -07:00
Nikolaj Bjorner
9f7e80c440
trace also declarations in assumptions
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-11 09:39:17 -07:00
Nikolaj Bjorner
59d8895d15
add accessors for implied values to API
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-28 19:46:39 -07:00
Nuno Lopes
8fda4f904d
API: dont deref already free'd memory on error
2020-06-30 15:04:40 +01:00
Andrew V. Jones
a23ca1792b
Ensure that Z3 uses the correct SMT-LIB2 syntax for push
and pop
( #4495 )
...
* When pretty-printing SMTLIB2, ensure that Z3 uses the correct syntax for 'push'
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
* When pretty-printing SMTLIB2, ensure that Z3 uses the correct syntax for 'pop'
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
2020-06-03 09:35:14 -07:00
Nikolaj Bjorner
55225824ee
remove std::mutex, replace by util/mutex.h in api_solver
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 19:15:11 -07:00
Nikolaj Bjorner
4842c71019
fix #3537
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-05 00:38:14 -07:00
Nikolaj Bjorner
426e4cc75c
fix #3557
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-03 16:37:59 -07:00
Nikolaj Bjorner
145ec8f248
pick up log configuration consistently #3513
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-25 10:51:55 -07:00
Nikolaj Bjorner
dcd4fff284
fixes to cuts
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-21 18:06:57 -08:00
Nikolaj Bjorner
cb600a9329
consolidate model.compact and model_compress #2704
...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-11-15 11:07:08 -08:00