summaryrefslogtreecommitdiff
path: root/src/theory/strings/theory_strings.cpp
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2021-11-13 12:24:44 -0800
committerGitHub <noreply@github.com>2021-11-13 20:24:44 +0000
commitf5b8f74ec2f7297cd54e19459f039416df67f862 (patch)
tree1efe1609302ef1d669c0bb377585088de869a6fa /src/theory/strings/theory_strings.cpp
parent805205a2047eeae7842b1c534859b52fa204ee0e (diff)
Skip `str.code` inferences for sequence eqcs (#7644)
Fixes cvc5/cvc5-projects#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