3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-07-04 06:20:24 +07:00
parent 1517ca907e
commit 8e2ad4e461
7 changed files with 68 additions and 25 deletions

View file

@ -603,6 +603,7 @@ namespace smt {
theory_var internalize_to_int(app * n);
void internalize_is_int(app * n);
theory_var internalize_numeral(app * n);
theory_var internalize_numeral(app * n, numeral const& val);
theory_var internalize_term_core(app * n);
void mk_axiom(expr * n1, expr * n2, bool simplify_conseq = true);
void mk_idiv_mod_axioms(expr * dividend, expr * divisor);

View file

@ -240,12 +240,23 @@ namespace smt {
return;
}
}
rational _val;
rational _val1, _val2;
expr* arg1, *arg2;
if (m_util.is_mul(m, arg1, arg2) && m_util.is_numeral(arg1, _val) && is_app(arg1) && is_app(arg2)) {
if (m_util.is_mul(m, arg1, arg2) && m_util.is_numeral(arg1, _val1) && is_app(arg1) && is_app(arg2)) {
SASSERT(m->get_num_args() == 2);
numeral val(_val);
theory_var v = internalize_term_core(to_app(arg2));
if (m_util.is_numeral(arg2, _val2)) {
numeral val(_val1 + _val2);
theory_var v = internalize_numeral(m, val);
if (reflection_enabled()) {
internalize_term_core(to_app(arg1));
internalize_term_core(to_app(arg2));
mk_enode(m);
}
add_row_entry<true>(r_id, numeral::one(), v);
return;
}
numeral val(_val1);
theory_var v = internalize_term_core(to_app(arg2));
if (reflection_enabled()) {
internalize_term_core(to_app(arg1));
mk_enode(m);
@ -329,6 +340,7 @@ namespace smt {
theory_var theory_arith<Ext>::internalize_mul(app * m) {
rational _val;
SASSERT(m_util.is_mul(m));
SASSERT(!m_util.is_numeral(m->get_arg(1)));
if (m_util.is_numeral(m->get_arg(0), _val)) {
SASSERT(m->get_num_args() == 2);
numeral val(_val);
@ -713,6 +725,11 @@ namespace smt {
rational _val;
VERIFY(m_util.is_numeral(n, _val));
numeral val(_val);
return internalize_numeral(n, val);
}
template<typename Ext>
theory_var theory_arith<Ext>::internalize_numeral(app * n, numeral const& val) {
SASSERT(!get_context().e_internalized(n));
enode * e = mk_enode(n);
// internalizer is marking enodes as interpreted whenever the associated ast is a value and a constant.

View file

@ -5923,10 +5923,11 @@ void theory_seq::propagate_not_suffix(expr* e) {
e1 < e2 => e1 = empty or e1 = xcy
e1 < e2 => e1 = empty or c < d
e1 < e2 => e2 = xdz
!(e1 < e2) => e1 = e2 or e2 = empty or e2 = xcy
!(e1 < e2) => e1 = e2 or e2 = empty or c < d
!(e1 < e2) => e1 = e2 or e1 = xdz
!(e1 < e2) => e1 = e2 or e2 = empty or e2 = xdz
!(e1 < e2) => e1 = e2 or e2 = empty or d < c
!(e1 < e2) => e1 = e2 or e1 = xcy
optional:
e1 < e2 or e1 = e2 or e2 < e1
!(e1 = e2) or !(e1 < e2)
!(e1 = e2) or !(e2 < e1)
@ -5952,15 +5953,14 @@ void theory_seq::add_lt_axiom(expr* n) {
literal eq = mk_eq(e1, e2, false);
literal e1xcy = mk_eq(e1, xcy, false);
literal e2xdz = mk_eq(e2, xdz, false);
literal e2xcy = mk_eq(e2, xcy, false);
literal e1xdz = mk_eq(e1, xdz, false);
literal ltcd = mk_literal(m_util.mk_lt(c, d));
literal ltdc = mk_literal(m_util.mk_lt(d, c));
add_axiom(~lt, e2xdz);
add_axiom(~lt, emp1, e1xcy);
add_axiom(~lt, emp1, ltcd);
add_axiom(lt, eq, e1xdz);
add_axiom(lt, eq, emp2, ltcd);
add_axiom(lt, eq, emp2, e2xcy);
add_axiom(lt, eq, e1xcy);
add_axiom(lt, eq, emp2, ltdc);
add_axiom(lt, eq, emp2, e2xdz);
if (e1->get_id() <= e2->get_id()) {
literal gt = mk_literal(m_util.str.mk_lex_lt(e2, e1));
add_axiom(lt, eq, gt);