3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +00:00
Commit graph

2393 commits

Author SHA1 Message Date
Nikolaj Bjorner 6fab4fec23
#6508 2022-12-26 15:36:58 -08:00
Nikolaj Bjorner 8efaaaf249 Fix #6503
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-25 17:29:06 -08:00
Nikolaj Bjorner c4b2acac24 add missing error checking #6492
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-14 09:27:43 -08:00
Nikolaj Bjorner cd3d38caf7 sort out terminology/add explanations, add shortcut to C++, fix #6491
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-13 16:17:38 -08:00
Nikolaj Bjorner 1434c7d394 #6059
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-09 08:50:32 -08:00
Nikolaj Bjorner 4a451b10d8 add custom coercion for floats. fix #6482
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-07 09:07:13 -08:00
Nikolaj Bjorner 5c5673bc09 make sure parser context within solver object has its parameters updated
this is to enable use cases like:

```
from z3 import *

s = Solver()
OnClause(s, print)
s.set("solver.proof.check", False)
s.from_file("../satproof.smt2")
```

instead of setting global parameters before the proof replay is initialized.
2022-11-23 11:37:23 +07:00
Nikolaj Bjorner fcaa85d7a8 #6456 - elaborate on error message 2022-11-20 11:27:39 +07:00
Nikolaj Bjorner 86f3702403 prevent re-declaration of enumeration sort names
preventing redeclaration of all ADT cases is not part of this update.
2022-11-19 19:46:34 +07:00
Nikolaj Bjorner 3f2bbe5589 harness del_object #6452
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-14 08:54:08 -08:00
Nikolaj Bjorner ff68df3451 update output of z3 doc 2022-11-08 16:10:50 -08:00
Nikolaj Bjorner 4c1a3fab64 fix #6442 2022-11-05 23:15:03 -07:00
Nikolaj Bjorner 84af521514 fixes #6439 #6436 2022-11-04 09:36:06 -07:00
Facundo Domínguez 91cdc082c4
Optimize calls to Z3_eval_smtlib2_string (#6422)
* Allow reseting the stream of smt2::scanner

* Put the parser of parse_smt2_commands in the cmd_context

* Move parser streams to cmd_context

* Move parser fields from cmd_context to api::context

* Move forward declarations from cmd_context.h to api_context.h

* Change parse_smt2_commands_with_parser to use *& instead of **

* Add tests for Z3_eval_smtlib2_string

* Don't reuse the streams in Z3_eval_smtlib2_string

* Fix indentation

* Add back unnecessary deleted line

Co-authored-by: Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
2022-10-28 13:57:22 -07:00
Nuno Lopes 1720addc4e remove a bunch of string copies in the API
thanks to C++20
2022-10-26 18:22:55 +01:00
Nikolaj Bjorner 2f1514a259 initialization of proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 08:38:23 -07:00
Nikolaj Bjorner 65ea4925b3 initialization of proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 08:37:21 -07:00
Nikolaj Bjorner f6595c161f add examples with proof replay
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-19 17:43:56 -07:00
Nikolaj Bjorner 4c79e63c1b Update parse-api.ts 2022-10-19 12:52:58 -07:00
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
Walden Yan f175fcbb54
JS/TS API Array support (#6393)
* feat: basic array support

Still need deeper type support for Arrays

* fixed broken format rules

* spaces inside curly

* feat: range sort type inference

* feat: better type inference in model eval

* doc: fixed some incorrect documentation

* feat: domain type inference

* feat: addressed suggestions

* feat: addressed suggestions

* chore: moved ts-expect from deps to dev-deps

* test: added z3guide examples

* fix: removed ts-expect from dependencies again

* docs: fixed some documentation
2022-10-17 11:10:36 -07:00
Nikolaj Bjorner 541aba308c fix #6401
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-17 10:27:15 -07:00
Nikolaj Bjorner ddf4895c2f admit timeouts and other resource limits for get-core #6310 2022-10-12 12:09:52 +02:00
Nuno Lopes 24ff0f2d36 attempt to fix cmake build 2022-10-01 21:48:27 +01: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
Clemens Eisenhofer a67fe054d5
Memory leak in .NET user-propagator (#6360)
The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically
2022-09-22 13:26:08 -05:00
Peter Bruch 58fad41dfa
Dotnet Api: Fix infinite finalization of Context (#6361)
* Dotnet Api: suppress GC finalization of dotnet context in favor of re-registering finalization

* Dotnet Api: enable concurrent dec-ref even if context is created without parameters.

* Dotnet Api: removed dead code.
2022-09-22 13:25:17 -05:00
Nikolaj Bjorner af258d1720 add method for accessing i'th domain sort in array #6344 2022-09-15 07:38:02 -07:00
Nuno Lopes 16ef89905d fix infinite loop in internalize 2022-09-14 11:50:53 +01:00
Nikolaj Bjorner a5ad109707 suppress debug warnings when concurrent dec-ref is enabled. The contract with the client is that it doesn't invoke methods on auxiliary objects after the context is deleted. The client is not required to decrement reference counts
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-11 19:06:23 -07:00
Nikolaj Bjorner edeeded4ea
remove DecRefQueue, use Z3_enable_concurrent_dec_ref (#6332)
The notion of reference counted contexts never worked.
The reference count to a context only ends up being 0 if the GC kicks in and disposes the various z3 objects. A call to Dispose on Context should free up all resources associated with that context. In exchange none of the resources are allowed any other operation than DecRef. The invocations of DecRef are protected by a lock and test on the context that the native pointer associated with the context is non-zero. Dispose sets the native pointer to zero.

Z3_enable_concurrent_dec_ref ensures that:

- calls to decref are thread safe. Other threads can operate on the context without interference.

The Z3_context ensures that
- z3objects allocated, but not disposed during the lifetime of Z3_context are freed when Z3_context is deleted (it triggers a debug warning, but this is now benign).
2022-09-11 18:59:00 -07:00
Clemens Eisenhofer 25b5b985e6
Missing overload for conflict (#6329) 2022-09-07 09:02:06 -07:00
Nikolaj Bjorner 5322d4f241 fix #6326 2022-09-06 23:48:21 -07:00
Nuno Lopes b9ddb11701 add static love 2022-09-04 11:57:43 +01:00
Clemens Eisenhofer a0ca5d745e
Fixed nested user-propagator callbacks in .NET (#6307)
* Fixed nested user-propagator callbacks in .NET

* Typo
2022-08-28 17:49:15 -07:00
Nikolaj Bjorner 2f8b13368d add redirect for warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 15:55:55 -07:00
Nikolaj Bjorner f6e4a45f4b Merge branch 'master' of https://github.com/z3prover/z3 2022-08-21 18:28:19 -07:00
Nikolaj Bjorner daa24ef4ce add missing error check 2022-08-21 18:26:53 -07:00
Clemens Eisenhofer 56fb161532
ADT-constructor generation crashed in .NET/Java when no (= default) fields are given (#6287) 2022-08-21 12:40:38 -07:00
Bruce Mitchener 6ba9ada1e2
Fix typos. (#6291) 2022-08-21 12:40:07 -07:00
Nikolaj Bjorner 08bf7a6293 fix name
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 18:22:42 -07:00
Nikolaj Bjorner 665ef2c6ba add missing new
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 18:21:03 -07:00
Nikolaj Bjorner b26420ed99 #6285 2022-08-19 18:17:16 -07:00
Nikolaj Bjorner 19da3c7086 fix closing parnetheses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 13:26:29 -07:00
Nikolaj Bjorner d094f6a856 fixing interface and test'
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 13:00:46 -07:00
Nikolaj Bjorner c7eda4e687 fixing interface and test'
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:59:00 -07:00
Nikolaj Bjorner 6fb7a049ea test fromString
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:41:02 -07:00
Nikolaj Bjorner 53e168879a add fromString method 2022-08-18 12:33:10 -07:00
Bruce Mitchener 72f4ee9230 api: Correctly map OP_BSREM0 to Z3_BSREM0. 2022-08-12 14:40:16 -04:00
Nikolaj Bjorner 78eaefe5a8 move solver-params to params 2022-08-08 11:34:41 +03:00