mirror of
https://github.com/Z3Prover/z3
synced 2025-07-23 12:48:53 +00:00
Cleaned up hacky rewriter cancelation fix in theory_fpa.
This commit is contained in:
parent
1600823435
commit
b138a0f6d3
1 changed files with 26 additions and 92 deletions
|
@ -238,14 +238,7 @@ namespace smt {
|
||||||
if (m_fpa_util.is_fp(e)) {
|
if (m_fpa_util.is_fp(e)) {
|
||||||
expr * cargs[3] = { to_app(e)->get_arg(0), to_app(e)->get_arg(1), to_app(e)->get_arg(2) };
|
expr * cargs[3] = { to_app(e)->get_arg(0), to_app(e)->get_arg(1), to_app(e)->get_arg(2) };
|
||||||
res = m_bv_util.mk_concat(3, cargs);
|
res = m_bv_util.mk_concat(3, cargs);
|
||||||
|
m_th_rw((expr_ref&)res);
|
||||||
try {
|
|
||||||
m_th_rw((expr_ref&)res);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sort * es = m.get_sort(e);
|
sort * es = m.get_sort(e);
|
||||||
|
@ -302,15 +295,8 @@ namespace smt {
|
||||||
TRACE("t_fpa_detail", tout << "converting atom: " << mk_ismt2_pp(e, get_manager()) << std::endl;);
|
TRACE("t_fpa_detail", tout << "converting atom: " << mk_ismt2_pp(e, get_manager()) << std::endl;);
|
||||||
expr_ref res(m);
|
expr_ref res(m);
|
||||||
proof_ref pr(m);
|
proof_ref pr(m);
|
||||||
try {
|
m_rw(e, res);
|
||||||
m_rw(e, res);
|
m_th_rw(res, res);
|
||||||
m_th_rw(res, res);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_rw.reset();
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
SASSERT(is_app(res));
|
SASSERT(is_app(res));
|
||||||
SASSERT(m.is_bool(res));
|
SASSERT(m.is_bool(res));
|
||||||
return res;
|
return res;
|
||||||
|
@ -323,41 +309,28 @@ namespace smt {
|
||||||
expr_ref e_conv(m), res(m);
|
expr_ref e_conv(m), res(m);
|
||||||
proof_ref pr(m);
|
proof_ref pr(m);
|
||||||
|
|
||||||
try {
|
m_rw(e, e_conv);
|
||||||
m_rw(e, e_conv);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("t_fpa_detail", tout << "term: " << mk_ismt2_pp(e, get_manager()) << std::endl;
|
TRACE("t_fpa_detail", tout << "term: " << mk_ismt2_pp(e, get_manager()) << std::endl;
|
||||||
tout << "converted term: " << mk_ismt2_pp(e_conv, get_manager()) << std::endl;);
|
tout << "converted term: " << mk_ismt2_pp(e_conv, get_manager()) << std::endl;);
|
||||||
|
|
||||||
try {
|
if (m_fpa_util.is_rm(e)) {
|
||||||
if (m_fpa_util.is_rm(e)) {
|
SASSERT(m_fpa_util.is_bv2rm(e_conv));
|
||||||
SASSERT(m_fpa_util.is_bv2rm(e_conv));
|
expr_ref bv_rm(m);
|
||||||
expr_ref bv_rm(m);
|
m_th_rw(to_app(e_conv)->get_arg(0), bv_rm);
|
||||||
m_th_rw(to_app(e_conv)->get_arg(0), bv_rm);
|
res = m_fpa_util.mk_bv2rm(bv_rm);
|
||||||
res = m_fpa_util.mk_bv2rm(bv_rm);
|
|
||||||
}
|
|
||||||
else if (m_fpa_util.is_float(e)) {
|
|
||||||
SASSERT(m_fpa_util.is_fp(e_conv));
|
|
||||||
expr_ref sgn(m), sig(m), exp(m);
|
|
||||||
m_converter.split_fp(e_conv, sgn, exp, sig);
|
|
||||||
m_th_rw(sgn);
|
|
||||||
m_th_rw(exp);
|
|
||||||
m_th_rw(sig);
|
|
||||||
res = m_fpa_util.mk_fp(sgn, exp, sig);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
catch (rewriter_exception &)
|
else if (m_fpa_util.is_float(e)) {
|
||||||
{
|
SASSERT(m_fpa_util.is_fp(e_conv));
|
||||||
m_th_rw.reset();
|
expr_ref sgn(m), sig(m), exp(m);
|
||||||
throw;
|
m_converter.split_fp(e_conv, sgn, exp, sig);
|
||||||
|
m_th_rw(sgn);
|
||||||
|
m_th_rw(exp);
|
||||||
|
m_th_rw(sig);
|
||||||
|
res = m_fpa_util.mk_fp(sgn, exp, sig);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
UNREACHABLE();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -366,15 +339,8 @@ namespace smt {
|
||||||
SASSERT(to_app(e)->get_family_id() == get_family_id());
|
SASSERT(to_app(e)->get_family_id() == get_family_id());
|
||||||
/* This is for the conversion functions fp.to_* */
|
/* This is for the conversion functions fp.to_* */
|
||||||
expr_ref res(get_manager());
|
expr_ref res(get_manager());
|
||||||
try {
|
m_rw(e, res);
|
||||||
m_rw(e, res);
|
m_th_rw(res, res);
|
||||||
m_th_rw(res, res);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_rw.reset();
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,13 +398,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
m_converter.m_extra_assertions.reset();
|
m_converter.m_extra_assertions.reset();
|
||||||
|
|
||||||
try {
|
m_th_rw(res);
|
||||||
m_th_rw(res);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTRACE("t_fpa", !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;);
|
CTRACE("t_fpa", !m.is_true(res), tout << "side condition: " << mk_ismt2_pp(res, m) << std::endl;);
|
||||||
return res;
|
return res;
|
||||||
|
@ -481,15 +441,7 @@ namespace smt {
|
||||||
expr_ref bv_atom(convert_atom(atom));
|
expr_ref bv_atom(convert_atom(atom));
|
||||||
expr_ref bv_atom_w_side_c(m), atom_eq(m);
|
expr_ref bv_atom_w_side_c(m), atom_eq(m);
|
||||||
bv_atom_w_side_c = m.mk_and(bv_atom, mk_side_conditions());
|
bv_atom_w_side_c = m.mk_and(bv_atom, mk_side_conditions());
|
||||||
|
m_th_rw(bv_atom_w_side_c);
|
||||||
try {
|
|
||||||
m_th_rw(bv_atom_w_side_c);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
atom_eq = m.mk_eq(atom, bv_atom_w_side_c);
|
atom_eq = m.mk_eq(atom, bv_atom_w_side_c);
|
||||||
assert_cnstr(atom_eq);
|
assert_cnstr(atom_eq);
|
||||||
return true;
|
return true;
|
||||||
|
@ -600,13 +552,7 @@ namespace smt {
|
||||||
else
|
else
|
||||||
c = m.mk_eq(xc, yc);
|
c = m.mk_eq(xc, yc);
|
||||||
|
|
||||||
try {
|
m_th_rw(c);
|
||||||
m_th_rw(c);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
expr_ref xe_eq_ye(m), c_eq_iff(m);
|
expr_ref xe_eq_ye(m), c_eq_iff(m);
|
||||||
xe_eq_ye = m.mk_eq(xe, ye);
|
xe_eq_ye = m.mk_eq(xe, ye);
|
||||||
|
@ -652,13 +598,7 @@ namespace smt {
|
||||||
c = m.mk_not(xc_eq_yc);
|
c = m.mk_not(xc_eq_yc);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
m_th_rw(c);
|
||||||
m_th_rw(c);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
expr_ref xe_eq_ye(m), not_xe_eq_ye(m), c_eq_iff(m);
|
expr_ref xe_eq_ye(m), not_xe_eq_ye(m), c_eq_iff(m);
|
||||||
xe_eq_ye = m.mk_eq(xe, ye);
|
xe_eq_ye = m.mk_eq(xe, ye);
|
||||||
|
@ -697,13 +637,7 @@ namespace smt {
|
||||||
|
|
||||||
expr_ref cnstr(m);
|
expr_ref cnstr(m);
|
||||||
cnstr = (is_true) ? m.mk_implies(e, converted) : m.mk_implies(converted, e);
|
cnstr = (is_true) ? m.mk_implies(e, converted) : m.mk_implies(converted, e);
|
||||||
try {
|
m_th_rw(cnstr);
|
||||||
m_th_rw(cnstr);
|
|
||||||
}
|
|
||||||
catch (rewriter_exception &) {
|
|
||||||
m_th_rw.reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
assert_cnstr(cnstr);
|
assert_cnstr(cnstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue