summaryrefslogtreecommitdiff
path: root/src/theory/strings/theory_strings.cpp
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2021-11-13 07:17:39 -0800
committerAndres Noetzli <andres.noetzli@gmail.com>2021-11-13 07:21:36 -0800
commit7acdd8db8e71a1dcd1ab6f935ea3efeacabe9363 (patch)
tree1ddc3292cc4ae69a3f6c97418688af6277b7ee39 /src/theory/strings/theory_strings.cpp
parente10051079bc5a12e23f0d87447f29f0d3c6622cb (diff)
Skip `str.code` inferences for sequence eqcs
Fixes https://github.com/cvc5/cvc5-projects/issues/340. Type checking failed because cvc5 was trying to construct a term `(str.to_code (seq.unit false))`. We do not allow the construction of terms `(str.to_code t)` where `t` is not of type string. This commit fixes the issue by skipping sequence equivalence classes when doing inferences related to `str.to_code`. Note that the regression test is slightly different from the original unit test. It asserts that the index passed to `seq.nth` is non-negative, which ensures that we can check the resulting model. I have checked that the modified regression test triggers the issue before the change in this commit.
Diffstat (limited to 'src/theory/strings/theory_strings.cpp')
-rw-r--r--src/theory/strings/theory_strings.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index 8324e3edb..ed00758a8 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -877,7 +877,7 @@ void TheoryStrings::computeCareGraph(){
void TheoryStrings::checkRegisterTermsPreNormalForm()
{
- const std::vector<Node>& seqc = d_bsolver.getStringEqc();
+ const std::vector<Node>& seqc = d_bsolver.getStringLikeEqc();
for (const Node& eqc : seqc)
{
eq::EqClassIterator eqc_i = eq::EqClassIterator(eqc, d_equalityEngine);
@@ -906,9 +906,14 @@ void TheoryStrings::checkCodes()
// str.code applied to the proxy variables for each equivalence classes that
// are constants of size one
std::vector<Node> const_codes;
- const std::vector<Node>& seqc = d_bsolver.getStringEqc();
+ const std::vector<Node>& seqc = d_bsolver.getStringLikeEqc();
for (const Node& eqc : seqc)
{
+ if (!eqc.getType().isString())
+ {
+ continue;
+ }
+
NormalForm& nfe = d_csolver.getNormalForm(eqc);
if (nfe.d_nf.size() == 1 && nfe.d_nf[0].isConst())
{
@@ -972,7 +977,7 @@ void TheoryStrings::checkCodes()
void TheoryStrings::checkRegisterTermsNormalForms()
{
- const std::vector<Node>& seqc = d_bsolver.getStringEqc();
+ const std::vector<Node>& seqc = d_bsolver.getStringLikeEqc();
for (const Node& eqc : seqc)
{
NormalForm& nfi = d_csolver.getNormalForm(eqc);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback