3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-19 09:40:20 +00:00
Commit graph

122 commits

Author SHA1 Message Date
Nikolaj Bjorner
08a925323c Merge branch 'master' of https://github.com/z3prover/z3 into xor 2022-11-10 10:42:38 -08:00
Clemens Eisenhofer
002d166f72
Xor (#6448)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int

* Fixed missing assignment for binary clauses

* 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

* Update (not compiling yet)

* #6429

* 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.

* Update: Missing data-structures (still not compiling)

* Nearly compiling

* Some missing arguments

* Polishing

* Only conflicts/propagations/justifications are missing for making it compile

* Added propagation (justifications for them are still missing)

* Use the right deallocation

* Use Z3's memory allocation system

* Ported "seen"

* Polishing

* Added 64-bit "1" counting

* More polishing

* minor fixes

- ensure mk_extract performs simplification to distribute over extract and removing extract if the range is the entire bit-vector
- ensure bool_rewriter simplifeis disjunctions when applicable.

* adding simplifiers layer

simplifiers layer is a common substrate for global non-incremental and incremental processing.
The first two layers are new, but others are to be ported form tactics.

- bv::slice - rewrites equations to cut-dice-slice bit-vector extractions until they align. It creates opportunities for rewriting portions of bit-vectors to common sub-expressions, including values.
- euf::completion - generalizes the KB simplifcation from asserted formulas to use the E-graph to establish a global and order-independent canonization.

The interface dependent_expr_simplifier is amenable to forming tactics. Plugins for asserted-formulas is also possible but not yet realized.

* Create bv_slice_tactic.cpp

missing file

* adding virtual destructor

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

* Added 64-bit "1" counting (#6434)

* 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 64-bit "1" counting

* remove incorrect assertion

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

* 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

* init solve_eqs

* working on solve_eqs

* Update .gitignore

* wip - converting the equation solver as a simplifier

* make visited_helper independent of literals

re-introduce shorthands in sat::solver for visited and have them convert literals to unsigned.

* build fix

* move model and proof converters to self-contained module

* Create solve_eqs2_tactic.h

* add converters module to python build

* move tactic_params to params

* move more converters

* move horn_subsume_model_converter to ast/converters

* add initial stubs for model reconstruction trail

* fixing build

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

* fixes #6439 #6436

* It's compiling (However, two important functions are commented out)

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-10 09:05:17 -08:00
Nikolaj Bjorner
10fb71cf93 better error description for configuring restart 2022-11-08 12:18:45 -08:00
Nikolaj Bjorner
6616a75283 porting more
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-28 20:06:28 -07:00
Nikolaj Bjorner
d08e61219b porting more
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-28 19:52:37 -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
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
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
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
ce1f3987d9 fix unsoundness in quantifier propagation #6116 and add initial lemma logging 2022-08-23 19:10:01 -07:00
Nikolaj Bjorner
828850f298 prepare for trim 2022-06-09 10:08:57 -07:00
Nikolaj Bjorner
4455f6caf8 move to get_sort as method, add opt_lns pass, disable xor simplification unless configured, fix perf bug in model converter update trail 2021-02-02 03:58:19 -08:00
Nikolaj Bjorner
a764d528a1 'clean
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-10-30 13:14:48 -07:00
Nikolaj Bjorner
ed7d969366 elaborate on smt/drat format outline, expose euf mode as config
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-31 19:29:23 -07:00
Nikolaj Bjorner
c41abf2241 fix #4624 #4633 #4632 #4631
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-13 08:36:16 -07:00
Jack Yao
55cd1e996c
add sat option for doing a global simplification before the bounded search and the main CDCL search loop. The option is also used for the sat-preprocess tacitc (#4514)
Co-authored-by: rainoftime <rainoftime@gmail.com>
2020-06-12 16:45:50 -07:00
Nikolaj Bjorner
95a78b2450
updates to seq and bug fixes (#4056)
* na

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

* fix #4037

* nicer output for skolem functions

* more overhaul of seq, some bug fixes

* na

* added offset_eq file

* na

* fix #4044

* fix #4040

* fix #4045

* updated ignore

* new rewrites for indexof based on #4036

* add shortcuts

* updated ne solver for seq, fix #4025

* use pair vectors for equalities that are reduced by seq_rewriter

* use erase_and_swap

* remove unit-walk

* na

* add check for #3200

* nits

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

* name a type

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

* remove fp check

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

* remove unsound axiom instantiation for non-contains

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

* fix rewrites

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

* fix #4053

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

* fix #4052

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-22 13:18:55 -07:00
Nikolaj Bjorner
b4e7730034 fix #3938
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-13 13:05:53 -07:00
Nikolaj Bjorner
9b609af8fc fix #3924
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-12 16:19:54 -07:00
Nikolaj Bjorner
c85113acdb fix #3928
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-12 15:25:08 -07:00
Nikolaj Bjorner
24dd047892 fix #3397, use it or lose it
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-18 11:06:19 -07:00
Nikolaj Bjorner
fcbf660592 fix #3133
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-03 19:29:15 -08:00
Nikolaj Bjorner
05158b3914 add cut redundancies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-03-01 12:49:59 -08:00
Nikolaj Bjorner
e8f7a08289 add stubs for npn3
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-27 21:19:40 -08:00
Nikolaj Bjorner
dddd740846 make aig/ite extraction conditional
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-25 16:27:13 -08:00
Nikolaj Bjorner
c71da17a10 add output for inprocessing
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-22 11:50:51 -08:00
Nikolaj Bjorner
d1e95a133b add simplifiation pass
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-22 11:21:53 -08:00
Nikolaj Bjorner
dd3e77107e rename aig_simplifier to cut_simplifier
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-18 18:29:59 -08:00
Nikolaj Bjorner
c46e36ce58 bug fixes to LUT extraction, bug fix for real value case of freedom intervals
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-11 14:25:25 -08:00
Nikolaj Bjorner
e1fb74edc5 add ite-finder, profile
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-05 16:46:50 -08:00
Nikolaj Bjorner
d27a949ae9 add anf and aig simplifier modules, cut-set enumeration, aig_finder, hoist out xor_finder from ba_solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-05 16:46:49 -08:00
Nikolaj Bjorner
40a4326ad4 add anf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-05 16:46:49 -08:00
Nikolaj Bjorner
5dfe4a4b48 ensure relevancy isn't increased between calls
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-11-23 15:42:44 -08:00
Nikolaj Bjorner
a337a51374 fixes for #2513
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-08-23 23:29:24 +03:00
Nikolaj Bjorner
364fbda925 expose reorder config
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-22 15:30:06 -07:00
Nikolaj Bjorner
cd93cdd819 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-09 07:40:29 +01:00
Nikolaj Bjorner
d17248821a include chronological backtracking, two-phase sat, xor inprocessing, probsat, ddfw
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-13 08:45:21 -07:00
Nikolaj Bjorner
a2dddbd7a5 check pb solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-28 14:28:03 -08:00
Nikolaj Bjorner
69d7d8ff87 local
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-28 11:42:17 -08:00
Nikolaj Bjorner
5cdfa7cd1c variations on unit-walk
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-13 17:43:15 -08:00
Nikolaj Bjorner
24dfdfe9bc disable fixes for #2128 and related as it breaks model evaluation time in regressions, set longer delay for inprocessing in sat solver, report stats
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-09 16:06:02 -08:00
Nikolaj Bjorner
08ce6f7ac1 working on binary drat format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-01-30 08:54:59 -08:00
Nikolaj Bjorner
dc77579707 delta faction to control double lookahead eagerness
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-12-04 23:41:03 -08:00
Nikolaj Bjorner
719bc5cd5d merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-10-30 17:23:31 -05:00
Nikolaj Bjorner
3c1c3d5987 fix #1908
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-10-30 14:15:29 -05:00
Nikolaj Bjorner
e9d615e309 merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-10-14 15:16:22 -07:00
Nikolaj Bjorner
f5fea8ae30 add parameter to force sat-cleaning on initialization and on simplification phases
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-10-11 22:05:04 -07:00
Nikolaj Bjorner
f53b7aaca2 fix none-case
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-04 15:46:10 -07:00
Nikolaj Bjorner
9ad17296c2 update parameters
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-03 17:22:48 -07:00