mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
theory_str params module, WIP
This commit is contained in:
parent
09053b831d
commit
f5bc17b864
7 changed files with 96 additions and 35 deletions
|
@ -29,8 +29,9 @@ Revision History:
|
|||
|
||||
namespace smt {
|
||||
|
||||
theory_str::theory_str(ast_manager & m):
|
||||
theory_str::theory_str(ast_manager & m, theory_str_params const & params):
|
||||
theory(m.mk_family_id("str")),
|
||||
m_params(params),
|
||||
/* Options */
|
||||
opt_AggressiveLengthTesting(false),
|
||||
opt_AggressiveValueTesting(false),
|
||||
|
@ -44,7 +45,6 @@ theory_str::theory_str(ast_manager & m):
|
|||
opt_CheckVariableScope(true),
|
||||
opt_UseFastLengthTesterCache(true),
|
||||
opt_UseFastValueTesterCache(true),
|
||||
opt_AssertStrongerArrangements(false),
|
||||
/* Internal setup */
|
||||
search_started(false),
|
||||
m_autil(m),
|
||||
|
@ -2911,7 +2911,7 @@ void theory_str::process_concat_eq_type1(expr * concatAst1, expr * concatAst2) {
|
|||
add_cut_info_merge(t1, sLevel, m);
|
||||
add_cut_info_merge(t1, sLevel, y);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -2963,7 +2963,7 @@ void theory_str::process_concat_eq_type1(expr * concatAst1, expr * concatAst2) {
|
|||
add_cut_info_merge(t2, sLevel, x);
|
||||
add_cut_info_merge(t2, sLevel, n);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3071,7 +3071,7 @@ void theory_str::process_concat_eq_type1(expr * concatAst1, expr * concatAst2) {
|
|||
if (!arrangement_disjunction.empty()) {
|
||||
expr_ref premise(ctx.mk_eq_atom(concatAst1, concatAst2), mgr);
|
||||
expr_ref conclusion(mk_or(arrangement_disjunction), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(premise, conclusion), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3272,7 +3272,7 @@ void theory_str::process_concat_eq_type2(expr * concatAst1, expr * concatAst2) {
|
|||
add_cut_info_merge(temp1, sLevel, y);
|
||||
add_cut_info_merge(temp1, sLevel, m);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3340,7 +3340,7 @@ void theory_str::process_concat_eq_type2(expr * concatAst1, expr * concatAst2) {
|
|||
expr_ref ax_l(mk_and(l_items), mgr);
|
||||
expr_ref ax_r(mk_and(r_items), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3404,7 +3404,7 @@ void theory_str::process_concat_eq_type2(expr * concatAst1, expr * concatAst2) {
|
|||
if (!arrangement_disjunction.empty()) {
|
||||
expr_ref implyR(mk_or(arrangement_disjunction), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref implyLHS(ctx.mk_eq_atom(concatAst1, concatAst2), mgr);
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(implyLHS, implyR), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
|
@ -3592,7 +3592,7 @@ void theory_str::process_concat_eq_type3(expr * concatAst1, expr * concatAst2) {
|
|||
r_items.push_back(ctx.mk_eq_atom(x, prefixAst));
|
||||
r_items.push_back(ctx.mk_eq_atom(y, suf_n_concat));
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, mk_and(r_items)), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3612,7 +3612,7 @@ void theory_str::process_concat_eq_type3(expr * concatAst1, expr * concatAst2) {
|
|||
expr_ref ax_l(mgr.mk_and(ax_l1, ax_l2), mgr);
|
||||
expr_ref ax_r(mgr.mk_and(ctx.mk_eq_atom(x, strAst), ctx.mk_eq_atom(y, n)), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3650,7 +3650,7 @@ void theory_str::process_concat_eq_type3(expr * concatAst1, expr * concatAst2) {
|
|||
add_cut_info_merge(temp1, sLevel, x);
|
||||
add_cut_info_merge(temp1, sLevel, n);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_l, ax_r), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3731,7 +3731,7 @@ void theory_str::process_concat_eq_type3(expr * concatAst1, expr * concatAst2) {
|
|||
if (!arrangement_disjunction.empty()) {
|
||||
expr_ref implyR(mk_or(arrangement_disjunction), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_lhs(ctx.mk_eq_atom(concatAst1, concatAst2), mgr);
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(ax_lhs, implyR), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
|
@ -3813,7 +3813,7 @@ void theory_str::process_concat_eq_type4(expr * concatAst1, expr * concatAst2) {
|
|||
if (!in_same_eqc(tmpAst, n)) {
|
||||
// break down option 4-1
|
||||
expr_ref implyR(ctx.mk_eq_atom(n, tmpAst), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3825,7 +3825,7 @@ void theory_str::process_concat_eq_type4(expr * concatAst1, expr * concatAst2) {
|
|||
//break down option 4-2
|
||||
expr_ref implyR(ctx.mk_eq_atom(n, y), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3838,7 +3838,7 @@ void theory_str::process_concat_eq_type4(expr * concatAst1, expr * concatAst2) {
|
|||
if (!in_same_eqc(y, tmpAst)) {
|
||||
//break down option 4-3
|
||||
expr_ref implyR(ctx.mk_eq_atom(y, tmpAst), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3915,7 +3915,7 @@ void theory_str::process_concat_eq_type5(expr * concatAst1, expr * concatAst2) {
|
|||
expr_ref x_deltaStr(mk_concat(x, m_strutil.mk_string(deltaStr)), mgr);
|
||||
if (!in_same_eqc(m, x_deltaStr)) {
|
||||
expr_ref implyR(ctx.mk_eq_atom(m, x_deltaStr), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3926,7 +3926,7 @@ void theory_str::process_concat_eq_type5(expr * concatAst1, expr * concatAst2) {
|
|||
// test
|
||||
if (!in_same_eqc(x, m)) {
|
||||
expr_ref implyR(ctx.mk_eq_atom(x, m), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -3938,7 +3938,7 @@ void theory_str::process_concat_eq_type5(expr * concatAst1, expr * concatAst2) {
|
|||
expr_ref m_deltaStr(mk_concat(m, m_strutil.mk_string(deltaStr)), mgr);
|
||||
if (!in_same_eqc(x, m_deltaStr)) {
|
||||
expr_ref implyR(ctx.mk_eq_atom(x, m_deltaStr), mgr);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -4156,7 +4156,7 @@ void theory_str::process_concat_eq_type6(expr * concatAst1, expr * concatAst2) {
|
|||
|
||||
expr_ref implyR(mk_or(arrangement_disjunction), mgr);
|
||||
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom( ctx.mk_eq_atom(concatAst1, concatAst2), implyR ), mgr);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
@ -6266,7 +6266,7 @@ void theory_str::solve_concat_eq_str(expr * concat, expr * str) {
|
|||
assert_axiom(negate_ast);
|
||||
} else {
|
||||
implyR1 = mk_or(arrangement_disjunction);
|
||||
if (opt_AssertStrongerArrangements) {
|
||||
if (m_params.m_AssertStrongerArrangements) {
|
||||
expr_ref ax_strong(ctx.mk_eq_atom(implyL, implyR1), m);
|
||||
assert_axiom(ax_strong);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue