3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-07 00:11:55 +00:00
Commit graph

89 commits

Author SHA1 Message Date
Nikolaj Bjorner
0e6b3a922a Add commands for forcing preferences during search
Add commands:

(prefer <formula>)
- will instruct case split queue to assign formula to true.
- prefer commands added within a scope are forgotten after leaving the scope.

(reset-preferences)
- resets asserted preferences. Has to be invoked at base level.

This provides functionality related to MathSAT and based on an ask by Tomáš Kolárik who is integrating the functionality with OpenSMT2
2025-10-02 10:47:10 -07:00
Nikolaj Bjorner
712231dcda fix #7560 2025-02-19 09:39:17 -08:00
Nikolaj Bjorner
c2b7b58c78 #7468 - add option (get-info :parameters) to display solver parameters that were updated globally and distinct from defaults
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-10 11:57:14 -08:00
Nikolaj Bjorner
4f060dd2b1 fix #7445 2024-11-10 14:40:04 -08:00
Nikolaj Bjorner
92065462b4 use std::exception as base class to z3_exception
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-11-04 11:08:15 -08:00
Nikolaj Bjorner
0c48a50d59 Add support for initializing variable values in solver and optimize contexts in Z3 2024-09-20 18:28:26 +03:00
Nikolaj Bjorner
b99c4a47a4 Add override specifiers to methods in set_initial_value_cmd class for clarity and consistency 2024-09-19 15:11:59 +03:00
Nikolaj Bjorner
a3f35b6830 Add command to set initial value hints for solver in various components 2024-09-18 17:48:03 +03:00
someplaceguy
7bbe3fb2b6
fix (get-proof) command to respect option pp.simplify_implies (#7157) 2024-03-09 15:13:42 -08: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
Bruce Mitchener
5d0dea05aa
Remove empty leaf destructors. (#6211) 2022-07-30 10:07:03 +01:00
Nikolaj Bjorner
f20db3e644 allow for toggling proof and core mode until the first assertion. 2022-07-02 09:31:36 -07:00
Nikolaj Bjorner
011c1b2dd2 remove refs to bare_str 2022-04-09 12:06:27 +02:00
Nuno Lopes
43f7636826 remove some copies/moves 2022-03-09 12:46:41 +00:00
Nikolaj Bjorner
a44a46a514 fix #5745 2021-12-31 16:41:51 -08: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
549ef0e052 fix typos #4573
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-20 10:22:57 -07: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
4e81085292 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-21 10:29:42 -06:00
Nikolaj Bjorner
c816d45a7d share some equalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-20 16:22:38 -06:00
Nikolaj Bjorner
9179deb746 add get-interpolant command
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-20 16:22:38 -06:00
Nikolaj Bjorner
18b8089a1e Revert "remove unused random seed parameter on cmd_context"
This reverts commit e2a9cb80e2.
2019-10-29 11:05:50 -07:00
Nikolaj Bjorner
e2a9cb80e2 remove unused random seed parameter on cmd_context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-22 08:42:18 -07:00
Nikolaj Bjorner
724a42b6f2 fix #2643
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-18 09:48:55 -07:00
Nikolaj Bjorner
f128398bf9 add clause proof module, small improvements to bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-30 15:57:19 -07:00
Nikolaj Bjorner
cdc89b6193 add get-info :rlimit option to cmd-context to facilitate timeout based repros
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-24 12:57:08 -07:00
Nikolaj Bjorner
54a125063b remove produce interpolants
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-01-14 15:00:25 -08:00
Bruce Mitchener
e570940662 Prefer using empty rather than size comparisons. 2018-11-27 21:42:04 +07:00
Nikolaj Bjorner
e391416855 fix include path for z3_version.h
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-21 20:30:50 -07:00
Nuno Lopes
cef17c22a1 remove some allocs from exceptions 2018-07-02 17:08:02 +01:00
Nikolaj Bjorner
335d672bf1 fix #1675, regression in core processing in maxres
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-19 23:23:19 -07:00
Nikolaj Bjorner
74621e0b7d first eufi example running
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:52 -07:00
Nikolaj Bjorner
c963f6f2df merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-05-23 08:02:16 -07:00
Nikolaj Bjorner
50c93d1ad4 merge with 4.7.1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-05-22 17:10:36 -07:00
Daniel Schemmel
f02d031d11
As of GCC8, the throw by value, catch by reference idiom is enforced via -Wcatch-value 2018-05-19 04:39:36 +02:00
Nikolaj Bjorner
f525f43e43 merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-30 09:30:43 -07:00
Nikolaj Bjorner
5dbba8bd53 fix #1599. fix #1600
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-27 17:48:04 +02:00
Nikolaj Bjorner
c513f3ca09 merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-03-25 14:57:01 -07:00
Bruce Mitchener
76eb7b9ede Use nullptr. 2018-02-12 14:05:55 +07:00
Bruce Mitchener
b7d1753843 Use override rather than virtual. 2018-02-09 21:19:27 +07:00
Nikolaj Bjorner
354c16454a fix bug in translation of pbeq into sat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-02-03 22:19:25 -08:00
Bruce Mitchener
ae8027e594 Fix typos. 2018-02-01 19:39:43 +07:00
Nikolaj Bjorner
7b8101c502 fix bugs related to model-converter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-01-17 12:25:24 -08:00
Simon Cruanes
ed526b808d add parameter to specify the file into which dot proofs are to be printed 2017-10-24 10:16:56 +02:00
Simon Cruanes
d630838b38 add a basic printer into graphviz (http://graphviz.org/) for proofs
- proofs are output into file `proof.dot` if `(get-proof-graph)` is
  in the input
- use `dot -Txlib proof.dot` to see the proof
- use `dot -Tsvg proof.dot` to get a svg file
2017-10-24 09:41:38 +02:00
Nikolaj Bjorner
06087c17be support for legacy datatype test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-09-05 10:28:11 -07:00
Dan Liew
a2d7b43554 Update header includes to be relative to src/ directory. 2017-08-17 18:26:53 +01:00
Nikolaj Bjorner
082936bca6 enable overloading resolution on define-fun declarations, fix #1199
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-08 09:21:06 +02:00
Nikolaj Bjorner
2b82fd5d0c updated include directives
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-01 10:51:47 -07:00
Nikolaj Bjorner
b19f94ae5b make include paths uniformly use path relative to src. #534
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-07-31 13:24:11 -07:00