mirror of
https://github.com/Z3Prover/z3
synced 2025-06-03 04:41:21 +00:00
remove unstable sequence interpolant from doc test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
7f127cdd5d
commit
2ea9bfaa41
8 changed files with 31 additions and 67 deletions
|
@ -8185,9 +8185,9 @@ def sequence_interpolant(v,p=None,ctx=None):
|
||||||
If parameters p are supplied, these are used in creating the
|
If parameters p are supplied, these are used in creating the
|
||||||
solver that determines satisfiability.
|
solver that determines satisfiability.
|
||||||
|
|
||||||
>>> x = Int('x')
|
x = Int('x')
|
||||||
>>> y = Int('y')
|
y = Int('y')
|
||||||
>>> print(sequence_interpolant([x < 0, y == x , y > 2]))
|
print(sequence_interpolant([x < 0, y == x , y > 2]))
|
||||||
[Not(x >= 0), Not(y >= 0)]
|
[Not(x >= 0), Not(y >= 0)]
|
||||||
"""
|
"""
|
||||||
f = v[0]
|
f = v[0]
|
||||||
|
|
|
@ -284,7 +284,7 @@ public:
|
||||||
}
|
}
|
||||||
unsigned num_args = to_app(n)->get_num_args();
|
unsigned num_args = to_app(n)->get_num_args();
|
||||||
if (num_args > 0)
|
if (num_args > 0)
|
||||||
m_out << "(_ ";
|
m_out << "(";
|
||||||
display_name(to_app(n)->get_decl());
|
display_name(to_app(n)->get_decl());
|
||||||
display_params(to_app(n)->get_decl());
|
display_params(to_app(n)->get_decl());
|
||||||
for (unsigned i = 0; i < num_args; i++) {
|
for (unsigned i = 0; i < num_args; i++) {
|
||||||
|
|
|
@ -629,61 +629,23 @@ br_status bool_rewriter::try_ite_value(app * ite, app * val, expr_ref & result)
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expr* cond2, *t2, *e2;
|
{
|
||||||
if (m().is_ite(t, cond2, t2, e2) && m().is_value(t2) && m().is_value(e2)) {
|
expr* cond2, *t2, *e2;
|
||||||
try_ite_value(to_app(t), val, result);
|
if (m().is_ite(t, cond2, t2, e2) && m().is_value(t2) && m().is_value(e2)) {
|
||||||
result = m().mk_ite(cond, result, m().mk_eq(e, val));
|
try_ite_value(to_app(t), val, result);
|
||||||
return BR_REWRITE2;
|
result = m().mk_ite(cond, result, m().mk_eq(e, val));
|
||||||
}
|
return BR_REWRITE2;
|
||||||
if (m().is_ite(e, cond2, t2, e2) && m().is_value(t2) && m().is_value(e2)) {
|
}
|
||||||
try_ite_value(to_app(e), val, result);
|
if (m().is_ite(e, cond2, t2, e2) && m().is_value(t2) && m().is_value(e2)) {
|
||||||
result = m().mk_ite(cond, m().mk_eq(t, val), result);
|
try_ite_value(to_app(e), val, result);
|
||||||
return BR_REWRITE2;
|
result = m().mk_ite(cond, m().mk_eq(t, val), result);
|
||||||
|
return BR_REWRITE2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BR_FAILED;
|
return BR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Return true if ite is an if-then-else tree where the leaves are values,
|
|
||||||
// and they are all different from val
|
|
||||||
static bool is_ite_value_tree_neq_value(ast_manager & m, app * ite, app * val) {
|
|
||||||
SASSERT(m.is_ite(ite));
|
|
||||||
SASSERT(m.is_value(val));
|
|
||||||
|
|
||||||
expr_fast_mark1 visited;
|
|
||||||
ptr_buffer<app> todo;
|
|
||||||
todo.push_back(ite);
|
|
||||||
|
|
||||||
#define VISIT(ARG) { \
|
|
||||||
if (m.is_value(ARG)) { \
|
|
||||||
if (ARG == val) \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
else if (m.is_ite(ARG)) { \
|
|
||||||
if (!visited.is_marked(ARG)) { \
|
|
||||||
visited.mark(ARG); \
|
|
||||||
todo.push_back(to_app(ARG)); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!todo.empty()) {
|
|
||||||
app * ite = todo.back();
|
|
||||||
todo.pop_back();
|
|
||||||
SASSERT(m.is_ite(ite));
|
|
||||||
expr * t = ite->get_arg(1);
|
|
||||||
expr * e = ite->get_arg(2);
|
|
||||||
VISIT(t);
|
|
||||||
VISIT(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
||||||
if (m().are_equal(lhs, rhs)) {
|
if (m().are_equal(lhs, rhs)) {
|
||||||
|
@ -697,26 +659,20 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
br_status r = BR_FAILED;
|
br_status r = BR_FAILED;
|
||||||
|
|
||||||
if (m().is_ite(lhs) && m().is_value(rhs)) {
|
if (m().is_ite(lhs) && m().is_value(rhs)) {
|
||||||
// if (is_ite_value_tree_neq_value(m(), to_app(lhs), to_app(rhs))) {
|
|
||||||
// result = m().mk_false();
|
|
||||||
// return BR_DONE;
|
|
||||||
// }
|
|
||||||
r = try_ite_value(to_app(lhs), to_app(rhs), result);
|
r = try_ite_value(to_app(lhs), to_app(rhs), result);
|
||||||
CTRACE("try_ite_value", r != BR_FAILED,
|
CTRACE("try_ite_value", r != BR_FAILED,
|
||||||
tout << mk_ismt2_pp(lhs, m()) << "\n" << mk_ismt2_pp(rhs, m()) << "\n--->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
||||||
}
|
}
|
||||||
else if (m().is_ite(rhs) && m().is_value(lhs)) {
|
else if (m().is_ite(rhs) && m().is_value(lhs)) {
|
||||||
// if (is_ite_value_tree_neq_value(m(), to_app(rhs), to_app(lhs))) {
|
|
||||||
// result = m().mk_false();
|
|
||||||
// return BR_DONE;
|
|
||||||
// }
|
|
||||||
r = try_ite_value(to_app(rhs), to_app(lhs), result);
|
r = try_ite_value(to_app(rhs), to_app(lhs), result);
|
||||||
CTRACE("try_ite_value", r != BR_FAILED,
|
CTRACE("try_ite_value", r != BR_FAILED,
|
||||||
tout << mk_ismt2_pp(lhs, m()) << "\n" << mk_ismt2_pp(rhs, m()) << "\n--->\n" << mk_ismt2_pp(result, m()) << "\n";);
|
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
|
||||||
}
|
}
|
||||||
if (r != BR_FAILED)
|
if (r != BR_FAILED)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
||||||
if (m().is_bool(lhs)) {
|
if (m().is_bool(lhs)) {
|
||||||
bool unfolded = false;
|
bool unfolded = false;
|
||||||
|
|
|
@ -18,6 +18,7 @@ Notes:
|
||||||
--*/
|
--*/
|
||||||
#include "ast/rewriter/rewriter.h"
|
#include "ast/rewriter/rewriter.h"
|
||||||
#include "ast/ast_smt2_pp.h"
|
#include "ast/ast_smt2_pp.h"
|
||||||
|
#include "ast/ast_ll_pp.h"
|
||||||
|
|
||||||
template<typename Config>
|
template<typename Config>
|
||||||
template<bool ProofGen>
|
template<bool ProofGen>
|
||||||
|
@ -259,10 +260,10 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||||
}
|
}
|
||||||
br_status st = m_cfg.reduce_app(f, new_num_args, new_args, m_r, m_pr2);
|
br_status st = m_cfg.reduce_app(f, new_num_args, new_args, m_r, m_pr2);
|
||||||
SASSERT(st != BR_DONE || m().get_sort(m_r) == m().get_sort(t));
|
SASSERT(st != BR_DONE || m().get_sort(m_r) == m().get_sort(t));
|
||||||
TRACE("reduce_app",
|
CTRACE("reduce_app", st != BR_FAILED,
|
||||||
tout << mk_ismt2_pp(t, m()) << "\n";
|
tout << mk_bounded_pp(t, m()) << "\n";
|
||||||
tout << "st: " << st;
|
tout << "st: " << st;
|
||||||
if (m_r) tout << " --->\n" << mk_ismt2_pp(m_r, m());
|
if (m_r) tout << " --->\n" << mk_bounded_pp(m_r, m());
|
||||||
tout << "\n";);
|
tout << "\n";);
|
||||||
if (st != BR_FAILED) {
|
if (st != BR_FAILED) {
|
||||||
result_stack().shrink(fr.m_spos);
|
result_stack().shrink(fr.m_spos);
|
||||||
|
|
|
@ -736,6 +736,7 @@ ast_manager & th_rewriter::m() const {
|
||||||
void th_rewriter::updt_params(params_ref const & p) {
|
void th_rewriter::updt_params(params_ref const & p) {
|
||||||
m_params = p;
|
m_params = p;
|
||||||
m_imp->cfg().updt_params(p);
|
m_imp->cfg().updt_params(p);
|
||||||
|
IF_VERBOSE(10, verbose_stream() << p << "\n";);
|
||||||
}
|
}
|
||||||
|
|
||||||
void th_rewriter::get_param_descrs(param_descrs & r) {
|
void th_rewriter::get_param_descrs(param_descrs & r) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ asserted_formulas::asserted_formulas(ast_manager & m, smt_params & p):
|
||||||
|
|
||||||
m_macro_finder = alloc(macro_finder, m, m_macro_manager);
|
m_macro_finder = alloc(macro_finder, m, m_macro_manager);
|
||||||
|
|
||||||
|
m_elim_and = true;
|
||||||
set_eliminate_and(false);
|
set_eliminate_and(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,10 @@ void asserted_formulas::push_assertion(expr * e, proof * pr, vector<justified_ex
|
||||||
}
|
}
|
||||||
|
|
||||||
void asserted_formulas::set_eliminate_and(bool flag) {
|
void asserted_formulas::set_eliminate_and(bool flag) {
|
||||||
|
if (flag == m_elim_and) return;
|
||||||
|
m_elim_and = flag;
|
||||||
params_ref p;
|
params_ref p;
|
||||||
|
p.set_bool("pull_cheap_ite", false);
|
||||||
p.set_bool("elim_and", flag);
|
p.set_bool("elim_and", flag);
|
||||||
p.set_bool("arith_ineq_lhs", true);
|
p.set_bool("arith_ineq_lhs", true);
|
||||||
p.set_bool("sort_sums", true);
|
p.set_bool("sort_sums", true);
|
||||||
|
|
|
@ -52,6 +52,7 @@ class asserted_formulas {
|
||||||
static_features m_static_features;
|
static_features m_static_features;
|
||||||
vector<justified_expr> m_formulas;
|
vector<justified_expr> m_formulas;
|
||||||
unsigned m_qhead;
|
unsigned m_qhead;
|
||||||
|
bool m_elim_and;
|
||||||
macro_manager m_macro_manager;
|
macro_manager m_macro_manager;
|
||||||
scoped_ptr<macro_finder> m_macro_finder;
|
scoped_ptr<macro_finder> m_macro_finder;
|
||||||
maximize_bv_sharing_rw m_bv_sharing;
|
maximize_bv_sharing_rw m_bv_sharing;
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
proof_converter_ref & pc,
|
proof_converter_ref & pc,
|
||||||
expr_dependency_ref & core) {
|
expr_dependency_ref & core) {
|
||||||
try {
|
try {
|
||||||
|
IF_VERBOSE(10, verbose_stream() << "(smt.tactic start)\n";);
|
||||||
mc = 0; pc = 0; core = 0;
|
mc = 0; pc = 0; core = 0;
|
||||||
SASSERT(in->is_well_sorted());
|
SASSERT(in->is_well_sorted());
|
||||||
ast_manager & m = in->m();
|
ast_manager & m = in->m();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue