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

14346 commits

Author SHA1 Message Date
Nikolaj Bjorner 1a79d92f3a revert last ditch array
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-30 12:56:21 -07:00
Nikolaj Bjorner 36d76a5bb2 fix #6304
Conditionals are used to guard unfolding of recursive functions.
This is, as shown in #6304, incompatible with the case where recursive functions are used inside if-then-else guards.
We address this by disabling if-conditions as guards if they contain a recursive definition.
The approach is simplistic: if a recursive function, defined prior (not mutually recursive) is used in a guard it should be fine and the condition can guard the current recursive unfolding.
2022-08-30 09:50:58 -07:00
Nikolaj Bjorner 45d8d73fce #6303
handle more array instantiation cases for quantifier instantiation
2022-08-30 09:46:19 -07:00
Nikolaj Bjorner 0f475f45b5 Add RUP checking mode to proof checker. 2022-08-30 09:45:19 -07:00
Nikolaj Bjorner 8cb118235a add missing status case for cancelation 2022-08-30 09:43:10 -07:00
Nikolaj Bjorner cd0af999a8 fix #6302
crash due to not checking for dead rows.
non-termination due to solving div and mod separately.
To ensure termination one needs to at least process them simultaneously, otherwise the metric of number-of-terms x under number of mod/div does not decrease. Substituting in K*y + z under either a mod or div increases the number of terms under a mod/div when eliminating only one of the kinds.
Currently handling divides constraints separately because pre-existing solution uses the model to determine z as a constant between 0 and K-1. The treatment of mod/div is supposed to be more general and use a variable while at the same time reducing the mod/div terms where the eliminated variable is used (the variable z is not added under the mod/div terms, but instead the model is used to determine cut-offs to calculate mod/div directly.
2022-08-29 14:32:13 -07:00
Nikolaj Bjorner dd90689339 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:54:36 -07:00
Nikolaj Bjorner 6f2a6da600 address unused variable warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:50:54 -07:00
Nikolaj Bjorner 4d29925c3f build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:43:50 -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
J Sailor f5d2b9b89a
fix typo in comment defining macros (#6306)
The existing comment describes macros as "formulas of the form
`(forall X (= (f X) T[X]))` ... where `T[X]` does not contain `X`". This is
incorrect; of course the macros' definitions are allowed to be in terms of
the macros' arguments. The comment should say "...does not contain `f`" because
macros can't be recursive.
2022-08-28 17:49:52 -07: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 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 9922c766b9 add extra information for type error message
a recent opened and closed bug report was due to an error of taking bit-wise or between two bit-vectors of different size. The error message was not understood by the user. Adding a little extra generic information to see if it helps.
2022-08-28 17:39:14 -07:00
Nikolaj Bjorner dd91fab6f4 Merge branch 'master' of https://github.com/Z3Prover/z3 2022-08-26 10:44:40 -07:00
Nikolaj Bjorner 159026b5e8 regression fix to ackerman gc and memory smash, perf fix for handling bv2int axioms, perf fix for filtering ackerman
this update addresses some perf regressions introduced when handling axioms for bv2int and a memory smash regression when decoupling bv-ackerman from in-processing. It adds a filter based on bv_eq_axioms for disabling ackerman reductions on disequalities.
2022-08-26 10:44:33 -07:00
Nikolaj Bjorner 458f417f44 move drat functionality into euf 2022-08-25 19:19:13 -07:00
Nikolaj Bjorner 1ffbe23ee3 add virtual destructor to fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 18:37:24 -07:00
Nikolaj Bjorner 1894c86ee0 virtual
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 18:27:30 -07:00
Nikolaj Bjorner ca0a82952f add function pointer to class to see how MacOs build reacts
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 16:15:34 -07:00
Nikolaj Bjorner 0d7b7a417a selectively re-add solver_params
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 13:29:42 -07:00
Nikolaj Bjorner 5f2387b3be revert some changes that coincide with breaking macos build 2022-08-25 11:22:35 -07:00
Nikolaj Bjorner a628e4c4e5 updates to printer to get instantiations, take 1 2022-08-25 11:22:35 -07:00
Nikolaj Bjorner f0eee41ab9 include depenency 2022-08-25 09:09:04 -07:00
Nikolaj Bjorner 6c165e89dc #6299 2022-08-24 20:25:01 -07:00
Nikolaj Bjorner f6e151a49c assert 2022-08-24 17:16:47 -07:00
Nikolaj Bjorner d975886cdc fix #6300
several boundary cases with repeated rows being retired twice and non-termination for K = 1 where decomposition is just identity.
2022-08-24 17:16:47 -07:00
Nikolaj Bjorner fb8532bf55 succinct logging
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 21:06:04 -07:00
Nikolaj Bjorner 74c61f49b4 move std::function to header of sat-drat - alignment?
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 20:20:51 -07:00
Nikolaj Bjorner c6263587c3 fix validator bug returning true for unprocessed case, bug reported in #6116 2022-08-23 20:17:32 -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 912b284602 disable validate_hint too permissive 2022-08-23 19:07:55 -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
Nuno Lopes 916d1dbb13 fix default parameter regression
bug introduced in commit 63f48f8fd4
2022-08-23 15:26:29 +01:00
Nuno Lopes 7ab904bfc6 remove spurious file 2022-08-23 14:39:44 +01:00
Nikolaj Bjorner 0eea021dc3 include global parameters and fixup for HTML meta-characters 2022-08-22 14:25:18 -07:00
Nikolaj Bjorner f6e4a45f4b Merge branch 'master' of https://github.com/z3prover/z3 2022-08-21 18:28:19 -07:00
Nikolaj Bjorner 64e0e785e7 #5953 2022-08-21 18:28:07 -07:00
Nikolaj Bjorner 09ab575d29 parens 2022-08-21 18:27:14 -07:00
Nikolaj Bjorner daa24ef4ce add missing error check 2022-08-21 18:26:53 -07:00
Nikolaj Bjorner 9eb4237dfe fix #6292
this patches a case where macro-finder is used with arrays. It doesn't work so macro quantifiers have to be re-instated to ensure correctness
2022-08-21 16:32:01 -07:00
Nikolaj Bjorner a38308792e #6288
floating points may also track bit-literals.
Since the legacy solver doesn't handle dual tracking of literals we just let the floating point solver track.
2022-08-21 15:47:19 -07:00
Nikolaj Bjorner 4092302590 use interface for creating unary equalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-21 15:37:43 -07:00
Nikolaj Bjorner 17fc438476 don't have bv-ackerman influence simplification
previous scheme has Ackmerman module instrument main solver to backjump and simplify when reaching a threshold.
This destroys overall performance: simplification does many more things than invoking Ackerman axioms.
Having a dependency between simplification (in-processing) and depleting a priority queue of auxiliary axioms therefore hurts overall performance. It has to be decoupled. The current approach is now to empty the axiom queue on occasion.
It is still not ideal - it should be coupled with the search level - axioms don't survive higher levels where redundant clauses get garbage collected as they don't have a chance of being used.
2022-08-21 15:25:18 -07:00
Nikolaj Bjorner be0cd74c71 #6289 2022-08-21 15:25:17 -07:00
Nikolaj Bjorner 2181a0ff74 #6289 2022-08-21 15:25:17 -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
Bruce Mitchener 706f7fbdc7
Fix some warnings about unused stuff. (#6290) 2022-08-21 12:39:30 -07:00
Nuno Lopes d5d77dfe64 minor code simplifications 2022-08-20 12:56:45 +01: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 bb5d81195c use equalities 2022-08-19 18:17:16 -07:00
Nikolaj Bjorner b26420ed99 #6285 2022-08-19 18:17:16 -07:00
Nikolaj Bjorner e83a70f9ad add newlines for description
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 06:57:39 -07:00
Nikolaj Bjorner 540e36e6cb roll version number
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 15:47:08 -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 c3d635cf77 handle build warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:50:30 -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
Nikolaj Bjorner 4be26eb543 #6116
handle also nan/oo/0+ as numerals
2022-08-18 04:26:14 -07:00
Nikolaj Bjorner 8e167aa213 #6116
fix unsoundness issue due to book-keeping changes for whether the solver uses assumptions.
2022-08-18 03:58:06 -07:00
Nikolaj Bjorner 1a5503c87b enable new code path for mod handling 2022-08-17 07:31:26 -07:00
Nikolaj Bjorner cb272bd7a8 fix missing removal of x in solve_mod 2022-08-17 07:31:26 -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 9d6de2f873 parameters neatified
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 09:14:34 -07:00
Nikolaj Bjorner b169292743 add parameter descriptions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 08:26:53 -07:00
Nikolaj Bjorner 583dae2e27 enable nested division
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-15 16:11:00 -07:00
Nikolaj Bjorner e0aa32e6c5 fix #6270
MBQI asserts auxiliary function definitions to handle models of arrays. This is unsound if the definition contains a model value.
2022-08-15 00:13:32 -07:00
Nikolaj Bjorner a0d4a8c21c update diagnostics 2022-08-15 00:12:44 -07:00
Nikolaj Bjorner 138f0d269c fix regression found by fuzzers fix #6271 2022-08-14 12:26:33 -07:00
Nikolaj Bjorner 1d87592b13 fixes to mod/div elimination
elimination of mod/div should be applied to all occurrences of x under mod/div at the same time. It affects performance and termination to perform elimination on each occurrence since substituting in two new variables for eliminated x doubles the number of variables under other occurrences.

Also generalize inequality resolution to use div.

The new features are still disabled.
2022-08-14 11:34:03 -07:00
Nikolaj Bjorner f014e30d46 disable case1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-13 08:53:19 -07:00
Nikolaj Bjorner d80e2fb61d fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-13 08:49:07 -07:00
Nikolaj Bjorner 16a948683f Merge branch 'master' of https://github.com/z3prover/z3 2022-08-13 07:07:34 -07:00
Nikolaj Bjorner fa91a644d3 make extensionality commutative 2022-08-13 07:07:14 -07:00
Nikolaj Bjorner 5669cf65bc bug fixes to mod/div quantifier elimination features 2022-08-13 06:18:13 -07:00
Nikolaj Bjorner 88b6c4a30d pdate decl collection to include functions under arrays
Signedoff-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-12 13:45:16 -07:00
Bruce Mitchener 72f4ee9230 api: Correctly map OP_BSREM0 to Z3_BSREM0. 2022-08-12 14:40:16 -04:00
Nikolaj Bjorner 550d6914b1 updates to div/mod handling in quantifier projection
note: the new code remains disabled at this point.
2022-08-12 14:39:33 -04:00
Nikolaj Bjorner d272becade fixes for division 2022-08-12 11:54:26 -04:00
Nikolaj Bjorner f989521a8c add initial skeleton for xor-solver 2022-08-12 11:54:10 -04:00
Nikolaj Bjorner b6d71fccd8 fix #6265 2022-08-12 10:22:22 -04:00
Nikolaj Bjorner 03385bf78d improve quantifier elimination for arithmetic
This update changes the handling of mod and adds support for nested div terms.

Simple use cases that are handled using small results are given below.

```
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(assert (exists ((x Int)) (and (<= y (* 10 x)) (<= (* 10 x) z))))
(apply qe2)
(reset)

(declare-const y Int)
(assert (exists ((x Int)) (and (> x 0) (= (div x 41) y))))
(apply qe2)
(reset)

(declare-const y Int)
(assert (exists ((x Int)) (= (mod x 41) y)))
(apply qe2)
(reset)
```

The main idea is to introduce definition rows for mod/div terms.
Elimination of variables under mod/div is defined by rewriting the variable to multiples of the mod/divisior and remainder.

The functionality is disabled in this push.
2022-08-12 10:20:43 -04:00
Nikolaj Bjorner 786280c646 print skolem declarations only for lemma tracing 2022-08-11 11:34:54 +03:00
Nikolaj Bjorner b55ad5f20e fix #6267 2022-08-11 09:31:54 +03:00
Nikolaj Bjorner 49064252ac fix issues for user-propagator from new core 2022-08-09 14:56:27 +03:00
Nikolaj Bjorner f27485dae7 avoid push/pop if diseq/eq are not defined 2022-08-09 11:33:29 +03:00
Nikolaj Bjorner 78eaefe5a8 move solver-params to params 2022-08-08 11:34:41 +03:00
Nikolaj Bjorner 77a313ff76 redo #6242
revert to byte based high watermark
add mb based high watermark
2022-08-08 11:26:18 +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
Nikolaj Bjorner 410eed9bd5 #6116 2022-08-07 11:09:43 +03:00
Nikolaj Bjorner 8e077d8ef9 #6116 2022-08-07 10:25:04 +03:00
Nikolaj Bjorner 539d44464f #6196
map can be simplified
2022-08-07 10:17:24 +03:00
Nikolaj Bjorner f34317d604 #6196 2022-08-07 09:44:10 +03:00
Nikolaj Bjorner a4ea281602 fix #6260 2022-08-06 08:21:52 +03:00