Make 256 the default cardinality for strings (#1783)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Mon, 16 Apr 2018 17:12:24 +0000 (12:12 -0500)
committerGitHub <noreply@github.com>
Mon, 16 Apr 2018 17:12:24 +0000 (12:12 -0500)
src/options/strings_options.toml
src/theory/strings/regexp_operation.cpp
src/theory/strings/theory_strings.cpp
src/theory/strings/theory_strings_type_rules.h

index 06edb53edbec9c89fb08ae990b571fa9fc66585c..a6e7aa41253c5bf3e7ef8d723e798b17befee443 100644 (file)
@@ -22,14 +22,13 @@ header = "options/strings_options.h"
   help       = "the strategy of LB rule application: 0-lazy, 1-eager, 2-no"
 
 [[option]]
-  name       = "stdASCII"
+  name       = "stdPrintASCII"
   category   = "regular"
-  long       = "strings-std-ascii"
+  long       = "strings-print-ascii"
   type       = "bool"
-  default    = "true"
-  predicates = ["unsignedLessEqual2"]
+  default    = "false"
   read_only  = true
-  help       = "the alphabet contains only characters from the standard ASCII or the extended one"
+  help       = "the alphabet contains only printable characters from the standard extended ASCII"
 
 [[option]]
   name       = "stringFMF"
index a8fd087921b6ec5306bdd9c2a04620fac0fde7b1..f9db441020cb46e50cf86c419c381f8f79e013a5 100644 (file)
@@ -24,7 +24,7 @@ namespace theory {
 namespace strings {
 
 RegExpOpr::RegExpOpr()
-    : d_lastchar(options::stdASCII() ? '\x7f' : '\xff'),
+    : d_lastchar(options::stdPrintASCII() ? '\x7f' : '\xff'),
       d_emptyString(NodeManager::currentNM()->mkConst(::CVC4::String(""))),
       d_true(NodeManager::currentNM()->mkConst(true)),
       d_false(NodeManager::currentNM()->mkConst(false)),
@@ -39,8 +39,9 @@ RegExpOpr::RegExpOpr()
       d_char_end(),
       d_sigma(NodeManager::currentNM()->mkNode(kind::REGEXP_SIGMA,
                                                std::vector<Node>{})),
-      d_sigma_star(
-          NodeManager::currentNM()->mkNode(kind::REGEXP_STAR, d_sigma)) {}
+      d_sigma_star(NodeManager::currentNM()->mkNode(kind::REGEXP_STAR, d_sigma))
+{
+}
 
 RegExpOpr::~RegExpOpr() {}
 
index fe6f7ea772f176cd8e4f74ef2706b08a5198d24c..c780caca2229910a082ecbeb6755a5f84a55ae13 100644 (file)
@@ -143,7 +143,11 @@ TheoryStrings::TheoryStrings(context::Context* c, context::UserContext* u,
   d_true = NodeManager::currentNM()->mkConst( true );
   d_false = NodeManager::currentNM()->mkConst( false );
 
-  d_card_size = 128;
+  d_card_size = 256;
+  if (options::stdPrintASCII())
+  {
+    d_card_size = 128;
+  }
 }
 
 TheoryStrings::~TheoryStrings() {
@@ -450,10 +454,6 @@ int TheoryStrings::getReduction( int effort, Node n, Node& nr ) {
 
 void TheoryStrings::presolve() {
   Debug("strings-presolve") << "TheoryStrings::Presolving : get fmf options " << (options::stringFMF() ? "true" : "false") << std::endl;
-
-  if(!options::stdASCII()) {
-    d_card_size = 256;
-  }
 }
 
 
index da1b71fff7f6a78639b9fd3955db8e19432ca6b8..03267abcda26e690bbdd33b9c0b09eac995c2948 100644 (file)
@@ -361,8 +361,12 @@ public:
       if(ch[0] > ch[1]) {
         throw TypeCheckingExceptionPrivate(n, "expecting the first constant is less or equal to the second one in regexp range");
       }
-      if(options::stdASCII() && ch[1] > '\x7f') {
-        throw TypeCheckingExceptionPrivate(n, "expecting standard ASCII characters in regexp range, or please set the option strings-std-ascii to be false");
+      if (options::stdPrintASCII() && ch[1] > '\x7f')
+      {
+        throw TypeCheckingExceptionPrivate(n,
+                                           "expecting standard ASCII "
+                                           "characters in regexp range when "
+                                           "strings-print-ascii is true");
       }
     }
     return nodeManager->regExpType();