3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-10 03:07:07 +00:00
Commit graph

3118 commits

Author SHA1 Message Date
Guido Martínez 7c380fd6a0
bool_rewriter: fix possible segfault when disabling rewriter.sort_disjunctions (#6779)
After introducing the rewriter.sort_disjunctions option (#6774), I
noticed a segfault in a Z3 run that was working fine for me before the
PR.

I traced the difference to a slight discrepancy between the first patch
I submitted and the one we ended up merging: my first version would skip
sorting the disjuncts in mk_nflat_core, but still return BR_DONE, while
the patch in master returns BR_FAILED instead.

This patch fixes that problem, and it makes slightly more sense to me to
return a BR_DONE since, if `s` is true, some disjunct (e.g. a `false`
or a repeat) might have been simplified away. However I don't fully
understand this code.

... and I can't say I understand why the segfault happens. Perhaps that
is a separate issue?

This is the file to reproduce:
 https://gist.github.com/mtzguido/b7360c74d3d2e42d89f1bd9149ad26f6

Here's a stack trace of the failure, mk_nflat_or_core is not involved.
```
 (gdb) where
 #0  0x0000555555b98497 in smt::context::get_lit_assignment(unsigned int) const ()
 #1  0x0000555555b984cb in smt::context::get_assignment(sat::literal) const ()
 #2  0x0000555555b98504 in smt::context::get_assignment(unsigned int) const ()
 #3  0x0000555555ca83b8 in smt::context::get_assignment_core(expr*) const ()
 #4  0x0000555555c9af5a in smt::context::get_assignment(expr*) const ()
 #5  0x0000555555d7bd1d in (anonymous namespace)::has_child_assigned_to(smt::context&, app*, lbool, expr*&, unsigned int) ()
 #6  0x0000555555d7c413 in (anonymous namespace)::rel_case_split_queue::next_case_split_core(ptr_vector<expr>&, unsigned int&, unsigned int&, lbool&) ()
 #7  0x0000555555d7c589 in (anonymous namespace)::rel_case_split_queue::next_case_split(unsigned int&, lbool&) ()
 #8  0x0000555555c9c1b7 in smt::context::decide() ()
 #9  0x0000555555ca39fd in smt::context::bounded_search() ()
 #10 0x0000555555ca30c2 in smt::context::search() ()
 #11 0x0000555555ca273d in smt::context::check(unsigned int, expr* const*, bool) ()
 #12 0x0000555555cb166a in smt::kernel::check(unsigned int, expr* const*) ()
 #13 0x0000555555cb9695 in (anonymous namespace)::smt_solver::check_sat_core2(unsigned int, expr* const*) ()
 #14 0x00005555560dc0c6 in solver_na2as::check_sat_core(unsigned int, expr* const*) ()
 #15 0x00005555560d73f3 in combined_solver::check_sat_core(unsigned int, expr* const*) ()
 #16 0x00005555560d34e3 in solver::check_sat(unsigned int, expr* const*) ()
 #17 0x0000555556097b26 in cmd_context::check_sat(unsigned int, expr* const*) ()
 #18 0x0000555556082ff0 in smt2::parser::parse_check_sat() ()
 #19 0x0000555556084dc0 in smt2::parser::parse_cmd() ()
 #20 0x00005555560861b6 in smt2::parser::operator()() ()
 #21 0x00005555560757e6 in parse_smt2_commands(cmd_context&, std::basic_istream<char, std::char_traits<char> >&, bool, params_ref const&, char const*) ()
 #22 0x00005555555e8f68 in read_smtlib2_commands(char const*) ()
 #23 0x00005555555ee6f6 in main ()
 (gdb)
```
2023-06-23 11:45:29 -07:00
Guido Martínez 3517361a73
Adding some options in support of F* (#6774)
* patterns: add option for pattern decomposition (pi.decompose_patterns)

True by default, retaining current behavior.

* rewriter: add option for sorting of disjunctions (rewriter.sort_disjunctions)

True by default, retaining current behavior.
2023-06-20 16:10:37 -07:00
tcely b93171de78
pattern_inference.h: include rewriter_def.h (#6765)
Needed to use the `rewriter_tpl` constructor.
2023-06-16 08:46:40 -07:00
Nikolaj Bjorner ac00306355 fix context simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 11:30:56 -07:00
Nikolaj Bjorner d0085b41c1 disable breaking change
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 11:15:54 -07:00
Nikolaj Bjorner 555ccc8aab simplify bounds by subsumption checks
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 10:21:45 -07:00
Nikolaj Bjorner 06a8987314 fix #6748
destructive equality resolution uses an occurs check function that is only safe for quantifier-free formulas. In the special case where a bound variable is Boolean and occurs on a side of an equality the other side cannot have a quantifier.
2023-06-07 15:59:39 -07:00
Jakob Rath 57e92b2a59
Fix bvnego (#6750) 2023-06-07 11:24:40 -07:00
Nikolaj Bjorner 73c3f34d66 remove debug output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-06 16:37:24 -07:00
Nikolaj Bjorner 68f43ac7a4 make der selective to configuration. For F*, quantifiers are hand or machine generated in specific formats and the tool depends on e-matching to use precisely the format of the quantifiers that have been entered. For other cases of quantifiers, destructive equality resolution (der) can be expected to offer simplifications
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-06 16:15:04 -07:00
Nikolaj Bjorner a68f91f0a6 fix #6729
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-22 14:07:12 +01:00
Nikolaj Bjorner 06ea765b82 fix #6721
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-13 09:46:49 -07:00
Antti Hyvärinen 12e45c9d17
Implement proposed smtlib2 bitvector overflow predicates (#6715)
* Logical names for function declarations in c++

Currently, for example, the function declaration symbol member for
checking whether multiplication *does not* overflow is called
`m_bv_smul_ovfl`.  Since we are introducing the upcoming smtlib2 symbols
that check that multpliciation *does* overflow, the not overflow check
symbols are renamed to `m_bv_smul_no_ovfl` etc.

* Implement smtlib overflow preds for multiplication

Smtlib2 is being extended to include overflow predicates for bit
vectors (see https://groups.google.com/u/1/g/smt-lib/c/J4D99wT0aKI).
This commit introduces the predicates `bvumulo` and `bvsmulo` that
return `true` if the unsigned multiplication overflows or the signed
multiplication underflows or overflows, respectively.

* Move mul overflow predicates to BV logic

* Add a todo on illogical argument order

* Implement mk_unary_pred for bv

* Implement bvnego

* Implement bvuaddo

* Implement bvsaddo

* Implement bvusubo

* Implement bvssubo

* Implement bvsdivo
2023-05-09 10:37:46 -07:00
Nikolaj Bjorner 2e441e38c9 fix #6713 fix #6714
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-08 12:24:20 -07:00
Nikolaj Bjorner f17691715b make default argument to ensure_def and mk_def explicit
- insert also macro definitions into models
2023-05-02 12:18:31 -07:00
Nikolaj Bjorner 7a689c3298 disable destructive equality resolution simplification if there are patterns
- regression from F\star
- reported by @mtzguido (stlc_min.smt2)
2023-04-24 17:59:41 -07:00
Nikolaj Bjorner cb041c1b6d fix #6689 2023-04-17 12:05:08 -07:00
Nikolaj Bjorner 1a70ac75df fix #6687 2023-04-13 09:01:17 -07:00
Nikolaj Bjorner 7cd8edce1f perf and memory smash fixes to internal node count routine 2023-04-12 21:01:05 -07:00
Nikolaj Bjorner eba0732629 fix #6675
disable remove_unused_defs from pb-solver until it is integrated with model reconstruction.
2023-04-12 19:50:13 -07:00
Nikolaj Bjorner e8222433c3 count internal nodes, use to block expanding use of hoist, #6683 2023-04-12 19:40:31 -07:00
Nikolaj Bjorner 444238bc53 formatting updates 2023-04-12 19:40:31 -07:00
Nikolaj Bjorner 0b5c38dea5 fix #6676 get rid of rem0 declare it to be mod0 semantics to simplify code paths 2023-04-11 16:46:43 -07:00
Nikolaj Bjorner 368d60f553 add branch / cut selection heuristic from solver=2
disabled for testing.
2023-04-10 22:14:16 -07:00
Nikolaj Bjorner e6ea81546e fix #6662 2023-04-08 17:14:39 -07:00
Nikolaj Bjorner 84b9204616 inherit and reset rlimit counter on children limits
addresses rlimit leak reported by @mtzguido
2023-04-05 16:39:21 -07:00
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