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

55 commits

Author SHA1 Message Date
Nikolaj Bjorner ac1552d194 wip - updates to proof logging and self-checking
move self-checking functionality to inside sat/smt so it can be used on-line and not just off-line.

when self-validation fails, use vs, not clause, to check. It allows self-validation without checking and maintaining RUP validation.

new options sat.smt.proof.check_rup, sat.smt.proof.check for online validation.

z3 sat.smt.proof.check=true sat.euf=true /v:1 sat.smt.proof.check_rup=true /st file.smt2 sat.smt.proof=p.smt2
2022-10-16 23:33:30 +02:00
Nikolaj Bjorner de69874076 wip - adding proof checkers, fixes to quantifier proof certificates 2022-10-10 09:46:22 +02: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 ac5b190a72 track instantiations from MBQI in proof logging for new solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-01 08:51:53 -07:00
Nikolaj Bjorner 3011b34b3b log E-matching based quantifier instantiations as hints 2022-08-31 18:59:02 -07:00
Nikolaj Bjorner e2f4fc2307 overhaul of proof format for new solver
This commit overhauls the proof format (in development) for the new core.

NOTE: this functionality is work in progress with a long way to go.
It is shielded by the sat.euf option, which is off by default and in pre-release state.
It is too early to fuzz or use it. It is pushed into master to shed light on road-map for certifying inferences of sat.euf.

It retires the ad-hoc extension of DRUP used by the SAT solver.
Instead it relies on SMT with ad-hoc extensions for proof terms.
It adds the following commands (consumed by proof_cmds.cpp):

- assume  - for input clauses
- learn   - when a clause is learned (or redundant clause is added)
- del     - when a clause is deleted.

The commands take a list of expressions of type Bool and the
last argument can optionally be of type Proof.
When the last argument is of type Proof it is provided as a hint
to justify the learned clause.

Proof hints can be checked using a self-contained proof
checker. The sat/smt/euf_proof_checker.h class provides
a plugin dispatcher for checkers.
It is instantiated with a checker for arithmetic lemmas,
so far for Farkas proofs.

Use example:
```
(set-option :sat.euf true)
(set-option :tactic.default_tactic smt)
(set-option :sat.smt.proof f.proof)
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(declare-const u Int)
(assert (< x y))
(assert (< y z))
(assert (< z x))
(check-sat)
```

Run z3 on a file with above content.
Then run z3 on f.proof

```
(verified-smt)
(verified-smt)
(verified-smt)
(verified-farkas)
(verified-smt)
```
2022-08-28 17:44:33 -07:00
Nikolaj Bjorner a628e4c4e5 updates to printer to get instantiations, take 1 2022-08-25 11:22:35 -07:00
Nikolaj Bjorner ce1f3987d9 fix unsoundness in quantifier propagation #6116 and add initial lemma logging 2022-08-23 19:10:01 -07:00
Nikolaj Bjorner 4b1419261f #5778 2022-03-21 16:23:43 -07:00
Nikolaj Bjorner 9969809745 #5778 2022-01-21 09:40:06 +01:00
Nikolaj Bjorner 637ddf9397 fix #5777
latest issue
2022-01-16 18:09:38 -08:00
Nikolaj Bjorner b259f46f85 dependencies 2022-01-13 12:34:58 -08:00
Nikolaj Bjorner 4b6679e8e0 #5753 2022-01-13 12:19:54 -08:00
Nikolaj Bjorner 10dc8d7313 #5753 2022-01-12 12:49:06 -08:00
Nikolaj Bjorner bf3c213fd3 #5753 2022-01-09 11:03:29 -08:00
Nikolaj Bjorner 90fd3d82fc enable propagation 2022-01-08 19:00:56 -08:00
Nikolaj Bjorner a90b66134d make roots uniform for theory lemmas 2021-12-29 13:42:11 -08:00
Nikolaj Bjorner 281fb67d88 unit propagate with fingerprints 2021-10-04 20:01:46 -07:00
Nikolaj Bjorner da124e4275 tune q-eval and q-ematch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-28 13:41:37 -07:00
Nikolaj Bjorner 6c71baf77b lifting iff to binary 2021-09-27 03:45:54 -07:00
Nikolaj Bjorner d3194bb8a8 #5445 2021-08-02 11:07:28 -07:00
Nikolaj Bjorner 005d35f9c9 #5422 2021-07-21 07:39:39 -07:00
Nikolaj Bjorner 134562162a #5420 2021-07-20 13:50:21 -07:00
Nikolaj Bjorner 49bd3ad159 #5417 again, refining root clauses above search level
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-19 16:56:10 -07:00
Nikolaj Bjorner a64867942d #5417 designate quantifier axioms as auxiliary
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-19 15:35:18 -07:00
Nikolaj Bjorner 18a76ab82c #5336
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-11 06:42:27 +02:00
Nikolaj Bjorner e05f5ef6d1 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-11 06:15:27 +02:00
Nikolaj Bjorner 9038dfd30d #5336 2021-06-16 23:27:26 -05:00
Nikolaj Bjorner bce903ae97 #5324 2021-06-04 15:52:38 -07:00
Nikolaj Bjorner ae6aea7a4d #5324 2021-06-04 13:49:01 -07:00
Nikolaj Bjorner 73118012c5 #5324 2021-06-04 09:40:31 -07:00
Nikolaj Bjorner 7e7360dd0c #5223 2021-05-05 17:40:42 -07:00
Nikolaj Bjorner 308f399224 #5215 converting NYI 2021-04-27 16:19:54 -07:00
Nikolaj Bjorner 83f4a006c6 wreckfun 2021-02-12 19:46:47 -08:00
Nikolaj Bjorner a152bb1e80 remove template Context dependency in every trail object 2021-02-08 15:41:57 -08:00
Nikolaj Bjorner 937b61fc88 fix build, refactor 2021-02-02 05:26:57 -08:00
Nikolaj Bjorner 3ae4c6e9de refactor get_sort 2021-02-02 04:45:54 -08:00
Nikolaj Bjorner 33525007ab try #4984
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-01-31 22:15:00 -08:00
Nikolaj Bjorner 46f754c43d add priority queue to instantiation 2021-01-31 16:17:52 -08:00
Nikolaj Bjorner 4af9132f2e more ematching 2021-01-29 13:39:14 -08:00
Nikolaj Bjorner f48fb8d3e8 it just works
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-01-28 11:12:05 -08:00
Nikolaj Bjorner 8a229bf684 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-01-27 22:39:02 -08:00
Nikolaj Bjorner 579caab025 na 2021-01-27 19:35:34 -08:00
Nikolaj Bjorner 680b185872 adding ematching engine, fixing seq_unicode 2021-01-22 17:10:45 -08:00
Nikolaj Bjorner 60ef60dff8 euf solver updates 2021-01-07 17:32:04 -08:00
Nikolaj Bjorner 374ae52d70 testing mbi 2020-12-26 13:49:59 -08:00
Nikolaj Bjorner ab199dedf9 debug arith/mbi
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-11-02 12:13:19 -08:00
Nikolaj Bjorner 72d407a49f
mbp (#4741)
* adding dt-solver

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

* dt

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

* move mbp to self-contained module

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

* files

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

* Create CMakeLists.txt

* dt

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

* rename to bool_var2expr to indicate type class

* mbp

* na

* add projection

* na

* na

* na

* na

* na

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

* deps

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

* testing arith/q

* na

* newline for model printing

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-21 15:48:40 -07:00
Nikolaj Bjorner 2f756da294
adding dt-solver (#4739)
* adding dt-solver

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

* dt

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

* move mbp to self-contained module

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

* files

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

* Create CMakeLists.txt

* dt

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

* rename to bool_var2expr to indicate type class

* mbp

* na
2020-10-18 15:28:21 -07:00
Nikolaj Bjorner 72b1e8a714 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-12 13:36:40 -07:00