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

2095 commits

Author SHA1 Message Date
Nikolaj Bjorner 6092bf534c fix #6599 2023-02-18 14:18:02 -08:00
Nikolaj Bjorner daeaed1e82 revert debug only changes to sat-solver 2023-02-18 14:13:40 -08:00
Nikolaj Bjorner c5e33b79b5 wip - arith sls
overhaul to tier inequalities with Boolean variables instead of literals
2023-02-18 14:11:48 -08:00
Nikolaj Bjorner bd10ddf6ae wip - local search - use dispatch model from bool local search instead of separate phases. 2023-02-16 09:17:11 -08:00
Nikolaj Bjorner c1ecc49021 wip - local search - move to plugin model 2023-02-15 13:32:30 -08:00
Nikolaj Bjorner a1f73d3805 wip - local search - fix build 2023-02-15 08:48:37 -08:00
Nikolaj Bjorner 4f20b8e2ba wip - local search 2023-02-15 08:36:10 -08:00
Nikolaj Bjorner 44fcf60a72 wip experiments with sls 2023-02-14 15:06:26 -08:00
Nikolaj Bjorner 2b77012993 fix build 2023-02-13 08:36:12 -08:00
Nikolaj Bjorner 52804b5c8f save on dtt
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-13 08:29:32 -08:00
Nikolaj Bjorner 7956cf1201 annotate arith_sls 2023-02-12 20:55:44 -08:00
Nikolaj Bjorner bb81bc5452 fix #6580
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-12 20:21:53 -08:00
Nikolaj Bjorner 102eee77dc patch regressions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-12 20:12:01 -08:00
Nikolaj Bjorner 5e30323b1a wip - bounded local search for arithmetic 2023-02-11 15:46:39 -08:00
Nikolaj Bjorner 4b2c166e8b fixes to build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-11 10:19:24 -08:00
Nikolaj Bjorner 7bef2f3e6f wip - local search for euf/arithmetic 2023-02-11 09:33:43 -08:00
Nikolaj Bjorner d22e4aa525 wip - integrating arithmetic local search 2023-02-11 09:33:42 -08:00
Nikolaj Bjorner 1b0c76e3f0 fixes to mbqi in the new core based on #6575 2023-02-10 16:56:06 -08:00
Nikolaj Bjorner a8335f2d5e use phase 2023-02-07 19:50:45 -08:00
Nikolaj Bjorner b3ebce3966 fix compilation 2023-02-07 19:30:45 -08:00
Nikolaj Bjorner 96d815b904 adding arith sls 2023-02-07 19:27:19 -08:00
Nikolaj Bjorner 90a75866fb elaborating on local-search rephase strategy 2023-02-07 03:17:52 -08:00
Nikolaj Bjorner c1c26f0726 restart after sat solution
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-06 09:21:35 -08:00
Nikolaj Bjorner 03a4920f3d fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-05 21:41:07 -08:00
Nikolaj Bjorner 75c573877d updates to ddfw, initial local search phase option 2023-02-05 21:35:22 -08:00
Nikolaj Bjorner d263b373ed update release notes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-31 12:19:33 -08:00
Nikolaj Bjorner 6022c17131 Add simplification customization for SMTLIB2
Add the ability to customize incremental pre-processing simplification for the SMTLIB2 front-end. The main new capability is to use pre-processing tactics in incremental mode that were previously not available. The main new capabilities are
- solve-eqs
- reduce-args
- elim-unconstrained
There are several more. Documentation and exposed simplifiers are populated incrementally. The current set of supported simplifiers can be inspected by using z3 with the --simplifiers flag or referring to https://microsoft.github.io/z3guide/docs/strategies/simplifiers

Some pending features are:
- add the ability to update parameters to simplifiers similar to how tactics can be controlled using parameters.
- expose simplification solvers over the binary API.
2023-01-30 22:38:51 -08:00
Nikolaj Bjorner dd0decfe5d create simplifier_solver wrapper to supply simplifier layer
move sat_smt_preprocess to solver
fix bugs in model_reconstruction_trail for dependency replay

This is a preparatory step for exposing pre-processing as tactics.
2023-01-30 16:12:25 -08:00
Nikolaj Bjorner 8ea49eed8e convert reduce-args to a simplifier
- convert reduce-args to a simplifier. Currently exposed as reduce-args2 tactic until the old tactic code gets removed.
- bug fixes in model_reconstruction trail
  - allow multiple defs to be added with same pool of removed formulas
  - fix tracking of function symbols instead of expressions to filter replay
- add nla_divisions to track (cheap) divisibility lemmas.
-
2023-01-28 20:12:14 -08:00
Nikolaj Bjorner d11e5c8ca6 address compiler warnings, and user question #6544 2023-01-19 19:02:43 -08:00
Nikolaj Bjorner 7368f9f7d3 increase build version, better propagation in euf-egraph, handle assumptions in sat.smt
- increase build version to 4.12.1. This prepares updated release for MacOs-11 build on x86
- move literal propagation mode in euf-egraph to a callback and traversal of equivalence class. Track antecedent by newest equality instead of root. This makes equality propagation to literals have similar behavior as in legacy solver and appears to result in a speedup (10% fewer conflicts on QF_UF/QG-classification/qg5/iso_icl478.smt2 in preliminary testing)
- fix interaction of pre-processing and assumptions. Pre-processing has to freeze assumption literals so they don't get eliminated. This is similar to dependencies that are already frozen.
2023-01-17 14:07:07 -08:00
Nikolaj Bjorner d5fde2e578 #6538
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-15 15:58:29 -05:00
Nikolaj Bjorner 4f7f4376b8 fix bug in new core not detecting conflict, fix #6525, add tactic doc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-14 17:20:43 -05:00
Jerry James e5e16268cc
Initialize m_istamp_id in lookahead::init (#6533) 2023-01-12 11:20:28 -08:00
Nikolaj Bjorner 8970a54eaa expose parameters to control behavior for #5660 2023-01-10 22:06:19 -08:00
Nikolaj Bjorner c3e31149a5 fix #6530
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-10 13:43:17 -08:00
Nikolaj Bjorner a4d4e2e483 track assertions 2023-01-09 15:18:33 -08:00
Nikolaj Bjorner fcea32344e add missing tactic descriptions, add rewrite for tamagochi
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 13:32:26 -08:00
Nikolaj Bjorner 0d8a472aac pass sign into literal definition for pbge 2023-01-04 16:55:44 -08:00
Nikolaj Bjorner 81ce57b5a8 #6429 2023-01-04 15:38:13 -08:00
Nikolaj Bjorner ef10119005 #6429 fixes 2023-01-04 13:05:45 -08:00
Nikolaj Bjorner aa080a6b19 update ignore-int handling #6429
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-04 12:22:38 -08:00
Nikolaj Bjorner 6f95c77023 fix bugs in flatten_clauses simplifier, switch proof/fml
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-04 11:56:28 -08:00
Nikolaj Bjorner f6d411d54b experimental feature to access congruence closure of SimpleSolver
This update includes an experimental feature to access a congruence closure data-structure after search.
It comes with several caveats as pre-processing is free to eliminate terms. It is therefore necessary to use a solver that does not eliminate the terms you want to track for congruence of. This is partially addressed by using SimpleSolver or incremental mode solving.

```python
from z3 import *
s = SimpleSolver()
x, y, z = Ints('x y z')
s.add(x == y)
s.add(y == z)
s.check()
print(s.root(x), s.root(y), s.root(z))
print(s.next(x), s.next(y), s.next(z))
```
2022-12-30 21:41:27 -08:00
Nikolaj Bjorner 5f6f2fc758 rename bit_blaster class to bit_blaster_simplifier to avoid name clash 2022-12-30 18:39:02 -08:00
Nikolaj Bjorner 80033e8744 cave in to supporting proofs (partially) in simplifiers, updated doc 2022-12-06 17:02:04 -08:00
Nikolaj Bjorner e5984dd397 add cnf/nnf simplifier 2022-11-30 23:04:38 -08:00
Nikolaj Bjorner 30c9cda61e increment generation for literals created during E-matching 2022-12-01 10:04:33 +09:00
Nikolaj Bjorner f24ecde35c wip - fixes to simplifiers 2022-12-01 09:31:52 +09:00
Nikolaj Bjorner cfc8e19baf add more simplifiers, fix model reconstruction order for elim_unconstrained
- enable sat.smt in smt_tactic that
is invoked by default on first goals
add flatten-clauses
add push-ite
have tptp5 front-end pretty print SMT2 formulas a little nicer.
2022-12-01 02:35:43 +09:00
Nikolaj Bjorner b084821a0c wip - dependent expr simpliifer
- simplify iterator over current indices
- add more simplifiers used by asserted_formulas
- improve diagnostics printing
2022-11-30 13:41:40 +07:00
Nikolaj Bjorner bec3acd146 consolidate freeze functionality into dependent_expr_state
rename size() to qtail() and introduce shortcuts
ensure tactic goals are not updated if they are in inconsistent state (because indices could be invalidated)
2022-11-30 08:35:29 +07:00
Nikolaj Bjorner 73a652cf4b some fixes to backtracking restore points in new solver 2022-11-29 16:42:42 +07:00
Nikolaj Bjorner dd1ca8f6bd move qhead to attribute on the state instead of the simplifier,
- add sat.smt option to enable the new incremental core (it is not ready for mainstream consumption as cloning and other features are not implemented and it hasn't been tested in any detail yet).
- move "name" into attribute on simplifier so it can be reused for diagnostics by the seq-simplifier.
2022-11-29 16:36:02 +07:00
Nikolaj Bjorner ac023935a3 introduce sat-smt-solver
in an iteration of inc-sat-solver introduce sat-smt-solver to allow incremental pre-processing.
The aim is to allow incrementally handling formulas while at the same time retaining the main benefits of global in/pre-processing that change models. Previous incremental solving capabilities have been limited to use pre-processing that does not require model conversion.
2022-11-28 15:06:31 +07:00
Nikolaj Bjorner 82d9e4a4fc update goal2sat interface to use explicit initialization 2022-11-28 15:04:12 +07:00
Nikolaj Bjorner 500626e814 add sat-smt-preprocess module
self-contained pre-processing initialization
2022-11-28 12:13:00 +07:00
Nikolaj Bjorner 85f9c7eefa replace restore_size_trail by more generic restore_vector
other updates:
- change signature of advance_qhead to simplify call sites
- have model reconstruction replay work on a tail of dependent_expr state, while adding formulas to the tail.
2022-11-28 11:45:56 +07:00
Nikolaj Bjorner 5fe2ff84e9 change functionality to not track ite terms for congruence closure 2022-11-24 19:45:16 +07:00
Nikolaj Bjorner 15dc7b78a0 Move merge_tf handling to euf_internalize
literals true/false are not necessarily created when the merge flag is set.
Also disable merge_tf for if-then-else expressions
Perhaps even not insert children of if expressions into congruence table?
2022-11-24 15:09:13 +07:00
Nikolaj Bjorner 4ac5e51e3a #6429 2022-11-23 18:35:17 +07:00
Nikolaj Bjorner f87e187b62 #6429 2022-11-23 17:52:14 +07:00
Nikolaj Bjorner 22353c2d6c new core perf - add merge_tf and enable_cgc distinction
perf fix for propagation behavior for equalities in the new core.
The old behavior was not to allow congruence closure on equalities.
The new behavior is to just not allow merging tf with equalities unless they appear somewhere in a foreign context (not under a Boolean operator)

The change re-surfaces merge_tf and enable_cgc distinction from the old core.
They can both be turned on or off.

merge_enabled renamed to cgc_enabled

The change is highly likely to introduce regressions in the new core.

Change propagation of literals from congruence:
- track antecedent enode. There are four ways to propagate
literals from the egraph.
- the literal is an equality and the two arguments are congruent
- the antecedent is merged with node n and the antecedent has a Boolean variable assignment.
- the antecedent is true or false, they are merged.
- the merge_tf flag is toggled to true but the node n has not been merged with true/false
2022-11-23 11:37:24 +07:00
Nikolaj Bjorner 11b712fee0 switch to new configuration convention in solver object 2022-11-23 11:37:23 +07:00
Nikolaj Bjorner c7781f346d move parameter sat.smt.proof to solver.proof.log
this update breaks use cases that set sat.smt.proof to True.
As it is such a new feature and the change affects possibly at most the tutorial it is made without compatibility layers.
2022-11-23 11:37:23 +07:00
Nikolaj Bjorner e33e66212c propagate values should not flatten and/or
also, elim_uncstr should only be disabled on recursive functions
2022-11-12 18:03:47 -08:00
Nikolaj Bjorner f4e17ecc65 add logging and diagnostics 2022-11-12 18:03:47 -08:00
Nikolaj Bjorner 10fb71cf93 better error description for configuring restart 2022-11-08 12:18:45 -08:00
Nikolaj Bjorner 1dca6402fb move model and proof converters to self-contained module 2022-11-03 05:23:01 -07:00
Nikolaj Bjorner 90490cb22f make visited_helper independent of literals
re-introduce shorthands in sat::solver for visited and have them convert literals to unsigned.
2022-11-03 03:54:39 -07:00
Clemens Eisenhofer 6790f18132
Added limit to "visit" to allow detecting multiple visits (#6435)
* Memory leak in .NET user-propagator
The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically

* Throw an exception if variable passed to decide is already assigned instead of running in an assertion violation

* Added limit to "visit" to allow detecting multiple visits

* Putting visit in a separate class
(Reason: We will probably need two of them in the sat::solver)

* Bugfix
2022-11-03 03:34:52 -07:00
Nikolaj Bjorner 9fc4015c46 remove ternary clause optimization
Removing ternary clause optimization from sat_solver simplifies special case handling of ternary clauses throughout the sat solver and dependent solvers (pb_solver). Benchmarking on QF_BV suggests the ternary clause optimization does not have any effect. While removing ternary clause optimization two bugs in unit propagation were also uncovered: it missed propagations when the only a single undef literal remained in the non-watched literals and it did not update blocked literals in cases where it could in the watch list. These performance bugs were for general clauses, ternary clause propagation did not miss propagations (and don't use blocked literals), but fixing these issues for general clauses appear to have made ternary clause optimization irrelevant based on what was measured.
2022-10-30 03:57:39 -07:00
Nikolaj Bjorner a409a4a677 enforce flat within QF_BV tactic, cap in-processing var-elim loops 2022-10-27 20:10:55 -07:00
Nikolaj Bjorner 1fae3aa152 rename set-flat to set-flat-and-or to allow to differentiate parameters 2022-10-27 11:22:57 -07:00
Nikolaj Bjorner fe1b4bf5ce disable ternary, fixes to propagation, make bv_rewrites for multiplier n-ary 2022-10-26 23:44:38 -07:00
Nikolaj Bjorner 2258b9b9b6 #6423 2022-10-26 12:06:11 -07:00
Nikolaj Bjorner a4ece21461 toggle enable-ternary to true 2022-10-25 10:44:23 -07:00
Nikolaj Bjorner 154fed7783 introduce globally visible macro for controlling use of ternary, turn them off 2022-10-25 10:30:18 -07:00
Nikolaj Bjorner c672c3a250 fix regression introduced in #6143 2022-10-25 09:39:11 -07:00
Nikolaj Bjorner e1a00f4917 remove unused experimental feature - diff 2022-10-24 16:13:24 -07:00
Nikolaj Bjorner 280887cc5a remove deprecated theory aware drat functionality
it is handled by the on-clause callback that is owned by the smt solver.
2022-10-24 08:32:10 -07:00
Nuno Lopes cb3c86736c fix build 2022-10-24 10:23:50 +01:00
Nikolaj Bjorner a24b5a64e1 #6364 proviso for ignore int 2022-10-24 00:48:57 -07:00
Nikolaj Bjorner 5c7eaec566 #6364 - remove option of redundant clauses from internalization
gc-ing definitions leads to unsoundness when they are not replayed.
Instead of attempting to replay definitions theory internalization is irredundant by default.
This is also the old solver behavior where TH_LEMMA is essentially never used, but is valid for top-level theory lemmas.
2022-10-24 00:38:31 -07:00
Nikolaj Bjorner c8e1e180ea prefix Boolean variables in log with b 2022-10-23 11:05:50 -07:00
Nikolaj Bjorner 6393ed78d7 remove useless log 2022-10-23 11:05:33 -07:00
Nikolaj Bjorner ddbca68270 minor formatting update 2022-10-23 11:05:09 -07:00
Nikolaj Bjorner 53adc2afee update debugging information for new core 2022-10-21 15:24:44 -07:00
Nikolaj Bjorner 842e8057bc log also quantifier generation (besides binding)
We add also logging for quantifier generation.
It is auxiliary information that is of use for diagnostics (axiom profiler).
2022-10-20 17:49:15 -07:00
Nikolaj Bjorner c1b355f342 #6364
throttle on upwards propagation of default was too restrictive
2022-10-20 17:48:17 -07:00
Nikolaj Bjorner 6d6752b2aa #6364 2022-10-20 16:39:43 -07:00
Nikolaj Bjorner 5976978062 move std functions up for potential alignment issues
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 09:11:15 -07:00
Nikolaj Bjorner fc30461828 unused variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 09:09:06 -07:00
Nikolaj Bjorner 6292b06c67 ensure that initialization order for euf_solver is aligned
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 08:48:15 -07:00
Nikolaj Bjorner 2842c27e92 #6364 2022-10-20 04:48:13 -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 b084852397 update release notes, fix bug in replay of Boolean variables in new core 2022-10-19 12:12:32 -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
Nikolaj Bjorner 77cbd89420 remove once pragma from cpp file
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-18 14:57:49 -07:00
Nikolaj Bjorner cdfab8cb13 wip - add bit-vector validator plugins and logging 2022-10-18 14:50:21 -07:00
Nikolaj Bjorner f0b85716a9 wip - proof logging fixes 2022-10-18 11:20:56 -07:00
Nikolaj Bjorner 1fc77c8c00 wip - proof checking
fixes to smt_theory_checker. Generalize it to apply to arrays and fpa.
Missing: bv
2022-10-18 09:02:50 -07:00
Nikolaj Bjorner 7b3a634b8d wip - features and bug-fixes to proof logging 2022-10-18 07:54:49 -07:00
Nikolaj Bjorner 3bf1b606df remove on-the fly ackerman reduction because it interferes with conflict resolution 2022-10-18 07:53:42 -07:00
Nikolaj Bjorner b758d5b2b1 wip - proof checking, add support for distinct, other fixes 2022-10-17 17:51:10 -07:00
Nikolaj Bjorner 98fe2e637a add generic theory lemma in default case.
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-17 10:17:08 -07:00
Nikolaj Bjorner a25247aa7b wip - remove stale skaffolding for retrieving sub-hints. 2022-10-16 17:18:08 -07:00
Nikolaj Bjorner 3ed791b16a fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-16 15:01:42 -07:00
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 993ff40826 fixes to proof logging and checking 2022-10-15 12:42:50 +02:00
Nikolaj Bjorner 4388719848 adjust logging 2022-10-14 18:56:18 +02:00
Nikolaj Bjorner e2cfc53c9f #6364
skip proof hint unless proofs are on
2022-10-13 15:31:58 +02:00
Nuno Lopes a7f018aa03 fix compiler warnings 2022-10-12 10:02:21 +01:00
Nikolaj Bjorner a2e0646eed wip - proof checker 2022-10-12 09:34:49 +02:00
Nikolaj Bjorner 1b3684c9c1 wip - fixes to implied-eq proof hints 2022-10-11 09:54:00 +02:00
Nikolaj Bjorner ffeb8f4572 wip - tseitin check
```
(set-option :sat.euf true)
(set-option :sat.smt.proof tseitinproof.smt2)
(set-option :tactic.default_tactic smt)

(declare-const a1 Bool)
(declare-const a2 Bool)
(declare-const a3 Bool)
(declare-const a4 Bool)
(declare-const a5 Bool)
(declare-const a6 Bool)
(declare-const a7 Bool)
(declare-const a8 Bool)
(declare-const a9 Bool)

(declare-const a10 Bool)
(declare-const a11 Bool)
(declare-const a12 Bool)
(declare-const a13 Bool)
(declare-const a14 Bool)
(declare-const a15 Bool)
(declare-const a16 Bool)
(declare-const a17 Bool)
(declare-const a18 Bool)
(declare-const a19 Bool)

(declare-const x1 Bool)
(declare-const x2 Bool)
(declare-const x3 Bool)
(declare-const x4 Bool)
(declare-const x5 Bool)
(declare-const x6 Bool)
(declare-const x7 Bool)
(declare-const x8 Bool)
(declare-const x9 Bool)

(declare-const b1 Int)
(declare-const b2 Int)
(declare-const b3 Int)
(declare-const b4 Int)

(assert (= x1 (and a1 a2)))
(assert (= x2 (or a3 a4)))
(assert (= x3 (=> a5 a6)))
(assert (= x4 (=  a7 a8)))
(assert (= x5 (if a9 a10 a11)))
(assert (= x6 (=> a12 a13)))
(assert (= x7 (xor a1 a2 a3)))
(assert (= x7 (xor a1 a2 a3 a4 a5 (not a6))))
(assert (= x8 (= (ite a1 b1 b2) b3)))
(check-sat)
(exit)

```
2022-10-11 09:21:36 +02:00
Nikolaj Bjorner 62438da0f5 wip - add xor and non-bool ite tseitin rules 2022-10-11 09:15:18 +02:00
Nikolaj Bjorner cd8b8b603a tseitin rule checking - wip
Unit test

```
(set-option :sat.euf true)
(set-option :sat.smt.proof tseitinproof.smt2)

(declare-const a1 Bool)
(declare-const a2 Bool)
(declare-const a3 Bool)
(declare-const a4 Bool)
(declare-const a5 Bool)
(declare-const a6 Bool)
(declare-const a7 Bool)
(declare-const a8 Bool)
(declare-const a9 Bool)

(declare-const a10 Bool)
(declare-const a11 Bool)
(declare-const a12 Bool)
(declare-const a13 Bool)
(declare-const a14 Bool)
(declare-const a15 Bool)
(declare-const a16 Bool)
(declare-const a17 Bool)
(declare-const a18 Bool)
(declare-const a19 Bool)

(declare-const x1 Bool)
(declare-const x2 Bool)
(declare-const x3 Bool)
(declare-const x4 Bool)
(declare-const x5 Bool)
(declare-const x6 Bool)
(declare-const x7 Bool)
(declare-const x8 Bool)
(declare-const x9 Bool)

(assert (= x1 (and a1 a2)))
(assert (= x2 (or a3 a4)))
(assert (= x3 (=> a5 a6)))
(assert (= x4 (=  a7 a8)))
(assert (= x5 (if a9 a10 a11)))
(assert (= x6 (=> a12 a13)))

(check-sat)
```

Output proof

```
(declare-fun a1 () Bool)
(declare-fun a2 () Bool)
(define-const $26 Bool (and a1 a2))
(declare-fun tseitin (Bool Bool) Proof)
(define-const $60 Bool (not $26))
(define-const $61 Proof (tseitin $60 a1))
(infer a1 (not $26) $61)
(define-const $62 Proof (tseitin $60 a2))
(infer a2 (not $26) $62)
(declare-fun tseitin (Bool Bool Bool) Proof)
(define-const $64 Bool (not a2))
(define-const $63 Bool (not a1))
(define-const $65 Proof (tseitin $63 $64 $26))
(infer (not a1) (not a2) $26 $65)
(declare-fun x1 () Bool)
(assume (not x1) $26)
(assume x1 (not $26))
(declare-fun a3 () Bool)
(declare-fun a4 () Bool)
(define-const $31 Bool (or a3 a4))
(define-const $66 Bool (not a3))
(define-const $67 Proof (tseitin $66 $31))
(infer (not a3) $31 $67)
(define-const $68 Bool (not a4))
(define-const $69 Proof (tseitin $68 $31))
(infer (not a4) $31 $69)
(define-const $70 Bool (not $31))
(define-const $71 Proof (tseitin a3 a4 $70))
(infer a3 a4 (not $31) $71)
(declare-fun x2 () Bool)
(assume (not x2) $31)
(assume x2 (not $31))
(declare-fun a6 () Bool)
(declare-fun a5 () Bool)
(define-const $38 Bool (not a5))
(define-const $39 Bool (or a6 $38))
(define-const $72 Bool (not a6))
(define-const $73 Proof (tseitin $72 $39))
(infer (not a6) $39 $73)
(define-const $74 Proof (tseitin a5 $39))
(infer a5 $39 $74)
(define-const $75 Bool (not $39))
(define-const $76 Proof (tseitin a6 $38 $75))
(infer a6 (not a5) (not $39) $76)
(declare-fun x3 () Bool)
(assume (not x3) $39)
(assume x3 (not $39))
(declare-fun a7 () Bool)
(declare-fun a8 () Bool)
(define-const $44 Bool (= a7 a8))
(define-const $78 Bool (not a7))
(define-const $77 Bool (not $44))
(define-const $79 Proof (tseitin $77 a8 $78))
(infer (not a7) a8 (not $44) $79)
(define-const $80 Bool (not a8))
(define-const $81 Proof (tseitin $77 $80 a7))
(infer a7 (not a8) (not $44) $81)
(define-const $82 Proof (tseitin $44 a8 a7))
(infer a7 a8 $44 $82)
(define-const $83 Proof (tseitin $44 $80 $78))
(infer (not a7) (not a8) $44 $83)
(declare-fun x4 () Bool)
(assume (not x4) $44)
(assume x4 (not $44))
(declare-fun a9 () Bool)
(declare-fun a10 () Bool)
(declare-fun a11 () Bool)
(define-const $50 Bool (ite a9 a10 a11))
(define-const $85 Bool (not a9))
(define-const $84 Bool (not $50))
(define-const $86 Proof (tseitin $84 $85 a10))
(infer (not a9) a10 (not $50) $86)
(define-const $87 Proof (tseitin $84 a9 a11))
(infer a9 a11 (not $50) $87)
(define-const $88 Bool (not a10))
(define-const $89 Proof (tseitin $50 $85 $88))
(infer (not a9) (not a10) $50 $89)
(define-const $90 Bool (not a11))
(define-const $91 Proof (tseitin $50 a9 $90))
(infer a9 (not a11) $50 $91)
(define-const $92 Proof (tseitin $88 $90 $50))
(infer (not a10) (not a11) $50 $92)
(define-const $93 Proof (tseitin a10 a11 $84))
(infer a10 a11 (not $50) $93)
(declare-fun x5 () Bool)
(assume (not x5) $50)
(assume x5 (not $50))
(declare-fun a13 () Bool)
(declare-fun a12 () Bool)
(define-const $57 Bool (not a12))
(define-const $58 Bool (or a13 $57))
(define-const $94 Bool (not a13))
(define-const $95 Proof (tseitin $94 $58))
(infer (not a13) $58 $95)
(define-const $96 Proof (tseitin a12 $58))
(infer a12 $58 $96)
(define-const $97 Bool (not $58))
(define-const $98 Proof (tseitin a13 $57 $97))
(infer a13 (not a12) (not $58) $98)
(declare-fun x6 () Bool)
(assume (not x6) $58)
(assume x6 (not $58))

```
2022-10-10 23:44:03 +02:00
Nikolaj Bjorner fceedf60dc wip - proofs 2022-10-10 16:41:09 +02:00
Nikolaj Bjorner de69874076 wip - adding proof checkers, fixes to quantifier proof certificates 2022-10-10 09:46:22 +02:00
Nikolaj Bjorner 4623117af8 wip - proof hints 2022-10-08 20:12:57 +02:00
Nikolaj Bjorner 6796ea7e49 add new files
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-07 19:22:36 +02:00
Nikolaj Bjorner 35639c5ac0 adding q proof hints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-07 19:21:21 +02:00
Nikolaj Bjorner 5c9f69829b fixes to trim 2022-10-07 09:58:12 +02:00
Nikolaj Bjorner 9f78a96c1d wip - trim 2022-10-06 18:19:03 +02:00
Nikolaj Bjorner 4e780d0cc8 trim
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-05 05:43:48 +02:00
Nikolaj Bjorner f8ca692dee fixes to trim
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-05 04:32:00 +02:00
Nikolaj Bjorner c1c659dc93 trying trim
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-04 16:25:40 +02:00
Naxaes 49ebca6c1c
Fix clang build (#6378) 2022-10-01 14:01:36 +01:00
Nikolaj Bjorner ab045f0645 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-30 16:52:19 -04:00
Nikolaj Bjorner b9cba82531 work on proof checking
- add outline of trim routine
- streamline how proof terms are checked and how residue units are extracted.
2022-09-30 13:04:19 -04: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 3df8b9c7e2 Merge branch 'master' of https://github.com/z3prover/z3 2022-09-25 18:03:26 -07:00
Nikolaj Bjorner d7b9cc70d0 smc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-25 18:03:16 -07:00
Nikolaj Bjorner 9be8fc7857 Add EUF (congruence closure) proof hints and checker to the new core
EUF proofs are checked modulo union-find.
Equalities are added to to union-find if they are assumptions or if they can be derived using congruence closure. The congruence closure assumptions are added as proof-hints.
Note that this proof format does not track equality inferences, symmetry and transitivity. Instead they are handled by assuming a union-find based checker.
2022-09-25 14:26:20 -07:00
Nikolaj Bjorner 6f2fde87d1 move has-default up before merge of parents
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-24 14:40:30 -07:00
Nikolaj Bjorner 3dfff3d7a1 tracing for fpa 2022-09-23 22:48:54 -07:00
Nikolaj Bjorner 1f150ecd52 #6319
#6319 - fix incompleteness in propagation of default to all array terms in the equivalence class.

Fix bug with q_mbi where domain restrictions are not using values because the current model does not evaluate certain bound variables to values. Set model completion when adding these bound variables to the model to ensure their values are not missed.

Add better propagation of diagnostics when tactics and the new solver return unknown. The reason for unknown can now be traced to what theory was culprit (currently no additional information)
2022-09-23 22:22:34 -05:00
Nikolaj Bjorner 6226875283 fix regression with uninitialized variable 2022-09-23 15:51:26 -05:00
Nikolaj Bjorner c41b6da6bb #6319
using a queue for disequality propagaiton was a regression: values of numerals can change along the same stack so prior passing the filter does not mean it passes later.
2022-09-23 14:47:48 -05:00
Nikolaj Bjorner 4c6d7158cb extended debugging for sat.euf 2022-09-22 17:05:32 -05:00
Nikolaj Bjorner 20250b200f #6319
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-19 20:31:36 -07:00
Nikolaj Bjorner 7caf6a682b #6319 resolve for unsat core when using assumptions 2022-09-19 20:10:53 -07:00
Nikolaj Bjorner f4bea58852 #6319
ensure unknown when a lambda is not in beta redex
2022-09-19 03:19:47 -07:00
Nikolaj Bjorner fce4d2ad90 #6319 2022-09-19 03:07:51 -07:00
Nikolaj Bjorner d6d34a8962 #6319 2022-09-19 02:32:04 -07:00
Nikolaj Bjorner 13f43ea107 bug fix for #6319
literals that are replayed need to be registered with respective theories, otherwise, they will not propagate with the theories (the enode have to be attached with relevant theory variables).
2022-09-18 17:23:00 -07:00
Nikolaj Bjorner e54635e0ed rename statistics to something more meaningful: instantiations from MBQI are tagged with mbi 2022-09-18 17:23:00 -07:00
Nikolaj Bjorner 2b4ba5e170 updated header file for arithmetic solver 2022-09-18 17:23:00 -07:00
Nikolaj Bjorner 0b9c9cbbce add a queue head to delay propagation
delay propagation on each disequality/equality should suffice once. It adds relevant inequalities to ensure the arithmetic solver is coherent about disequalities.
2022-09-18 17:23:00 -07:00
Nikolaj Bjorner d479bd9c53 formatting 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner c11bd79484 add assertions 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner 9a987237d5 don't rename uint_set but keep the original name 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner 55d5af00cc disable bv delay until it is debugged #6324
regression introduced when filter for when to apply delay was fixed, but then it exercises delay tactic that isn't tested.
2022-09-07 00:04:57 -07:00
Nikolaj Bjorner fcc6e6c899 doc bug 2022-09-05 03:17:13 -07:00
Nikolaj Bjorner 8dc8de8ccd lazy multiplier experiment
this update provides a use case for and allows testing incremental multiplier compilation.
2022-09-05 03:09:18 -07:00
Nikolaj Bjorner b49ffb8a87 indentation 2022-09-04 16:23:11 -07:00
Nikolaj Bjorner 60967efd38 fix wrong condition for delayed bit-blasting 2022-09-02 18:39:21 -07:00
Nikolaj Bjorner 7e1e64d027 fix #6313
remaining new issues
2022-09-02 17:48:00 -07:00
Nikolaj Bjorner e4ef1717e3 fix variable tracking bug in explanations with literals 2022-09-01 23:26:38 -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 d3e6ba9f98 remove union
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-31 19:09:13 -07:00
Nikolaj Bjorner 3011b34b3b log E-matching based quantifier instantiations as hints 2022-08-31 18:59:02 -07:00
Nikolaj Bjorner 6077c4154a #6116 bv2int bug fix 2022-08-31 17:31:54 -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 dd90689339 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:54:36 -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 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 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 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 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 bb5d81195c use equalities 2022-08-19 18:17:16 -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 b169292743 add parameter descriptions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 08:26:53 -07:00
Nikolaj Bjorner f989521a8c add initial skeleton for xor-solver 2022-08-12 11:54:10 -04:00
Nikolaj Bjorner 49064252ac fix issues for user-propagator from new core 2022-08-09 14:56:27 +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
Bruce Mitchener 5014b1a34d Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
Bruce Mitchener 77e5d6ab19 Use nullptr consistently instead of 0 or NULL. 2022-08-01 14:24:32 +03:00
Bruce Mitchener 5d0dea05aa
Remove empty leaf destructors. (#6211) 2022-07-30 10:07:03 +01:00
Bruce Mitchener 1eb84fe4b9
Mark override methods appropriately. (#6207) 2022-07-29 23:29:15 +02:00
Nikolaj Bjorner 43f2b848d4 fix typo
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-25 03:44:12 +02:00
Nikolaj Bjorner 5c2c0ae900 force-push on new_eq, new_diseq in user propagator, other fixes to Python bindings for user propagator
This update allows the python bindings for user-propagator to handle functions that are declared to be registered with the user propagator plugin. It fixes a bug in UserPropagateBase.add to allow registering terms dynamically during search.
It also fixes a bug in theory_user_propagate as scopes were not fully pushed when the solver gets the callbacks for new equalities and new disequalities.
It also adds equality and disequality interfaces to the sat/smt solver version (which isn't being exercised in earnest yet)
2022-07-25 03:42:29 +02:00
Bruce Mitchener 3e38bbb009
Make sure all headers do #pragma once. (#6188) 2022-07-23 10:41:14 -07:00
Nikolaj Bjorner efa74fe6c6 fix #6180
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-21 12:20:36 -07:00