summaryrefslogtreecommitdiff
path: root/src/theory/strings/theory_strings.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2018-08-02 14:16:48 -0500
committerAndres Noetzli <andres.noetzli@gmail.com>2018-08-02 12:16:48 -0700
commitbf040e895716b3f38a5ef92e3412e7615d96bc5f (patch)
tree70c932945e3e8e49b8b0c2f052bb61599c97ac56 /src/theory/strings/theory_strings.cpp
parentdb53123fe114732b647f87e6dd6ee756ca43c291 (diff)
Make strings robust to regular expression variables. (#2255)
The theory solver for strings does not support regular expression variables. With this PR, we properly throw an exception if it is given one. However, the rewriter needs to handle regular expression variables (for various reasons: rewriting an expression before its asserted, sygus explanation generalization, etc.). This corrects a few miscellaneous issues in the strings rewriter to make it sound for these cases. It also corrects a seg fault in simpleRegexpConsume when testing memberships `(str.in.re "" R)`, where R is a *non-constant* regular expression (which will now be allowed if variables are allowed). This is in preparation for adding `RegLan` as a token to the smt2/sygus parsers.
Diffstat (limited to 'src/theory/strings/theory_strings.cpp')
-rw-r--r--src/theory/strings/theory_strings.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp
index cb1f006b3..2ce325862 100644
--- a/src/theory/strings/theory_strings.cpp
+++ b/src/theory/strings/theory_strings.cpp
@@ -701,6 +701,8 @@ bool TheoryStrings::collectModelInfo(TheoryModel* m)
void TheoryStrings::preRegisterTerm(TNode n) {
if( d_pregistered_terms_cache.find(n) == d_pregistered_terms_cache.end() ) {
d_pregistered_terms_cache.insert(n);
+ Trace("strings-preregister")
+ << "TheoryString::preregister : " << n << std::endl;
//check for logic exceptions
Kind k = n.getKind();
if( !options::stringExp() ){
@@ -732,6 +734,12 @@ void TheoryStrings::preRegisterTerm(TNode n) {
default: {
registerTerm(n, 0);
TypeNode tn = n.getType();
+ if (tn.isRegExp() && n.isVar())
+ {
+ std::stringstream ss;
+ ss << "Regular expression variables are not supported.";
+ throw LogicException(ss.str());
+ }
if( tn.isString() ) {
// if finite model finding is enabled,
// then we minimize the length of this term if it is a variable
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback