mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
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.
This commit is contained in:
parent
c8f197d0ca
commit
7368f9f7d3
22 changed files with 201 additions and 162 deletions
|
@ -27,6 +27,8 @@ Notes:
|
|||
for assembling bounds, but it does not have a way to check for
|
||||
subsumption of atoms.
|
||||
|
||||
## Tactic arith-bounds
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
#include "tactic/tactic.h"
|
||||
|
|
|
@ -128,9 +128,8 @@ struct cofactor_elim_term_ite::imp {
|
|||
fr.m_first = false;
|
||||
bool visited = true;
|
||||
if (is_app(t)) {
|
||||
unsigned num_args = to_app(t)->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++)
|
||||
visit(to_app(t)->get_arg(i), form_ctx, visited);
|
||||
for (expr* arg : *to_app(t))
|
||||
visit(arg, form_ctx, visited);
|
||||
}
|
||||
// ignoring quantifiers
|
||||
if (!visited)
|
||||
|
@ -138,16 +137,13 @@ struct cofactor_elim_term_ite::imp {
|
|||
}
|
||||
|
||||
if (is_app(t)) {
|
||||
unsigned num_args = to_app(t)->get_num_args();
|
||||
unsigned i;
|
||||
for (i = 0; i < num_args; i++) {
|
||||
if (m_has_term_ite.is_marked(to_app(t)->get_arg(i)))
|
||||
for (expr* arg : *to_app(t)) {
|
||||
if (m_has_term_ite.is_marked(arg)) {
|
||||
m_has_term_ite.mark(t);
|
||||
TRACE("cofactor", tout << "saving candidate: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";);
|
||||
save_candidate(t, form_ctx);
|
||||
break;
|
||||
}
|
||||
if (i < num_args) {
|
||||
m_has_term_ite.mark(t);
|
||||
TRACE("cofactor", tout << "saving candidate: " << form_ctx << "\n" << mk_bounded_pp(t, m) << "\n";);
|
||||
save_candidate(t, form_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -284,16 +280,14 @@ struct cofactor_elim_term_ite::imp {
|
|||
}
|
||||
expr * best = nullptr;
|
||||
unsigned best_occs = 0;
|
||||
obj_map<expr, unsigned>::iterator it = occs.begin();
|
||||
obj_map<expr, unsigned>::iterator end = occs.end();
|
||||
for (; it != end; ++it) {
|
||||
for (auto const& [k, v] : occs) {
|
||||
if ((!best) ||
|
||||
(get_depth(it->m_key) < get_depth(best)) ||
|
||||
(get_depth(it->m_key) == get_depth(best) && it->m_value > best_occs) ||
|
||||
(get_depth(k) < get_depth(best)) ||
|
||||
(get_depth(k) == get_depth(best) && v > best_occs) ||
|
||||
// break ties by giving preference to equalities
|
||||
(get_depth(it->m_key) == get_depth(best) && it->m_value == best_occs && m.is_eq(it->m_key) && !m.is_eq(best))) {
|
||||
best = it->m_key;
|
||||
best_occs = it->m_value;
|
||||
(get_depth(k) == get_depth(best) && v == best_occs && m.is_eq(k) && !m.is_eq(best))) {
|
||||
best = k;
|
||||
best_occs = v;
|
||||
}
|
||||
}
|
||||
visited.reset();
|
||||
|
|
|
@ -8,13 +8,22 @@ Module Name:
|
|||
Abstract:
|
||||
|
||||
Wrap cofactor_elim_term_ite as a tactic.
|
||||
Eliminate (ground) term if-then-else's using cofactors.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-02-20.
|
||||
|
||||
Revision History:
|
||||
Tactic Documentation:
|
||||
|
||||
## Tactic cofactor-term-ite
|
||||
|
||||
### Short Description
|
||||
Eliminate (ground) term if-then-else's using cofactors.
|
||||
It hoists nested if-then-else expressions inside terms into the top level of the formula.
|
||||
|
||||
### Notes
|
||||
|
||||
* does not support proofs, does not support cores
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
|
|
@ -13,6 +13,22 @@ Author:
|
|||
|
||||
Nikolaj Bjorner (nbjorner) 2022-10-30
|
||||
|
||||
Tactic Documentation:
|
||||
|
||||
## Tactic euf-completion
|
||||
|
||||
### Short Description
|
||||
|
||||
Uses the ground equalities as a rewrite system. The formulas are simplified
|
||||
using the rewrite system.
|
||||
|
||||
### Long Description
|
||||
|
||||
The tactic uses congruence closure to represent and orient the rewrite system. Equalities from the formula
|
||||
are inserted in the an E-graph (congruence closure structure) and then a representative that is most shallow
|
||||
is extracted.
|
||||
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -34,31 +34,10 @@ Thus, we replace the $f(t_1, t_2)$ with
|
|||
Since $f_a$, $f_b$, $f_c$ are new symbols, satisfiability is preserved.
|
||||
|
||||
This transformation is very similar in spirit to the Ackermman's reduction.
|
||||
For each function `f` and argument position of `f` it checks if all occurrences of `f` uses a value at position `i`.
|
||||
The values may be different, but all occurrences have to be values for the reduction to be applicable.
|
||||
It creates a fresh function for each of the different values at position `i`.
|
||||
|
||||
This transformation should work in the following way:
|
||||
|
||||
```
|
||||
1- Create a mapping decl2arg_map from declarations to tuples of booleans, an entry [f -> (true, false, true)]
|
||||
means that f is a declaration with 3 arguments where the first and third arguments are always values.
|
||||
2- Traverse the formula and populate the mapping.
|
||||
For each function application f(t1, ..., tn) do
|
||||
a) Create a boolean tuple (is_value(t1), ..., is_value(tn)) and do
|
||||
the logical-and with the tuple that is already in the mapping. If there is no such tuple
|
||||
in the mapping, we just add a new entry.
|
||||
|
||||
If all entries are false-tuples, then there is nothing to be done. The transformation is not applicable.
|
||||
|
||||
Now, we create a mapping decl2new_decl from (decl, val_1, ..., val_n) to decls. Note that, n may be different for each entry,
|
||||
but it is the same for the same declaration.
|
||||
For example, suppose we have [f -> (true, false, true)] in decl2arg_map,
|
||||
and applications f(1, a, 2), f(1, b, 2), f(1, b, 3), f(2, b, 3), f(2, c, 3) in the formula.
|
||||
Then, decl2arg_map would contain
|
||||
(f, 1, 2) -> f_1_2
|
||||
(f, 1, 3) -> f_1_3
|
||||
(f, 2, 3) -> f_2_3
|
||||
where f_1_2, f_1_3 and f_2_3 are new function symbols.
|
||||
Using the new map, we can replace the occurrences of f.
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
|
|
|
@ -865,11 +865,11 @@ public:
|
|||
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
insert_max_memory(r);
|
||||
r.insert("common_patterns", CPK_BOOL, "(default: true) minimize the number of auxiliary variables during CNF encoding by identifing commonly used patterns");
|
||||
r.insert("distributivity", CPK_BOOL, "(default: true) minimize the number of auxiliary variables during CNF encoding by applying distributivity over unshared subformulas");
|
||||
r.insert("distributivity_blowup", CPK_UINT, "(default: 32) maximum overhead for applying distributivity during CNF encoding");
|
||||
r.insert("ite_chaing", CPK_BOOL, "(default: true) minimize the number of auxiliary variables during CNF encoding by identifing if-then-else chains");
|
||||
r.insert("ite_extra", CPK_BOOL, "(default: true) add redundant clauses (that improve unit propagation) when encoding if-then-else formulas");
|
||||
r.insert("common_patterns", CPK_BOOL, "minimize the number of auxiliary variables during CNF encoding by identifing commonly used patterns", "true");
|
||||
r.insert("distributivity", CPK_BOOL, "minimize the number of auxiliary variables during CNF encoding by applying distributivity over unshared subformulas", "true");
|
||||
r.insert("distributivity_blowup", CPK_UINT, "maximum overhead for applying distributivity during CNF encoding", "32");
|
||||
r.insert("ite_chaing", CPK_BOOL, "minimize the number of auxiliary variables during CNF encoding by identifing if-then-else chains", "true");
|
||||
r.insert("ite_extra", CPK_BOOL, "add redundant clauses (that improve unit propagation) when encoding if-then-else formulas", "true");
|
||||
}
|
||||
|
||||
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
|
||||
|
|
|
@ -5,15 +5,16 @@ Module Name:
|
|||
|
||||
fpa2bv_tactic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Tactic that converts floating points to bit-vectors
|
||||
|
||||
Author:
|
||||
|
||||
Christoph (cwinter) 2012-02-09
|
||||
|
||||
Notes:
|
||||
Tactic Documentation:
|
||||
|
||||
## Tactic fpa2bv
|
||||
|
||||
### Short Description
|
||||
Converts floating points to bit-vector representation.
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
|
|
@ -13,8 +13,17 @@ Author:
|
|||
|
||||
Christoph (cwinter) 2012-01-16
|
||||
|
||||
Notes:
|
||||
Tactic Documentation:
|
||||
|
||||
## Tactic qffp
|
||||
|
||||
### Short Description
|
||||
Tactic for QF_FP formulas
|
||||
|
||||
## Tactic qffpbv
|
||||
|
||||
### Short Description
|
||||
Tactic for QF_FPBV formulas
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
|
|
@ -14,7 +14,8 @@ Author:
|
|||
|
||||
Christoph (cwinter) 2018-04-24
|
||||
|
||||
Notes:
|
||||
|
||||
## Tactic qffplra
|
||||
|
||||
|
||||
--*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue