summaryrefslogtreecommitdiff
path: root/src/theory/strings
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2019-09-27 15:01:42 -0500
committerGitHub <noreply@github.com>2019-09-27 15:01:42 -0500
commitb2447df23d473184a7881ead02aa0b1e8f547d53 (patch)
tree16bd315ee3358bd857ad4cb6cb910be46990fe6f /src/theory/strings
parent6c878c1cf54620b10bac95e5765d0d03bf718f5c (diff)
Fix case of disjunctive conclusion in strings (#3254)
Diffstat (limited to 'src/theory/strings')
-rw-r--r--src/theory/strings/inference_manager.cpp3
-rw-r--r--src/theory/strings/theory_strings.cpp53
2 files changed, 31 insertions, 25 deletions
diff --git a/src/theory/strings/inference_manager.cpp b/src/theory/strings/inference_manager.cpp
index 97f9666bd..56a46eed5 100644
--- a/src/theory/strings/inference_manager.cpp
+++ b/src/theory/strings/inference_manager.cpp
@@ -123,8 +123,9 @@ void InferenceManager::sendInference(const std::vector<Node>& exp,
{
return;
}
+ Node atom = eq.getKind() == NOT ? eq[0] : eq;
// check if we should send a lemma or an inference
- if (asLemma || eq == d_false || eq.getKind() == OR || !exp_n.empty()
+ if (asLemma || atom == d_false || atom.getKind() == OR || !exp_n.empty()
|| options::stringInferAsLemmas())
{
Node eq_exp;
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index fafff1412..caaded4c3 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -2069,32 +2069,37 @@ void TheoryStrings::checkExtfInference( Node n, Node nr, ExtfInfoTmp& in, int ef
i++)
{
Node onr = d_extf_info_tmp[nr[0]].d_ctn[opol][i];
- Node conc =
+ Node concOrig =
nm->mkNode(STRING_STRCTN, pol ? nr[1] : onr, pol ? onr : nr[1]);
- conc = Rewriter::rewrite(conc);
- conc = conc.negate();
- bool do_infer = false;
- bool pol = conc.getKind() != NOT;
- Node lit = pol ? conc : conc[0];
- if (lit.getKind() == EQUAL)
+ Node conc = Rewriter::rewrite(concOrig);
+ // For termination concerns, we only do the inference if the contains
+ // does not rewrite (and thus does not introduce new terms).
+ if (conc == concOrig)
{
- do_infer = pol ? !areEqual(lit[0], lit[1])
- : !areDisequal(lit[0], lit[1]);
- }
- else
- {
- do_infer = !areEqual(lit, pol ? d_true : d_false);
- }
- if (do_infer)
- {
- std::vector<Node> exp_c;
- exp_c.insert(exp_c.end(), in.d_exp.begin(), in.d_exp.end());
- Node ofrom = d_extf_info_tmp[nr[0]].d_ctn_from[opol][i];
- Assert(d_extf_info_tmp.find(ofrom) != d_extf_info_tmp.end());
- exp_c.insert(exp_c.end(),
- d_extf_info_tmp[ofrom].d_exp.begin(),
- d_extf_info_tmp[ofrom].d_exp.end());
- d_im.sendInference(exp_c, conc, "CTN_Trans");
+ bool do_infer = false;
+ conc = conc.negate();
+ bool pol = conc.getKind() != NOT;
+ Node lit = pol ? conc : conc[0];
+ if (lit.getKind() == EQUAL)
+ {
+ do_infer = pol ? !areEqual(lit[0], lit[1])
+ : !areDisequal(lit[0], lit[1]);
+ }
+ else
+ {
+ do_infer = !areEqual(lit, pol ? d_true : d_false);
+ }
+ if (do_infer)
+ {
+ std::vector<Node> exp_c;
+ exp_c.insert(exp_c.end(), in.d_exp.begin(), in.d_exp.end());
+ Node ofrom = d_extf_info_tmp[nr[0]].d_ctn_from[opol][i];
+ Assert(d_extf_info_tmp.find(ofrom) != d_extf_info_tmp.end());
+ exp_c.insert(exp_c.end(),
+ d_extf_info_tmp[ofrom].d_exp.begin(),
+ d_extf_info_tmp[ofrom].d_exp.end());
+ d_im.sendInference(exp_c, conc, "CTN_Trans");
+ }
}
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback