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

116 commits

Author SHA1 Message Date
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
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
fcdf220559 parameters
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-28 18:21:04 -07:00
Nikolaj Bjorner
e4f57a13ba add hook to turn on xor solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-28 16:33:30 -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
ce1f3987d9 fix unsoundness in quantifier propagation #6116 and add initial lemma logging 2022-08-23 19:10:01 -07:00
Nikolaj Bjorner
97437bce4c Update sat_params.pyg 2022-06-09 10:09:30 -07:00
Nikolaj Bjorner
828850f298 prepare for trim 2022-06-09 10:08:57 -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
c21a2fcf9f sat solver setup
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-26 09:40:42 -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
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
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
a337a51374 fixes for #2513
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-08-23 23:29:24 +03:00
Bruce Mitchener
e2122c0d3d Fix whitespace issues in *.pyg. 2019-08-15 10:19:33 -07: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
a9a26e5f2e review comments by Elffers
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-21 06:52:02 -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
4c76d43670 add binary_merge encoding option
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-28 08:35:22 -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
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
Bruce Mitchener
5bd93b8a77 Typo fixes. 2018-10-12 23:38:53 +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
9a09689dfa add documentation on the cuber
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-22 19:19:05 -07:00
Nikolaj Bjorner
9ad17296c2 update parameters
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-03 17:22:48 -07:00
Nikolaj Bjorner
c8730daea7 fix memory leak, add strengthening
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-09-03 16:56:07 -07:00
Nikolaj Bjorner
e4ae80b3f2 update documentation for renamed parameter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-07-06 21:25:38 -07:00
Nikolaj Bjorner
3ae0ea8246 add circuit and unate encoding besides sorting option
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-07-06 21:09:13 -07:00
Nikolaj Bjorner
2aedaf315a fix removal bug, tune all-interval usage
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-05-09 16:32:38 +01:00
Nikolaj Bjorner
13b54f379c fix ema
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-05-05 13:58:47 +02:00
Nikolaj Bjorner
e940f53e9c n/a
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-30 07:57:33 -07:00
Nikolaj Bjorner
563f337997 testing memory defragmentation, prefetch, delay ate
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-27 17:59:03 +02:00