3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-18 14:49:01 +00:00
Commit graph

3142 commits

Author SHA1 Message Date
Nikolaj Bjorner 479f844200 fix #6661
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-02 11:14:20 -07:00
Nikolaj Bjorner def83ed26e fix #6661
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-02 11:13:37 -07:00
Hari Govind V K 6324db207b
Only print func-decl names for indexed parameters (#6663) 2023-04-02 10:39:13 -07:00
Nikolaj Bjorner 7664429fda remove cast expression
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-03-31 12:51:23 -07:00
Nikolaj Bjorner a62e4b2893 extract multi-patterns when pattern can be decomposed
deals with fluke regression for F* reported by Guido Martinez

Background:
The automatic pattern inference facility looks for terms that contains all bound variables of a quantifier. It may end up with a term that contains all bound variables but the extracted term can be simplified.

Example. The pattern

(ApplyTT (ApplyTT @x3!1 (ApplyTT @x4!0 (:var 1))) (ApplyTT @x4!0 (:var 0)))
can be decomposed into a multi-pattern
(ApplyTT @x4!0 (:var 1))) (ApplyTT @x4!0 (:var 0))
The multi-pattern may enable a quantifier instantiation while the original pattern does not. The multi-pattern should be preferred.

The regression showed up based on a change that should not be considered harmful but turned out to be noticeable.
The change was a simplification of and-or expressions based on sorting. This played with the case split queue used by F* (smt.case_split = 3) that uses a top-level case split of clauses to avoid redundant branches. The net effect was that without sorting, the benchmarks would always choose the opportune branch that enabled matching against the larger term. With sorting it would mostly choose inopportune branches.
2023-03-31 12:45:51 -07:00
Nikolaj Bjorner a849a29b4f fix #6659 2023-03-31 10:31:18 -07:00
Nikolaj Bjorner 53ca65a62e fix unsound rewrite 2023-03-20 18:55:40 +01:00
Nikolaj Bjorner f075dc2882 remove experimental files 2023-03-20 17:07:48 +01:00
Nikolaj Bjorner 48de7c2da8 missing updates 2023-03-20 17:07:04 +01:00
Nikolaj Bjorner c6e3fb446a print lemmas2console faster
- add option pp.no_lets (default = false) to print formulas without let (used by the low-level SMT2 printer).
- print lemmas2console faster by using the low level printer
2023-03-20 17:07:04 +01:00
Nikolaj Bjorner d1c7ff1a36 add unconstrained elimination for sequences 2023-03-20 17:07:04 +01:00
Nikolaj Bjorner 42076a3c13 bug fixes to new core, elim_predicates and elim_unconstrained 2023-03-05 22:26:37 -08:00
Nuno Lopes b9a87e493b minor code simplifications 2023-03-05 19:08:41 +00:00
Nikolaj Bjorner b82d177276 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-03-03 11:26:13 -08:00
Nikolaj Bjorner aa75ba8a6b remove parenthesis 2023-03-01 21:03:41 -08:00
Nikolaj Bjorner 94b79eefea add back max_occs parameter dependency to solve-eqs 2023-03-01 20:40:22 -08:00
Nikolaj Bjorner acd2eaa390 add (disabled) code path to enable nested conjunctions
for experiments with disabling flat-and-or dependency
2023-03-01 20:39:39 -08:00
Nikolaj Bjorner 46d37b6e30 fix #6615
make rewriting exception safe (for cancelation).
The state during restart in smt_context is not exception safe.
2023-03-01 17:30:07 -08:00
Nikolaj Bjorner 027770930e fix bug in quasi macro identification: require quantifiers 2023-03-01 17:03:15 -08:00
Nikolaj Bjorner 755b517001 fix #6600
ensure that semantics of last-indexof(t,"") = len(t)
2023-02-19 14:02:37 -08:00
Nikolaj Bjorner 6454e7fa3f apply rewriting if result of destructive equality resolution is simplified 2023-02-19 11:03:04 -08:00
Nikolaj Bjorner cb81473260 add destructive equality resolution to the main simplifier. 2023-02-18 17:54:26 -08:00
Nikolaj Bjorner c0f80f92ba deal with compiler warnings (unused variables etc) 2023-02-18 17:53:37 -08:00
Nikolaj Bjorner f66a082de9 fix #6595 2023-02-18 14:11:48 -08:00
Ding Fei 828ff98c77
fix tpl instantiation issue for mingw (#6597) 2023-02-17 09:26:45 -08:00
Nikolaj Bjorner ac068888e7 add trichotomy for sequence comparison. #6586 2023-02-16 08:59:55 -08:00
Nikolaj Bjorner c2fe76569f remove dependency on bool-rewriter in hoist rewriter
deal with regression reported in
cac5052685 (commitcomment-100606067)
and unit tests doc.cpp
2023-02-14 17:48:02 -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 cac5052685 fixes related to #6577
- enforce elim-and in bool-rewriter when invoking hoisting.
- make cnf tactic more resilient to non-normalized input.
- enable eliminate predicates on ground formulas
2023-02-12 13:43:44 -08:00
Nikolaj Bjorner 46c8d78ece fixes for #6577
- the literal false should not appear in clauses
- the literal true forces a tautology
- fix early return in is_cnf check. It should check all clauses for nested Booleans.
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 02d48adae5 fix #6573 2023-02-08 08:24:52 -08:00
Nikolaj Bjorner 0d05104d8c remove unused field
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-02 19:33:23 -08:00
Nikolaj Bjorner 2e068e3f56 add simplifiers to .net API 2023-02-02 17:41:00 -08:00
Nikolaj Bjorner 30fa37e393 fix warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-01 10:31:34 -08:00
Nikolaj Bjorner 38d526ee45 fix warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-01 10:18:14 -08:00
Nikolaj Bjorner ebc2cd572b fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-31 14:53:04 -08:00
Nikolaj Bjorner 88bf3c6e51 check if trail is empty to avoid collecting variables 2023-01-31 13:35:43 -08:00
Nikolaj Bjorner 8495be11f9 add shortcut filter to avoid traversing model reconstruction trail if there are no intersections with model 2023-01-31 13:34:52 -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 4ffe3fab05 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-28 21:51:51 -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 91d6082f2f Move modular interval to interval directory 2023-01-27 17:55:36 -08:00
Nikolaj Bjorner 0f3c56213e move dominator simplifier functionality to rewriter and simplifier, move bv_bounds simplifier functionality to simplifier 2023-01-27 17:11:48 -08:00
Nikolaj Bjorner d4ca7e5374 #6555 2023-01-26 21:39:52 -08:00
Nikolaj Bjorner 9e2ec9d018 add stubs for proof production in elim_unconstrained 2023-01-25 13:32:51 -08:00
Nikolaj Bjorner b3de7ac595 remove passing proof parameter to expr-inverter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-25 11:15:09 -08:00
Nikolaj Bjorner f100d2f4de add contextual simplification to bv-bounds-tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 17:49:55 -08:00
Nikolaj Bjorner eac7d7576f force to_fp to disambiguate +zero and -zero, #6548, filter unsupported on relevancy
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 12:29:42 -08:00
Nikolaj Bjorner 47c7ed3b17 update ml example to 64 bit
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 04:33:52 -08:00
Nikolaj Bjorner 15d853dc04 add trail to avoid stale references in expr2var 2023-01-24 04:15:52 -08:00
Nikolaj Bjorner 4601d1d664 fix #6550
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 03:37:09 -08:00
Nikolaj Bjorner 3032c9315d handle to-real in variable mapping
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-23 14:31:24 -08:00
Nikolaj Bjorner d9f9cceea4 use intervals for tracking bounds on arithmetic variables
leverage interval propagation for bounds.
merge functionality with propagate-ineqs tactic
remove the new propagate-bounds tactic and instead use propagate-ineqs
2023-01-23 14:13:03 -08:00
Nikolaj Bjorner eb751bec4c fix riscv/aarch/powerpc build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-22 23:57:59 -08:00
Nikolaj Bjorner 3b5ae285d9 add outline for interval reasoning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-22 23:28:36 -08:00
Nikolaj Bjorner db79346ef7 Add new tactic bound-simplifier for integer-based bit-vector reasoning. 2023-01-22 22:07:28 -08:00
Nikolaj Bjorner 021ef699af detect bounds from mod 2023-01-22 14:40:19 -08:00
Nikolaj Bjorner 0f4f32c5d0 apply relevancy filtering on unsupported ops, fix term construction bug in bv2fpa_converter fix #6548 2023-01-20 13:05:01 -08:00
Nikolaj Bjorner f3d6856736 remove msf example, add option to make model converter not reduce models
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-19 20:24:31 -08:00
Nikolaj Bjorner 9290de8223 make euf-egraph resilient to when there are no consumers to literal propagation.
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-18 07:57:19 -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
Nikolaj Bjorner f1805138e7 missing code signing
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-13 16:13:20 -08:00
Nikolaj Bjorner 60fef928cc missing code signing
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-13 16:12:48 -08:00
Nikolaj Bjorner 25b0b1430c move bound_manager to simplifiers, add bound manager to extract_eqs for solve-eqs #6532 2023-01-12 12:42:28 -08:00
Nikolaj Bjorner d415f07386 memory leak on proof justifications
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-10 18:58:25 -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 64ec8acd30 fix model reconstruction ordering for elim_unconstrained 2023-01-09 15:18:19 -08:00
Nikolaj Bjorner 30e0f78c16 remove exit
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-09 10:00:36 -08:00
Nikolaj Bjorner 49ee570b09 split into separate function
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 19:16:46 -08:00
Nuno Lopes 5899fe3cea
Add rewrite for array selects of chain of stores of a same value (#6526)
* Add rewrite for array selects of chain of stores of a same value

Example:
```smt
(declare-fun mem () (Array (_ BitVec 4) (_ BitVec 4)))
(declare-const x (_ BitVec 4))
(declare-const y (_ BitVec 4))
; simplifies to #x1
(simplify (select (store (store (store mem #x1 #x1) y #x1) x #x1) #x1))
```

* Update array_rewriter.cpp

* Update array_rewriter.cpp
2023-01-08 19:09:01 -08:00
Nikolaj Bjorner 61b90e64b2 disable new simplifcation for multiplier until really understood
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 14:17:49 -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 95cb06d8cf add quasi macro detection 2023-01-06 19:53:55 -08:00
Nikolaj Bjorner 25112e47b4 bugfix to flatten-clases simplifier
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-05 20:59:28 -08:00
Nikolaj Bjorner 21362c0b98 make case-def and recfun-num-rounds re-parsable for logging 2023-01-04 15:00:25 -08:00
Nikolaj Bjorner 8d0d6d8f04 Merge branch 'master' of https://github.com/z3prover/z3 2023-01-04 11:56: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
Nuno Lopes e448191212 array rewriter: expand select of store with const array into an ite
This:
(simplify (select (store ((as const (Array (_ BitVec 4) (_ BitVec 4))) #x0) x #x1) y))
=>
(ite (= x y) #x1 #x0)
2023-01-03 11:08:57 +00:00
Nuno Lopes e508ef17f6 fix Alive bug #875: bit blaster not respecting soft memory limit 2023-01-03 10:39:28 +00: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 2c3ecceb03 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-30 15:47:24 -08:00
Nikolaj Bjorner 293627c889 fix #6513
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-30 09:55:33 -08:00
Nikolaj Bjorner 07ab4d38b6 fix #6513
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-30 09:55:10 -08:00
Nikolaj Bjorner b9c4f5d4fa #6506
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-25 18:33:01 -08:00
Nikolaj Bjorner fe8034731d fix #6501 2022-12-19 21:02:55 -08:00
Nikolaj Bjorner ecf25a4fe2 outline scheme
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-15 14:57:52 -08:00
Nikolaj Bjorner 2d7a38e95e fix #6488
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-13 16:07:41 -08:00
Nikolaj Bjorner aded8e5bf4 fix #6488
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-12 11:40:59 -08:00
Nikolaj Bjorner 4598af70c8 fix #6488
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-12 11:04:46 -08:00
Nikolaj Bjorner a3e6885680 fix #6488 2022-12-12 09:50:44 -08:00
Nikolaj Bjorner 039de6a2c8 build issues
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-11 15:05:13 -08:00
Nuno Lopes cb8603177e fix build 2022-12-11 22:17:11 +00:00
Nuno Lopes d308b8f555 simplify code + remove unused file 2022-12-11 22:11:19 +00:00
Nikolaj Bjorner 2520dcb04b merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-11 14:03:22 -08:00
Nuno Lopes 2d43ccc4c6 Revert "fix crashes in elim-uncnstr2"
This reverts commit a302c2f15e.
2022-12-11 21:37:25 +00:00
Nikolaj Bjorner 6a1b3f7344 move debug output to before state update 2022-12-11 12:51:46 -08:00
Nikolaj Bjorner f7269bb60a update doc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-11 10:16:17 -08:00
Nikolaj Bjorner a9f52b0069 doc fixes 2022-12-11 10:04:01 -08:00
Nikolaj Bjorner 527fb18366 add doc for card2bv 2022-12-11 09:51:49 -08:00
Nuno Lopes a302c2f15e fix crashes in elim-uncnstr2
This would crash before:
(declare-fun x () (_ BitVec 4))
(assert (not (bvule x #x1)))
(apply elim-uncnstr2)

That's because the index_set iterator was querying qtail to compute the end of the iteration
But the problem is that elim-uncnstr2 may add new fmls to the goal, as in this case.
The bvule is replaced with an 'or', but since it's negated, it turns into 2 goals
Solve the issue by freezing the qtail for the iteration loop.
This is the right behavior for elim-uncnstr2, as it can't rewrite exprs that haven't been analyzed before

@NikolajBjorner please check if this the right behavior for the other simplifiers. Thank you
2022-12-11 15:21:23 +00:00
Nuno Lopes c6f9c09d70 cleanup more in dependent_expr_state_tactic to reduce mem consumption 2022-12-09 11:34:53 +00:00
Nikolaj Bjorner 7e69dab8f6 distribute forall cpp code 2022-12-06 18:15:18 -08:00
Nikolaj Bjorner c33e58ee1a update distribute forall
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-12-06 17:59:33 -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 5a5758baaa add documentation to initial selection of tactics 2022-12-05 20:05:06 -08:00
Nuno Lopes eb8c53c164 simplify factory of dependent_expr_state_tactic
And as a side-effect, remove heap allocations for factories
2022-12-05 14:07:57 +00:00
Nikolaj Bjorner de916f50d6 add demodulator tactic based on demodulator-simplifier
- some handling for commutative operators
- fix bug in demodulator_index where fwd and bwd are swapped
2022-12-05 03:20:46 -08:00
Nikolaj Bjorner 87095950cb fix #6477 2022-12-04 13:02:45 -08:00
Nikolaj Bjorner ead2a46a88 build 2022-12-04 10:38:24 -08:00
Nikolaj Bjorner b76ed6a47f proper fix to #6476 2022-12-04 10:19:39 -08:00
Nikolaj Bjorner 9b58135876 try to fix linux builds 2022-12-04 09:55:31 -08:00
Nikolaj Bjorner 0f7bebcbed try big M for linux build 2022-12-04 09:49:32 -08:00
Nikolaj Bjorner 1974c224ab add demodulator simplifier
refactor demodulator-rewriter a bit to separate reusable features.
2022-12-04 09:39:28 -08:00
Nikolaj Bjorner 9acbfa3923 move it into substitution to handle dependencies 2022-12-04 06:23:32 -08:00
Nikolaj Bjorner 3d7bd40a87 a round of cleanup 2022-12-04 06:07:45 -08:00
Nikolaj Bjorner d218083145 The demodulator doesn't produce proofs so remove code path that depends it does. 2022-12-04 04:48:48 -08:00
Nikolaj Bjorner 7fe6787748 ufbv-rewriter is really a demodulator rewriter and does not reference ufbv
so moving first the rewriter into place of other rewriters
2022-12-04 04:44:02 -08:00
Nikolaj Bjorner 79e6d4e32d tune and debug elim-unconstrained (v2 - for simplifiers infrastructure) 2022-12-04 03:53:31 -08:00
Nikolaj Bjorner 3ebbb8472a fix perf bugs in new value propagation 2022-12-04 03:53:30 -08:00
Nikolaj Bjorner 758c3b2c3b fix filtering for recursive functions 2022-12-04 03:53:30 -08:00
Nikolaj Bjorner cf7bba6288 use ast_manager as an attribute 2022-12-04 03:53:30 -08:00
Nikolaj Bjorner 5073959ae0 add macro attribute 2022-12-04 03:53:29 -08:00
Nikolaj Bjorner a96b7d243a remove incorrect check for quantifier 2022-12-01 00:04:08 -08:00
Nikolaj Bjorner e5984dd397 add cnf/nnf simplifier 2022-11-30 23:04:38 -08:00
Nikolaj Bjorner e3e2c21632 Create cnf_nnf.h 2022-11-30 22:53:14 -08:00
Nikolaj Bjorner 529f116be0 disable new code until pre-condition gets fixed
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-30 22:29:59 -08: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 edb0fc394b rewrite some simplifiers 2022-11-30 23:15:32 +09:00
Nikolaj Bjorner 23c53c6820 fix build 2022-11-30 19:36:13 +09:00
Nikolaj Bjorner c1ff3d3192 wip - adding quasi macro detection 2022-11-30 13:46:00 +07: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 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 6454014119 enable incrementality for model reconstruction 2022-11-25 15:28:38 +07:00
Nikolaj Bjorner 4e9f21c2a1 add rewriter and seq simplifiers 2022-11-25 15:16:14 +07:00
Nikolaj Bjorner a152f9cfd6 port bit-blaster to simplifiers
inc_sat_solver uses bit-blaster, card2bv and max_bv_sharing.
By turning these into simplifiers it will be possible to remove
dependencies on tactics and goals in inc_sat_simplifier and instead use a modular and general incremental pre-processing infrastructure.
2022-11-25 13:37:16 +07:00
Nikolaj Bjorner f0570fbc0e remove tactic exception dependency 2022-11-25 11:48:44 +07:00
Nikolaj Bjorner e95b0bd2cd remove include of tactical 2022-11-25 11:47:38 +07:00
Nikolaj Bjorner 8184e7fe0a keep track of qhead 2022-11-25 11:42:16 +07:00
Nikolaj Bjorner 5af6e1a046 make max_bv_sharing a simplifier 2022-11-25 11:38:41 +07:00
Nikolaj Bjorner db74e23de1 make card2bv a simplifier 2022-11-25 11:07:31 +07:00
Nikolaj Bjorner cb789f6ca8 add arithmetical macros
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-24 23:44:35 +07:00
Nikolaj Bjorner eb812e47be cleanup 2022-11-24 22:46:35 +07:00
Nikolaj Bjorner a64c7c5d19 add incremental version of value propagate 2022-11-24 21:52:55 +07:00
Nikolaj Bjorner decb3d3907 stashed header file 2022-11-24 19:51:26 +07:00
Nikolaj Bjorner 3479129582 remove unused structs 2022-11-24 19:47:26 +07:00
Nikolaj Bjorner caf204ab95 hoist macro-replacer as shared utility, update eliminate-predicates and model reconstruction 2022-11-24 19:45:51 +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 eceeb295fc fix #6457 2022-11-24 14:41:50 +07:00
Nikolaj Bjorner f87e187b62 #6429 2022-11-23 17:52:14 +07:00
Nikolaj Bjorner 9a2693bb72 tune euf-completion 2022-11-23 16:39:20 +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 cd0d52acec using C++11 features to simplify for-loops 2022-11-23 11:37:23 +07:00
Nuno Lopes 477b90228e fix #6460: crash in mk_to_ieee_bv_i 2022-11-20 19:19:12 +00:00
Nuno Lopes 0445d6f264 FPA->BV fix unused vars 2022-11-20 19:03:32 +00:00
Nikolaj Bjorner b9f34286a7 generalize macro head detection and elaboration 2022-11-20 11:36:45 +07:00
Nikolaj Bjorner 86f3702403 prevent re-declaration of enumeration sort names
preventing redeclaration of all ADT cases is not part of this update.
2022-11-19 19:46:34 +07:00
Nikolaj Bjorner c3c45f495a add some comments to elim_predicates 2022-11-19 19:45:25 +07:00
Nikolaj Bjorner 251d49d133 remove outdated comment 2022-11-19 18:55:30 +07:00
Nikolaj Bjorner 3f10933225 remove VERBOSE 0 2022-11-19 18:55:01 +07:00
Nikolaj Bjorner 771157696b new simplifier/tactic
eliminate_predicates finds macros and eliminates predicates from formulas as pre-processing.
2022-11-19 18:51:20 +07:00
Nikolaj Bjorner d735faae4e add isolated hide/add model converter functions 2022-11-19 18:50:37 +07:00
Nikolaj Bjorner a81a5ec68c add virtual function requirement to dependent_expr_state 2022-11-19 18:46:31 +07:00
Nikolaj Bjorner dcc995f0e5 code simplification 2022-11-19 18:45:54 +07:00
Nikolaj Bjorner 41b40c3a51 remove dead code 2022-11-19 18:45:07 +07:00
Nikolaj Bjorner c2e9016d04 display model-add parameters in correct order 2022-11-19 18:44:52 +07:00
Nikolaj Bjorner ba68652c72 add destructive equality resolution to existentials 2022-11-19 18:43:46 +07:00
Nikolaj Bjorner 7da91f4313 allow printing declarations with reverse variable order 2022-11-19 18:43:21 +07:00
Nikolaj Bjorner 59b7845c7d reset visited (fast mark) to not clash with occurs 2022-11-17 17:36:21 +09:00
Nikolaj Bjorner 6662afdd26 perf improvements to solve-eqs and euf-completion 2022-11-16 22:15:02 -08:00
Nikolaj Bjorner 2c7799939e wip - tuning and fixes to euf-completion 2022-11-16 03:47:38 -08:00
Nikolaj Bjorner 98fc8c99db add shortcut to equality mk utility 2022-11-16 03:47:01 -08:00
Nikolaj Bjorner 55ab7778f4 fix perf bug in new solve_eqs. 2022-11-16 03:46:17 -08:00
Nikolaj Bjorner d70dbdad50 wip euf-completion - debugging 2022-11-15 20:17:39 -08:00
Nikolaj Bjorner 255414f4a9 fix regression crash
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-15 11:20:12 -08:00
Nikolaj Bjorner 9845c33236 add shortcuts in rewriter, eliminate redundancies in dependent_expr tactic 2022-11-15 09:13:13 -08:00
Nikolaj Bjorner 48c0f8694f euf-completion bug fix, streamline name to solve_eqs 2022-11-14 20:01:00 -08:00
Nikolaj Bjorner 3eeb59db34 fix #6451 missing occurrence marking when there is an unsafe equality already
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-14 19:23:27 -08:00
Nikolaj Bjorner 95e07ffe8e disable unsound context equality solving
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-14 19:14:51 -08:00
Nikolaj Bjorner 6297c001ee remove legacy solve_eqs_tactic entirely
also, bug fixes to elim_unconstrained (elim_uncnstr2) which is to replace legacy tactic for eliminating unconstrained constants.
2022-11-14 18:57:16 -08:00
Nikolaj Bjorner 3d2bf13577 streamline statistics, fix bug in updating goals 2022-11-13 20:30:00 -08:00
Nikolaj Bjorner ce6cfeaa68 fix bug in euf-completion relating to missed normalization 2022-11-13 18:01:17 -08:00
Nikolaj Bjorner 3fa81d6527 bug fixes to elim-uncnstr2 tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-13 13:25:19 -08:00
Nikolaj Bjorner 38cde14e08 wip missing updates 2022-11-13 12:10:43 -08:00
Nikolaj Bjorner 196788a091 bug fix for equality solving 2022-11-13 12:09:56 -08:00
Nikolaj Bjorner ce76e3138d streamlining expr-inverter code 2022-11-13 11:48:32 -08:00
Nikolaj Bjorner 3d570aaa0a add missing process_eq
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-12 18:43:57 -08:00
Nikolaj Bjorner 0b83732b82 missing override specifier 2022-11-12 18:35:41 -08:00
Nikolaj Bjorner 343603f643 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-12 18:34:04 -08:00
Nikolaj Bjorner 9d09064ad0 add comments to elim_unconstrained and remove unused function 2022-11-12 18:01:38 -08:00
Nikolaj Bjorner efbe0a6554 wip - updated version of elim_uncstr_tactic
- remove reduce_invertible. It is subsumed by reduce_uncstr(2)
- introduce a simplifier for reduce_unconstrained. It uses reference counting to deal with inefficiency bug of legacy reduce_uncstr. It decomposes theory plugins into expr_inverter.

reduce_invertible is a tactic used in most built-in scenarios. It is useful for removing subterms that can be eliminated using "cheap" quantifier elimination. Specifically variables that occur only once can be removed in many cases by computing an expression that represents the effect computing a value for the eliminated occurrence.

The theory plugins for variable elimination are very partial and should be augmented by extensions, esp. for the case of bit-vectors where the invertibility conditions are thoroughly documented by Niemetz and Preiner.
2022-11-12 17:56:45 -08:00
Nikolaj Bjorner 3faca52c40 re-enable new solve_eqs with bug fixes 2022-11-08 14:17:17 -08:00
Nikolaj Bjorner 3a37cfca30 switch to solve_eqs2 tactic 2022-11-08 12:23:36 -08:00
Nikolaj Bjorner f769e2f1f6 have bool rewriter use flat_and_or, and integrate hoist rewriter 2022-11-08 12:21:50 -08:00
Nikolaj Bjorner 238ea0a264 add shorthands for concatentation 2022-11-08 12:21:25 -08:00
Nikolaj Bjorner 3a4b8e2334 add rewrite rules to bv-rewriter 2022-11-08 12:20:51 -08:00
Nikolaj Bjorner a34701471f clean up hoist rewriter 2022-11-08 12:20:25 -08:00
Nikolaj Bjorner cbc5b1f4f6 have theory_recfun use recursive function discriminator to control when it is enabled 2022-11-06 12:09:45 -08:00
Nikolaj Bjorner 8ff1e44a95 add discriminator to whether context contains recursive functions to avoid enabling recursive function solver when there are just macros 2022-11-06 11:58:21 -08:00
Nikolaj Bjorner a4c2a2b22c use ast_util::mk_not to avoid redundant double negations during nff 2022-11-06 11:57:46 -08:00
Nikolaj Bjorner 78f9e6b31a extend error type message with more information - display the arguments that are passed 2022-11-06 11:57:21 -08:00
Nikolaj Bjorner d8133a47c2 Update solve_eqs.cpp 2022-11-05 22:47:46 -07:00
Nikolaj Bjorner 6c12aaad74 wip - testing solve-eqs2, added as tactic 2022-11-05 22:42:59 -07:00
Nikolaj Bjorner 4d8860c0bc wip - adding context equation solver
the solve_eqs_tactic is to be replaced by a re-implementation that uses solve_eqs in the simplifiers directory.
The re-implementation should address efficiency issues with the previous code.
At this point it punts on low level proofs. The plan is to use coarser
dependency tracking instead of low level proofs for pre-processing. Dependencies can be converted into a proof hint representation that can be checked using a stronger checker.
2022-11-05 10:34:57 -07:00
Nikolaj Bjorner 154b09309b fixing build, wip on model reconstruction integration into dependent-expr-state 2022-11-04 14:04:44 -07:00
Nikolaj Bjorner 7bb962d934 add ad-hoc any-of for cross compatibility and simplifying interface
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-04 12:49:55 -07:00
Nikolaj Bjorner 49d1490454 add ad-hoc any-of for cross compatibility and simplifying interface
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-04 12:48:30 -07:00
Nikolaj Bjorner de9368bab0 Update expr_replacer.h 2022-11-04 11:25:39 -07:00
Nikolaj Bjorner 28668c6efc set up model reconstruction trail 2022-11-04 11:25:39 -07:00
Nikolaj Bjorner 84af521514 fixes #6439 #6436 2022-11-04 09:36:06 -07:00
Nikolaj Bjorner 626380b3c7 fixing build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-03 22:08:21 -07:00
Nikolaj Bjorner e8112a6564 add initial stubs for model reconstruction trail 2022-11-03 21:35:07 -07:00
Nikolaj Bjorner 9007bdf780 move horn_subsume_model_converter to ast/converters 2022-11-03 20:26:02 -07:00
Nikolaj Bjorner 25bb935793 move more converters 2022-11-03 20:18:21 -07:00
Nikolaj Bjorner 06eb460c75 move tactic_params to params 2022-11-03 05:50:46 -07:00
Nikolaj Bjorner 1dca6402fb move model and proof converters to self-contained module 2022-11-03 05:23:01 -07:00
Nikolaj Bjorner 7b12a5c5a8 build fix 2022-11-03 04:49:20 -07:00
Nikolaj Bjorner 070c5c624a wip - converting the equation solver as a simplifier 2022-11-03 03:35:30 -07:00
Nikolaj Bjorner c0f483528d working on solve_eqs 2022-11-03 03:35:29 -07:00
Nikolaj Bjorner e141759768 init solve_eqs 2022-11-03 03:35:29 -07:00
Nikolaj Bjorner df71e83428 remove incorrect assertion
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-02 17:32:09 -07:00
Nikolaj Bjorner 0d97d2214c adding virtual destructor
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-02 09:37:55 -07:00
Nikolaj Bjorner e57674490f 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.
2022-11-02 08:51:30 -07:00
Nikolaj Bjorner 1646a41b2f 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.
2022-11-02 08:44:55 -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 5352a0106d fix #6426 2022-10-26 12:20:55 -07:00
Nikolaj Bjorner c62c5e9d23 add opportunistic, missing, bv rewrites
- x >> x logical = 0
- ~x = -1 -x
- x * (y << z) = (x * y) << z
2022-10-25 10:29:48 -07:00
Nikolaj Bjorner e1a00f4917 remove unused experimental feature - diff 2022-10-24 16:13:24 -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 7b3a634b8d wip - features and bug-fixes to proof logging 2022-10-18 07:54:49 -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 8a30128933 formatting updates 2022-10-13 15:20:24 +02:00
Nikolaj Bjorner 4623117af8 wip - proof hints 2022-10-08 20:12:57 +02:00
Nikolaj Bjorner 876ca2f1a5 fix #6371 2022-09-30 14:51:28 -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 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