diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2017-10-12 13:00:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-12 13:00:12 -0500 |
commit | ebd9c958a0c20e37cc0e1a79be26afd525dd8fb9 (patch) | |
tree | f53a09d9f8cba99173683ae6c43b386b6b057478 | |
parent | 5dd102d4cb7fc8413d6e8f68b0c32c9ef06b1b17 (diff) |
Sygus logics (#1226)
* Allow any smt2 logic to be a sygus logic. Add non-linear SyGuS regressions.
* Minor
* Add case for reals, comment.
* Fix regress1.
-rw-r--r-- | src/parser/smt2/smt2.cpp | 38 | ||||
-rw-r--r-- | test/regress/regress0/sygus/Makefile.am | 3 | ||||
-rw-r--r-- | test/regress/regress0/sygus/nia-max-square-ns.sy | 13 | ||||
-rw-r--r-- | test/regress/regress1/sygus/Makefile.am | 3 | ||||
-rw-r--r-- | test/regress/regress1/sygus/nia-max-square.sy | 21 |
5 files changed, 54 insertions, 24 deletions
diff --git a/src/parser/smt2/smt2.cpp b/src/parser/smt2/smt2.cpp index a186c052e..bc9f2a06f 100644 --- a/src/parser/smt2/smt2.cpp +++ b/src/parser/smt2/smt2.cpp @@ -365,30 +365,13 @@ void Smt2::resetAssertions() { } void Smt2::setLogic(std::string name) { + if(sygus()) { - // sygus by default requires UF, datatypes, and LIA + // non-smt2-standard sygus logic names go here (http://sygus.seas.upenn.edu/files/sygus.pdf Section 3.2) if(name == "Arrays") { - name = "AUFDTLIA"; - } else if(name == "Reals") { - name = "UFDTLIRA"; - } else if(name == "LIA") { - name = "UFDTLIA"; - } else if(name == "LRA") { - name = "UFDTLIRA"; - } else if(name == "LIRA") { - name = "UFDTLIRA"; - } else if(name == "BV") { - name = "UFDTBVLIA"; - } else if(name == "SLIA") { - name = "UFDTSLIA"; - } else if(name == "SAT") { - name = "UFDTLIA"; - } else if(name == "ALL" || name == "ALL_SUPPORTED") { - //no change - } else { - std::stringstream ss; - ss << "Unknown SyGuS background logic `" << name << "'"; - parseError(ss.str()); + name = "A"; + }else if(name == "Reals") { + name = "LRA"; } } @@ -398,6 +381,17 @@ void Smt2::setLogic(std::string name) { } else { d_logic = name; } + + // if sygus is enabled, we must enable UF, datatypes and integer arithmetic + if(sygus()) { + // get unlocked copy, modify, copy and relock + LogicInfo log(d_logic.getUnlockedCopy()); + log.enableTheory(theory::THEORY_UF); + log.enableTheory(theory::THEORY_DATATYPES); + log.enableIntegers(); + d_logic = log; + d_logic.lock(); + } // Core theory belongs to every logic addTheory(THEORY_CORE); diff --git a/test/regress/regress0/sygus/Makefile.am b/test/regress/regress0/sygus/Makefile.am index d8f675af1..a297cee81 100644 --- a/test/regress/regress0/sygus/Makefile.am +++ b/test/regress/regress0/sygus/Makefile.am @@ -64,7 +64,8 @@ TESTS = commutative.sy \ cggmp.sy \ parse-bv-let.sy \ cegar1.sy \ - triv-type-mismatch-si.sy + triv-type-mismatch-si.sy \ + nia-max-square-ns.sy # sygus tests currently taking too long for make regress diff --git a/test/regress/regress0/sygus/nia-max-square-ns.sy b/test/regress/regress0/sygus/nia-max-square-ns.sy new file mode 100644 index 000000000..96baab7fe --- /dev/null +++ b/test/regress/regress0/sygus/nia-max-square-ns.sy @@ -0,0 +1,13 @@ +; EXPECT: unsat +; COMMAND-LINE: --cegqi-si=all --no-dump-synth --nl-ext-tplanes +(set-logic NIA) + +(synth-fun max ((x Int) (y Int)) Int) + +(declare-var x Int) +(declare-var y Int) + +(constraint (>= (max x y) (* x x))) +(constraint (>= (max x y) (* y y))) + +(check-synth) diff --git a/test/regress/regress1/sygus/Makefile.am b/test/regress/regress1/sygus/Makefile.am index f1f1c1342..ed8755236 100644 --- a/test/regress/regress1/sygus/Makefile.am +++ b/test/regress/regress1/sygus/Makefile.am @@ -25,7 +25,8 @@ TESTS = \ inv_gen_n_c11.sy \ unbdd_inv_gen_ex7.sy \ icfp_easy_mt_ite.sy \ - three.sy + three.sy \ + nia-max-square.sy EXTRA_DIST = $(TESTS) diff --git a/test/regress/regress1/sygus/nia-max-square.sy b/test/regress/regress1/sygus/nia-max-square.sy new file mode 100644 index 000000000..5858af98a --- /dev/null +++ b/test/regress/regress1/sygus/nia-max-square.sy @@ -0,0 +1,21 @@ +; EXPECT: unsat +; COMMAND-LINE: --no-dump-synth --nl-ext-tplanes +(set-logic NIA) + +(synth-fun max ((x Int) (y Int)) Int + ((Start Int (0 1 x y + (+ Start Start) + (- Start Start) + (* Start Start) + (ite StartBool Start Start))) + (StartBool Bool ((and StartBool StartBool) + (not StartBool) + (<= Start Start))))) + +(declare-var x Int) +(declare-var y Int) + +(constraint (>= (max x y) (* x x))) +(constraint (>= (max x y) (* y y))) + +(check-synth) |