Skip to content

Commit 71d68b8

Browse files
fix #2445 fix #2519
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 224cc8f commit 71d68b8

File tree

5 files changed

+157
-120
lines changed

5 files changed

+157
-120
lines changed

src/ast/rewriter/seq_rewriter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,11 @@ br_status seq_rewriter::mk_seq_at(expr* a, expr* b, expr_ref& result) {
10051005

10061006
m_lhs.reset();
10071007
m_util.str.get_concat_units(a, m_lhs);
1008+
1009+
if (m_lhs.empty()) {
1010+
result = m_util.str.mk_empty(m().get_sort(a));
1011+
return BR_DONE;
1012+
}
10081013

10091014
unsigned i = 0;
10101015
for (; i < m_lhs.size(); ++i) {

src/ast/seq_decl_plugin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@ class seq_util {
279279
app* mk_lex_le(expr* a, expr* b) const { expr* es[2] = { a, b }; return m.mk_app(m_fid, OP_STRING_LE, 2, es); }
280280

281281

282-
bool is_nth_i(func_decl* f) const { return is_decl_of(f, m_fid, OP_SEQ_NTH_I); }
283-
bool is_nth_u(func_decl* f) const { return is_decl_of(f, m_fid, OP_SEQ_NTH_U); }
282+
bool is_nth_i(func_decl const* f) const { return is_decl_of(f, m_fid, OP_SEQ_NTH_I); }
283+
bool is_nth_u(func_decl const* f) const { return is_decl_of(f, m_fid, OP_SEQ_NTH_U); }
284+
bool is_skolem(func_decl const* f) const { return is_decl_of(f, m_fid, _OP_SEQ_SKOLEM); }
284285

285286
bool is_string(expr const * n) const { return is_app_of(n, m_fid, OP_STRING_CONST); }
286287
bool is_string(expr const* n, symbol& s) const {

src/cmd_context/cmd_context.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,19 @@ void cmd_context::validate_model() {
19121912
}
19131913

19141914
void cmd_context::analyze_failure(model_evaluator& ev, expr* a, bool expected_value) {
1915+
expr* c = nullptr, *t = nullptr, *e = nullptr;
1916+
if (m().is_not(a, e)) {
1917+
analyze_failure(ev, e, !expected_value);
1918+
return;
1919+
}
1920+
if (!expected_value && m().is_or(a)) {
1921+
for (expr* arg : *to_app(a)) {
1922+
if (ev.is_true(arg)) {
1923+
analyze_failure(ev, arg, false);
1924+
return;
1925+
}
1926+
}
1927+
}
19151928
if (expected_value && m().is_and(a)) {
19161929
for (expr* arg : *to_app(a)) {
19171930
if (ev.is_false(arg)) {
@@ -1920,36 +1933,27 @@ void cmd_context::analyze_failure(model_evaluator& ev, expr* a, bool expected_va
19201933
}
19211934
}
19221935
}
1923-
expr* c = nullptr, *t = nullptr, *e = nullptr;
19241936
if (expected_value && m().is_ite(a, c, t, e)) {
19251937
if (ev.is_true(c) && ev.is_false(t)) {
1926-
analyze_failure(ev, t, true);
1938+
if (!m().is_true(c)) analyze_failure(ev, c, false);
1939+
if (!m().is_false(t)) analyze_failure(ev, t, true);
19271940
return;
19281941
}
19291942
if (ev.is_false(c) && ev.is_false(e)) {
1930-
analyze_failure(ev, e, true);
1943+
if (!m().is_false(c)) analyze_failure(ev, c, true);
1944+
if (!m().is_false(e)) analyze_failure(ev, e, true);
19311945
return;
19321946
}
19331947
}
1934-
if (m().is_not(a, e)) {
1935-
analyze_failure(ev, e, !expected_value);
1936-
return;
1937-
}
1938-
if (!expected_value && m().is_or(a)) {
1939-
for (expr* arg : *to_app(a)) {
1940-
if (ev.is_false(arg)) {
1941-
analyze_failure(ev, arg, false);
1942-
return;
1943-
}
1944-
}
1945-
}
19461948
if (!expected_value && m().is_ite(a, c, t, e)) {
19471949
if (ev.is_true(c) && ev.is_true(t)) {
1948-
analyze_failure(ev, t, false);
1950+
if (!m().is_true(c)) analyze_failure(ev, c, false);
1951+
if (!m().is_true(t)) analyze_failure(ev, t, false);
19491952
return;
19501953
}
19511954
if (ev.is_false(c) && ev.is_true(e)) {
1952-
analyze_failure(ev, e, false);
1955+
if (!m().is_false(c)) analyze_failure(ev, c, true);
1956+
if (!m().is_true(e)) analyze_failure(ev, e, false);
19531957
return;
19541958
}
19551959
}

0 commit comments

Comments
 (0)