3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 13:28:47 +00:00
Commit graph

385 commits

Author SHA1 Message Date
Nikolaj Bjorner 07dd1065db added API to monitor clause inferences
See RELEASE_NOTES for more information
examples pending.
2022-10-19 08:34:55 -07:00
Nikolaj Bjorner 876ca2f1a5 fix #6371 2022-09-30 14:51:28 -04:00
Nikolaj Bjorner 107981f099 update proof formats for new core
- update proof format for quantifier instantiation to track original literals
- update proof replay tools with ability to extract proof object

The formats and features are subject to heavy revisions.

Example
```
(set-option :sat.euf true)
(set-option :sat.smt.proof eufproof.smt2)
(declare-fun f (Int) Int)
(declare-const x Int)
(assert (or (= (f (f (f x))) x) (= (f (f x)) x)))
(assert (not (= (f (f (f (f (f (f x)))))) x)))
(check-sat)
```

eufproof.smt2 is:
```
(declare-fun x () Int)
(declare-fun f (Int) Int)
(define-const $24 Int (f x))
(define-const $25 Int (f $24))
(define-const $26 Int (f $25))
(define-const $27 Bool (= $26 x))
(define-const $28 Bool (= $25 x))
(assume $27 $28)
(define-const $30 Int (f $26))
(define-const $31 Int (f $30))
(define-const $32 Int (f $31))
(define-const $33 Bool (= $32 x))
(assume (not $33))
(declare-fun rup () Proof)
(infer (not $33) rup)
(declare-fun euf (Bool Bool Proof Proof Proof Proof) Proof)
(declare-fun cc (Bool) Proof)
(define-const $42 Bool (= $32 $30))
(define-const $43 Proof (cc $42))
(define-const $40 Bool (= $31 $24))
(define-const $41 Proof (cc $40))
(define-const $38 Bool (= $30 $25))
(define-const $39 Proof (cc $38))
(define-const $36 Bool (= $24 $26))
(define-const $37 Proof (cc $36))
(define-const $34 Bool (not $33))
(define-const $44 Proof (euf $34 $28 $37 $39 $41 $43))
(infer (not $28) $33 $44)
(infer (not $28) rup)
(infer $27 rup)
(declare-fun euf (Bool Bool Proof Proof Proof) Proof)
(define-const $49 Bool (= $32 $26))
(define-const $50 Proof (cc $49))
(define-const $47 Bool (= $31 $25))
(define-const $48 Proof (cc $47))
(define-const $45 Bool (= $24 $30))
(define-const $46 Proof (cc $45))
(define-const $51 Proof (euf $34 $27 $46 $48 $50))
(infer $33 $51)
(infer rup)
```

Example of inspecting proof from Python:

```
from z3 import *

def parse(file):
    s = Solver()
    set_option("solver.proof.save", True)
    set_option("solver.proof.check", False)
    s.from_file(file)
    for step in s.proof().children():
        print(step)

parse("../eufproof.smt2")
```

Proof checking (self-validation) is on by default.
Proof saving is off by default.

You can use the proof logs and the proof terms to retrieve quantifier instantiations from the new core.

The self-checker contains a few built-in tuned checkers but falls back to self-checking inferred clauses using SMT.
2022-09-28 10:40:43 -07:00
Nikolaj Bjorner 1f150ecd52 #6319
#6319 - fix incompleteness in propagation of default to all array terms in the equivalence class.

Fix bug with q_mbi where domain restrictions are not using values because the current model does not evaluate certain bound variables to values. Set model completion when adding these bound variables to the model to ensure their values are not missed.

