diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-03-26 08:37:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 08:37:13 -0500 |
commit | 9523b4248da9764fa14f078659b42085a7fe2654 (patch) | |
tree | fd7e67b9c307b7dd20dd3e43e18049bbc7047034 /src/theory/strings/eqc_info.cpp | |
parent | e7edc09b227af1f58573cf5a636a91674dc2d936 (diff) |
Generalize more string-specific functions (#4152)
Towards theory of sequences.
Note this PR also changes design in core/base solver. Previously I had estimated that we should have separate instances per type for these solvers, but I think it is better to have these classes handle all string-like types simultaneously. This means they should not have a d_type field.
Diffstat (limited to 'src/theory/strings/eqc_info.cpp')
-rw-r--r-- | src/theory/strings/eqc_info.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/theory/strings/eqc_info.cpp b/src/theory/strings/eqc_info.cpp index 4e9b0f8cd..3c0dbc2a7 100644 --- a/src/theory/strings/eqc_info.cpp +++ b/src/theory/strings/eqc_info.cpp @@ -15,6 +15,7 @@ #include "theory/strings/eqc_info.h" #include "theory/strings/theory_strings_utils.h" +#include "theory/strings/word.h" using namespace std; using namespace CVC4::context; @@ -59,10 +60,8 @@ Node EqcInfo::addEndpointConst(Node t, Node c, bool isSuf) Assert(!t.isConst() || !prev.isConst()); Trace("strings-eager-pconf-debug") << "Check conflict constants " << prevC << ", " << c << std::endl; - const String& ps = prevC.getConst<String>(); - const String& cs = c.getConst<String>(); - unsigned pvs = ps.size(); - unsigned cvs = cs.size(); + size_t pvs = Word::getLength(prevC); + size_t cvs = Word::getLength(c); if (pvs == cvs || (pvs > cvs && t.isConst()) || (cvs > pvs && prev.isConst())) { @@ -73,15 +72,15 @@ Node EqcInfo::addEndpointConst(Node t, Node c, bool isSuf) } else { - const String& larges = pvs > cvs ? ps : cs; - const String& smalls = pvs > cvs ? cs : ps; + Node larges = pvs > cvs ? prevC : c; + Node smalls = pvs > cvs ? c : prevC; if (isSuf) { - conflict = !larges.hasSuffix(smalls); + conflict = !Word::hasSuffix(larges, smalls); } else { - conflict = !larges.hasPrefix(smalls); + conflict = !Word::hasPrefix(larges, smalls); } } if (!conflict && (pvs > cvs || prev.isConst())) |