3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-16 05:48:44 +00:00
Commit graph

496 commits

Author SHA1 Message Date
Nikolaj Bjorner 6a61efbf99 add missing override
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-05 13:35:53 -07:00
Nikolaj Bjorner 3011b34b3b log E-matching based quantifier instantiations as hints 2022-08-31 18:59:02 -07:00
Nikolaj Bjorner 4abff18e8d fill in missing pieces of proof hint checker for Farkas and RUP
The proof validator based on SMT format proof logs uses RUP to check propositional inferences and has plugins for theory axioms/lemmas.
2022-08-31 05:29:15 -07:00
Nikolaj Bjorner 0f475f45b5 Add RUP checking mode to proof checker. 2022-08-30 09:45:19 -07:00
Nikolaj Bjorner 8b8caf9ded re-add smt-solver for proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:19:30 -07:00
Nikolaj Bjorner 37fab88de0 respect dependencies, move proof_cmds to extra_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:16:43 -07:00
Nikolaj Bjorner f65a244385 move proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:11:26 -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 2f8b13368d add redirect for warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 15:55:55 -07:00
Nikolaj Bjorner b169292743 add parameter descriptions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 08:26:53 -07: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
Bruce Mitchener 3e38bbb009
Make sure all headers do #pragma once. (#6188) 2022-07-23 10:41:14 -07:00
Nikolaj Bjorner 32614722ef fix #6176
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 21:19:20 -07:00
Andrea Lattuada af80bd18ce
Flush the trace stream before displaying sat results (#6162) 2022-07-14 13:43:57 -07:00
Nikolaj Bjorner 894fb836e2 fix build break (debug assertion) and isolate gomory functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-13 17:26:56 -07:00
Nikolaj Bjorner dec87fe4d9 fix issue with set-logic for eval_smtlib2_string 2022-07-13 16:19:12 -07:00
Nikolaj Bjorner a3eb9da191 fix #6158 2022-07-13 14:33:42 -07: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 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
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 da9382956c use common functionality 2022-06-04 11:36:05 -07:00
Nikolaj Bjorner 1e7a9e3e61 fix #6023 2022-05-08 12:03:13 -07:00
Nikolaj Bjorner d58de2f8e4 java build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-08 10:20:32 -07:00
Nikolaj Bjorner 81d97a81af enable nested ADT and sequences
add API to define forward reference to recursively defined datatype.
The forward reference should be used only when passed to constructor declarations that are used in a datatype definition (Z3_mk_datatypes). The call to Z3_mk_datatypes ensures that the forward reference can be resolved with respect to constructors.
2022-04-27 09:58:38 +01:00
Nikolaj Bjorner a634876180 sort muxes 2022-04-15 12:55:26 +02:00
Nikolaj Bjorner 011c1b2dd2 remove refs to bare_str 2022-04-09 12:06:27 +02:00
Nikolaj Bjorner 1346a168a1 #5952 2022-04-08 07:00:53 +02:00
Nikolaj Bjorner d790523c59 #5917
Add model.user_functions (default true) to control whether user functions are added to the model.
2022-03-23 09:49:44 -07:00
Nuno Lopes 43f7636826 remove some copies/moves 2022-03-09 12:46:41 +00:00
Nikolaj Bjorner d7c7fbb8f1 setting roots breaks relevancy propagation 2022-01-05 21:16:25 -08:00
Nikolaj Bjorner a44a46a514 fix #5745 2021-12-31 16:41:51 -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 4856581b68 na 2021-12-17 16:40:19 -08:00
Nikolaj Bjorner 4dad414161 fix performance regression after adding user declared functions to model
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-10-28 05:49:15 +02:00
Nikolaj Bjorner d980ee0533 fix regression in FPNumRef sign 2021-08-18 10:00:22 -07:00
Nikolaj Bjorner 5c9f4dc4d7 #5486 - improve type elaboration by epsilon to make common cases parse without type annotation 2021-08-17 16:43:36 -07:00
Nikolaj Bjorner 0ba518b0c0 avoid perf abyss for macros
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-20 20:07:06 -07:00
Nikolaj Bjorner ba56bfa656 spelling 2021-05-31 19:04:38 -07:00
Nikolaj Bjorner b1606487f0 fix #5289 2021-05-30 10:32:30 -07:00
Nikolaj Bjorner ce6fc21bef fix #5300
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-28 14:17:13 -07:00
Nikolaj Bjorner c5d4ff9b6f fix #5300
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-28 14:16:43 -07:00
Nuno Lopes f1e0d5dc8a remove a hundred implicit constructors/destructors 2021-05-23 14:25:01 +01:00
Nikolaj Bjorner 17be37a5f6 fix #5287 2021-05-20 15:40:18 -07:00
Nikolaj Bjorner 1a432529dd fix #5272 2021-05-17 11:10:05 -07:00
Nikolaj Bjorner ff480d1183 fix #5238 2021-05-02 16:09:01 -07:00
Nikolaj Bjorner aa3975ed87 fix #5235 2021-05-01 10:53:50 -07: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 a5f957afb3 fixes for type #5164 2021-04-09 14:44:16 -07:00
Nikolaj Bjorner 673d2d700e more #5164 2021-04-09 13:11:53 -07:00