Add better propagation of diagnostics when tactics and the new solver return unknown. The reason for unknown can now be traced to what theory was culprit (currently no additional information)
2022-09-23 22:22:34 -05:00
Nikolaj Bjorner 616fc2cbd5 fix #6314
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-04 16:23:11 -07:00
Nikolaj Bjorner 48b13291d1 add bv-size reduce #6137
- add option smt.bv.reduce_size.
  - it allows to apply incremental pre-processing of bit-vectors by identifying ranges that are known to be constant.
    This rewrite is beneficial, for instance, when bit-vectors are constrained to have many high-level bits set to 0.
2022-08-16 16:35:14 -07:00
Nikolaj Bjorner 78eaefe5a8 move solver-params to params 2022-08-08 11:34:41 +03:00
Nikolaj Bjorner 63f48f8fd4 add options for logging learned lemmas and theory axioms
- add solver.axioms2files
  - prints negated theory axioms to files. Each file should be unsat
- add solver.lemmas2console
  - prints lemmas to the console.
- remove option smt.arith.dump_lemmas. It is replaced by solver.axioms2files
2022-08-08 11:18:56 +03:00
Bruce Mitchener 5014b1a34d Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
Bruce Mitchener 5d0dea05aa
Remove empty leaf destructors. (#6211) 2022-07-30 10:07:03 +01:00
Nikolaj Bjorner 32614722ef fix #6176
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 21:19:20 -07:00
Clemens Eisenhofer 95c3dd9224
Added missing decide-callback for tactics (#6166)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int

* Fixed missing assignment for binary clauses

* Added missing decide-callback for tactics
2022-07-17 10:07:52 -07:00
Anthony Romano 7ae1a338a7
parallel-tactic: fix deadlocking race between shutdown and get_task (#6152)
Deadlock/Race is as follows:
  1. get_task() reads m_shutdown == false and enters loop body
  2. shutdown() is called; sets m_shutdown = true
  3. shutdown() calls m_cond.notify_all()
  4. get_task() finds no task in try_get_task()
  5. get_task() calls m_cond.wait(), missing the notification
  6. solve() waits forever on join()

Provided patch wraps (2) and (3) with the condition variable lock so that
step (5) cannot miss the notification.

Co-authored-by: Anthony Romano <anthony@forallsecure.com>
2022-07-11 09:26:11 -07:00
Nikolaj Bjorner 8c2ba3d47e missing virtual functions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-01 19:18:09 -07:00
Nikolaj Bjorner 06771d1ac5 missing virtual functions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-01 18:31:08 -07:00
Nikolaj Bjorner 4f9ef12f34 create dummy tactics for single threaded mode
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-01 18:13:36 -07:00
Nikolaj Bjorner b43965bf05 make user propagator work with combined solver
Then users don't have to specify SImpleSolver, but can use "Solver"
2022-06-28 09:42:28 -07:00
Nuno Lopes d9fcfdab34 fix debug build 2022-06-17 14:35:33 +01:00
Nikolaj Bjorner e3c35840bb remove out
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-04-20 11:26:16 +01:00
Nikolaj Bjorner ec57d3b15c missing switch cases 2022-04-19 16:20:02 +01: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
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 3f3d058567 extract also units from search state 2022-02-07 06:16:22 +02:00
Nikolaj Bjorner 3de9d37772 fix overrides for created_eh
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-01-25 16:24:08 +01:00
Nikolaj Bjorner 56d3718cde add simplification with qe-lite as an option #5767
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-01-12 03:41:21 -08:00
Nikolaj Bjorner 0ca5e7207e #5746 2022-01-02 11:35:55 -08:00
Nikolaj Bjorner e84ddb0d9a more #5746 2022-01-02 11:33:21 -08:00
Nikolaj Bjorner fc77345bec breaking change. Enforce append semantics everywhere for parameter updates #5744
Replace semantics doesn't work with assumptions made elsewhere in code.
The remedy is to apply append (override) semantics for parameter changes.
2021-12-30 19:11:14 -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 8ca023d541 expose propagate created 2021-12-17 16:12:47 -08:00
Nikolaj Bjorner 9f2b18cac5 add tactic name
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-07 13:37:57 -08:00
Nikolaj Bjorner 658a334ecf clear tactic user propagate state on solver destructor 2021-12-07 03:14:50 -08:00
Nikolaj Bjorner bfd61fec00 enable user propagation on tactics
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-02 08:28:52 -08:00
Nikolaj Bjorner b5efb87118 base -> core 2021-11-29 19:55:10 -08:00
Nikolaj Bjorner 5857236f2f introducing base namespace for user propagator 2021-11-29 19:41:30 -08:00
Henrich Lauko 96671cfc73
Add and fix a few general compiler warnings. (#5628)
* rewriter: fix unused variable warnings

* cmake: make missing non-virtual dtors error

* treewide: add missing virtual destructors

* cmake: add a few more checks

* api: add missing virtual destructor to user_propagator_base

* examples: compile cpp example with compiler warnings

* model: fix unused variable warnings

* rewriter: fix logical-op-parentheses warnings

* sat: fix unused variable warnings

* smt: fix unused variable warnings
2021-10-29 15:42:32 +02:00
Nikolaj Bjorner 125eae06bd #4869 load datatype parsing for HORN logic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-10-26 11:54:29 +02:00
Nikolaj Bjorner 3036b88f09 support threading for TRACE mode 2021-10-25 13:35:32 +02:00
Nikolaj Bjorner f05ac8a429 updated C++ API for escaped and unescaped strings #5615
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-10-21 14:52:59 -04:00
Nikolaj Bjorner 34f878fb97 make it easier to debug parallel 2021-09-10 07:09:22 +02:00
Nikolaj Bjorner a7bc4719c0 fix #5526
when propagation claims progress, but is a no-op.
2021-09-01 11:45:21 -07:00
Nikolaj Bjorner 39c3f34a30 remove unused dependency 2021-07-21 09:25:08 -07:00
Nikolaj Bjorner a8b433e6ac #5331
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-19 15:58:10 -07:00
Nikolaj Bjorner c7a7d40a8f remove incorrect and inefficient default model conversion 2021-07-15 18:47:25 +02:00
Nuno Lopes f1e0d5dc8a remove a hundred implicit constructors/destructors 2021-05-23 14:25:01 +01:00
Nikolaj Bjorner 4a6083836a call it data instead of c_ptr for approaching C++11 std::vector convention. 2021-04-13 18:17:35 -07:00
Nikolaj Bjorner 97f560054d Create CMakeLists.txt 2021-03-17 15:51:50 -07:00
Nikolaj Bjorner ab0735fde2 separate component for asserted_formulas to break dependency cycles
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-03-17 15:51:38 -07:00
Nikolaj Bjorner ddbcd08d46 move asserted_formulas to solver scope 2021-03-17 15:02:16 -07:00
Nikolaj Bjorner 377d060036 move to separate axiom management
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-02-23 18:09:45 -08:00
Nikolaj Bjorner d9fb40602e use theory agnostic axioms in more cases 2021-02-21 18:36:53 -08:00
Nikolaj Bjorner 4c3c15c015 Propagate reason for undef as exception to improve error reporting in scenarios such as #5009 2021-02-09 16:58:01 -08:00
Nikolaj Bjorner 8b5094fe73 provide additional diagnostics for #5009 2021-02-09 10:14:38 -08:00
Nikolaj Bjorner 0ec567fe15 integrate v2 of lns 2021-02-04 15:47:40 -08:00
Nikolaj Bjorner fb1509d011 expose internal API for set_phase 2021-02-02 14:29:06 -08:00
Nikolaj Bjorner 8f577d3943 remove ast_manager get_sort method entirely 2021-02-02 13:57:01 -08:00
Nikolaj Bjorner 3ae4c6e9de refactor get_sort 2021-02-02 04:45:54 -08:00
Nikolaj Bjorner ab199dedf9 debug arith/mbi
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-11-02 12:13:19 -08:00
Pierre Bouvier 24321e311b
Add support of the SunOS platform (Solaris, OpenSolaris, OpenIndiana) (#4757)
* Add support of the SunOS plateform (OpenSolaris, OpenIndiana) in scripts/mk_util.py

* Add missing casts for the SunOS plateform (OpenSolaris, OpenIndiana) for the pow function
2020-10-27 11:39:21 -07:00
Pierre Bouvier f3147d6e22
Fix: QF_UFDT has UF (#4755) 2020-10-26 12:01:21 -07:00
Nikolaj Bjorner 8d76470a8a fixes to mostly solver arith/euf and backtracking scopes 2020-10-26 11:06:41 -07:00
Nuno Lopes 0213af3c61 replace remaining volatiles with atomic<>
volatiles are now deprecated in recent C++
2020-10-24 11:47:45 +01:00
Nikolaj Bjorner 1d199b707b connect mbi
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-29 23:51:31 -07: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 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 152c95f72a adding user-propagator ability
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-17 22:39:55 -07:00
Nikolaj Bjorner ca3ec22b7a handle better cancellation for parallel, switch between cube mode and base level mode in smt.threads, expose parameters to control theory_bv and phase caching
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-16 23:29:24 -07:00
Nikolaj Bjorner fae206b738 add command-line help descriptions on tactics
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-14 19:29:35 -07:00
Nikolaj Bjorner a892e4793b typo
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-13 12:48:18 -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
Nikolaj Bjorner 8857a67e4f fix model return after shutdown, reported in #4532
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-27 23:48:19 -07:00
Nikolaj Bjorner 61b85d7123 verbosity
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-20 14:11:59 -07:00
Nuno Lopes bb26f219fe remove unneeded constructors (last round) 2020-07-12 17:41:57 +01:00
Nuno Lopes 23e6adcad3 fix a couple hundred deref-after-free bugs due to .c_str() on a temporary string 2020-07-11 20:24:45 +01:00
Nikolaj Bjorner d0e20e44ff booyah
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-04 15:56:30 -07:00
Nikolaj Bjorner fd57faee7c another module level ifdef for #4382
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 15:03:58 -07:00
Nikolaj Bjorner c8c02060ee another module level ifdef for #4382
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 15:01:27 -07:00
Murphy Berzish 6f0a367357
add SMTLIB2.6 names for QF_SLIA and string-int conversion operators (#4341) 2020-05-16 14:31:47 -07:00
Nikolaj Bjorner fdc87f286f
na (#4254)
* remove level of indirection for context and ast_manager in smt_theory

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add request by #4252

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* move to def

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* int

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4251

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4255

* fix #4257

* add code to debug #4246

* restore new solver as default

* na

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4246

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-09 17:40:02 -07:00
Nikolaj Bjorner 16bc5b8432 build warning 2020-04-30 19:30:54 -07:00
Nikolaj Bjorner e67112f289 NYI control paths 2020-04-28 20:19:20 -07:00
Nikolaj Bjorner 21a31fcd26 add missing fixed propagations on negated integer inequalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-11 02:28:38 -07:00
Nikolaj Bjorner 296a97d0d3 build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-05 01:03:38 -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 918b6a8c03 trace & threads = undef
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-03 13:58:22 -07:00
Nikolaj Bjorner 50624723af fix #3704
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-03 10:38:31 -07:00
Nikolaj Bjorner 8290cfadcc fix #3694
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-02 08:05:43 -07:00
Nikolaj Bjorner 78ebe0a94c fix #3701
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-02 06:22:32 -07:00
Nikolaj Bjorner 4ee0462beb fix #3590
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-31 15:43:33 -07:00
Nikolaj Bjorner c108b7f99c early givup #3604
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-31 13:46:02 -07:00
Nikolaj Bjorner 98b43322b1 collect statistics under lock #3604
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-31 13:33:18 -07:00