Add RegLan to smt2/sygus parsers. (#2276)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Tue, 7 Aug 2018 03:39:21 +0000 (22:39 -0500)
committerGitHub <noreply@github.com>
Tue, 7 Aug 2018 03:39:21 +0000 (22:39 -0500)
src/parser/smt2/smt2.cpp
test/regress/Makefile.tests
test/regress/regress1/sygus/simple-regexp.sy [new file with mode: 0644]

index 257ee1171bf0fa10700a7e2a7ba2c03e3e7987d9..a0cc750b303ff74de4374b3b99d73faaabdbc47f 100644 (file)
@@ -287,6 +287,7 @@ void Smt2::addTheory(Theory theory) {
 
   case THEORY_STRINGS:
     defineType("String", getExprManager()->stringType());
+    defineType("RegLan", getExprManager()->regExpType());
     defineType("Int", getExprManager()->integerType());
     addStringOperators();
     break;
index 34855e81ddb10ced04962ad9bdbc3720c7174e38..aec72993c1afe8c22a7f84e5116952ad13421730 100644 (file)
@@ -1544,6 +1544,7 @@ REG1_TESTS = \
        regress1/sygus/process-10-vars.sy \
        regress1/sygus/qe.sy \
        regress1/sygus/real-grammar.sy \
+       regress1/sygus/simple-regexp.sy \
        regress1/sygus/stopwatch-bt.sy \
        regress1/sygus/strings-concat-3-args.sy \
        regress1/sygus/strings-double-rec.sy \
diff --git a/test/regress/regress1/sygus/simple-regexp.sy b/test/regress/regress1/sygus/simple-regexp.sy
new file mode 100644 (file)
index 0000000..b4c248d
--- /dev/null
@@ -0,0 +1,37 @@
+; EXPECT: unsat
+; COMMAND-LINE: --sygus-out=status
+(set-logic SLIA)
+(synth-fun P ((x String)) Bool (
+(Start Bool (
+  (str.in.re StartStr StartRL)
+  ))
+(StartStr String (
+  x
+  (str.++ StartStr StartStr)
+  ))
+(StartStrC String (
+  "A" "B" ""
+  (str.++ StartStrC StartStrC)))
+(StartRL RegLan (
+(re.++ StartRLi StartRLi)
+(re.inter StartRL StartRL)
+(re.union StartRL StartRL)
+(re.* StartRLi)
+))
+(StartRLi RegLan (
+(str.to.re StartStrC)
+(re.inter StartRLi StartRLi)
+(re.union StartRLi StartRLi)
+(re.++ StartRLi StartRLi)
+(re.* StartRLi)
+))
+))
+
+(constraint (P "AAAAA"))
+(constraint (P "AAA"))
+(constraint (P "AA"))
+(constraint (not (P "AB")))
+(constraint (not (P "B")))
+
+; (str.in.re x (re.* (str.to.re "A"))) is a solution
+(check-synth)