├── .travis.yml ├── project └── assembly.sbt ├── tests ├── concat-empty.smt2 ├── str.to_int.smt2 ├── model-bug.smt2 ├── str.from_int_3.smt2 ├── str.from_int_4.smt2 ├── str.from_int_5.smt2 ├── substring-bug.smt2 ├── str-leq2.smt2 ├── str-leq-reflexive.smt2 ├── str-leq8.smt2 ├── negated-equation-2.smt2 ├── str-leq-reflexive-2.smt2 ├── prefix-1.smt2 ├── str-leq10.smt2 ├── str.from_int_2.smt2 ├── str.to_int_2.smt2 ├── suffix-1.smt2 ├── suffix-5.smt2 ├── contains-1.smt2 ├── contains-2.smt2 ├── contains-3.smt2 ├── str-leq9.smt2 ├── str.to_int_3.smt2 ├── suffix-2.smt2 ├── suffix-3.smt2 ├── negated-equation-1.smt2 ├── str-leq.smt2 ├── str-leq4.smt2 ├── str-leq6.smt2 ├── str-leq7.smt2 ├── substring-bug3.smt2 ├── parse-ecma-bug2.smt2 ├── str-leq13.smt2 ├── str-leq3.smt2 ├── str-leq5.smt2 ├── str-leq14.smt2 ├── str.at.smt2 ├── str.from_int.smt2 ├── parse-regex-lookahead2.smt2 ├── prefix-2.smt2 ├── str.to_int_4.smt2 ├── suffix-4.smt2 ├── is-digit.smt2 ├── str-leq11.smt2 ├── str-leq12.smt2 ├── str-lt.smt2 ├── str-lt2.smt2 ├── anchor-2.smt2 ├── str.to_int_5.smt2 ├── subsumption.smt2 ├── subsumption2.smt2 ├── chars2.smt2 ├── parse-regex2.smt2 ├── parse-regex4.smt2 ├── str.at-3.smt2 ├── yan-benchmarks │ ├── concat-006.smt2 │ ├── concat-008.smt2 │ ├── concat-009.smt2 │ ├── concat-010.smt2 │ ├── concat-007.smt2 │ ├── regex-001.smt2 │ ├── regex-003.smt2 │ ├── concat-002.smt2 │ ├── equal-001.smt2 │ ├── regex-002-unsat.smt2 │ ├── regex-006.smt2 │ ├── regex-005-unsat.smt2 │ ├── concat-004-unsat.smt2 │ ├── regex-004-unsat.smt2 │ ├── concat-005-unsat.smt2 │ ├── concat-003.smt2 │ ├── replaceAll-003.smt2 │ ├── concat-001.smt2 │ ├── replaceAll-024.smt2 │ ├── replaceAll-011.smt2 │ ├── replaceAll-002.smt2 │ ├── replaceAll-014.smt2 │ ├── replaceAll-025.smt2 │ ├── replaceAll-004.smt2 │ ├── replaceAll-005.smt2 │ ├── replaceAll-021.smt2 │ ├── replaceAll-008.smt2 │ ├── replaceAll-019.smt2 │ ├── replaceAll-007.smt2 │ ├── replaceAll-016.smt2 │ ├── replaceAll-010.smt2 │ ├── replaceAll-009.smt2 │ ├── replaceAll-013.smt2 │ ├── replaceAll-001.smt2 │ ├── replaceAll-012.smt2 │ ├── replaceAll-015.smt2 │ ├── replaceAll-022.smt2 │ ├── replaceAll-023.smt2 │ ├── replaceAll-018.smt2 │ ├── replaceAll-020.smt2 │ ├── replaceAll-006.smt2 │ └── replaceAll-017.smt2 ├── automata.smt2 ├── parse-regex-lookahead2b.smt2 ├── bug-58-replace-re.smt2 ├── parse-regex-lookahead3.smt2 ├── str_in_re_translation.smt2 ├── test-replace-regex3.smt2 ├── hu-benchmarks │ ├── replace_empty_string.smt2 │ ├── replace_shortest_sat.smt2 │ ├── length_sat.smt2 │ ├── replace_longest_unsat.smt2 │ ├── str_to_int_sat.smt2 │ ├── bug-58-replace-re.smt2 │ ├── replace-length.smt2 │ ├── bug-56-replace-bug2.smt2 │ ├── slow-little.smt2 │ ├── replace_all-bug.smt2 │ ├── indexof_const_startpos_sat.smt2 │ ├── indexof_empty_sat.smt2 │ ├── indexof_var_sat.smt2 │ ├── indexof_const_startpos_unsat.smt2 │ ├── indexof_var_unsat.smt2 │ ├── replace-length-2.smt2 │ ├── regex_counting_unsat.smt2 │ ├── indexof_empty_sat2.smt2 │ ├── indexof_const_index_sat.smt2 │ ├── indexof_empty_unsat.smt2 │ ├── indexof_const_index_unsat.smt2 │ ├── substr_var_sat.smt2 │ ├── substr_const_len_sat.smt2 │ ├── substr_empty_sat.smt2 │ ├── substr_var_unsat.smt2 │ ├── substr_const_begin_sat.smt2 │ ├── substr_const_len_unsat.smt2 │ ├── substr_const_begin_unsat.smt2 │ ├── substr_empty_unsat.smt2 │ ├── concat_sat.smt2 │ ├── concat_unsat.smt2 │ ├── loopCountMotivation.smt2 │ └── bigSubstrIdx.smt2 ├── test-replace-regex4.smt2 ├── brackets-regex.smt2 ├── indexof.smt2 ├── str.at-2.smt2 ├── simple-replace-1e.smt2 ├── simple-replace.smt2 ├── name-regex.smt2 ├── parse-ecma-bug1.smt2 ├── parse-regex-lookahead3b.smt2 ├── indexof-6.smt2 ├── is-digit-2.smt2 ├── failedProp2.smt2 ├── prefix-suffix.smt2 ├── str.at-3b.smt2 ├── case-insensitive-2.smt2 ├── parse-regex2b.smt2 ├── simple-replace-1b.smt2 ├── parse-ecma-cases-3.smt2 ├── parse-regex-lookahead4.smt2 ├── indexof-3.smt2 ├── simple-replace-1d.smt2 ├── indexof-4.smt2 ├── parse-regex3.smt2 ├── simple-replace-1f.smt2 ├── simple-replace-1g.smt2 ├── indexof-5.smt2 ├── replace-length.smt2 ├── simple-replace-1c.smt2 ├── parse-regex-lookahead.smt2 ├── regex_cg_4.smt2 ├── contains-4.smt2 ├── monadic-length.smt2 ├── contains-5.smt2 ├── indexof-2.smt2 ├── test-reverse.smt2 ├── test-reverse2.smt2 ├── contains-6.smt2 ├── bug-56-replace-bug2.smt2 ├── case-insensitive.smt2 ├── loop2.smt2 ├── parse-regex.smt2 ├── nonlinear-2.smt2 ├── nonlinear.smt2 ├── minimize-problem.smt2 ├── null-problem.smt2 ├── simple-cycle.smt2 ├── substring.smt2 ├── replace-bug.smt2 ├── simple-replace-5.smt2 ├── escapeSequences-1b.smt2 ├── str.from_int_6.smt2 ├── str.to_int_6.smt2 ├── temp-prop │ ├── word-equation-6-copy.smt2 │ ├── word-equation-6.smt2 │ ├── noodles-unsat7.smt2 │ ├── 03_track_11.smt2 │ ├── noodles-unsat6.smt2 │ ├── noodles-unsat10.smt2 │ ├── noodles-unsat8.smt2 │ ├── noodles-unsat9.smt2 │ ├── 03_track_10.smt2 │ ├── word-equation-6-regex.smt2 │ ├── 03_track_1.smt2 │ └── nikolai-sat.smt2 ├── word-equation-4.smt2 ├── word-equation.smt2 ├── escapeSequences-1a.smt2 ├── propagation.smt2 ├── simple-replace-2.smt2 ├── simple-replace-2d.smt2 ├── empty-concat.smt2 ├── euf.smt2 ├── word-equation-2.smt2 ├── simple-cycle2.smt2 ├── str.at-bug.smt2 ├── parse-ecma-groups.smt2 ├── word-equation-6.smt2 ├── substring2.smt2 ├── substring2b.smt2 ├── test-replace2.smt2 ├── chars3.smt2 ├── regex_cg.smt2 ├── test-replace-word.smt2 ├── test-replace-word2.smt2 ├── contains-8.smt2 ├── email-regex.smt2 ├── js-semantics.smt2 ├── len-bug.smt2 ├── replace-length-2.smt2 ├── test-replace.smt2 ├── contains-7.smt2 ├── prefix3.smt2 ├── extract-cg.smt2 ├── extract-cg2.smt2 ├── test-replace-regex.smt2 ├── test-replace-regex2.smt2 ├── loop-cg.smt2 ├── parse-regex-incremental.smt2 ├── regex_cg_2.smt2 ├── concat-regex.smt2 ├── simple-replace-2c.smt2 ├── norn-benchmark-9k.smt2 ├── concat-regex2.smt2 ├── extract-cg4.smt2 ├── norn-benchmark-9g.smt2 ├── simple-cvc-smtlib-b.smt2 ├── simple-cvc-smtlib.smt2 ├── simple-replace-3b.smt2 ├── str.at-3c.smt2 ├── simple-replace-3.smt2 ├── loop-cg2.smt2 ├── prefix.smt2 ├── extract-cg3.smt2 ├── prefix2.smt2 ├── epsilon-2.smt2 ├── simple-cvc-smtlib-c.smt2 ├── parse-ecma-replace.smt2 ├── simple-replace-4c.smt2 ├── simple-replace-2b.smt2 ├── simple-replace-4.smt2 ├── simple-replace-4b.smt2 ├── norn-benchmark-9.smt2 ├── norn-benchmark-9c.smt2 ├── norn-benchmark-9e.smt2 ├── norn-benchmark-9b.smt2 ├── regex_cg_6.smt2 ├── propagation-benchmarks │ ├── parikh.smt2 │ ├── cyclic-xy.smt2 │ ├── noodles-unsat4.smt2 │ ├── noodles-unsat5.smt2 │ ├── noodles-unsat.smt2 │ ├── noodles-unsat2.smt2 │ ├── artur-unsat-we.smt2 │ ├── noodles-unsat3.smt2 │ ├── artur-unsat-common-prefix.smt2 │ ├── artur-unsat.smt2 │ └── nikolai-unsat.smt2 ├── norn-benchmark-9h.smt2 ├── automata-bwd.smt2 ├── norn-benchmark-9f.smt2 ├── loop-cg3.smt2 ├── non-greedy-quantifiers.smt2 ├── norn-benchmark-9d.smt2 ├── concat-regex3.smt2 ├── anchor-5.smt2 ├── parikh-constraints.smt2 ├── norn-benchmark-9j.smt2 ├── norn-benchmark-9i.smt2 ├── anchor-1.smt2 ├── no-regexes.smt2 ├── regex_cg_ref3.smt2 ├── anchor-8.smt2 ├── regex_cg_ref2.smt2 ├── chars.smt2 ├── empty-union.smt2 ├── membership_427.smt2 ├── anchor-4.smt2 ├── anchor-7.smt2 ├── anchor-double.smt2 ├── adt.smt2 ├── adt2.smt2 ├── anchor-3.smt2 ├── anchor-6.smt2 ├── parse-ecma-cases-2.smt2 ├── failedProp.smt2 ├── replace-special.smt2 ├── transducer2b.smt2 ├── transducer2c.smt2 ├── transducer2.smt2 ├── transducer2d.smt2 ├── replace-special-2.smt2 ├── str-term-small-rw_186.smt2 ├── anchor-alternate.smt2 ├── replace-special-3.smt2 ├── replace-special-4.smt2 ├── replace-special-5.smt2 ├── str-term-small-rw_164.smt2 ├── cvc_replace_28.smt2 ├── simple-concat.smt2 ├── simple-concat-2.smt2 ├── simple-concat-4.smt2 ├── simple-concat-4b.smt2 ├── simple-concat-5.smt2 ├── simple-concat-5b.smt2 ├── simple-concat-3.smt2 ├── test-replace3.smt2 ├── test-replace4.smt2 ├── cg-star.smt2 ├── regex_cg_ref.smt2 ├── substring-bug2.smt2 ├── epsilon-3.smt2 ├── regex_cg_3.smt2 ├── regex_cg_5.smt2 ├── epsilon-1.smt2 ├── concat-regex4.smt2 ├── loop.smt2 ├── priorityTransducer.smt2 ├── priorityTransducer2.smt2 ├── pcp-1.smt2 ├── transducer1b.smt2 ├── priorityTransducer3.smt2 ├── priorityTransducer4.smt2 ├── transducer1.smt2 ├── regex_cg_ref4.smt2 ├── transducer1c.smt2 ├── cvc_replace_185.smt2 ├── extract-1.smt2 ├── extract-1b.smt2 └── extract-1c.smt2 ├── ecma2020 └── ecma2020-regex-parser.jar ├── .gitignore ├── .github └── workflows │ └── scala.yml ├── AUTHORS ├── src ├── test │ └── scala │ │ └── ostrich │ │ └── preop │ │ ├── ConcatPreOpSpecification.scala │ │ └── NOPPreOpSpecification.scala └── main │ └── scala │ └── ostrich │ └── cesolver │ ├── preprocess │ └── CEPredtoEqConverter.scala │ ├── preop │ └── CEPreOp.scala │ └── util │ └── Exception.scala ├── ostrich └── LICENSE /.travis.yml: -------------------------------------------------------------------------------- 1 | language: scala 2 | scala: 3 | - 2.11.12 4 | - 2.12.10 5 | 6 | -------------------------------------------------------------------------------- /project/assembly.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5") 2 | -------------------------------------------------------------------------------- /tests/concat-empty.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (assert (not (= a (str.++ a "")))) 3 | (check-sat) 4 | -------------------------------------------------------------------------------- /tests/str.to_int.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | 4 | (assert (= w (str.to.int "42"))) 5 | (check-sat) 6 | -------------------------------------------------------------------------------- /tests/model-bug.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const x String) 3 | (assert (not (= x ""))) 4 | (check-sat) 5 | (get-model) 6 | -------------------------------------------------------------------------------- /ecma2020/ecma2020-regex-parser.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uuverifiers/ostrich/HEAD/ecma2020/ecma2020-regex-parser.jar -------------------------------------------------------------------------------- /tests/str.from_int_3.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | 4 | (assert (= "123" (str.from_int w))) 5 | 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.from_int_4.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | 4 | (assert (= "123a" (str.from_int w))) 5 | 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.from_int_5.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | 4 | (assert (= "0" (str.from_int w))) 5 | 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/substring-bug.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (assert (= (str.len (str.substr a 0 (- 1))) 0)) 3 | (check-sat) 4 | -------------------------------------------------------------------------------- /tests/str-leq2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (str.<= x "")) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str-leq-reflexive.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (assert (str.<= "a" "b")) 4 | (assert (str.<= "a" "a")) 5 | (check-sat) 6 | -------------------------------------------------------------------------------- /tests/str-leq8.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (str.<= "cba" "cab")) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/negated-equation-2.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (assert (distinct (str.at (str.++ "A" x) 1) (str.at x 0))) 3 | (check-sat) 4 | -------------------------------------------------------------------------------- /tests/str-leq-reflexive-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (assert (str.<= "abc" "abd")) 4 | (assert (str.<= "abc" "abc")) 5 | (check-sat) 6 | -------------------------------------------------------------------------------- /tests/prefix-1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.prefixof x x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq10.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (= "abc" x)) 5 | (assert (str.<= "b" x)) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.from_int_2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | 4 | (assert (= w (int.to.str (- 42)))) 5 | (assert (not (= w ""))) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.to_int_2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | 4 | (assert (= w (str.to.int "-42"))) 5 | (assert (not (= w (- 1)))) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/suffix-1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.suffixof x x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/suffix-5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.suffixof "" x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/contains-1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.contains "A" x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/contains-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.contains x "A") true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/contains-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.contains x x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq9.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (= 1 (str.len x))) 5 | (assert (str.<= "" x)) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.to_int_3.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | 4 | (assert (= 42 (str.to.int w))) 5 | (assert (= (str.len w) 5)) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/suffix-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.suffixof x "A") true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/suffix-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (= (str.suffixof "A" x) true))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/negated-equation-1.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (assert (not (= (str.at a 0) (str.at "" 0)))) 3 | (assert (= (str.len a) 0)) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/str-leq.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= 1 (str.len x))) 6 | (assert (str.<= x "")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= x "cbaa")) 6 | (assert (str.<= x "cba")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq6.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= x "cab")) 6 | (assert (str.<= x "cba")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq7.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (= 1 (str.len x))) 5 | (assert (str.<= "cba" x)) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/substring-bug3.smt2: -------------------------------------------------------------------------------- 1 | ; Problem for which OSTRICH previously incorrectly reported unsat 2 | 3 | (assert (= "" (str.substr "" 1 0))) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/parse-ecma-bug2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | (assert (str.in.re w (re.from_ecma2020 '^[-a]'))) 4 | 5 | (assert (= w "")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq13.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | 6 | (assert (str.<= x y)) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/str-leq3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= 1 (str.len x))) 6 | (assert (str.<= x "cba")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= 4 (str.len x))) 6 | (assert (str.<= x "cba")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq14.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (str.in.re x (str.to.re "a"))) 5 | (assert (str.<= "abc" x)) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/str.at.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (= (str.at x 2) "x")) 6 | (assert (= (str.at x 3) "y")) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/str.from_int.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | 4 | (assert (= w (int.to.str 42))) 5 | (assert (str.in_re w (re.* (re.range "2" "4")))) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead2.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$"))) 4 | 5 | (check-sat) -------------------------------------------------------------------------------- /tests/prefix-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (not (= (str.prefixof x y) true))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/str.to_int_4.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | 4 | (assert (= (- 1) (str.to.int w))) 5 | (assert (str.in_re w (re.+ (re.range "0" "9")))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/suffix-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (not (= (str.suffixof x y) true))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/is-digit.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun x () String) 5 | 6 | (assert (str.is_digit x)) 7 | 8 | (check-sat) 9 | (get-model) 10 | 11 | -------------------------------------------------------------------------------- /tests/str-leq11.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (= 1 (str.len x))) 5 | (assert (str.<= "a" x)) 6 | (assert (str.<= x "c")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-leq12.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (assert (= 1 (str.len x))) 5 | (assert (str.<= "a" x)) 6 | (assert (str.<= x "b")) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/str-lt.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= 1 (str.len x))) 6 | (assert (str.< "A" x)) 7 | (assert (str.< x "C")) 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/str-lt2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (= 1 (str.len x))) 6 | (assert (str.< "A" x)) 7 | (assert (str.< x "B")) 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/anchor-2.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w 6 | (re.++ re.begin-anchor (re.+ (re.range "a" "z")) re.end-anchor))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/str.to_int_5.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | 4 | (assert (= (str.to_int (str.substr w 0 10)) 123)) 5 | (assert (= (str.to_int (str.substr w 10 10)) 321)) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/subsumption.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in_re w (re.* (str.to_re "abc")))) 6 | (assert (str.in_re w (re.+ (str.to_re "abc")))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/subsumption2.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in_re w (re.* (str.to_re "abc")))) 6 | (assert (str.in_re w (re.+ (str.to_re "abcd")))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/chars2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_) 2 | 3 | (declare-fun x () String) 4 | 5 | (assert (str.in.re x (re.range (str.from_code (bv2nat #x0b)) (str.from_code (bv2nat #xff))))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/parse-regex2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "[\+]\d{2}[\(]\d{2}[\)]\d{4}[\-]\d{4}"))) 6 | 7 | (check-sat) 8 | (get-model) 9 | -------------------------------------------------------------------------------- /tests/parse-regex4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"))) 6 | 7 | (check-sat) 8 | (get-model) 9 | -------------------------------------------------------------------------------- /tests/str.at-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (= (str.at x (- (str.len x) 1)) "x")) 6 | (assert (= (str.at x (- (str.len x) 2)) "y")) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-006.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun z () String) 4 | 5 | (assert (= (str.++ "test" a) "testhello")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/automata.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (assert (= x "ab")) 3 | (assert (str.in.re x (re.from_automaton "automaton value_0 {init s0; s0 -> s1 [0, 100]; s1 -> s1 [0, 65535];accepting s1;};"))) 4 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead2b.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$"))) 4 | (assert (str.contains w " ")) 5 | 6 | (check-sat) -------------------------------------------------------------------------------- /tests/bug-58-replace-re.smt2: -------------------------------------------------------------------------------- 1 | (define-fun sigmaStar_048 () String "Ajavascript:") 2 | (define-fun x_7 () String "javascript:") 3 | (assert (= x_7 (str.replace_re sigmaStar_048 re.allchar "") ) ) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead3.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "(?=.*[\d\W])(?![.\n])(?=.*[A-Z])(?=.*[a-z]).{8,}$"))) 4 | (assert (str.contains w "z")) 5 | 6 | (check-sat) -------------------------------------------------------------------------------- /tests/str_in_re_translation.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const R RegLan) 4 | (declare-const x String) 5 | 6 | (assert (= R (re.* (re.range "a" "z")))) 7 | (assert (str.in_re x R)) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/test-replace-regex3.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (assert (= b (str.replace_re a (re.* re.allchar) ""))) 6 | (assert (distinct b "")) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace_empty_string.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | 3 | (assert (= "hhhh" (str.replace_re x (re.* (str.to_re "h")) "hhh"))) 4 | (assert (= 1 (str.len x))) 5 | 6 | (check-sat) 7 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace_shortest_sat.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | 3 | (assert (= "hhhh" (str.replace_re x (re.+ (str.to_re "h")) "hhh"))) 4 | (assert (= 2 (str.len x))) 5 | 6 | (check-sat) 7 | (get-model) -------------------------------------------------------------------------------- /tests/test-replace-regex4.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (assert (= b (str.replace_re_longest a (re.* re.allchar) ""))) 6 | (assert (distinct b "")) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-008.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun z () String) 4 | 5 | (assert (= (str.++ (str.++ "test" a) "num") "testhellonum")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-009.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun z () String) 4 | 5 | (assert (= (str.++ (str.++ a "hello") "num") "testhellonum")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-010.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun z () String) 4 | 5 | (assert (= (str.++ "test" (str.++ a "num") ) "testhellonum")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/brackets-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str ""))) 6 | (assert (str.in.re w (re.from.str "[<>X].*"))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/length_sat.smt2: -------------------------------------------------------------------------------- 1 | ; sat 2 | (declare-fun x ()String) 3 | 4 | (declare-const len_x Int) 5 | 6 | (assert (= len_x (str.len x))) 7 | (assert (< 1 len_x)) 8 | 9 | 10 | (check-sat) 11 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace_longest_unsat.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | 3 | (assert (= "hhhh" (str.replace_re_longest x (re.+ (str.to_re "h")) "hhh"))) 4 | (assert (= 2 (str.len x))) 5 | 6 | (check-sat) 7 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/str_to_int_sat.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w Int) 3 | (declare-const x String) 4 | 5 | (assert (= w (str.to.int x))) 6 | (assert (str.in_re x (re.+ (str.to_re "4")))) 7 | (check-sat) 8 | (get-model) 9 | -------------------------------------------------------------------------------- /tests/indexof.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun n () Int) 7 | 8 | (assert (= (str.indexof x0 "===" 0) n)) 9 | (assert (> n 0)) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/str.at-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (= (str.at x 2) "x")) 6 | (assert (= (str.at x 3) "y")) 7 | (assert (not (str.contains x "xy"))) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-007.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun z () String) 4 | 5 | (assert (= (str.++ "test" (str.++ "hello" a) ) "testhellonum")) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-001.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | 4 | 5 | (assert (= x "")) 6 | (assert (str.in.re x (re.* (str.to.re "ced") ) ) ) 7 | 8 | (check-sat) 9 | 10 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/bug-58-replace-re.smt2: -------------------------------------------------------------------------------- 1 | (define-fun sigmaStar_048 () String "Ajavascript:") 2 | (define-fun x_7 () String "javascript:") 3 | (assert (= x_7 (str.replace_re sigmaStar_048 re.allchar "") ) ) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/simple-replace-1e.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replace "HelloWorld" "e" "a"))) 7 | 8 | (check-sat) 9 | (get-model) 10 | -------------------------------------------------------------------------------- /tests/simple-replace.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replaceall "HelloWorld" "e" "a"))) 7 | 8 | (check-sat) 9 | (get-model) 10 | -------------------------------------------------------------------------------- /tests/name-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "^[a-z\d\.]{5,}$"))) 6 | 7 | ; inconsistent 8 | (assert (str.contains w "]")) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/parse-ecma-bug1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (set-option :produce-models true) 4 | 5 | (declare-const w String) 6 | 7 | (assert (str.in.re w (re.from_ecma2020 '[\)]'))) 8 | 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead3b.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "(?=.*[\d\W])(?![.\n])(?=.*[A-Z])(?=.*[a-z]).{8,}$"))) 4 | (assert (str.in.re w (re.* (re.range "a" "z")))) 5 | 6 | (check-sat) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bloop/ 2 | /.metals/ 3 | /target/ 4 | *.swo 5 | *.swp 6 | /.bsp 7 | # More metals ignores 8 | /project/.bloop/ 9 | /project/metals.sbt 10 | /project/project 11 | /project/target 12 | /project/build.properties 13 | -------------------------------------------------------------------------------- /tests/indexof-6.smt2: -------------------------------------------------------------------------------- 1 | ; UNSAT 2 | 3 | (set-option :print-success false) 4 | (set-logic QF_SLIA) 5 | 6 | (define-fun y () String "\u{0}\u{0}?#") 7 | 8 | (assert (> 0 (str.indexof y "#" 2))) 9 | 10 | (check-sat) 11 | (exit) 12 | -------------------------------------------------------------------------------- /tests/is-digit-2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun x () String) 5 | 6 | (assert (str.is_digit (str.at x 1))) 7 | (assert (str.is_digit (str.at x 2))) 8 | 9 | (check-sat) 10 | (get-model) 11 | 12 | -------------------------------------------------------------------------------- /tests/failedProp2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () Int) 6 | 7 | (assert (not (= (str.suffixof x (str.at x 1)) (= x "")))) 8 | (check-sat) 9 | (exit) 10 | -------------------------------------------------------------------------------- /tests/prefix-suffix.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; UNSAT 4 | 5 | (declare-fun a () String) 6 | (declare-fun b () String) 7 | 8 | (assert (not (=> (and (str.prefixof a b) (str.suffixof b a)) (= a b)))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/str.at-3b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (= (str.at x (- (str.len x) 1)) "x")) 6 | (assert (= (str.at x (- (str.len x) 2)) "y")) 7 | (assert (< (str.len x) 2)) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-003.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | 3 | 4 | (assert (= x "cdeabcdcde")) 5 | (assert (str.in.re x (re.* (re.union (str.to.re "abcd") (str.to.re "cde") ) ) ) ) 6 | 7 | 8 | 9 | (check-sat) 10 | 11 | -------------------------------------------------------------------------------- /tests/case-insensitive-2.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in_re w (re.case_insensitive (re.from_ecma2020 '[a-c]+')))) 6 | (assert (str.in_re w (re.case_insensitive (re.from_ecma2020 '[d-f]+')))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/parse-regex2b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "[\+]\d{2}[\(]\d{2}[\)]\d{4}[\-]\d{4}"))) 6 | (assert (str.contains w "a")) 7 | 8 | (check-sat) 9 | (get-model) 10 | -------------------------------------------------------------------------------- /tests/simple-replace-1b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replaceall "HelloWorld" "e" "a"))) 7 | (assert (= x_7 "HolloWorld")) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-002.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y1 () String) 3 | (declare-fun y2 () String) 4 | 5 | 6 | (assert (= x ( str.++ ( str.++ "te" y1 ) ( str.++ "st" y2 ) ) ) ) 7 | 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/equal-001.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | 4 | 5 | (assert (str.in.re x (re.++ (str.to.re "ced") (re.* (str.to.re "ced") ) )) ) 6 | (assert (= x y)) 7 | 8 | (check-sat) 9 | 10 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-002-unsat.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | 4 | 5 | (assert (= x "aaaaaaaaa")) 6 | (assert (str.in.re x (re.* (str.to.re "ced") ) ) ) 7 | 8 | 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-006.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | 4 | 5 | (assert (= x "abcabc")) 6 | (assert (str.in.re x (re.* (re.* (str.to.re "abc") ) ) ) ) 7 | 8 | 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/parse-ecma-cases-3.smt2: -------------------------------------------------------------------------------- 1 | ; Example that previously led to an exception using the full 2AFA pipeline 2 | 3 | (set-logic QF_S) 4 | 5 | (assert (str.in_re "P{Lowercase_Letter}" (re.from_ecma2020 '\P{Lowercase_Letter}'))) 6 | 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead4.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "abc(?!x)q"))) 4 | (assert (str.in.re w (re.* (re.union (str.to.re "a") (str.to.re "b") (str.to.re "c") (str.to.re "q"))))) 5 | 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/indexof-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun n () Int) 7 | 8 | (assert (str.prefixof "testtesttest" x0)) 9 | (assert (= (str.indexof x0 "testtest" 1) n)) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/simple-replace-1d.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replace "HelloWorld" "e" ""))) 7 | (assert (= x_7 "hlloWorld")) 8 | 9 | (check-sat) 10 | (get-model) -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-005-unsat.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | 4 | 5 | (assert (= x "aaaaaaaaa")) 6 | (assert (str.in.re x (re.* (re.* (str.to.re "ced") ) ) ) ) 7 | 8 | 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/indexof-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun n () Int) 7 | 8 | (assert (str.prefixof "testtesttest" x0)) 9 | (assert (= (str.indexof x0 "testtest" (- 1)) n)) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/parse-regex3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "^(?:0|\(?\+33\)?\s?|0033\s?)[1-79](?:[\.\-\s]?\d\d){4}$"))) 6 | (assert (str.prefixof "8" w)) 7 | 8 | (check-sat) 9 | (get-model) 10 | -------------------------------------------------------------------------------- /tests/simple-replace-1f.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replace "HelloWorld" "e" "a"))) 7 | (assert (= x_7 "HolloWorld")) 8 | 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/simple-replace-1g.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replace "HelloWorld" "e" "a"))) 7 | (assert (= x_7 "HalloWorld")) 8 | 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/indexof-5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun n () Int) 7 | 8 | (assert (str.prefixof "testtesttest" x0)) 9 | (assert (= (str.indexof x0 "" 3) n)) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/replace-length.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y (str.replace x "l" "L"))) 7 | (assert (= (str.len x) 10)) 8 | 9 | (assert (str.contains x "l")) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/simple-replace-1c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replaceall "HelloWorld" "e" "a"))) 7 | (assert (= x_7 "HalloWorld")) 8 | 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/parse-regex-lookahead.smt2: -------------------------------------------------------------------------------- 1 | (declare-const w String) 2 | 3 | (assert (str.in.re w (re.from.str "^(?=.*[A-Z])(?=.*[a-z])(?=.*[\@%\+\/!#$^\?:,\.\(\){}\[\]~\-_`&*])(?=.*\d).{8,32}$"))) 4 | (assert (str.contains w "")) 5 | 6 | (check-sat) -------------------------------------------------------------------------------- /tests/regex_cg_4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_7 (str.replace_cg_all "HelloWorld" (re.range "e" "e") (str.to.re "a")))) 7 | (assert (= x_7 "HolloWorld")) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/contains-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | (declare-const z String) 6 | 7 | (assert (str.contains y z)) 8 | (assert (= x (str.++ y y))) 9 | (assert (not (str.contains x z))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace-length.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y (str.replace x "l" "L"))) 7 | (assert (= (str.len x) 10)) 8 | 9 | (assert (str.contains x "l")) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/monadic-length.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const x String) 3 | (declare-const a Int) 4 | (declare-const b Int) 5 | 6 | (assert (= (str.len x) a)) 7 | (assert (> a 5)) 8 | (assert (< a 10)) 9 | (assert (str.in_re x (re.* (str.to_re "abc")))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/contains-5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | (declare-const z String) 6 | (declare-const res String) 7 | 8 | (assert(= res (str.replace x y z))) 9 | (assert (not (str.contains x y))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/indexof-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_SLIA) 2 | 3 | ; UNSAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun n () Int) 7 | 8 | (assert (str.prefixof "testtesttest" x0)) 9 | (assert (= (str.indexof x0 "testtest" 0) n)) 10 | (assert (> n 0)) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/test-reverse.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | 6 | (assert (= a (str.reverse b))) 7 | 8 | (assert (str.in.re a (str.to.re "abcd"))) 9 | (assert (str.in.re b (str.to.re "dcba"))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/test-reverse2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | 6 | (assert (= a (str.reverse b))) 7 | 8 | (assert (str.in.re a (str.to.re "abcd"))) 9 | (assert (str.in.re b (str.to.re "abcd"))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/contains-6.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | (declare-const z String) 6 | (declare-const res String) 7 | 8 | (assert(= res (str.replace_all x y z))) 9 | (assert (not (str.contains x y))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-004-unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-option :auto-config true) 2 | (set-option :produce-models true) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | 7 | (assert (= (str.++ a b) "testhello")) 8 | (assert (= a "hello")) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/bug-56-replace-bug2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_4 () String) 4 | (declare-fun sigmaStar_0 () String) 5 | 6 | (assert (= x_4 (str.replace sigmaStar_0 "ab" "c"))) 7 | 8 | (assert (str.in_re x_4 (str.to_re "aa"))) 9 | 10 | (check-sat) 11 | (get-model) 12 | -------------------------------------------------------------------------------- /tests/case-insensitive.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in_re w (re.case_insensitive (re.from_ecma2020 '[a-z]+')))) 6 | (assert (str.in_re w (re.case_insensitive (re.from_ecma2020 '.{5,10}')))) 7 | (assert (str.contains w "ABC")) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/loop2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const x String) 3 | 4 | (assert (str.in.re x ((_ re.loop 0 100) (re.range "0" "9")))) 5 | (assert (str.in.re x ((_ re.loop 100 200) (re.range "0" "9")))) 6 | 7 | (assert (not (str.in.re x ((_ re.^ 100) (re.range "0" "9"))))) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/parse-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$"))) 6 | (assert (str.in.re w (re.* (re.range "a" "z")))) 7 | (assert (= (str.len w) 5)) 8 | 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/regex-004-unsat.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | 3 | 4 | ;(assert (= x "abcdabcdabcdabcd")) 5 | (assert (= x "abcdcde")) 6 | (assert (str.in.re x (re.union (re.* (str.to.re "abcd") ) (re.* (str.to.re "cde") ) ) ) ) 7 | 8 | 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/nonlinear-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | 6 | (assert (= a (str.++ b b))) 7 | (assert (str.in.re a (re.++ (re.* (str.to.re "(")) 8 | (re.+ (str.to.re ")"))))) 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/nonlinear.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | 6 | (assert (= a (str.++ b b))) 7 | (assert (str.in.re a (re.++ (re.+ (str.to.re "(")) 8 | (re.+ (str.to.re ")"))))) 9 | 10 | (check-sat) 11 | 12 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-005-unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-option :auto-config true) 2 | (set-option :produce-models true) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | (declare-fun z () String) 7 | 8 | (assert (= (str.++ a "testhello") "hello")) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/bug-56-replace-bug2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_4 () String) 4 | (declare-fun sigmaStar_0 () String) 5 | 6 | (assert (= x_4 (str.replace sigmaStar_0 "ab" "c"))) 7 | 8 | (assert (str.in_re x_4 (str.to_re "aa"))) 9 | 10 | (check-sat) 11 | (get-model) 12 | -------------------------------------------------------------------------------- /tests/minimize-problem.smt2: -------------------------------------------------------------------------------- 1 | ; Example that tends to time out when trying to minimize/determinize automata 2 | 3 | (declare-const w String) 4 | (assert (str.in.re w (re.from_ecma2020 "^.+@.+\\..{2,20}$"))) 5 | 6 | (assert (str.in.re w (re.* (re.range "\u{20}" "\u{FFFF}")))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/null-problem.smt2: -------------------------------------------------------------------------------- 1 | ; Problem that earlier crashed with the message "ERROR: null" 2 | 3 | (define-fun z () String "10") 4 | (define-fun y () String "010101") 5 | (define-fun x () String "1001") 6 | 7 | (assert (= x (str.replaceallre y (str.to.re "0101") z))) 8 | 9 | (check-sat) 10 | -------------------------------------------------------------------------------- /tests/simple-cycle.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= a (str.++ b c))) 9 | (assert (= b (str.++ d a))) 10 | 11 | (assert (not (= c ""))) 12 | 13 | (check-sat) -------------------------------------------------------------------------------- /tests/substring.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun n () Int) 6 | 7 | (assert (= y (str.substr x n 5))) 8 | (assert (>= (str.len x) (+ n 5))) 9 | (assert (= (str.at y 0) "a")) 10 | (assert (> n 0)) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/replace-bug.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun c () String) 4 | (declare-fun d () String) 5 | (assert (= c (str.replace_all a "B" (str.replace_all "A" "B" b)))) 6 | (assert (= d (str.replace_all a "B" "A"))) 7 | (assert (distinct c d)) 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/simple-replace-5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_7 () String) 4 | (declare-fun x_10 () String) 5 | 6 | (assert (= x_10 "This is a very long sentence with code")) 7 | (assert (= x_7 (str.replaceall x_10 "" ""))) 8 | 9 | (check-sat) 10 | (get-model) 11 | 12 | -------------------------------------------------------------------------------- /tests/escapeSequences-1b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | 4 | (declare-fun x () String) 5 | (declare-fun y () String) 6 | 7 | (assert (= x "\x68\145\x6cl")) 8 | 9 | ;sat 10 | (assert (str.in.re x (re.* (re.charrange (char.from-int 97) (char.from-int 117))))) 11 | (check-sat) 12 | 13 | (check-sat) 14 | -------------------------------------------------------------------------------- /tests/str.from_int_6.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | (declare-const x Int) 4 | (declare-const y Int) 5 | 6 | (assert (= (str.substr w 0 3) (str.from_int x))) 7 | (assert (= (str.substr w 10 3) (str.from_int y))) 8 | 9 | (assert (> x (* 2 y))) 10 | (assert (>= y 0)) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/str.to_int_6.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const w String) 3 | (declare-const x Int) 4 | (declare-const y Int) 5 | 6 | (assert (= (str.to_int (str.substr w 0 10)) x)) 7 | (assert (= (str.to_int (str.substr w 10 10)) y)) 8 | 9 | (assert (> x (* 2 y))) 10 | (assert (>= y 1000)) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/temp-prop/word-equation-6-copy.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun H () String) 4 | (declare-fun G () String) 5 | (declare-fun E () String) 6 | (declare-fun J () String) 7 | (assert (= (str.++ "e" H "f" H "g") 8 | (str.++ "ei" G "ig") )) 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/word-equation-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= (str.++ a b b a) (str.++ c d d c))) 9 | (assert (>= (str.len a) 1)) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/word-equation.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= (str.++ a "xy" b) (str.++ b "x" c))) 9 | (assert (<= (str.len a) 3)) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-003.smt2: -------------------------------------------------------------------------------- 1 | (set-option :auto-config true) 2 | (set-option :produce-models true) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | (declare-fun z () String) 7 | 8 | (assert (= (str.++ a b) "testhello")) 9 | (assert (= a "testhe")) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/escapeSequences-1a.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | 4 | (declare-fun x () String) 5 | (declare-fun y () String) 6 | 7 | (assert (= x "\x48\145\x6cl")) 8 | 9 | ;unsat 10 | (assert (str.in.re x (re.* (re.charrange (char.from-int 97) (char.from-int 117))))) 11 | (check-sat) 12 | 13 | (check-sat) 14 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/slow-little.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (declare-const x String) 3 | (declare-const y String) 4 | (assert (str.in.re x (re.* (re.union (str.to.re "Qqqqa") (str.to.re "1111"))))) 5 | (assert (= 10 (str.len x))) 6 | (assert (not (= x "1111Qqqqa"))) 7 | (check-sat) 8 | (get-model) 9 | 10 | -------------------------------------------------------------------------------- /tests/propagation.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-fun f (String) Int) 3 | 4 | (declare-const x String) 5 | (declare-const y String) 6 | 7 | (assert (= (f x) 1)) 8 | (assert (= (f y) 2)) 9 | 10 | (assert (= x "aaaaa")) 11 | (assert (str.in_re y (re.from_ecma2020 'a{5,}'))) 12 | 13 | (check-sat) 14 | (get-model) 15 | -------------------------------------------------------------------------------- /tests/simple-replace-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_10 (str.++ a b))) 9 | (assert (= x_7 (str.replaceall x_10 "e" "a"))) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/simple-replace-2d.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_10 (str.++ a b))) 9 | (assert (= x_7 (str.replace x_10 "e" "a"))) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace_all-bug.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () String) 2 | (declare-fun b () String) 3 | (declare-fun c () String) 4 | (declare-fun d () String) 5 | (assert (= c (str.replace_all a "B" (str.replace_all "A" "B" b)))) 6 | (assert (= d (str.replace_all a "B" "A"))) 7 | (assert (distinct c d)) 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/empty-concat.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun sigmaStar_0 () String) 4 | (declare-fun literal_1 () String) 5 | (declare-fun x_2 () String) 6 | (declare-fun literal_3 () String) 7 | (declare-fun x_4 () String) 8 | 9 | (assert (= x_2 (str.++ literal_1 sigmaStar_0))) 10 | (check-sat) 11 | (get-model) 12 | -------------------------------------------------------------------------------- /tests/euf.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun f (String) Int) 7 | 8 | (assert (= (f a) 1)) 9 | (assert (= (f b) 2)) 10 | (assert (= a "abc")) 11 | (assert (= b (str.++ "a" c))) 12 | (assert (= c "bc")) 13 | 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/word-equation-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= (str.++ a b) (str.++ b a))) 9 | (assert (>= (str.len a) 1)) 10 | (assert (>= (str.len b) 5)) 11 | 12 | (check-sat) 13 | (get-model) 14 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-003.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "*") z))) 6 | 7 | (assert (str.in.re y (str.to.re "******"))) 8 | (assert (str.in.re z (str.to.re "\u{5c}"))) ; \ 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/simple-cycle2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | (declare-fun e () String) 8 | 9 | (assert (= a (str.++ b (str.++ c e)))) 10 | (assert (= b (str.++ d a))) 11 | 12 | (assert (not (= e ""))) 13 | 14 | (check-sat) -------------------------------------------------------------------------------- /tests/str.at-bug.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () String) 3 | (declare-fun c () String) 4 | (declare-fun d () Bool) 5 | (declare-fun e () Bool) 6 | (assert (xor a e)) 7 | (assert (= d (not (= "" (str.replace b c (str.at b (str.len b))))))) 8 | (assert (= (xor a e) (= "-" c))) 9 | (check-sat) 10 | 11 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/concat-001.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (str.in.re x (re.* (str.to.re "ab")))) 6 | (assert (str.in.re y (re.* (str.to.re "c")))) 7 | (assert (str.in.re z (str.to.re "cccc"))) 8 | (assert (= z (str.++ x y))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/parse-ecma-groups.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const g1 String) 5 | (declare-const g2 String) 6 | 7 | (assert (= g1 ((_ str.extract 1) x (re.from_ecma2020 'abc([a-z]+)([A-Z]+)')))) 8 | (assert (= g2 ((_ str.extract 2) x (re.from_ecma2020 'abc([a-z]+)([A-Z]+)')))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/word-equation-6.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun H () String) 4 | (declare-fun G () String) 5 | (declare-fun E () String) 6 | (declare-fun J () String) 7 | (assert (= (str.++ "de" H "fahgf" E H "bg" H "dfchjgbjhgafiagegfcije" J H "dg") 8 | (str.++ "deifah" G "idg") )) 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/substring2.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun x () String) 5 | (declare-fun y () String) 6 | (declare-fun z () String) 7 | 8 | (assert (= x (str.++ "x" z))) 9 | (assert (= y (str.substr x 3 (- (str.len x) 5)))) 10 | (assert (str.in_re y (re.from_ecma2020 'a+b+'))) 11 | (assert (= (str.at x 4) "c")) 12 | 13 | (check-sat) -------------------------------------------------------------------------------- /tests/substring2b.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun x () String) 5 | (declare-fun y () String) 6 | (declare-fun z () String) 7 | 8 | (assert (= x (str.++ "x" z))) 9 | (assert (= y (str.substr x 3 (- (str.len x) 5)))) 10 | (assert (str.in_re y (re.from_ecma2020 'a+b+'))) 11 | (assert (= (str.at x 5) "c")) 12 | 13 | (check-sat) -------------------------------------------------------------------------------- /tests/temp-prop/word-equation-6.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun H () String) 4 | (declare-fun G () String) 5 | (declare-fun E () String) 6 | (declare-fun J () String) 7 | (assert (= (str.++ "de" H "fahgf" E H "bg" H "dfchjgbjhgafiagegfcije" J H "dg") 8 | (str.++ "deifah" G "idg") )) 9 | (check-sat) 10 | (get-model) -------------------------------------------------------------------------------- /tests/test-replace2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (= x (str.replaceall y "e" z))) 8 | (assert (str.in.re y (str.to.re "hello"))) 9 | (assert (str.in.re z (str.to.re "d"))) 10 | (assert (str.in.re x (str.to.re "hbllo"))) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-024.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (assert (= x (str.replace_re_longest_all y (re.++ (re.++ (re.* (str.to.re "1")) (re.* (str.to.re "0"))) (str.to.re "10")) z))) 5 | 6 | (assert (str.in.re x (re.++ (re.* (str.to.re "01")) (str.to.re "01")))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/chars3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_) 2 | 3 | (declare-fun Constructed_Argument () String) 4 | 5 | (assert (let ((a!1 (to_real (str.indexof Constructed_Argument 6 | (str.++ (str.from_code (bv2nat #x2d)) (str.from_code (bv2nat #x2d))) 7 | 0)))) 8 | (= a!1 (- 1.0)))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/regex_cg.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y (str.replace_cg_all x 7 | ((_ re.capture 1) (re.range "a" "z")) 8 | (re.++ (_ re.reference 1) (_ re.reference 1))))) 9 | (assert (= x "ZabA")) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/test-replace-word.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (= x (str.replaceall y "ell" z))) 8 | (assert (str.in.re y (str.to.re "hello"))) 9 | (assert (str.in.re z (str.to.re "b"))) 10 | (assert (str.in.re x (str.to.re "hbo"))) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/test-replace-word2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (= x (str.replaceall y "ell" z))) 8 | (assert (str.in.re y (str.to.re "hello"))) 9 | (assert (str.in.re z (str.to.re "b"))) 10 | (assert (str.in.re x (str.to.re "hao"))) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/contains-8.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | (declare-const z String) 6 | (declare-const res String) 7 | 8 | (assert(= res (str.replace_re_all x (re.comp (re.*(str.to_re "ab"))) z))) 9 | (assert (str.in_re x (re.*(str.to_re "ab")))) 10 | (assert(not (= res ""))) 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/email-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const w String) 4 | 5 | (assert (str.in.re w (re.from.str "[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*"))) 6 | 7 | (assert (str.prefixof "me@" w)) 8 | (assert (str.suffixof "@gmail.com" w)) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/js-semantics.smt2: -------------------------------------------------------------------------------- 1 | (set-option :produce-models true) 2 | (set-option :inline-size-limit 10000) 3 | 4 | (declare-const var0 String) 5 | (declare-const y String) 6 | (assert (= var0 "abb")) 7 | (assert (= y 8 | ((_ str.extract 1) var0 (re.+ ((_ re.capture 1) (re.*? re.allchar)))))) 9 | (assert (= y "b")) 10 | 11 | (check-sat) 12 | (get-model) 13 | -------------------------------------------------------------------------------- /tests/len-bug.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-const x String) 3 | (declare-const y String) 4 | (declare-const a Int) 5 | (declare-const b Int) 6 | 7 | (assert (= x "abc")) 8 | (assert (= (str.len x) (+ (str.len y) 1))) 9 | (assert (= a (str.len x))) 10 | (assert (= b (str.len y))) 11 | 12 | (assert (= a 1)) ; should be unsat, previously gave sat 13 | 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_const_startpos_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | 9 | (assert (= "hhhhjjj" (str.++ "h" a))) 10 | (assert (= (str.indexof a "hhh" j) i)) 11 | (assert (>= i 0)) 12 | (assert (= j 0)) 13 | (check-sat) 14 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_empty_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "" j) i)) 10 | (assert (= i j)) 11 | 12 | (check-sat) 13 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_var_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "hhh" j) i)) 10 | (assert (> i 0)) 11 | 12 | (check-sat) 13 | (get-model) -------------------------------------------------------------------------------- /tests/replace-length-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_4 () String) 4 | (declare-fun sigmaStar_0 () String) 5 | 6 | (assert (= x_4 (str.replace sigmaStar_0 "\u{2f}\u{5b}\u{5e}\u{30}\u{2d}\u{39}\u{61}\u{2d}\u{7a}\u{5c}\u{2d}\u{5f}\u{2c}\u{5d}\u{2b}\u{2f}\u{69}" ""))) 7 | 8 | (assert (> (str.len sigmaStar_0) (str.len x_4))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/test-replace.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (= x (str.replaceall y "e" z))) 8 | (assert (str.in.re y (str.to.re "hello"))) 9 | (assert (str.in.re z (str.to.re "b"))) 10 | (assert (str.in.re x (str.to.re "hbllo"))) 11 | 12 | (check-sat) 13 | (get-model) 14 | -------------------------------------------------------------------------------- /tests/contains-7.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | (declare-const z String) 6 | (declare-const res String) 7 | 8 | (assert(= res (str.replace_all x y z))) 9 | (assert (str.in_re x (re.*(str.to_re "ab")))) 10 | (assert (not(str.in_re y (re.*(str.to_re "ab"))))) 11 | (assert(not (= res ""))) 12 | 13 | (check-sat) 14 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_const_startpos_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | 9 | (assert (= "hhhhjjj" (str.++ "h" a))) 10 | (assert (= (str.indexof a "hhh" j) i)) 11 | (assert (>= i 0)) 12 | (assert (= j 1)) 13 | (check-sat) 14 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_var_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "hhh" j) i)) 10 | (assert (> i 1)) 11 | 12 | (check-sat) 13 | (get-model) -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-011.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (str.in.re x (re.* (str.to.re "ab")))) 6 | (assert (str.in.re y (re.* (str.to.re "c")))) 7 | (assert (str.in.re z (str.to.re "cccc"))) 8 | (assert (= z (str.replace_re_longest_all x (str.to.re "ab") y))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/prefix3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun x1 () String) 7 | 8 | (assert (str.prefixof x0 x1)) 9 | (assert (str.in.re x0 (re.* (re.range "a" "c")))) 10 | (assert (str.in.re x1 (re.* (re.range "c" "e")))) 11 | 12 | (assert (not (= (str.len x0) 0))) 13 | (assert (not (= (str.len x1) 0))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/extract-cg.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.++ ((_ re.capture 1) (re.+ (str.to.re "a"))) 8 | re.all)))) 9 | 10 | (assert (str.in.re x (str.to.re "aabbb"))) 11 | ;(assert (str.in.re y (str.to.re ""))) 12 | 13 | (check-sat) 14 | (get-model) 15 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/replace-length-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x_4 () String) 4 | (declare-fun sigmaStar_0 () String) 5 | 6 | (assert (= x_4 (str.replace sigmaStar_0 "\u{2f}\u{5b}\u{5e}\u{30}\u{2d}\u{39}\u{61}\u{2d}\u{7a}\u{5c}\u{2d}\u{5f}\u{2c}\u{5d}\u{2b}\u{2f}\u{69}" ""))) 7 | 8 | (assert (> (str.len sigmaStar_0) (str.len x_4))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/extract-cg2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.++ ((_ re.capture 1) (re.+ (str.to.re "a"))) 8 | re.all)))) 9 | 10 | (assert (str.in.re x (str.to.re "bbbaabbb"))) 11 | ;(assert (str.in.re y (str.to.re ""))) 12 | 13 | (check-sat) 14 | (get-model) 15 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/regex_counting_unsat.smt2: -------------------------------------------------------------------------------- 1 | (declare-const X String) 2 | (assert (str.in_re X (re.++ ((_ re.loop 5 60) (re.diff re.allchar (str.to_re "a"))) ((_ re.loop 5 60) (re.diff re.allchar (str.to_re "b")))((_ re.loop 0 60) (re.diff re.allchar (str.to_re "c")))))) 3 | (assert (str.in_re X (re.++ re.all (str.to_re "c")))) 4 | (assert (< 120 (str.len X))) 5 | (check-sat) 6 | (get-model) -------------------------------------------------------------------------------- /tests/test-replace-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (str.in.re y (str.to.re "010101"))) 8 | (assert (str.in.re z (str.to.re "c"))) 9 | (assert (= x (str.replace_re_longest_all y (re.* (str.to.re "01")) z))) 10 | (assert (str.in.re x (str.to.re "c"))) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/test-replace-regex2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x () String) 4 | (declare-fun y () String) 5 | (declare-fun z () String) 6 | 7 | (assert (str.in.re y (str.to.re "010101"))) 8 | (assert (str.in.re z (str.to.re "c"))) 9 | (assert (= x (str.replace_re_longest_all y (re.* (str.to.re "01")) z))) 10 | (assert (str.in.re x (str.to.re "cc"))) 11 | 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_empty_sat2.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "" j) i)) 10 | (assert (not (= i j))) 11 | (assert (< i 0)) 12 | (check-sat) 13 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_const_index_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "hhh" j) i)) 10 | (assert (= i 1)) 11 | (assert (= j 0)) 12 | 13 | (check-sat) 14 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_empty_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "" j) i)) 10 | (assert (not (= i j))) 11 | (assert (>= i 0)) 12 | (check-sat) 13 | (get-model) -------------------------------------------------------------------------------- /tests/loop-cg.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.++ ((_ re.capture 1) ((_ re.loop 2 3) (str.to.re "a"))) 8 | re.all)))) 9 | 10 | (assert (str.in.re x (str.to.re "aaaabb"))) 11 | (assert (str.in.re y (str.to.re "aaa"))) 12 | 13 | (check-sat) 14 | (get-model) 15 | -------------------------------------------------------------------------------- /tests/parse-regex-incremental.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic QF_S) 4 | 5 | (declare-const w String) 6 | 7 | (assert (str.in.re w (re.from.str "^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$"))) 8 | 9 | (check-sat) 10 | (get-model) 11 | 12 | (assert (str.in.re w (re.* (re.range "a" "z")))) 13 | 14 | (check-sat) 15 | (get-model) 16 | 17 | (assert (= (str.len w) 5)) 18 | 19 | (check-sat) 20 | (get-model) 21 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-002.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "0") z))) 6 | 7 | (assert (str.in.re x (re.++ (str.to.re "*") (re.* (str.to.re "*"))))) 8 | (assert (str.in.re y (re.* (str.to.re "0")))) 9 | (assert (str.in.re z (re.* (str.to.re "*")))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/indexof_const_index_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (= (str.indexof a "hhh" j) i)) 10 | 11 | (assert (= i 2)) 12 | (assert (> j 0)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/regex_cg_2.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y (str.replace_cg x 7 | ((_ re.capture 1) (re.range "a" "z")) 8 | (re.++ (_ re.reference 1) (_ re.reference 1))))) 9 | (assert (str.contains x "a")) 10 | (assert (not (str.contains y "aa"))) 11 | 12 | (check-sat) 13 | (get-model) 14 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-014.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "0101") z))) 6 | 7 | (assert (str.in.re x (re.++ (re.* (str.to.re "0")) (str.to.re "11")))) 8 | (assert (str.in.re y (re.* (str.to.re "01")))) 9 | (assert (str.in.re z (re.* (str.to.re "10")))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/concat-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= a (str.++ b c))) 9 | (assert (= b (str.++ d c))) 10 | 11 | (assert (str.in.re a (re.+ (re.union (str.to.re "x") (str.to.re "y"))))) 12 | (assert (str.in.re c (re.+ (str.to.re "x")))) 13 | 14 | (check-sat) 15 | (get-model) 16 | -------------------------------------------------------------------------------- /tests/simple-replace-2c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_10 (str.++ a b))) 9 | (assert (= x_7 (str.replaceall x_10 "e" "a"))) 10 | (assert (str.in.re x_10 (str.to.re "Hello"))) 11 | (assert (str.in.re x_7 (str.to.re "Hallo"))) 12 | 13 | (check-sat) 14 | (get-model) 15 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9k.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (= "abc" "abd")) 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/concat-regex2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (set-info :status unsat) 4 | 5 | (declare-fun a () String) 6 | (declare-fun b () String) 7 | (declare-fun c () String) 8 | (declare-fun d () String) 9 | 10 | (assert (= a (str.++ b c))) 11 | (assert (= b (str.++ d c))) 12 | 13 | (assert (str.in.re a (re.+ (str.to.re "y")))) 14 | (assert (str.in.re c (re.+ (str.to.re "x")))) 15 | 16 | (check-sat) 17 | (get-model) 18 | -------------------------------------------------------------------------------- /tests/extract-cg4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.union 8 | (re.+ (str.to.re "a")) 9 | ((_ re.capture 1) (re.+ (str.to.re "a"))))))) 10 | 11 | (assert (str.in.re x (str.to.re "aa"))) 12 | ;(assert (str.in.re y (str.to.re ""))) 13 | 14 | (check-sat) 15 | (get-model) 16 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9g.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (not (= "abc" "abd"))) 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/simple-cvc-smtlib-b.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | (declare-fun a_len () Int) 7 | 8 | (assert (= b (str.++ a "c"))) 9 | (assert (= (str.len a) (str.len b))) 10 | (assert (str.in.re a (re.* (str.to.re "xy")))) 11 | (assert (not (str.in.re b (re.* (str.to.re "xy"))))) 12 | (assert (= (str.len a) a_len)) 13 | (assert (> a_len 0)) 14 | 15 | (check-sat) -------------------------------------------------------------------------------- /tests/simple-cvc-smtlib.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | (declare-fun a_len () Int) 7 | 8 | (assert (= b (str.++ a "c"))) 9 | ; (assert (= (str.len a) (str.len b))) 10 | (assert (str.in.re a (re.* (str.to.re "xy")))) 11 | (assert (not (str.in.re b (re.* (str.to.re "xy"))))) 12 | (assert (= (str.len a) a_len)) 13 | (assert (> a_len 0)) 14 | 15 | (check-sat) -------------------------------------------------------------------------------- /tests/simple-replace-3b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_7 (str.replace x_10 "e" "X"))) 9 | (assert (str.in.re x_7 (re.++ re-full-set 10 | (str.to.re "e") 11 | re-full-set))) 12 | 13 | (check-sat) 14 | (get-model) 15 | 16 | -------------------------------------------------------------------------------- /tests/str.at-3c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | 5 | (assert (not (and 6 | (= (str.at "012" (- 1)) "") 7 | (= (str.at "012" 0) "0") 8 | 9 | (= (str.at "012" (- (str.len "012") 1)) "2") 10 | (= (str.at "012" (- (str.len "012") 2)) "1") 11 | (= (str.at "012" (- (str.len "012") 0)) "") 12 | (distinct (str.at "000" (- (str.len "000") 5)) "0") 13 | ))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-025.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (assert (= x (str.replace_re_longest_all y (re.++ (str.to.re "a") (re.* (str.to.re "a"))) z))) 5 | 6 | (assert (str.in.re x (str.to.re "cccc")) ) 7 | (assert (str.in.re y (re.++ (str.to.re "aa") (str.to.re "ccc")))) 8 | (assert (str.in.re z (re.* (str.to.re "c")))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/simple-replace-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_7 (str.replaceall x_10 "e" "X"))) 9 | (assert (str.in.re x_7 (re.++ re-full-set 10 | (str.to.re "e") 11 | re-full-set))) 12 | 13 | (check-sat) 14 | (get-model) 15 | 16 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-004.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "a") z))) 6 | 7 | (assert (str.in.re y (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b"))))) 8 | (assert (str.in.re z (str.to.re "1"))) 9 | (assert (str.in.re x (re.++ (str.to.re "1111") (re.* (str.to.re "1"))))) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/loop-cg2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.++ 8 | ((_ re.loop 2 3) 9 | ((_ re.capture 1) (str.to.re "a"))) 10 | re.all)))) 11 | 12 | (assert (str.in.re x (str.to.re "aabb"))) 13 | (assert (str.in.re y (str.to.re "a"))) 14 | 15 | (check-sat) 16 | (get-model) 17 | -------------------------------------------------------------------------------- /tests/prefix.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; SAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun x1 () String) 7 | 8 | (assert (str.prefixof x0 x1)) 9 | (assert (str.in.re x0 (re.* (re.charrange (char.from-int 70) (char.from-int 80))))) 10 | (assert (str.in.re x1 (re.* (re.charrange (char.from-int 80) (char.from-int 90))))) 11 | 12 | (assert (not (= (str.len x0) 0))) 13 | (assert (not (= (str.len x1) 0))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/extract-cg3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y ((_ str.extract 1) x 7 | (re.++ 8 | (re.*? re.allchar) 9 | ((_ re.capture 1) (re.+ (str.to.re "a"))) 10 | re.all)))) 11 | 12 | (assert (str.in.re x (str.to.re "bbbaabbb"))) 13 | ;(assert (str.in.re y (str.to.re ""))) 14 | 15 | (check-sat) 16 | (get-model) 17 | -------------------------------------------------------------------------------- /tests/prefix2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; UNSAT 4 | 5 | (declare-fun x0 () String) 6 | (declare-fun x1 () String) 7 | 8 | (assert (str.prefixof x0 x1)) 9 | (assert (str.in.re x0 (re.* (re.charrange (char.from-int 70) (char.from-int 80))))) 10 | (assert (str.in.re x1 (re.* (re.charrange (char.from-int 81) (char.from-int 90))))) 11 | 12 | (assert (not (= (str.len x0) 0))) 13 | (assert (not (= (str.len x1) 0))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-005.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "a") z))) 6 | 7 | 8 | 9 | (assert (str.in.re y (re.++ (re.* (str.to.re "ab")) (re.* (str.to.re "b"))))) 10 | 11 | 12 | (assert (str.in.re z (str.to.re "1"))) 13 | 14 | (assert (str.in.re x (re.* (str.to.re "1")))) 15 | 16 | 17 | 18 | (check-sat) 19 | -------------------------------------------------------------------------------- /tests/epsilon-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | (declare-fun sigmaStar_2 () String) 5 | (declare-fun epsilon () String) 6 | (declare-fun x_3 () String) 7 | (assert (= epsilon "")) 8 | (assert (= x_3 (str.replace epsilon "http://" "https://"))) 9 | (assert (str.in.re x_3 (re.++ (re.* re.allchar) (re.++ (str.to.re "/evil") (re.* re.allchar))))) 10 | (check-sat) 11 | (get-model) 12 | -------------------------------------------------------------------------------- /tests/simple-cvc-smtlib-c.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (declare-fun a () String) 5 | (declare-fun b () String) 6 | (declare-fun a_len () Int) 7 | 8 | (assert (= b (str.++ a "c"))) 9 | ; (assert (= (str.len a) (str.len b))) 10 | (assert (str.in.re a (re.* (str.to.re "xy")))) 11 | (assert (not (str.in.re b (re.* (str.to.re "xy"))))) 12 | (assert (= (str.len a) a_len)) 13 | (assert (> a_len 0)) 14 | (assert (= a_len 8)) 15 | 16 | (check-sat) -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_var_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (> i 0)) 12 | (assert (> j 0)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/parse-ecma-replace.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | (assert (= y (str.replace_cg x (re.from_ecma2020 'a([a-z]*)z') 7 | (_ re.reference 1) 8 | ; not working yet: 9 | ; (re.from_ecma2020 '\1') 10 | ))) 11 | (assert (str.contains x 'abcz')) 12 | 13 | (check-sat) 14 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_const_len_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (= i 0)) 12 | (assert (= j 2)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_empty_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) "")) 11 | (assert (> i 3)) 12 | (assert (> j 0)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_var_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (> i 6)) 12 | (assert (> j 0)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/simple-replace-4c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | (declare-fun x_11 () String) 8 | (declare-fun x_12 () String) 9 | (declare-fun x_13 () String) 10 | 11 | 12 | (assert (= x_10 (str.++ x_11 x_12 ))) 13 | (assert (= x_7 (str.replace x_10 "e" "a"))) 14 | (assert (= x_7 "")) 15 | 16 | (check-sat) 17 | (get-model) 18 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_const_begin_sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status sat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (= i 1)) 12 | (assert (= j 2)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_const_len_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (> i 5)) 12 | (assert (= j 2)) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /tests/simple-replace-2b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const a String) 4 | (declare-const b String) 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | 8 | (assert (= x_10 (str.++ a b))) 9 | (assert (or (= x_7 (str.replace x_10 "e" "a")) 10 | (= x_7 (str.replaceall x_10 "e" "a")))) 11 | (assert (str.in.re x_10 (str.to.re "Hello"))) 12 | (assert (str.in.re x_7 (str.to.re "Hollo"))) 13 | 14 | (check-sat) 15 | (get-model) 16 | -------------------------------------------------------------------------------- /tests/simple-replace-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | (declare-fun x_11 () String) 8 | (declare-fun x_12 () String) 9 | (declare-fun x_13 () String) 10 | 11 | 12 | (assert (= x_10 (str.++ x_11 x_12 ))) 13 | (assert (= x_7 (str.replace x_10 "e" "a"))) 14 | (assert (= x_7 "hallo")) 15 | 16 | (check-sat) 17 | (get-model) 18 | -------------------------------------------------------------------------------- /tests/simple-replace-4b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | 5 | (declare-fun x_7 () String) 6 | (declare-fun x_10 () String) 7 | (declare-fun x_11 () String) 8 | (declare-fun x_12 () String) 9 | (declare-fun x_13 () String) 10 | 11 | 12 | (assert (= x_10 (str.++ x_11 x_12 ))) 13 | (assert (= x_7 (str.replace x_10 "e" "a"))) 14 | (assert (= x_7 "hello")) 15 | 16 | (check-sat) 17 | (get-model) 18 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_const_begin_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) b)) 11 | (assert (= i 1)) 12 | (assert (not (= j 2))) 13 | 14 | (check-sat) 15 | (get-model) -------------------------------------------------------------------------------- /.github/workflows/scala.yml: -------------------------------------------------------------------------------- 1 | name: Scala CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up JDK 11 17 | uses: actions/setup-java@v2 18 | with: 19 | java-version: '11' 20 | distribution: 'adopt' 21 | - name: Run tests 22 | run: sbt test 23 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/substr_empty_unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :status unsat) 2 | (declare-fun a () String) 3 | (declare-fun b () String) 4 | 5 | (declare-fun i () Int) 6 | (declare-fun j () Int) 7 | 8 | (assert (str.in_re a (re.union (str.to_re "hhhbbb") (str.to_re "bhhh")))) 9 | (assert (str.in_re b (re.union (str.to_re "hh") (str.to_re "bb")))) 10 | (assert (= (str.substr a i j) "")) 11 | (assert (< i 3)) 12 | (assert (> i 0)) 13 | (assert (> j 0)) 14 | 15 | (check-sat) 16 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/concat_sat.smt2: -------------------------------------------------------------------------------- 1 | ; sat 2 | (declare-fun x ()String) 3 | (declare-fun y ()String) 4 | (declare-fun z ()String) 5 | 6 | (declare-const len_x Int) 7 | (declare-const len_y Int) 8 | (declare-const len_z Int) 9 | 10 | (assert (= len_x (str.len x))) 11 | (assert (= len_y (str.len y))) 12 | (assert (= len_z (str.len z))) 13 | 14 | (assert (< 1 len_x)) 15 | (assert (< 3 len_y)) 16 | (assert (> 7 len_z)) 17 | 18 | (assert (= z (str.++ x y))) 19 | 20 | (check-sat) 21 | (get-model) -------------------------------------------------------------------------------- /tests/hu-benchmarks/concat_unsat.smt2: -------------------------------------------------------------------------------- 1 | ; unsat 2 | (declare-fun x ()String) 3 | (declare-fun y ()String) 4 | (declare-fun z ()String) 5 | 6 | (declare-const len_x Int) 7 | (declare-const len_y Int) 8 | (declare-const len_z Int) 9 | 10 | (assert (= len_x (str.len x))) 11 | (assert (= len_y (str.len y))) 12 | (assert (= len_z (str.len z))) 13 | 14 | (assert (< 1 len_x)) 15 | (assert (< 3 len_y)) 16 | (assert (> 6 len_z)) 17 | (assert (= z (str.++ x y))) 18 | 19 | (check-sat) 20 | (get-model) -------------------------------------------------------------------------------- /tests/norn-benchmark-9.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re "" (re.* (re.range "a" "u")))) 14 | (assert (not (str.in.re "" (re.* (str.to.re "b"))))) 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (re.* (re.range "a" "u")))) 14 | (assert (str.in.re var_0 (re.* (str.to.re "v")))) 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9e.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (re.* (re.range "m" "u")))) 14 | (assert (str.in.re var_0 (re.+ (str.to.re "v")))) 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-021.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (assert (= x (str.replace_re_longest_all y (re.++ (re.* (str.to.re "0")) (re.++ (str.to.re "01") (re.union (re.* (str.to.re "0")) (re.* (str.to.re "1"))))) z))) 5 | 6 | (assert (str.in.re x (re.++ (re.* (str.to.re "0")) (str.to.re "11")))) 7 | (assert (str.in.re y (re.* (str.to.re "01")))) 8 | (assert (str.in.re z (re.* (str.to.re "10")))) 9 | 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (re.* (re.range "a" "u")))) 14 | (assert (not (str.in.re var_0 (re.* (str.to.re "b"))))) 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Matthew Hague 2 | http://www.cs.rhul.ac.uk/home/hague/ 3 | 4 | Philipp Ruemmer 5 | http://www.philipp.ruemmer.org 6 | 7 | Denghang Hu 8 | https://tis.ios.ac.cn/?page_id=2451 9 | 10 | Riccardo De Masellis 11 | http://demasellis.x10host.com/ 12 | 13 | Zhilei Han 14 | https://www.linusboyle.cn/ 15 | 16 | Oliver Markgraf 17 | https://arg.cs.uni-kl.de/gruppe/markgraf/ -------------------------------------------------------------------------------- /tests/regex_cg_6.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | (assert (= y (str.replace_cg x 5 | (re.+? (re.range "a" "a")) 6 | (str.to.re "b")))) 7 | 8 | (assert (str.in.re x (re.+ 9 | (re.++ 10 | (re.+ (re.range "a" "b")) 11 | (re.+ (re.range "b" "b")))))) 12 | (assert (str.in.re y (re.+ (re.range "b" "c")))) 13 | 14 | (check-sat) 15 | (get-model) 16 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/parikh.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Cyclic Word equation 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (assert (= (str.++ x x "b" x)(str.++ x "a" x x))) 15 | (check-sat) 16 | (exit) 17 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9h.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (str.to.re "abc"))) 14 | (assert (str.in.re var_1 (str.to.re "abc"))) 15 | (assert (not (= var_0 var_1))) 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/automata-bwd.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | ;(assert (= x "bB")) 4 | (assert(str.suffixof "B" x)) 5 | 6 | ;(assert (str.in.re x (re.from_automaton "automaton value_0 {init s0; s0 -> s0 [0, 65];s0 -> s0 [68, 97];s0 -> s1 [98, 98];s0 -> s0 [99, 65535]; s1 -> s1 [0, 66];s1 -> s1 [68, 65535];accepting s0,s1;};"))) 7 | (assert (str.in.re x (re.from_automaton "automaton value_0 {init s0; s0 -> s0 [0, 66];s0 -> s0 [68, 65535];accepting s0;};"))) 8 | 9 | (assert(= y (str.replace x "B" "b"))) 10 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9f.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (re.* (re.range "a" "u")))) 14 | (assert (str.in.re var_0 (re.* (str.to.re "v")))) 15 | (assert (not (= var_0 ""))) 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/loop-cg3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const x String) 4 | (declare-const y String) 5 | 6 | ; "aaaa".match(/(a*?){1,4}/) ===> a 7 | (assert (= y ((_ str.extract 1) x 8 | (re.++ 9 | (re.*? re.allchar) 10 | ((_ re.loop 1 4) 11 | ((_ re.capture 1) 12 | (re.*? (str.to.re "a")))) 13 | re.all)))) 14 | 15 | (assert (str.in.re x (str.to.re "aaaa"))) 16 | (assert (str.in.re y (str.to.re "a"))) 17 | 18 | (check-sat) 19 | (get-model) 20 | -------------------------------------------------------------------------------- /tests/non-greedy-quantifiers.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | 8 | (assert (= a (str.++ b c))) 9 | (assert (= b (str.++ d c))) 10 | 11 | ; in a simple membership test, non-greedy quantifiers have exactly the same 12 | ; semantics as greedy quantifiers 13 | (assert (str.in.re a (re.+ (re.union (str.to.re "x") (str.to.re "y"))))) 14 | (assert (str.in.re c (re.+? (str.to.re "x")))) 15 | 16 | (check-sat) 17 | (get-model) 18 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-008.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "*") z))) 8 | (assert (= z (str.replace_re_longest_all w (str.to.re "*") v))) 9 | 10 | (assert (str.in.re y (str.to.re "******"))) 11 | (assert (str.in.re z (str.to.re "\x5c"))) ; \ 12 | (assert (str.in.re w (str.to.re "**"))) 13 | (assert (str.in.re v (str.to.re "\x5c"))) ; \ 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9d.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | ;(assert (str.in.re var_0 (re.* (re.range "a" "u")))) 14 | (assert (str.in.re var_0 (re.* (str.to.re "u")))) 15 | (assert (str.in.re var_0 (re.+ (str.to.re "v")))) 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/concat-regex3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (set-info :status sat) 4 | 5 | (declare-fun a () String) 6 | (declare-fun b () String) 7 | (declare-fun c () String) 8 | (declare-fun d () String) 9 | 10 | (assert (= a (str.++ b (str.++ (str.++ c c) b)))) 11 | (assert (= b (str.++ d c))) 12 | 13 | (assert (str.in.re a (re.+ (re.++ (str.to.re "x") 14 | (re.++ (re.* (str.to.re "z")) 15 | (re.* (str.to.re "y"))))))) 16 | (assert (str.in.re c (re.+ (str.to.re "x")))) 17 | 18 | (check-sat) 19 | (get-model) 20 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-019.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "0101") z))) 8 | (assert (= y (str.replace_re_longest_all w (str.to.re "a") v))) 9 | 10 | (assert (str.in.re x (re.++ (re.* (str.to.re "0")) (str.to.re "11")))) 11 | (assert (str.in.re y (re.* (str.to.re "01")))) 12 | (assert (str.in.re z (re.* (str.to.re "10")))) 13 | (assert (str.in.re v (re.* (str.to.re "10")))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/anchor-5.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | (assert (= y (str.replace_cg_all 5 | x 6 | (re.++ 7 | (re.+ (str.to.re "a")) 8 | re.end-anchor) 9 | (str.to.re "b")))) 10 | 11 | (assert (= y "cb")) 12 | (assert (str.in.re x 13 | (re.++ 14 | re.all 15 | (str.to.re "a") 16 | (re.+ 17 | (str.to.re "a")) 18 | re.all))) 19 | 20 | (check-sat) 21 | (get-model) 22 | -------------------------------------------------------------------------------- /tests/parikh-constraints.smt2: -------------------------------------------------------------------------------- 1 | ;(set-logic ALL_SUPPORTED) 2 | ;(set-option :strings-exp true) 3 | ;(set-option :produce-models true) 4 | ;(set-option :rewrite-divk true) 5 | 6 | (declare-fun value2 () String) 7 | (declare-fun key2 () String) 8 | 9 | (assert 10 | 11 | (str.contains 12 | (str.replace 13 | (str.substr 14 | value2 15 | 0 (+ (str.indexof value2 "G" 0) 1)) 16 | "G" "g") 17 | "M") 18 | 19 | ) 20 | 21 | (check-sat) 22 | 23 | ;(get-value (value2)) 24 | ;(get-value (key2)) -------------------------------------------------------------------------------- /tests/norn-benchmark-9j.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (str.to.re "abc"))) 14 | (assert (or (str.in.re var_1 (str.to.re "abd")) 15 | (str.in.re var_1 (str.to.re "ab")) 16 | (str.in.re var_1 (str.to.re "abcd")))) 17 | (assert (= var_0 var_1)) 18 | (check-sat) 19 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-007.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "0") z))) 8 | (assert (= z (str.replace_re_longest_all w (str.to.re "1") v))) 9 | 10 | (assert (str.in.re x (re.++ (str.to.re "*") (re.* (str.to.re "*"))))) 11 | (assert (str.in.re y (re.* (str.to.re "0")))) 12 | (assert (str.in.re z (re.* (str.to.re "*")))) 13 | (assert (str.in.re w (re.* (str.to.re "1")))) 14 | (assert (str.in.re v (str.to.re "**"))) 15 | 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/norn-benchmark-9i.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun var_0 () String) 4 | (declare-fun var_1 () String) 5 | (declare-fun var_2 () String) 6 | (declare-fun var_3 () String) 7 | (declare-fun var_4 () String) 8 | (declare-fun var_5 () String) 9 | (declare-fun var_6 () String) 10 | (declare-fun var_7 () String) 11 | (declare-fun var_8 () String) 12 | 13 | (assert (str.in.re var_0 (str.to.re "abc"))) 14 | (assert (or (str.in.re var_1 (str.to.re "abd")) 15 | (str.in.re var_1 (str.to.re "ab")) 16 | (str.in.re var_1 (str.to.re "abcd")))) 17 | (assert (not (= var_0 var_1))) 18 | (check-sat) 19 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-016.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (str.in.re x (re.* (str.to.re "ab")))) 8 | (assert (str.in.re y (re.* (str.to.re "c")))) 9 | (assert (str.in.re z (str.to.re "cccc"))) 10 | (assert (str.in.re w (re.++ (str.to.re "01") (re.* (str.to.re "01"))))) 11 | (assert (str.in.re v (str.to.re "c"))) 12 | 13 | (assert (= z (str.replace_re_longest_all x (str.to.re "abab") y))) 14 | (assert (= y (str.replace_re_longest_all w (str.to.re "01") v))) 15 | 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-010.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "a") z))) 8 | (assert (= y (str.replace_re_longest_all w (str.to.re "1") v))) 9 | 10 | (assert (str.in.re y (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b"))))) 11 | (assert (str.in.re z (str.to.re "1"))) 12 | (assert (str.in.re x (re.++ (str.to.re "1111") (re.* (str.to.re "1"))))) 13 | (assert (str.in.re w (re.++ (str.to.re "1") (re.* (str.to.re "11"))))) 14 | 15 | (check-sat) 16 | -------------------------------------------------------------------------------- /tests/anchor-1.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | (assert (= y (str.replace_cg_all 5 | x 6 | (re.++ 7 | re.begin-anchor 8 | (re.+ (str.to.re "a"))) 9 | (str.to.re "b")))) 10 | 11 | (assert (= y "bc")) 12 | (assert (str.in.re x 13 | (re.++ 14 | re.all 15 | (str.to.re "a") 16 | (re.+ 17 | (str.to.re "a")) 18 | re.all))) 19 | ;(assert (not (str.contains y "aa"))) 20 | 21 | (check-sat) 22 | (get-model) 23 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-009.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "a") z))) 8 | (assert (= y (str.replace_re_longest_all w (str.to.re "1") v))) 9 | 10 | (assert (str.in.re y (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b"))))) 11 | (assert (str.in.re z (str.to.re "1"))) 12 | (assert (str.in.re x (re.++ (str.to.re "1111") (re.* (str.to.re "1"))))) 13 | (assert (str.in.re w (re.* (str.to.re "1")))) 14 | (assert (str.in.re v (str.to.re "ab"))) 15 | 16 | (check-sat) 17 | -------------------------------------------------------------------------------- /tests/no-regexes.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_S) 3 | 4 | (set-option :parse-transducers true) 5 | 6 | (define-funs-rec ((isempty ((x String) (y String)) Bool)) ( 7 | ; def isempty 8 | (and (not (= x "")) (not (= y "")) 9 | (= (str.head x) (char.from-int 48)) ; '0' 10 | (= (str.head y) (char.from-int 49)) ; '1' 11 | (isempty (str.tail x) (str.tail y))) 12 | )) 13 | 14 | (declare-fun x () String) 15 | (declare-fun y () String) 16 | 17 | (assert (isempty x y)) 18 | 19 | (check-sat) 20 | 21 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-013.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "010") z))) 6 | 7 | (assert 8 | (str.in.re x 9 | (re.++ 10 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 11 | (re.union 12 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 14 | ) 15 | ) 16 | ) 17 | ) 18 | (assert (str.in.re y (str.to.re "010101"))) 19 | (assert (str.in.re z (re.* (str.to.re "10")))) 20 | 21 | (check-sat) 22 | -------------------------------------------------------------------------------- /tests/regex_cg_ref3.smt2: -------------------------------------------------------------------------------- 1 | ; function globUnescape (s) { 2 | ; return s.replace(/\\(.)/g, '$1') 3 | ; } 4 | (set-logic QF_S) 5 | 6 | (declare-const x String) 7 | (declare-const y String) 8 | 9 | (assert (= y (str.replace_cg_all x 10 | (re.++ (re.charrange (char.from-int 92) (char.from-int 92)) ((_ re.capture 1) re.allchar)) 11 | (_ re.reference 1)))) 12 | 13 | (assert (str.in.re x (re.++ 14 | (re.charrange (char.from-int 92) (char.from-int 92)) 15 | (re.+ re.allchar)))) 16 | 17 | (assert (str.in.re y (re.++ 18 | re.all 19 | (re.charrange (char.from-int 92) (char.from-int 92)) 20 | re.all))) 21 | 22 | (check-sat) 23 | (get-model) 24 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-001.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "0") z))) 6 | 7 | (assert 8 | (str.in.re x 9 | (re.++ 10 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 11 | (re.union 12 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 14 | ) 15 | ) 16 | ) 17 | ) 18 | (assert (str.in.re y (re.* (str.to.re "01")))) 19 | (assert (str.in.re z (re.* (str.to.re "10")))) 20 | 21 | (check-sat) 22 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-012.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "010") z))) 6 | 7 | (assert 8 | (str.in.re x 9 | (re.++ 10 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 11 | (re.union 12 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 14 | ) 15 | ) 16 | ) 17 | ) 18 | (assert (str.in.re y (re.* (str.to.re "01")))) 19 | (assert (str.in.re z (re.* (str.to.re "10")))) 20 | 21 | (check-sat) 22 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-015.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | 5 | (assert (= x (str.replace_re_longest_all y (str.to.re "0101") z))) 6 | 7 | (assert 8 | (str.in.re x 9 | (re.++ 10 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 11 | (re.union 12 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 14 | ) 15 | ) 16 | ) 17 | ) 18 | (assert (str.in.re y (re.* (str.to.re "01")))) 19 | (assert (str.in.re z (re.* (str.to.re "10")))) 20 | 21 | (check-sat) 22 | -------------------------------------------------------------------------------- /tests/anchor-8.smt2: -------------------------------------------------------------------------------- 1 | (set-option :produce-models true) 2 | (set-option :inline-size-limit 10000) 3 | 4 | (declare-const var0 String) 5 | (assert (str.in.re 6 | (str.replace_cg_all var0 7 | (re.++ 8 | re.begin-anchor 9 | (re.opt 10 | ((_ re.capture 1) 11 | (re.range "a" "a"))) 12 | (re.range "a" "a") 13 | re.end-anchor) 14 | (_ re.reference 1)) 15 | (re.range "a" "a"))) 16 | 17 | (check-sat) 18 | (get-model) 19 | -------------------------------------------------------------------------------- /tests/regex_cg_ref2.smt2: -------------------------------------------------------------------------------- 1 | ; function globUnescape (s) { 2 | ; return s.replace(/\\(.)/g, '$1') 3 | ; } 4 | (set-logic QF_S) 5 | 6 | (declare-const x String) 7 | (declare-const y String) 8 | 9 | (assert (= y (str.replace_cg_all x 10 | (re.++ (re.charrange (char.from-int 92) (char.from-int 92)) ((_ re.capture 1) re.allchar)) 11 | (_ re.reference 1)))) 12 | 13 | (assert (str.in.re x (re.++ 14 | (re.charrange (char.from-int 92) (char.from-int 92)) 15 | (re.+ re.allchar)))) 16 | 17 | (assert (str.in.re y (re.complement (re.++ 18 | re.all 19 | (re.charrange (char.from-int 92) (char.from-int 92)) 20 | re.all)))) 21 | 22 | (check-sat) 23 | (get-model) 24 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/cyclic-xy.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Cyclic Word equations 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | 16 | (assert (= (str.++ y x) (str.++ x y))) 17 | (assert (str.in_re x (re.union (str.to_re "a") (str.to_re "b")))) 18 | (assert (str.in_re y (re.union (str.to_re "bab") (str.to_re "aba")))) 19 | 20 | (check-sat) 21 | (exit) 22 | -------------------------------------------------------------------------------- /tests/chars.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_) 2 | 3 | (declare-fun x () String) 4 | (declare-fun z () String) 5 | (declare-fun a () String) 6 | (declare-fun b () String) 7 | (declare-fun c () String) 8 | 9 | ; (declare-fun ch () Int) 10 | 11 | (assert (= (str.from_code 90) x)) 12 | ; (assert (= (str.from_code ch) x)) 13 | (assert (= (str.from_code (- 1)) z)) 14 | (assert (= (str.from_code (bv2nat #x73)) a)) 15 | (assert (= (str.from_code (bv2nat #x73)) b)) 16 | (assert (= (str.++ (str.from_code (bv2nat #b01110011)) (str.from_code (bv2nat #b01110100)) (str.from_code (bv2nat #b01110010)) (str.from_code (bv2nat #b01101001)) (str.from_code (bv2nat #b01101110)) (str.from_code (bv2nat #b01100111))) c)) 17 | 18 | (check-sat) 19 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-022.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (assert (= x (str.replace_re_longest_all y (re.++ (re.++ (re.* (str.to.re "1")) (re.* (str.to.re "0"))) (str.to.re "10")) z))) 5 | 6 | (assert 7 | (str.in.re x 8 | (re.++ 9 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 10 | (re.union 11 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 12 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | ) 14 | ) 15 | ) 16 | ) 17 | (assert (str.in.re y (re.* (str.to.re "01")))) 18 | (assert (str.in.re z (re.* (str.to.re "10")))) 19 | 20 | (check-sat) 21 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-023.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (assert (= x (str.replace_re_longest_all y (re.++ (re.++ (re.++ (str.to.re "1") (re.* (str.to.re "0"))) (re.* (str.to.re "0"))) (str.to.re "10")) z))) 5 | 6 | (assert 7 | (str.in.re x 8 | (re.++ 9 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 10 | (re.union 11 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 12 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 13 | ) 14 | ) 15 | ) 16 | ) 17 | (assert (str.in.re y (re.* (str.to.re "01")))) 18 | (assert (str.in.re z (re.* (str.to.re "10")))) 19 | 20 | (check-sat) 21 | -------------------------------------------------------------------------------- /tests/temp-prop/noodles-unsat7.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unknown) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.++(str.to_re "2") re.all))) 19 | (assert (str.in_re y (re.++(str.to_re "1") re.all))) 20 | (assert (str.in_re z (str.to_re "2"))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/noodles-unsat4.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.+ (str.to_re "1111")))) 19 | (assert (str.in_re y (str.to_re "11"))) 20 | (assert (str.in_re z (re.+ (str.to_re "111")))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/empty-union.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun TestC0 () String) 2 | (declare-fun |18 Fill 1| () String) 3 | (declare-fun |18 Fill 0| () String) 4 | (declare-fun |18 Fill 2| () String) 5 | (assert (let ((a!1 (re.union (re.range "a" "z") 6 | (re.range "A" "Z") 7 | (re.range "0" "9") 8 | (str.to.re "_")))) 9 | (let ((a!2 10 | (re.complement a!1)) 11 | (a!3 (re.inter (str.to.re "Giggles") 12 | (re.++ a!1 (re.* (re.range "\x00" "\xff"))))) 13 | ) 14 | (let ((a!6 (re.++ (re.union a!2 (str.to.re "")) ) 15 | )) 16 | (str.in.re TestC0 17 | a!6 18 | ))))) 19 | 20 | (check-sat) 21 | (get-model) -------------------------------------------------------------------------------- /tests/membership_427.smt2: -------------------------------------------------------------------------------- 1 | ;--- 2 | ; using 7-bit bit-vectors as characters 3 | ; check membership of .Net regex 4 | ; regexA = /([^\x00-\xFF]\s*)/u 5 | ;--- 6 | (set-info :status unsat) 7 | (set-option :print-success true) 8 | (set-logic QF_BVS) 9 | (define-sort CHAR () (_ BitVec 7)) 10 | (declare-const regexA (RegEx CHAR)) 11 | (declare-const x (Seq CHAR)) 12 | 13 | (assert (= regexA (re-concat (re-range #b0101111 #b0101111)(re-concat (re-concat (as re-empty-set (RegEx CHAR)) (re-star (re-union (re-range #b0001001 #b0001101) (re-range #b0100000 #b0100000)))) (re-of-seq (seq-cons #b0101111 (seq-cons #b1110101 (as seq-empty (Seq CHAR))))))))) 14 | 15 | ;check that the regex contains some x 16 | (assert (re-member x regexA)) 17 | (check-sat) 18 | -------------------------------------------------------------------------------- /tests/anchor-4.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | (assert (= y (str.replace_cg_all 5 | x 6 | (re.+ (re.++ 7 | re.begin-anchor 8 | (str.to.re "a"))) 9 | (str.to.re "b")))) 10 | 11 | ; a modified version of anchor-3 12 | ; sat 13 | (assert (str.in.re y 14 | (re.++ 15 | (str.to.re "b") 16 | re.all))) 17 | 18 | (assert (str.in.re x 19 | (re.++ 20 | re.all 21 | (str.to.re "a") 22 | (re.+ 23 | (str.to.re "a")) 24 | re.all))) 25 | 26 | (check-sat) 27 | (get-model) 28 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/noodles-unsat5.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.++(str.to_re "2") re.all))) 19 | (assert (str.in_re y (re.++(str.to_re "1") re.all))) 20 | (assert (str.in_re z (re.++(str.to_re "2") re.all))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/noodles-unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.* (str.to_re "1")))) 19 | (assert (str.in_re y (re.++ (re.+ (str.to_re "1")) (re.+ (str.to_re "2")) ))) 20 | (assert (str.in_re z (re.* (str.to_re "2")))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/temp-prop/03_track_11.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Joel Day, Thorsten Ehlers, Mitja Kulczynski, Federico Mora, Florin Manea, Dirk Nowotka, Danny Poulsen, Zhengyang Lu 5 | Application: Test WOORPJE 6 | Target solver: WOORPJE 7 | Publications: Day, J. D., Ehlers, T., Kulczynski, M., Manea, F., Nowotka, D., & Poulsen, D. B. (2019). On solving word equations using SAT. In RP 2019 8 | Description: Transoformed and expanded from Track02 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "random") 12 | (set-info :status unknown) 13 | 14 | (declare-fun C () String) 15 | (assert (= (str.++ C "a" C) (str.++ "aaaa" "") )) 16 | (check-sat) 17 | 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/noodles-unsat2.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x z x z))) 18 | (assert (str.in_re x (re.* (str.to_re "1")))) 19 | (assert (str.in_re y (re.++ (re.+ (str.to_re "1")) (re.+ (str.to_re "2")) ))) 20 | (assert (str.in_re z (re.* (str.to_re "2")))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-018.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "010") z))) 8 | (assert (= z (str.replace_re_longest_all w (str.to.re "00") v))) 9 | 10 | (assert 11 | (str.in.re x 12 | (re.++ 13 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 14 | (re.union 15 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 16 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 17 | ) 18 | ) 19 | ) 20 | ) 21 | (assert (str.in.re y (str.to.re "01011"))) 22 | (assert (str.in.re z (re.* (str.to.re "10")))) 23 | 24 | (check-sat) 25 | -------------------------------------------------------------------------------- /tests/anchor-7.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | ; a more tricky example where $ occurs in a star 5 | ; (a$)+ => b 6 | (assert (= y (str.replace_cg_all 7 | x 8 | (re.+ (re.++ 9 | (str.to.re "a") 10 | re.end-anchor)) 11 | (str.to.re "b")))) 12 | 13 | (assert (str.in.re y 14 | (re.++ 15 | re.all 16 | (str.to.re "b")))) 17 | 18 | (assert (str.in.re x 19 | (re.++ 20 | re.all 21 | (str.to.re "a") 22 | (re.+ 23 | (str.to.re "a")) 24 | re.all))) 25 | 26 | (check-sat) 27 | (get-model) 28 | -------------------------------------------------------------------------------- /tests/anchor-double.smt2: -------------------------------------------------------------------------------- 1 | (set-option :produce-models true) 2 | (set-option :inline-size-limit 10000) 3 | 4 | (declare-const var0 String) 5 | (assert (str.in.re 6 | (str.replace_cg_all var0 7 | (re.++ 8 | re.begin-anchor 9 | re.begin-anchor 10 | (re.opt 11 | ((_ re.capture 1) 12 | (re.range "a" "a"))) 13 | (re.range "a" "a") 14 | re.end-anchor 15 | re.end-anchor) 16 | (_ re.reference 1)) 17 | (re.range "a" "a"))) 18 | 19 | (check-sat) 20 | (get-model) 21 | -------------------------------------------------------------------------------- /tests/adt.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-datatype Tree ( (leaf) (node (left Tree) (data String) (right Tree)) )) 4 | 5 | (define-fun-rec cat ((t Tree)) String 6 | (ite (is-leaf t) "" 7 | (str.++ (cat (left t)) (data t) (cat (right t))))) 8 | 9 | (define-fun-rec nonEmpty ((t Tree)) Bool 10 | (or (is-leaf t) 11 | (and (is-node t) 12 | (not (= (data t) "")) 13 | (nonEmpty (left t)) 14 | (nonEmpty (right t))))) 15 | 16 | (declare-const a String) 17 | (declare-const b String) 18 | (declare-const c String) 19 | (declare-const t Tree) 20 | 21 | (assert (= (str.++ a b c) "Hello World")) 22 | 23 | (assert (= (cat t) "Hello World")) 24 | (assert (nonEmpty t)) 25 | ;(assert (> (_size t) 5)) 26 | (assert (< (_size t) 10)) 27 | 28 | (check-sat) -------------------------------------------------------------------------------- /tests/adt2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-datatype Tree ( (leaf) (node (left Tree) (data String) (right Tree)) )) 4 | 5 | (define-fun-rec cat ((t Tree)) String 6 | (ite (is-leaf t) "" 7 | (str.++ (cat (left t)) (data t) (cat (right t))))) 8 | 9 | (define-fun-rec nonEmpty ((t Tree)) Bool 10 | (or (is-leaf t) 11 | (and (is-node t) 12 | (not (= (data t) "")) 13 | (nonEmpty (left t)) 14 | (nonEmpty (right t))))) 15 | 16 | (declare-const a String) 17 | (declare-const b String) 18 | (declare-const c String) 19 | (declare-const t Tree) 20 | 21 | (assert (= (str.++ a b c) "Hello World")) 22 | 23 | (assert (= (cat t) "Hello World")) 24 | (assert (nonEmpty t)) 25 | (assert (> (_size t) 5)) 26 | (assert (< (_size t) 10)) 27 | 28 | (check-sat) -------------------------------------------------------------------------------- /tests/temp-prop/noodles-unsat6.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unknown) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.++(str.to_re "2") (re.union (str.to_re "1")(str.to_re "2"))))) 19 | (assert (str.in_re y (re.++(str.to_re "1") re.all))) 20 | (assert (str.in_re z (re.++(str.to_re "2") re.all))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-020.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | (assert (= x (str.replace_re_longest_all y (str.to.re "0101") z))) 8 | (assert (= z (str.replace_re_longest_all v (str.to.re "1111") w))) 9 | 10 | (assert 11 | (str.in.re x 12 | (re.++ 13 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 14 | (re.union 15 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 16 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 17 | ) 18 | ) 19 | ) 20 | ) 21 | (assert (str.in.re y (re.* (str.to.re "01")))) 22 | (assert (str.in.re z (re.* (str.to.re "10")))) 23 | 24 | (check-sat) 25 | -------------------------------------------------------------------------------- /tests/temp-prop/noodles-unsat10.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unknown) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ "2" y x) (str.++ x x "2"))) 18 | (assert (str.in_re x (re.++(str.to_re "2") (re.union (re.* (str.to_re "1"))(re.* (str.to_re "2")))))) 19 | (assert (str.in_re y (re.++(str.to_re "2")(re.union (re.* (str.to_re "1"))(re.* (str.to_re "2")))))) 20 | 21 | (check-sat) 22 | (exit) 23 | -------------------------------------------------------------------------------- /tests/anchor-3.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | ; a more tricky example where ^ occurs in a star 5 | ; (^a)+ => b 6 | (assert (= y (str.replace_cg_all 7 | x 8 | (re.+ (re.++ 9 | re.begin-anchor 10 | (str.to.re "a"))) 11 | (str.to.re "b")))) 12 | 13 | (assert (= y "bc")) 14 | 15 | ; suppose x has at least two consecutive 'a's 16 | ; but because of ^, the star can only match once 17 | ; making this unsat. 18 | (assert (str.in.re x 19 | (re.++ 20 | re.all 21 | (str.to.re "a") 22 | (re.+ 23 | (str.to.re "a")) 24 | re.all))) 25 | 26 | (check-sat) 27 | (get-model) 28 | -------------------------------------------------------------------------------- /tests/anchor-6.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | 4 | ; a more tricky example where $ occurs in a star 5 | ; (a$)+ => b 6 | (assert (= y (str.replace_cg_all 7 | x 8 | (re.+ (re.++ 9 | (str.to.re "a") 10 | re.end-anchor)) 11 | (str.to.re "b")))) 12 | 13 | (assert (= y "cb")) 14 | 15 | ; suppose x has at least two consecutive 'a's 16 | ; but because of $, the star can only match once 17 | ; making this unsat. 18 | (assert (str.in.re x 19 | (re.++ 20 | re.all 21 | (str.to.re "a") 22 | (re.+ 23 | (str.to.re "a")) 24 | re.all))) 25 | 26 | (check-sat) 27 | (get-model) 28 | -------------------------------------------------------------------------------- /tests/parse-ecma-cases-2.smt2: -------------------------------------------------------------------------------- 1 | ; Examples that need the full 2AFA regex pipeline 2 | 3 | (set-logic QF_S) 4 | 5 | (declare-const w String) 6 | 7 | (assert (not (and 8 | 9 | (= (str.in_re w (re.from_ecma2020 '((?=a*x)a)*x')) 10 | (str.in_re w (re.from_ecma2020 'a*x'))) 11 | 12 | (= (str.in_re w (re.from_ecma2020 '/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/')) 13 | (str.in_re w 14 | (re.inter (re.from_ecma2020 '/.{6,}/') 15 | (re.from_ecma2020 '.*\d.*') 16 | (re.from_ecma2020 '.*[a-z].*') 17 | (re.from_ecma2020 '.*[A-Z].*')))) 18 | 19 | (= (str.in_re w (re.from_ecma2020 '.(?=a|b)[b-z]')) 20 | (str.in_re w (re.from_ecma2020 '.b'))) 21 | 22 | ))) 23 | 24 | (check-sat) 25 | -------------------------------------------------------------------------------- /tests/failedProp.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.prefixof x (str.at x 1)) (= x "")))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/replace-special.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (= "B" (str.replace "" x "A")) false))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/transducer2b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-fun-rec toUpper ((x String) (y String)) Bool 8 | (or (and (= x "") (= y "")) 9 | (and (not (= x "")) (not (= y "")) 10 | (= (char.code (str.head y)) 11 | (ite (and (<= 97 (char.code (str.head x))) ; 'a' 12 | (<= (char.code (str.head x)) 122)) ; 'z' 13 | (- (char.code (str.head x)) 32) ; 'a' -> 'A', etc. 14 | (char.code (str.head x)))) 15 | (toUpper (str.tail x) (str.tail y)))) 16 | ) 17 | 18 | (declare-fun x () String) 19 | (declare-fun y () String) 20 | 21 | (assert (= x "Hello World")) 22 | (assert (toUpper x y)) 23 | (assert (= y "HELLO WORLT")) 24 | 25 | (check-sat) 26 | -------------------------------------------------------------------------------- /tests/transducer2c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-fun-rec toUpper ((x String) (y String)) Bool 8 | (or (and (= x "") (= y "")) 9 | (and (not (= x "")) (not (= y "")) 10 | (= (char.code (str.head y)) 11 | (ite (and (<= 97 (char.code (str.head x))) ; 'a' 12 | (<= (char.code (str.head x)) 122)) ; 'z' 13 | (- (char.code (str.head x)) 32) ; 'a' -> 'A', etc. 14 | (char.code (str.head x)))) 15 | (toUpper (str.tail x) (str.tail y)))) 16 | ) 17 | 18 | (declare-fun x () String) 19 | (declare-fun y () String) 20 | 21 | (assert (= x "Hello World")) 22 | (assert (toUpper x y)) 23 | (assert (= y "HELLO WORL")) 24 | 25 | (check-sat) 26 | -------------------------------------------------------------------------------- /tests/transducer2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-fun-rec toUpper ((x String) (y String)) Bool 8 | (or (and (= x "") (= y "")) 9 | (and (not (= x "")) (not (= y "")) 10 | (= (char.code (str.head y)) 11 | (ite (and (<= 97 (char.code (str.head x))) ; 'a' 12 | (<= (char.code (str.head x)) 122)) ; 'z' 13 | (- (char.code (str.head x)) 32) ; 'a' -> 'A', etc. 14 | (char.code (str.head x)))) 15 | (toUpper (str.tail x) (str.tail y)))) 16 | ) 17 | 18 | (declare-fun x () String) 19 | (declare-fun y () String) 20 | 21 | (assert (= x "Hello World")) 22 | (assert (toUpper x y)) 23 | (assert (not (= y "HELLO WORLD"))) 24 | 25 | (check-sat) 26 | -------------------------------------------------------------------------------- /tests/transducer2d.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-fun-rec toUpper ((x String) (y String)) Bool 8 | (or (and (= x "") (= y "")) 9 | (and (not (= x "")) (not (= y "")) 10 | (= (char.code (str.head y)) 11 | (ite (and (<= 97 (char.code (str.head x))) ; 'a' 12 | (<= (char.code (str.head x)) 122)) ; 'z' 13 | (- (char.code (str.head x)) 32) ; 'a' -> 'A', etc. 14 | (char.code (str.head x)))) 15 | (toUpper (str.tail x) (str.tail y)))) 16 | ) 17 | 18 | (declare-fun x () String) 19 | (declare-fun y () String) 20 | 21 | (assert (= x "Hello World")) 22 | (assert (toUpper x y)) 23 | ; (assert (= y "HELLO WORLD")) 24 | 25 | (check-sat) 26 | -------------------------------------------------------------------------------- /tests/replace-special-2.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.prefixof (str.replace "" x x) y) true))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/str-term-small-rw_186.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.substr x 1 (str.indexof x x z)) ""))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /src/test/scala/ostrich/preop/ConcatPreOpSpecification.scala: -------------------------------------------------------------------------------- 1 | package ostrich.preop 2 | 3 | import ostrich.automata.{BricsAutomaton, Automaton} 4 | 5 | import org.scalacheck.{Arbitrary, Gen, Properties} 6 | import org.scalacheck.Prop._ 7 | 8 | import dk.brics.automaton.{Automaton => BAutomaton, State, Transition} 9 | 10 | object ConcatPreOpSpecification 11 | extends Properties("ConcatPreOp"){ 12 | 13 | def seq(s : String) = s.map(_.toInt) 14 | 15 | property("Simple Post") = { 16 | val baut1 = BricsAutomaton.fromString("d") 17 | val baut2 = BricsAutomaton.fromString("e") 18 | 19 | val concat = ConcatPreOp.forwardApprox(Seq(Seq(baut1.asInstanceOf[Automaton]), 20 | Seq(baut2.asInstanceOf[Automaton]))) 21 | 22 | concat(seq("de")) && !concat(seq("d")) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/anchor-alternate.smt2: -------------------------------------------------------------------------------- 1 | (set-option :produce-models true) 2 | (set-option :inline-size-limit 10000) 3 | 4 | (declare-const var0 String) 5 | (assert (str.in.re 6 | (str.replace_cg_all var0 7 | (re.++ 8 | re.begin-anchor 9 | re.begin-anchor 10 | (re.opt 11 | ((_ re.capture 1) 12 | (re.range "a" "a"))) 13 | (re.range "a" "a") 14 | re.end-anchor 15 | re.begin-anchor 16 | re.end-anchor) 17 | (_ re.reference 1)) 18 | (re.* (re.range "a" "a")))) 19 | 20 | (check-sat) 21 | (get-model) 22 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/artur-unsat-we.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Instance of Lyndon-Schuetzenberger theorem 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | (declare-fun X () String) 13 | (declare-fun A () String) 14 | (declare-fun B () String) 15 | (declare-fun C () String) 16 | (declare-fun D () String) 17 | (declare-fun E () String) 18 | 19 | (assert (= X (str.++ A B C))) 20 | (assert (= C (str.++ "b" D))) 21 | (assert (= B (str.++ "a" E))) 22 | (assert (= (str.++ X X) (str.++ A A B B C C))) 23 | (assert (= (str.++ X X X) (str.++ A A A B B B C C C))) 24 | 25 | (check-sat) 26 | (exit) 27 | -------------------------------------------------------------------------------- /tests/temp-prop/noodles-unsat8.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unknown) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.++(str.to_re "2") (re.union (re.* (str.to_re "1"))(re.* (str.to_re "2")))))) 19 | (assert (str.in_re y (re.++(str.to_re "1") (re.union (re.* (str.to_re "1"))(re.* (str.to_re "2")))))) 20 | (assert (str.in_re z (re.++(str.to_re "2") re.all))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/replace-special-3.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.contains (str.replace "B" "" x) y) (str.contains (str.++ x "B") y)))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/replace-special-4.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.replace "" (str.++ x y) "A") (str.replace "" x (str.replace x y "A"))))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/replace-special-5.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.replace "" (str.replace "" x "A") "B") (str.substr "B" 0 (str.len x))))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/str-term-small-rw_164.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () Int) 16 | (assert (not (= (str.substr x 0 (str.indexof "A" y 1)) (str.at x (str.indexof "" y 0))))) 17 | (check-sat) 18 | (exit) 19 | -------------------------------------------------------------------------------- /tests/cvc_replace_28.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | (declare-fun sigmaStar_0 () String) 5 | (declare-fun sigmaStar_6 () String) 6 | (declare-fun literal_9 () String) 7 | (declare-fun x_7 () String) 8 | (declare-fun x_10 () String) 9 | (declare-fun literal_11 () String) 10 | (declare-fun A () String) 11 | (assert (= x_7 (str.replace sigmaStar_0 "\x2f\x5b\x5e\x41\x53\x43\x52\x20\x2e\x5c\x2d\x40\x3a\x2f\x5d\x2f" "\x48\x45\x4c\x4c\x4f"))) 12 | (assert (= literal_9 "\x3c\x74\x64\x3e\x55\x52\x4c\x3a\x20")) 13 | (assert (= x_10 (str.++ literal_9 x_7))) 14 | (assert (= literal_11 "\x3c\x2f\x74\x64\x3e")) 15 | (assert (= A (str.++ x_10 literal_11))) 16 | (assert (str.in.re A (re.++ (re.* re.allchar) (re.++ (str.to.re "\x5c\x3c\x53\x43\x52\x49\x50\x54") (re.* re.allchar))))) 17 | 18 | (check-sat) 19 | (get-model) 20 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/noodles-unsat3.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ "1111" z "1" y x "21111") (str.++ "11" x x "111" z))) 18 | (assert (str.in_re x (re.++ (re.+ (str.to_re "1")) (re.+ (str.to_re "2")) ))) 19 | (assert (str.in_re y (re.++ (re.+ (str.to_re "1")) (re.* (str.to_re "2")) ))) 20 | (assert (str.in_re z (re.++ (re.+ (str.to_re "2")) (re.* (str.to_re "1")) ))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/simple-concat.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | (assert (= x2 (str.++ x0 x1))) 23 | (assert (toUpper x2 x3)) 24 | (assert (str.in.re x3 (re.+ (re.range "A" "Z")))) 25 | 26 | (check-sat) 27 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/artur-unsat-common-prefix.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Instance of Lyndon-Schuetzenberger theorem 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | (declare-fun X () String) 13 | (declare-fun A () String) 14 | (declare-fun B () String) 15 | (declare-fun C () String) 16 | (declare-fun D () String) 17 | (declare-fun E () String) 18 | 19 | (assert (= X (str.++ A B C))) 20 | (assert (= (str.++ X X) (str.++ A A B B C C))) 21 | (assert (= (str.++ X X X) (str.++ A A A B B B C C C))) 22 | (assert (str.in_re B (re.+ (str.to_re "b")))) 23 | (assert (str.in_re A (re.+ (str.to_re "a")))) 24 | (check-sat) 25 | (exit) -------------------------------------------------------------------------------- /tests/propagation-benchmarks/artur-unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Instance of Lyndon-Schuetzenberger theorem 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | (declare-fun X () String) 13 | (declare-fun A () String) 14 | (declare-fun B () String) 15 | (declare-fun C () String) 16 | (declare-fun D () String) 17 | (declare-fun E () String) 18 | 19 | (assert (= X (str.++ A B C))) 20 | (assert (= (str.++ X X) (str.++ A A B B C C))) 21 | (assert (= (str.++ X X X) (str.++ A A A B B B C C C))) 22 | (assert (str.in_re C (re.++(str.to_re "b") re.all))) 23 | (assert (str.in_re B (re.++(str.to_re "a") re.all))) 24 | (check-sat) 25 | (exit) 26 | -------------------------------------------------------------------------------- /tests/simple-concat-2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | ; should be unsat 23 | (assert (= x2 (str.++ x0 x1))) 24 | (assert (toUpper x2 x3)) 25 | (assert (str.in.re x3 (re.+ (re.range "a" "z")))) 26 | 27 | (check-sat) 28 | -------------------------------------------------------------------------------- /tests/simple-concat-4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | (assert (str.in.re x1 (re.+ (re.range "a" "b")))) 23 | (assert (= x3 (str.++ x1 x2))) 24 | (assert (str.in.re x3 (re.+ (re.range "a" "d")))) 25 | 26 | (check-sat) 27 | -------------------------------------------------------------------------------- /tests/temp-prop/noodles-unsat9.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Word equations + Regular Constraints 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unknown) 12 | 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun z () String) 16 | 17 | (assert (= (str.++ z y x) (str.++ x x z))) 18 | (assert (str.in_re x (re.++(str.to_re "2") (re.* (re.union (str.to_re "1")(re.* (str.to_re "2"))))))) 19 | (assert (str.in_re y (re.++(str.to_re "1") (re.* (re.union (str.to_re "1")(re.* (str.to_re "2"))))))) 20 | (assert (str.in_re z (re.++(str.to_re "2") (re.* (re.union (str.to_re "1")(re.* (str.to_re "2"))))))) 21 | 22 | (check-sat) 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/simple-concat-4b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | (assert (str.in.re x1 (re.+ (re.range "a" "b")))) 23 | (assert (= x3 (str.++ x1 x2))) 24 | (assert (str.in.re x3 (re.+ (re.range "c" "d")))) 25 | 26 | (check-sat) 27 | -------------------------------------------------------------------------------- /tests/simple-concat-5.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | ; should be unsat 23 | (assert (= x2 (str.++ x0 "Hello World"))) 24 | (assert (toUpper x2 x3)) 25 | (assert (str.in.re x3 (re.+ (re.range "A" "Z")))) 26 | 27 | (check-sat) 28 | -------------------------------------------------------------------------------- /tests/simple-concat-5b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | ; should be sat 23 | (assert (= x2 (str.++ x0 "HelloWorld"))) 24 | (assert (toUpper x2 x3)) 25 | (assert (str.in.re x3 (re.+ (re.range "A" "Z")))) 26 | 27 | (check-sat) 28 | -------------------------------------------------------------------------------- /tests/simple-concat-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; to-uppercase transducer 4 | 5 | (define-fun-rec toUpper ((x String) (y String)) Bool 6 | (or (and (= x "") (= y "")) 7 | (and (= (seq-head y) 8 | (ite (and (bvule (_ bv97 8) (seq-head x)) ; 'a' 9 | (bvule (seq-head x) (_ bv122 8))) ; 'z' 10 | (bvsub (seq-head x) (_ bv32 8)) ; 'a' -> 'A', etc. 11 | (seq-head x))) 12 | (toUpper (seq-tail x) (seq-tail y)))) 13 | ) 14 | 15 | (declare-fun x0 () String) 16 | (declare-fun x1 () String) 17 | (declare-fun x2 () String) 18 | (declare-fun x3 () String) 19 | (declare-fun x4 () String) 20 | (declare-fun s0 () String) ; source variable 21 | 22 | (assert (str.in.re x0 (re.+ (re.range "a" "z")))) 23 | (assert (toUpper x0 x1)) 24 | (assert (= x3 (str.++ x1 x2))) 25 | (assert (str.in.re x3 (re.+ (re.range "a" "z")))) 26 | 27 | (check-sat) 28 | -------------------------------------------------------------------------------- /tests/test-replace3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x0 () String) 4 | 5 | (declare-fun y1 () String) 6 | (declare-fun z1 () String) 7 | (declare-fun x1 () String) 8 | 9 | (declare-fun y2 () String) 10 | (declare-fun z2 () String) 11 | (declare-fun x2 () String) 12 | 13 | (declare-fun y3 () String) 14 | (declare-fun z3 () String) 15 | (declare-fun x3 () String) 16 | 17 | (assert (str.in.re x0 (str.to.re "abc"))) 18 | (assert (= y1 (str.replaceall x0 "c" "0"))) 19 | (assert (= z1 (str.replaceall x0 "c" "1"))) 20 | (assert (= x1 (str.++ y1 z1))) 21 | 22 | (assert (= y2 (str.replaceall x1 "b" "0"))) 23 | (assert (= z2 (str.replaceall x1 "b" "1"))) 24 | (assert (= x2 (str.++ y2 z2))) 25 | 26 | (assert (= y3 (str.replaceall x2 "a" "0"))) 27 | (assert (= z3 (str.replaceall x2 "a" "1"))) 28 | (assert (= x3 (str.++ y3 z3))) 29 | 30 | (assert (str.in.re x3 (str.to.re "000001010011100101110111"))) 31 | 32 | (check-sat) 33 | -------------------------------------------------------------------------------- /tests/test-replace4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x0 () String) 4 | 5 | (declare-fun y1 () String) 6 | (declare-fun z1 () String) 7 | (declare-fun x1 () String) 8 | 9 | (declare-fun y2 () String) 10 | (declare-fun z2 () String) 11 | (declare-fun x2 () String) 12 | 13 | (declare-fun y3 () String) 14 | (declare-fun z3 () String) 15 | (declare-fun x3 () String) 16 | 17 | (assert (str.in.re x0 (str.to.re "abc"))) 18 | (assert (= y1 (str.replaceall x0 "c" "0"))) 19 | (assert (= z1 (str.replaceall x0 "c" "1"))) 20 | (assert (= x1 (str.++ y1 z1))) 21 | 22 | (assert (= y2 (str.replaceall x1 "b" "0"))) 23 | (assert (= z2 (str.replaceall x1 "b" "1"))) 24 | (assert (= x2 (str.++ y2 z2))) 25 | 26 | (assert (= y3 (str.replaceall x2 "a" "0"))) 27 | (assert (= z3 (str.replaceall x2 "a" "1"))) 28 | (assert (= x3 (str.++ y3 z3))) 29 | 30 | (assert (str.in.re x3 (str.to.re "000001010011100101110110"))) 31 | 32 | (check-sat) 33 | -------------------------------------------------------------------------------- /tests/temp-prop/03_track_10.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Joel Day, Thorsten Ehlers, Mitja Kulczynski, Federico Mora, Florin Manea, Dirk Nowotka, Danny Poulsen, Zhengyang Lu 5 | Application: Test WOORPJE 6 | Target solver: WOORPJE 7 | Publications: Day, J. D., Ehlers, T., Kulczynski, M., Manea, F., Nowotka, D., & Poulsen, D. B. (2019). On solving word equations using SAT. In RP 2019 8 | Description: Transoformed and expanded from Track02 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "random") 12 | (set-info :status unknown) 13 | 14 | (declare-fun I () String) 15 | (declare-fun K () String) 16 | (declare-fun F () String) 17 | (declare-fun E () String) 18 | (declare-fun M () String) 19 | (assert (= (str.++ "a" F F F "aa" F F F "b" K "aba") (str.++ "a" E E K I K I "b" M M "baa") )) 20 | (check-sat) 21 | 22 | (exit) 23 | -------------------------------------------------------------------------------- /tests/cg-star.smt2: -------------------------------------------------------------------------------- 1 | (declare-const var0 String) 2 | (declare-const re0 RegLan) 3 | (declare-const cap String) 4 | 5 | (assert (= re0 ((_ re.capture 1) 6 | (re.++ 7 | (str.to.re "<") 8 | (re.*? 9 | ((_ re.capture 2) 10 | (re.union 11 | (re.range "\x01" "\xff") 12 | (str.to.re "\u{0a}")))) 13 | (str.to.re ">"))))) 14 | (assert (= cap ((_ str.extract 2) var0 15 | (re.++ 16 | (re.*? re.allchar) re0 re.all)))) 17 | 18 | (assert (str.in.re var0 (re.* (re.range "\x01" "\xff")))) 19 | (assert (str.in.re var0 (re.++ (re.*? re.allchar) re0 re.all))) 20 | ; match!==null 21 | (assert (not (str.in.re cap (str.to.re "\x00")))) 22 | ;match[1]!==null 23 | (assert (str.in.re cap (re.++ re.all (re.+ (re.range "a" "z")) re.all))) 24 | ;/[a-z]+/.test(match[1]) == true 25 | (check-sat) 26 | -------------------------------------------------------------------------------- /tests/regex_cg_ref.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-const in String) 4 | (declare-const intermediate-1 String) 5 | (declare-const intermediate-2 String) 6 | (declare-const intermediate-3 String) 7 | (declare-const intermediate-4 String) 8 | 9 | (assert (= intermediate-1 (str.replaceall in "Attribution" "BY"))) 10 | 11 | (assert (= intermediate-2 (str.replaceall intermediate-1 "NonCommercial" "NC"))) 12 | 13 | (assert (= intermediate-3 (str.replaceall intermediate-2 "NoDerivatives" "ND"))) 14 | 15 | (assert (= intermediate-4 (str.replace_cg_all intermediate-3 16 | (re.++ (re.range " " " ") ((_ re.capture 2) (re.range "0" "9"))) 17 | ;((_ re.capture 1) (re.range "0" "9")) 18 | (re.++ (str.to.re "-") (_ re.reference 2))))) 19 | 20 | (assert (str.in.re in (re.from.str "CC((-(Attribution|NonCommercial|NoDerivatives))| \d)+"))) 21 | (assert (str.in.re intermediate-4 (re.complement (re.from.str ".*\s\d.*")))) 22 | 23 | (check-sat) 24 | -------------------------------------------------------------------------------- /tests/temp-prop/word-equation-6-regex.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun H () String) 4 | (declare-fun G () String) 5 | (declare-fun E () String) 6 | (declare-fun J () String) 7 | (declare-fun D1 () String) 8 | (declare-fun D2 () String) 9 | (declare-fun D3 () String) 10 | (declare-fun D4 () String) 11 | (declare-fun D5 () String) 12 | (declare-fun D6 () String) 13 | (declare-fun D7 () String) 14 | 15 | (assert (= (str.++ D1 H D2 E H D3 H D4 J H D5) 16 | (str.++ D6 G D7) )) 17 | (assert (str.in.re D1 (str.to.re "de"))) 18 | (assert (str.in.re D2 (str.to.re "fahgf"))) 19 | (assert (str.in.re D3 (str.to.re "bg"))) 20 | (assert (str.in.re D4 (str.to.re "dfche"))) 21 | (assert (str.in.re D5 (str.to.re "dg"))) 22 | (assert (str.in.re D6 (str.to.re "deifah"))) 23 | (assert (str.in.re D7 (str.to.re "idg"))) 24 | (assert (str.in.re H re.all)) 25 | (assert (str.in.re J re.all)) 26 | (assert (str.in.re G re.all)) 27 | (check-sat) 28 | (get-model) -------------------------------------------------------------------------------- /tests/temp-prop/03_track_1.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Joel Day, Thorsten Ehlers, Mitja Kulczynski, Federico Mora, Florin Manea, Dirk Nowotka, Danny Poulsen, Zhengyang Lu 5 | Application: Test WOORPJE 6 | Target solver: WOORPJE 7 | Publications: Day, J. D., Ehlers, T., Kulczynski, M., Manea, F., Nowotka, D., & Poulsen, D. B. (2019). On solving word equations using SAT. In RP 2019 8 | Description: Transoformed and expanded from Track02 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "random") 12 | (set-info :status unknown) 13 | 14 | (declare-fun H () String) 15 | (declare-fun K () String) 16 | (declare-fun I () String) 17 | (declare-fun J () String) 18 | (declare-fun L () String) 19 | (assert (= (str.++ "aaaaaaa" H "aaaaaaaaaa" H "aab" I H I I "b" J "ab" K "aba") (str.++ "a" H H "aa" I H I H I H I H "b" I "a" I "abaaaab" L L "baa") )) 20 | (check-sat) 21 | 22 | (exit) 23 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-006.smt2: -------------------------------------------------------------------------------- 1 | (declare-const x String) 2 | (declare-const y String) 3 | (declare-const z String) 4 | (declare-const w String) 5 | (declare-const v String) 6 | 7 | 8 | 9 | (assert (= x (str.replace_re_longest_all y (str.to.re "0") z))) 10 | (assert (= y (str.replace_re_longest_all w (str.to.re "1") v))) 11 | 12 | (assert 13 | (str.in.re x 14 | (re.++ 15 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 16 | (re.union 17 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 18 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 19 | ) 20 | ) 21 | ) 22 | ) 23 | (assert (str.in.re z (re.* (str.to.re "10")))) 24 | (assert (str.in.re y (re.* (str.to.re "01")))) 25 | (assert (str.in.re w (re.++ (re.* (str.to.re "0")) (re.++ (re.* (str.to.re "1")) (re.++ (re.* (str.to.re "0")) (re.* (str.to.re "1"))))))) 26 | (assert (str.in.re v (re.++ (re.* (str.to.re "0")) (re.* (str.to.re "1"))))) 27 | 28 | (check-sat) 29 | -------------------------------------------------------------------------------- /tests/yan-benchmarks/replaceAll-017.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun x () String) 2 | (declare-fun y () String) 3 | (declare-fun x1 () String) 4 | (declare-fun y1 () String) 5 | (declare-fun z () String) 6 | (declare-fun w () String) 7 | (declare-fun v () String) 8 | 9 | (assert (= x (str.replace_re_longest_all y (str.to.re "010") z))) 10 | (assert (= y (str.replace_re_longest_all w (str.to.re "1") v))) 11 | (assert (= w (str.replace_re_longest_all x1 (str.to.re "00") y1))) 12 | 13 | (assert 14 | (str.in.re x 15 | (re.++ 16 | (re.* (re.union (str.to.re "0") (str.to.re "1") ) ) 17 | (re.union 18 | (re.++ (str.to.re "00") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 19 | (re.++ (str.to.re "11") (re.* (re.union (str.to.re "0")(str.to.re "1") ) ) ) 20 | ) 21 | ) 22 | ) 23 | ) 24 | (assert (str.in.re y (re.* (str.to.re "01")))) 25 | (assert (str.in.re z (re.* (str.to.re "10")))) 26 | (assert (str.in.re w (re.* (str.to.re "1")))) 27 | (assert (str.in.re x1 (re.* (str.to.re "0")))) 28 | 29 | (check-sat) 30 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/loopCountMotivation.smt2: -------------------------------------------------------------------------------- 1 | (declare-const X String) 2 | ; ^[/]*([^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}/)*[^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}$ 3 | (assert (not (str.in.re X (re.++ (re.* (str.to.re "/")) (re.* (re.++ (re.union (str.to.re "/") (str.to.re "\x5c") (str.to.re " ") (str.to.re ":") (str.to.re "*") (str.to.re "?") (str.to.re "\x22") (str.to.re "<") (str.to.re ">") (str.to.re "|") (str.to.re ".")) ((_ re.loop 0 12) (re.union (str.to.re "/") (str.to.re "\x5c") (str.to.re ":") (str.to.re "*") (str.to.re "?") (str.to.re "\x22") (str.to.re "<") (str.to.re ">") (str.to.re "|"))) (str.to.re "/"))) (re.union (str.to.re "/") (str.to.re "\x5c") (str.to.re " ") (str.to.re ":") (str.to.re "*") (str.to.re "?") (str.to.re "\x22") (str.to.re "<") (str.to.re ">") (str.to.re "|") (str.to.re ".")) ((_ re.loop 0 12) (re.union (str.to.re "/") (str.to.re "\x5c") (str.to.re ":") (str.to.re "*") (str.to.re "?") (str.to.re "\x22") (str.to.re "<") (str.to.re ">") (str.to.re "|"))) (str.to.re "\x0a"))))) 4 | (check-sat) 5 | 6 | -------------------------------------------------------------------------------- /tests/substring-bug2.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun x () String) 14 | (declare-fun y () String) 15 | (declare-fun y2 () String) 16 | (declare-fun z () Int) 17 | ;(assert (not (= (str.substr "A" 0 (str.indexof x "A" 1)) (str.at x (str.indexof x "A" 1))))) 18 | (assert (= z (str.indexof x "A" 1))) 19 | (assert (= y (str.at x z))) 20 | (assert (= y2 (str.substr "A" 0 z))) 21 | (assert (distinct y y2)) 22 | (check-sat) 23 | (get-model) 24 | (exit) 25 | -------------------------------------------------------------------------------- /tests/epsilon-3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | (declare-fun sigmaStar_0 () String) 5 | (declare-fun sigmaStar_5 () String) 6 | (declare-fun x_2 () String) 7 | (declare-fun epsilon () String) 8 | (declare-fun literal_7 () String) 9 | (declare-fun x_6 () String) 10 | (declare-fun x_8 () String) 11 | (declare-fun sigmaStar_12 () String) 12 | (declare-fun literal_11 () String) 13 | (declare-fun x_14 () String) 14 | (declare-fun x_13 () String) 15 | (declare-fun x_15 () String) 16 | (declare-fun literal_16 () String) 17 | (declare-fun x_17 () String) 18 | (declare-fun x_18 () String) 19 | (declare-fun literal_19 () String) 20 | (declare-fun x_20 () String) 21 | 22 | (assert (= epsilon "")) 23 | (assert (or (= x_2 epsilon))) 24 | (assert (= literal_7 "[ hello:")) 25 | (assert (= x_8 (str.++ literal_7 x_6))) 26 | (assert (= x_18 (str.++ x_8 sigmaStar_0))) 27 | (assert (str.in.re x_18 (re.++ (re.* re.allchar) (re.++ (str.to.re "\ BAutomaton, State, Transition} 9 | 10 | object NOPPreOpSpecification 11 | extends Properties("NOPPreOp"){ 12 | 13 | val abcdAut = BricsAutomaton.fromString("abcd") 14 | 15 | def seq(s : String) = s.map(_.toInt) 16 | 17 | property("Simple word nop") = { 18 | // abcd = nop(x) 19 | NOPPreOp(Seq(Seq()), abcdAut)._1.exists(cons => { 20 | cons(0)(seq("abcd")) 21 | }) 22 | } 23 | 24 | property("Simple word nop unchanged") = { 25 | // abcd = nop(x) 26 | !NOPPreOp(Seq(Seq()), abcdAut)._1.exists(cons => { 27 | cons(0)(seq("abcde")) 28 | }) 29 | } 30 | 31 | property("Simple post nop") = { 32 | val baut1 = BricsAutomaton.fromString("hello") 33 | val post = NOPPreOp.forwardApprox(Seq(Seq(baut1.asInstanceOf[Automaton]))) 34 | post(seq("hello")) && !post(seq("hello1")) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/regex_cg_3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun x0 () String) 4 | 5 | (declare-fun y1 () String) 6 | (declare-fun z1 () String) 7 | (declare-fun x1 () String) 8 | 9 | (declare-fun y2 () String) 10 | (declare-fun z2 () String) 11 | (declare-fun x2 () String) 12 | 13 | (declare-fun y3 () String) 14 | (declare-fun z3 () String) 15 | (declare-fun x3 () String) 16 | 17 | (assert (str.in.re x0 (str.to.re "abc"))) 18 | (assert (= y1 (str.replace_cg_all x0 (re.range "c" "c") (str.to.re "0")))) 19 | (assert (= z1 (str.replace_cg_all x0 (re.range "c" "c") (str.to.re "1")))) 20 | (assert (= x1 (str.++ y1 z1))) 21 | 22 | (assert (= y2 (str.replace_cg_all x1 (re.range "b" "b") (str.to.re "0")))) 23 | (assert (= z2 (str.replace_cg_all x1 (re.range "b" "b") (str.to.re "1")))) 24 | (assert (= x2 (str.++ y2 z2))) 25 | 26 | (assert (= y3 (str.replace_cg_all x2 (re.range "a" "a") (str.to.re "0")))) 27 | (assert (= z3 (str.replace_cg_all x2 (re.range "a" "a") (str.to.re "1")))) 28 | (assert (= x3 (str.++ y3 z3))) 29 | 30 | (assert (str.in.re x3 (str.to.re "000001010011100101110111"))) 31 | 32 | (check-sat) 33 | -------------------------------------------------------------------------------- /tests/regex_cg_5.smt2: -------------------------------------------------------------------------------- 1 | ; modified from test-replace-4 2 | (set-logic QF_S) 3 | 4 | (declare-fun x0 () String) 5 | 6 | (declare-fun y1 () String) 7 | (declare-fun z1 () String) 8 | (declare-fun x1 () String) 9 | 10 | (declare-fun y2 () String) 11 | (declare-fun z2 () String) 12 | (declare-fun x2 () String) 13 | 14 | (declare-fun y3 () String) 15 | (declare-fun z3 () String) 16 | (declare-fun x3 () String) 17 | 18 | (assert (str.in.re x0 (str.to.re "abc"))) 19 | (assert (= y1 (str.replace_cg_all x0 (re.range "c" "c") (str.to.re "0")))) 20 | (assert (= z1 (str.replace_cg_all x0 (re.range "c" "c") (str.to.re "1")))) 21 | (assert (= x1 (str.++ y1 z1))) 22 | 23 | (assert (= y2 (str.replace_cg_all x1 (re.range "b" "b") (str.to.re "0")))) 24 | (assert (= z2 (str.replace_cg_all x1 (re.range "b" "b") (str.to.re "1")))) 25 | (assert (= x2 (str.++ y2 z2))) 26 | 27 | (assert (= y3 (str.replace_cg_all x2 (re.range "a" "a") (str.to.re "0")))) 28 | (assert (= z3 (str.replace_cg_all x2 (re.range "a" "a") (str.to.re "1")))) 29 | (assert (= x3 (str.++ y3 z3))) 30 | 31 | (assert (str.in.re x3 (str.to.re "000001010011100101110110"))) 32 | 33 | (check-sat) 34 | -------------------------------------------------------------------------------- /tests/epsilon-1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | (declare-fun sigmaStar_0 () String) 5 | (declare-fun sigmaStar_1 () String) 6 | (declare-fun sigmaStar_3 () String) 7 | (declare-fun sigmaStar_5 () String) 8 | (declare-fun sigmaStar_7 () String) 9 | (declare-fun literal_9 () String) 10 | (declare-fun x_8 () String) 11 | (declare-fun x_10 () String) 12 | (declare-fun sigmaStar_12 () String) 13 | (declare-fun literal_13 () String) 14 | (declare-fun x_14 () String) 15 | (declare-fun literal_16 () String) 16 | (declare-fun x_17 () String) 17 | (declare-fun x_18 () String) 18 | (declare-fun epsilon () String) 19 | (assert (= literal_9 "\Large ")) 20 | (assert (or (= x_8 sigmaStar_7))) 21 | (assert (= x_10 (str.++ literal_9 x_8))) 22 | 23 | (assert (= literal_13 ".gif")) 24 | (assert (= x_14 (str.++ sigmaStar_12 literal_13))) 25 | (assert (= literal_16 "//")) 26 | (assert (= x_17 (str.++ literal_16 x_14))) 27 | (assert (= epsilon "")) 28 | (assert (or (= x_18 epsilon) (= x_18 x_17))) 29 | (assert (str.in.re x_18 (re.++ (re.* re.allchar) (re.++ (str.to.re "/evil") (re.* re.allchar))))) 30 | (check-sat) 31 | (get-model) 32 | -------------------------------------------------------------------------------- /tests/concat-regex4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | (declare-fun a () String) 4 | (declare-fun b () String) 5 | (declare-fun c () String) 6 | (declare-fun d () String) 7 | (declare-fun x0 () String) 8 | (declare-fun x1 () String) 9 | (declare-fun x2 () String) 10 | (declare-fun x3 () String) 11 | (declare-fun x4 () String) 12 | (declare-fun x5 () String) 13 | (declare-fun x6 () String) 14 | (declare-fun x7 () String) 15 | (declare-fun x8 () String) 16 | (declare-fun x9 () String) 17 | 18 | (assert (= a (str.++ b (str.++ (str.++ c c) b)))) 19 | ; (assert (= b (str.++ d c))) 20 | 21 | (assert (= b (str.++ x0 x0))) 22 | (assert (= x0 (str.++ x1 x1))) 23 | (assert (= x1 (str.++ x2 x2))) 24 | (assert (= x2 (str.++ x3 x3))) 25 | (assert (= x3 (str.++ x4 x4))) 26 | (assert (= x4 (str.++ x5 x5))) 27 | (assert (= x5 (str.++ x6 x6))) 28 | (assert (= x6 (str.++ x7 x7))) 29 | (assert (= x7 (str.++ x8 x8))) 30 | (assert (= x8 (str.++ x9 x9))) 31 | 32 | (assert (str.in.re a (re.+ (re.++ (str.to.re "x") 33 | (re.++ (re.* (str.to.re "z")) 34 | (re.* (str.to.re "y"))))))) 35 | (assert (str.in.re c (re.+ (str.to.re "x")))) 36 | 37 | (check-sat) -------------------------------------------------------------------------------- /tests/loop.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun TestC0 () String) 2 | (declare-fun |1 Fill 2| () String) 3 | (declare-fun |1 Fill 0| () String) 4 | (declare-fun |1 Fill 1| () String) 5 | (declare-fun |1 Fill 3| () String) 6 | (assert (str.in.re TestC0 7 | (re.++ (re.* (re.range "\x00" "\xff")) 8 | ((_ re.loop 3 3) (re.range "0" "9")) 9 | (re.* (re.range "0" "9")) 10 | (re.* (re.range "\x00" "\xff"))))) 11 | (assert (let ((a!1 (str.in.re TestC0 12 | (re.++ (re.* (re.range "\x00" "\xff")) 13 | ((_ re.^ 3) (re.range "0" "9")) 14 | (re.* (re.range "0" "9")) 15 | (re.* (re.range "\x00" "\xff")))))) 16 | (=> a!1 (= TestC0 (str.++ |1 Fill 1| "" "" |1 Fill 0| |1 Fill 2|))))) 17 | (assert (str.in.re |1 Fill 0| 18 | (re.++ ((_ re.loop 3 3) (re.range "0" "9")) 19 | (re.* (re.range "0" "9"))))) 20 | (assert (str.in.re (str.++ "" "" |1 Fill 0|) 21 | (re.++ ((_ re.loop 3 3) (re.range "0" "9")) 22 | (re.* (re.range "0" "9"))))) 23 | (assert (= |1 Fill 3| (str.++ "" "" |1 Fill 0|))) 24 | 25 | (check-sat) 26 | 27 | -------------------------------------------------------------------------------- /tests/temp-prop/nikolai-sat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Query for Cloud Services 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status sat) 12 | 13 | (declare-const V31 String) 14 | (declare-const V32 String) 15 | (declare-const V16 String) 16 | (declare-const V29 String) 17 | (declare-const V30 String) 18 | (declare-const V17 String) 19 | (declare-const k!8 String) 20 | (declare-const k!7 String) 21 | (declare-const k!3 String) 22 | (declare-const V33 String) 23 | (declare-const V34 String) 24 | (declare-const V35 String) 25 | (declare-const V3 String) 26 | (declare-const V36 String) 27 | (declare-const V37 String) 28 | (declare-const V1 String) 29 | 30 | (assert (= (str.++ V31 "@" V32) (str.++ V16 V29 ":" V30 V17))) 31 | 32 | (assert (= (str.++ V29 ":" V30) (str.++ k!8 "G" k!7))) 33 | 34 | (assert (= (str.++ V33 "/" V34) (str.++ V1 V31 "@" V32 V3))) 35 | 36 | (assert (= (str.++ V36 "://" V37) (str.++ V33 "/" V34 k!3))) 37 | 38 | (assert (= (str.++ "mongodb://" V35) (str.++ V33 "/" V34 k!3))) 39 | 40 | (check-sat) 41 | (exit) 42 | 43 | -------------------------------------------------------------------------------- /src/main/scala/ostrich/cesolver/preprocess/CEPredtoEqConverter.scala: -------------------------------------------------------------------------------- 1 | package ostrich.cesolver.preprocess 2 | 3 | import ap.proof.goal.Goal 4 | import ostrich.cesolver.stringtheory.CEStringTheory 5 | import ap.proof.theoryPlugins.Plugin 6 | import ap.terfor.linearcombination.LinearCombination 7 | 8 | class CEPredtoEqConverter(goal: Goal, theory: CEStringTheory) { 9 | 10 | import theory.{str_to_int, int_to_str, FunPred} 11 | implicit val order = goal.order 12 | import ap.terfor.TerForConvenience._ 13 | 14 | val predConj = goal.facts.predConj 15 | 16 | def lazyEnumeration: Seq[Plugin.Action] = { 17 | val a = 18 | (for ( 19 | lit <- predConj.positiveLitsWithPred(FunPred(str_to_int)); 20 | act <- enumIntValues(lit.last).toSeq 21 | ) yield act) 22 | 23 | val b = 24 | (for ( 25 | lit <- predConj.positiveLitsWithPred(FunPred(int_to_str)); 26 | act <- enumIntValues(lit.head).toSeq 27 | ) yield act) 28 | a ++ b 29 | } 30 | 31 | private def enumIntValues(lc : LinearCombination) : Option[Plugin.Action] = 32 | for (t <- Some(lc); 33 | if !t.isConstant; 34 | enumAtom = conj(theory.IntEnumerator.enumIntValuesOf(t, order)); 35 | if !goal.reduceWithFacts(enumAtom).isTrue) 36 | yield Plugin.AddAxiom(List(), enumAtom, theory) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ostrich: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $(uname) = "Linux" ]; then 4 | pathCmd="readlink -f" 5 | elif [ $(uname) = "Darwin" ]; then 6 | pathCmd="stat -f %N" 7 | else 8 | pathCmd="realpath" 9 | fi 10 | 11 | BASEDIR=`dirname $($pathCmd $0)` 12 | TARGET=`echo $BASEDIR/target/scala-*/ostrich-assembly*.jar` 13 | LIBDIR=$BASEDIR/lib 14 | SCALA=scala 15 | JAVA=java 16 | export JAVA_OPTS="-Xss20000k -Xmx2000m" 17 | 18 | princessParams=() 19 | ostrichSolver=ostrich.OstrichStringTheory 20 | ostrichParams="" 21 | 22 | for p; do 23 | case "$p" in 24 | [+-]eager | [+-]forward | -length=* | [+-]minimizeAutomata | [+-]parikh | -regexTranslator=* | [+-]forwardPropagation | [+-]backwardPropagation | [+-]nielsenSplitter) 25 | if [ x"$ostrichParams" = x"" ]; then 26 | ostrichParams=$p 27 | else 28 | ostrichParams=$ostrichParams,$p 29 | fi 30 | ;; 31 | -cea) 32 | ostrichSolver=ostrich.OstrichStringTheory 33 | ;; 34 | +cea) 35 | ostrichSolver=ostrich.cesolver.stringtheory.CEStringTheory 36 | ;; 37 | *) 38 | princessParams+=("$p") 39 | ;; 40 | esac 41 | done 42 | 43 | exec $JAVA $JAVA_OPTS -cp $TARGET \ 44 | ostrich.OstrichMain -stringSolver=$ostrichSolver:$ostrichParams \ 45 | "${princessParams[@]}" 46 | -------------------------------------------------------------------------------- /tests/priorityTransducer.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Transducer extracting the captured string for the regex (a*)a* 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extr ((x String) (y String)) Bool) 8 | (extr1 ((x String) (y String)) Bool) 9 | (extr2 ((x String) (y String)) Bool)) ( 10 | 11 | ; definition of extr: choose whether to leave the capture group or not 12 | (or (extr1 x y) 13 | (and (not (exists ((z String)) (extr1 x z))) 14 | (extr2 x y))) 15 | 16 | ; definition of extr1: capture 17 | (and (not (= x "")) (not (= y "")) 18 | (= (str.head x) (char.from-int 97)) ; 'a' 19 | (= (str.head y) (char.from-int 97)) ; 'a' 20 | (extr (str.tail x) (str.tail y))) 21 | 22 | ; definition of extr2: do not capture 23 | (or 24 | (and (= x "") (= y "")) 25 | (and (not (= x "")) 26 | (= (str.head x) (char.from-int 97)) ; 'a' 27 | (extr2 (str.tail x) y)) 28 | ))) 29 | 30 | (declare-const x String) 31 | (declare-const y String) 32 | 33 | (assert (extr x y)) 34 | (assert (str.in.re x ((_ re.^ 7) (str.to.re "a")))) 35 | (assert (str.in.re y ((_ re.^ 5) (str.to.re "a")))) 36 | 37 | (check-sat) 38 | -------------------------------------------------------------------------------- /tests/priorityTransducer2.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Transducer extracting the captured string for the regex (a*)a* 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extr ((x String) (y String)) Bool) 8 | (extr1 ((x String) (y String)) Bool) 9 | (extr2 ((x String) (y String)) Bool)) ( 10 | 11 | ; definition of extr: choose whether to leave the capture group or not 12 | (or (extr1 x y) 13 | (and (not (exists ((z String)) (extr1 x z))) 14 | (extr2 x y))) 15 | 16 | ; definition of extr1: capture 17 | (and (not (= x "")) (not (= y "")) 18 | (= (str.head x) (char.from-int 97)) ; 'a' 19 | (= (str.head y) (char.from-int 97)) ; 'a' 20 | (extr (str.tail x) (str.tail y))) 21 | 22 | ; definition of extr2: do not capture 23 | (or 24 | (and (= x "") (= y "")) 25 | (and (not (= x "")) 26 | (= (str.head x) (char.from-int 97)) ; 'a' 27 | (extr2 (str.tail x) y)) 28 | ))) 29 | 30 | (declare-const x String) 31 | (declare-const y String) 32 | 33 | (assert (extr x y)) 34 | (assert (str.in.re x ((_ re.loop 2 10) (str.to.re "a")))) 35 | (assert (str.in.re y ((_ re.^ 5) (str.to.re "a")))) 36 | 37 | (check-sat) 38 | -------------------------------------------------------------------------------- /tests/propagation-benchmarks/nikolai-unsat.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_S) 3 | (set-info :source | 4 | Generated by: Oliver Markgraf 5 | Generated on: 2024-03-18 6 | Application: Query for Cloud Services 7 | Target solver: OSTRICH 8 | |) 9 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 10 | (set-info :category "industrial") 11 | (set-info :status unsat) 12 | 13 | (declare-const V31 String) 14 | (declare-const V32 String) 15 | (declare-const V16 String) 16 | (declare-const V29 String) 17 | (declare-const V30 String) 18 | (declare-const V17 String) 19 | (declare-const k!8 String) 20 | (declare-const k!7 String) 21 | (declare-const k!3 String) 22 | (declare-const V33 String) 23 | (declare-const V34 String) 24 | (declare-const V35 String) 25 | (declare-const V3 String) 26 | (declare-const V36 String) 27 | (declare-const V37 String) 28 | (declare-const V1 String) 29 | 30 | (assert (= (str.++ V31 "@" V32) (str.++ V16 V29 ":" V30 V17))) 31 | 32 | (assert (= (str.++ V29 ":" V30) (str.++ k!8 "G" k!7))) 33 | 34 | (assert (= (str.++ V33 "/" V34) (str.++ V1 V31 "@" V32 V3))) 35 | 36 | (assert (= (str.++ V36 "://" V37) (str.++ V33 "/" V34 k!3))) 37 | 38 | (assert (= (str.++ "mongodb://" V35) (str.++ V33 "/" V34 k!3))) 39 | 40 | (assert (str.in_re V31 (re.* (str.to_re "a")))) 41 | (assert (str.in_re V32 (re.* (str.to_re "b")))) 42 | 43 | (check-sat) 44 | (exit) 45 | -------------------------------------------------------------------------------- /tests/hu-benchmarks/bigSubstrIdx.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :produce-models true) 3 | (set-info :status sat) 4 | 5 | (declare-fun cookie () String) 6 | (declare-fun cookie_part1 () String) 7 | (declare-fun cookie_part2 () String) 8 | (declare-fun cookie_part3 () String) 9 | (declare-fun lang () String) 10 | (declare-fun idx1 () Int) 11 | (declare-fun len1 () Int) 12 | (declare-fun l1 () String) 13 | 14 | 15 | 16 | (assert (= cookie (str.++ cookie_part1 cookie_part2 cookie_part3) ) ) 17 | 18 | (assert (str.in.re cookie_part2 (re.++ (re.union (str.to.re "?") (str.to.re ";") ) 19 | (str.to.re "searchLang=") 20 | (re.* (re.union (str.to.re "a") (str.to.re "b") (str.to.re "c") (str.to.re "d") (str.to.re "e") (str.to.re "f") (str.to.re "g") (str.to.re "h") (str.to.re "i") (str.to.re "j") (str.to.re "k") (str.to.re "l") (str.to.re "m") (str.to.re "n") ) ) 21 | ) 22 | ) 23 | ) 24 | 25 | (assert (=> (not (= "" cookie_part3) ) (= cookie_part3 (str.++ ";" l1) ) ) ) 26 | 27 | (assert (> (str.len cookie_part2) 11) ) 28 | 29 | (assert (= cookie "expires=Thu, 18 Dec 2013 12:00:00 UTC;searchLang=nb;domain=local;") ) 30 | 31 | 32 | (assert (= len1 (str.len cookie_part2) ) ) 33 | 34 | 35 | (assert (= lang (str.substr cookie_part2 idx1 (- len1 idx1) ) ) ) 36 | 37 | 38 | (check-sat) 39 | (get-model) 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2020 Matthew Hague and Philipp Rümmer, 2 | unless otherwise specified. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the authors nor the names of their 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /tests/pcp-1.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_SLIA) 3 | (set-info :source | 4 | Generated by: Andres Noetzli, Andrew Reynolds, Haniel Barbosa, Aina Niemetz, Mathias Preiner, Clark Barrett, Cesare Tinelli 5 | Generated on: 2018-11-08 6 | Generator: CVC4 7 | Application: Rewrite rule verification 8 | Publications: "Syntax-Guided Rewrite Rule Enumeration for SMT Solvers" by A. Noetzli, A. Reynolds, H. Barbosa, A. Niemetz, M. Preiner, C. Barrett, and C. Tinelli, SAT 2019. 9 | |) 10 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 11 | (set-info :category "industrial") 12 | (set-info :status unknown) 13 | (declare-fun g1 () String) 14 | (declare-fun g2 () String) 15 | (declare-fun g3 () String) 16 | (declare-fun h1 () String) 17 | (declare-fun h2 () String) 18 | (declare-fun h3 () String) 19 | (declare-fun replace () String) 20 | 21 | 22 | (declare-fun x () String) 23 | (declare-fun y () String) 24 | (declare-fun x_1 () String) 25 | (declare-fun y_1 () String) 26 | (declare-fun x_2 () String) 27 | (declare-fun y_2 () String) 28 | 29 | (assert(= g1 "0110")) 30 | (assert(= g2 "00")) 31 | (assert(= g3 "11")) 32 | (assert(= h1 "010")) 33 | (assert(= h2 "0010")) 34 | (assert(= h3 "0100")) 35 | 36 | (assert(str.in_re replace (re.+ (re.union (str.to_re "2")(str.to_re "3")(str.to_re "4"))))) 37 | (assert(= x (str.replace_all x_1 "2" g1))) 38 | (assert(= x_1 (str.replace_all x_2 "3" g2))) 39 | (assert(= x_2 (str.replace_all replace "4" g3))) 40 | 41 | (assert(= y (str.replace_all y_1 "2" h1))) 42 | (assert(= y_1 (str.replace_all y_2 "3" h2))) 43 | (assert(= y_2 (str.replace_all replace "4" h3))) 44 | (assert(= y x)) 45 | 46 | (check-sat) 47 | (get-model) 48 | (exit) 49 | -------------------------------------------------------------------------------- /tests/transducer1b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Successor transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((succ ((x String) (y String)) Bool) 8 | (succH ((x String) (y String)) Bool)) ( 9 | ; definition of succ 10 | (or (and (not (= x "")) (not (= y "")) 11 | (= (str.head_code x) 48) ; '0' 12 | (= (str.head_code y) 48) ; '0' 13 | (succ (str.tail x) (str.tail y))) 14 | (and (not (= x "")) (not (= y "")) 15 | (= (str.head_code x) 49) ; '1' 16 | (= (str.head_code y) 49) ; '1' 17 | (succ (str.tail x) (str.tail y))) 18 | (and (not (= x "")) (not (= y "")) 19 | (= (str.head_code x) 48) ; '0' 20 | (= (str.head_code y) 49) ; '1' 21 | (succH (str.tail x) (str.tail y)))) 22 | ; definition of succH 23 | (or (and (= x "") 24 | (= y "")) 25 | (and (not (= x "")) (not (= y "")) 26 | (= (str.head_code x) 49) ; '1' 27 | (= (str.head_code y) 48) ; '0' 28 | (succH (str.tail x) (str.tail y)))))) 29 | 30 | (declare-fun x () String) 31 | (declare-fun y () String) 32 | 33 | (assert (str.in.re x 34 | (re.++ 35 | (re.+ (re.union (str.to.re "0") (str.to.re "1"))) 36 | (re.union (str.to.re "0") (str.to.re "1"))))) 37 | (assert (succ x y)) 38 | 39 | (check-sat) 40 | -------------------------------------------------------------------------------- /tests/priorityTransducer3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Transducer extracting the captured string for the regex ([ab]*)b[ab]* 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extr ((x String) (y String)) Bool) 8 | (extr1 ((x String) (y String)) Bool) 9 | (extr2 ((x String) (y String)) Bool) 10 | (extr3 ((x String) (y String)) Bool)) ( 11 | 12 | ; eager matching: extract the longest match 13 | (or (extr1 x y) 14 | (and (not (exists ((z String)) (extr1 x z))) 15 | (extr2 x y))) 16 | 17 | ; definition of extr1: capture 18 | (and (not (= x "")) (not (= y "")) 19 | (>= (str.head_code x) (str.to_code "a")) ; [ab] 20 | (<= (str.head_code x) (str.to_code "b")) 21 | (= (str.head y) (str.head x)) ; 'a' 22 | (extr (str.tail x) (str.tail y))) 23 | 24 | ; definition of extr2: do not capture 25 | (and (not (= x "")) 26 | (= (str.head_code x) (str.to_code "b")) 27 | (extr3 (str.tail x) y)) 28 | 29 | ; definition of extr3: do not capture 30 | (or (and (= x "") (= y "")) 31 | (and (not (= x "")) 32 | (>= (str.head_code x) (str.to_code "a")) ; [ab] 33 | (<= (str.head_code x) (str.to_code "b")) 34 | (extr3 (str.tail x) y)) 35 | ))) 36 | 37 | (declare-const x String) 38 | (declare-const y String) 39 | 40 | (assert (extr x y)) 41 | (assert (str.in.re x (re.++ (re.+ (re.range "a" "b")) (str.to.re "babababa")))) 42 | (assert (str.in.re y (re.+ (re.range "a" "b")))) 43 | (assert (str.contains y "b")) ; sat 44 | 45 | (check-sat) 46 | -------------------------------------------------------------------------------- /tests/priorityTransducer4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Transducer extracting the captured string for the regex ([ab]*)b[ab]* 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extr ((x String) (y String)) Bool) 8 | (extr1 ((x String) (y String)) Bool) 9 | (extr2 ((x String) (y String)) Bool) 10 | (extr3 ((x String) (y String)) Bool)) ( 11 | 12 | ; lazy matching: extract the shortest match 13 | (or (extr2 x y) 14 | (and (not (exists ((z String)) (extr2 x z))) 15 | (extr1 x y))) 16 | 17 | ; definition of extr1: capture 18 | (and (not (= x "")) (not (= y "")) 19 | (>= (str.head_code x) (str.to_code "a")) ; [ab] 20 | (<= (str.head_code x) (str.to_code "b")) 21 | (= (str.head y) (str.head x)) ; 'a' 22 | (extr (str.tail x) (str.tail y))) 23 | 24 | ; definition of extr2: do not capture 25 | (and (not (= x "")) 26 | (= (str.head_code x) (str.to_code "b")) 27 | (extr3 (str.tail x) y)) 28 | 29 | ; definition of extr3: do not capture 30 | (or (and (= x "") (= y "")) 31 | (and (not (= x "")) 32 | (>= (str.head_code x) (str.to_code "a")) ; [ab] 33 | (<= (str.head_code x) (str.to_code "b")) 34 | (extr3 (str.tail x) y)) 35 | ))) 36 | 37 | (declare-const x String) 38 | (declare-const y String) 39 | 40 | (assert (extr x y)) 41 | (assert (str.in.re x (re.++ (re.+ (re.range "a" "b")) (str.to.re "babababa")))) 42 | (assert (str.in.re y (re.+ (re.range "a" "b")))) 43 | (assert (str.contains y "b")) ; makes it unsat 44 | 45 | (check-sat) 46 | -------------------------------------------------------------------------------- /tests/transducer1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Successor transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((succ ((x String) (y String)) Bool) 8 | (succH ((x String) (y String)) Bool)) ( 9 | ; definition of succ 10 | (or (and (not (= x "")) (not (= y "")) 11 | (= (str.head x) (char.from-int 48)) ; '0' 12 | (= (str.head y) (char.from-int 48)) ; '0' 13 | (succ (str.tail x) (str.tail y))) 14 | (and (not (= x "")) (not (= y "")) 15 | (= (str.head x) (char.from-int 49)) ; '1' 16 | (= (str.head y) (char.from-int 49)) ; '1' 17 | (succ (str.tail x) (str.tail y))) 18 | (and (not (= x "")) (not (= y "")) 19 | (= (str.head x) (char.from-int 48)) ; '0' 20 | (= (str.head y) (char.from-int 49)) ; '1' 21 | (succH (str.tail x) (str.tail y)))) 22 | ; definition of succH 23 | (or (and (= x "") 24 | (= y "")) 25 | (and (not (= x "")) (not (= y "")) 26 | (= (str.head x) (char.from-int 49)) ; '1' 27 | (= (str.head y) (char.from-int 48)) ; '0' 28 | (succH (str.tail x) (str.tail y)))))) 29 | 30 | (declare-fun x () String) 31 | (declare-fun y () String) 32 | 33 | (assert (str.in.re x 34 | (re.++ 35 | (re.+ (re.union (str.to.re "0") (str.to.re "1"))) 36 | (re.union (str.to.re "0") (str.to.re "1"))))) 37 | (assert (succ x y)) 38 | 39 | (check-sat) -------------------------------------------------------------------------------- /tests/regex_cg_ref4.smt2: -------------------------------------------------------------------------------- 1 | ;'use strict'; 2 | ;module.exports = function (str, sep) { 3 | ;if (typeof str !== 'string') { 4 | ;throw new TypeError('Expected a string'); 5 | ;} 6 | 7 | ;sep = typeof sep === 'undefined' ? '_' : sep; 8 | 9 | ;return str 10 | ;.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') 11 | ;.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') 12 | ;.toLowerCase(); 13 | ;}; 14 | 15 | (set-logic QF_S) 16 | 17 | (declare-const s String) 18 | (declare-const in1 String) 19 | (declare-const res String) 20 | 21 | ; we assume 'sep' is '-' 22 | (assert (= in1 (str.replace_cg_all 23 | s 24 | (re.++ 25 | ((_ re.capture 1) (re.union 26 | (re.range "a" "z") 27 | (re.range "0" "9"))) 28 | ((_ re.capture 2) (re.range "A" "Z"))) 29 | (re.++ (_ re.reference 1) (str.to.re "-") (_ re.reference 2))))) 30 | 31 | (assert (= res 32 | (str.replace_cg_all 33 | in1 34 | (re.++ 35 | ((_ re.capture 1) (re.+ (re.range "A" "Z"))) 36 | ((_ re.capture 2) (re.++ 37 | (re.range "A" "Z") 38 | (re.+ (re.union 39 | (re.range "a" "z") 40 | (re.range "0" "9") 41 | ))))) 42 | (re.++ (_ re.reference 1) (str.to.re "-") (_ re.reference 2))))) 43 | 44 | ; we omit the 'tolowercase' part here 45 | 46 | (assert (str.in.re s (str.to.re "CaWOGo"))) 47 | 48 | (assert (str.in.re res (str.to.re "Ca-WO-Go"))) 49 | 50 | (check-sat) 51 | (get-model) 52 | -------------------------------------------------------------------------------- /tests/transducer1c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; Successor transducer 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((succ ((x String) (y String)) Bool) 8 | (succH ((x String) (y String)) Bool)) ( 9 | ; definition of succ 10 | (or (and (not (= x "")) (not (= y "")) 11 | (= (str.head_code x) (str.to_code "0")) ; '0' 12 | (= (str.head_code y) (str.to_code "0")) ; '0' 13 | (succ (str.tail x) (str.tail y))) 14 | (and (not (= x "")) (not (= y "")) 15 | (= (str.head_code x) (str.to_code "1")) ; '1' 16 | (= (str.head_code y) (str.to_code "1")) ; '1' 17 | (succ (str.tail x) (str.tail y))) 18 | (and (not (= x "")) (not (= y "")) 19 | (= (str.head_code x) (str.to_code "0")) ; '0' 20 | (= (str.head_code y) (str.to_code "1")) ; '1' 21 | (succH (str.tail x) (str.tail y)))) 22 | ; definition of succH 23 | (or (and (= x "") 24 | (= y "")) 25 | (and (not (= x "")) (not (= y "")) 26 | (= (str.head_code x) (str.to_code "1")) ; '1' 27 | (= (str.head_code y) (str.to_code "0")) ; '0' 28 | (succH (str.tail x) (str.tail y)))))) 29 | 30 | (declare-fun x () String) 31 | (declare-fun y () String) 32 | 33 | (assert (str.in.re x 34 | (re.++ 35 | (re.+ (re.union (str.to.re "0") (str.to.re "1"))) 36 | (re.union (str.to.re "0") (str.to.re "1"))))) 37 | (assert (succ x y)) 38 | 39 | (check-sat) 40 | -------------------------------------------------------------------------------- /tests/cvc_replace_185.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | (set-option :strings-exp true) 3 | (set-option :produce-models true) 4 | (declare-fun sigmaStar_0 () String) 5 | (declare-fun sigmaStar_1 () String) 6 | (declare-fun literal_20 () String) 7 | (assert (= literal_20 "\x3c\x6c\x69\x3e\x3c\x69\x6d\x67\x20\x73\x72\x63\x3d\x5c\x22\x69\x6d\x61\x67\x65\x73\x2f\x69\x6d\x73\x2e\x67\x69\x66\x5c\x22\x20\x61\x6c\x74\x3d\x5c\x22\x49\x4d\x53\x20\x43\x50\x20\x50\x61\x63\x6b\x61\x67\x65\x5c\x22\x20\x2f\x3e\x20\x20\x28\x3c\x61\x20\x68\x72\x65\x66\x3d\x5c\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x65\x6e\x65\x72\x2e\x64\x6f\x63\x75\x6d\x65\x6e\x74\x2e\x66\x6f\x72\x6d\x73\x5b\x27\x66\x6f\x72\x6d\x27\x5d\x2e\x72\x65\x66\x65\x72\x65\x6e\x63\x65\x2e\x76\x61\x6c\x75\x65\x20\x3d\x20\x27\x23\x3b\x20\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x65\x6e\x65\x72\x2e\x64\x6f\x63\x75\x6d\x65\x6e\x74\x2e\x66\x6f\x72\x6d\x73\x5b\x66\x6f\x72\x6d\x27\x5d\x2e\x6e\x61\x6d\x65\x2e\x76\x61\x6c\x75\x65\x20\x3d\x20\x27\x27\x3b\x20\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x77\x69\x6e\x64\x6f\x77\x2e\x63\x6c\x6f\x73\x65\x28\x29\x3b\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5c\x22\x3e\x63\x68\x6f\x6f\x73\x65\x3c\x2f\x61\x3e\x29\x20\x28\x3c\x61\x20\x68\x72\x65\x66\x3d\x5c\x22\x70\x72\x65\x76\x69\x65\x77\x2e\x70\x68\x70\x3f\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x3d\x5c\x22\x3e\x70\x72\x65\x76\x69\x65\x77\x3c\x2f\x61\x3e\x29\x3c\x2f\x6c\x69\x3e\x5c\x6e")) 8 | (assert (str.in.re literal_20 (re.++ (re.* re.allchar) (re.++ (str.to.re "\x5c\x3c\x53\x43\x52\x49\x50\x54") (re.* re.allchar))))) 9 | (check-sat) 10 | (get-model) 11 | -------------------------------------------------------------------------------- /tests/extract-1.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; transducer extracting the string in between the 0th and 1st '=' 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extract1st ((x String) (y String)) Bool) 8 | (extract1st_2 ((x String) (y String)) Bool) 9 | (extract1st_3 ((x String) (y String)) Bool)) ( 10 | 11 | ; extract1st 12 | (or (and (= x "") (= y "")) 13 | (and (not (= x "")) 14 | (not (= (str.head x) (char.from-int 61))) ; not '=' 15 | (extract1st (str.tail x) y)) 16 | (and (not (= x "")) 17 | (= (str.head x) (char.from-int 61)) ; '=' 18 | (extract1st_2 (str.tail x) y))) 19 | 20 | ; extract1st_2 21 | (or (and (= x "") (= y "")) 22 | (and (not (= x "")) (not (= y "")) 23 | (= (str.head x) (str.head y)) 24 | (not (= (str.head x) (char.from-int 61))) ; not '=' 25 | (extract1st_2 (str.tail x) (str.tail y))) 26 | (and (not (= x "")) 27 | (= (str.head x) (char.from-int 61)) ; '=' 28 | (extract1st_3 (str.tail x) y))) 29 | 30 | ; extract1st_3 31 | (or (and (= x "") (= y "")) 32 | (and (not (= x "")) 33 | (extract1st_3 (str.tail x) y))) 34 | 35 | )) 36 | 37 | (declare-fun x0 () String) 38 | (declare-fun x1 () String) 39 | (declare-fun x2 () String) 40 | (declare-fun x3 () String) 41 | (declare-fun x4 () String) 42 | (declare-fun s0 () String) ; source variable 43 | 44 | (assert (str.in.re s0 (re.+ (re.charrange (char.from-int 120) (char.from-int 122))))) 45 | (assert (= x0 "abc=xyz=123=4")) 46 | 47 | (assert (extract1st x0 x1)) 48 | (assert (= x2 (str.++ x1 s0))) 49 | 50 | (assert (not (str.in.re x2 (re.* (re.charrange (char.from-int 120) (char.from-int 122)))))) 51 | 52 | (check-sat) 53 | 54 | -------------------------------------------------------------------------------- /src/main/scala/ostrich/cesolver/preop/CEPreOp.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Ostrich, an SMT solver for strings. 3 | * Copyright (c) 2023 Denghang Hu. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 15 | * * Neither the name of the authors nor the names of their 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package ostrich.cesolver.preop 34 | 35 | import ostrich.preop.PreOp 36 | 37 | trait CEPreOp extends PreOp {} 38 | -------------------------------------------------------------------------------- /tests/extract-1b.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; transducer extracting the string in between the 0th and 1st '=' 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extract1st ((x String) (y String)) Bool) 8 | (extract1st_2 ((x String) (y String)) Bool) 9 | (extract1st_3 ((x String) (y String)) Bool)) ( 10 | 11 | ; extract1st 12 | (or (and (= x "") (= y "")) 13 | (and (not (= x "")) 14 | (not (= (str.head x) (char.from-int 61))) ; not '=' 15 | (extract1st (str.tail x) y)) 16 | (and (not (= x "")) 17 | (= (str.head x) (char.from-int 61)) ; '=' 18 | (extract1st_2 (str.tail x) y))) 19 | 20 | ; extract1st_2 21 | (or (and (= x "") (= y "")) 22 | (and (not (= x "")) (not (= y "")) 23 | (= (str.head x) (str.head y)) 24 | (not (= (str.head x) (char.from-int 61))) ; not '=' 25 | (extract1st_2 (str.tail x) (str.tail y))) 26 | (and (not (= x "")) 27 | (= (str.head x) (char.from-int 61)) ; '=' 28 | (extract1st_3 (str.tail x) y))) 29 | 30 | ; extract1st_3 31 | (or (and (= x "") (= y "")) 32 | (and (not (= x "")) 33 | (extract1st_3 (str.tail x) y))) 34 | 35 | )) 36 | 37 | (declare-fun x0 () String) 38 | (declare-fun x1 () String) 39 | (declare-fun x2 () String) 40 | (declare-fun x3 () String) 41 | (declare-fun x4 () String) 42 | (declare-fun s0 () String) ; source variable 43 | 44 | (assert (str.in.re s0 (re.* (re.charrange (char.from-int 120) (char.from-int 122))))) 45 | (assert (str.in.re x0 (re.* (re.union (re.charrange (char.from-int 120) (char.from-int 122)) (str.to.re "="))))) 46 | 47 | (assert (extract1st x0 x1)) 48 | (assert (= x2 (str.++ x1 s0))) 49 | 50 | (assert (not (str.in.re x2 (re.* (re.charrange (char.from-int 120) (char.from-int 122)))))) 51 | 52 | (check-sat) 53 | 54 | -------------------------------------------------------------------------------- /tests/extract-1c.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_S) 2 | 3 | ; transducer extracting the string in between the 0th and 1st '=' 4 | 5 | (set-option :parse-transducers true) 6 | 7 | (define-funs-rec ((extract1st ((x String) (y String)) Bool) 8 | (extract1st_2 ((x String) (y String)) Bool) 9 | (extract1st_3 ((x String) (y String)) Bool)) ( 10 | 11 | ; extract1st 12 | (or (and (= x "") (= y "")) 13 | (and (not (= x "")) 14 | (not (= (str.head x) (char.from-int 61))) ; not '=' 15 | (extract1st (str.tail x) y)) 16 | (and (not (= x "")) 17 | (= (str.head x) (char.from-int 61)) ; '=' 18 | (extract1st_2 (str.tail x) y))) 19 | 20 | ; extract1st_2 21 | (or (and (= x "") (= y "")) 22 | (and (not (= x "")) (not (= y "")) 23 | (= (str.head x) (str.head y)) 24 | (not (= (str.head x) (char.from-int 61))) ; not '=' 25 | (extract1st_2 (str.tail x) (str.tail y))) 26 | (and (not (= x "")) 27 | (= (str.head x) (char.from-int 61)) ; '=' 28 | (extract1st_3 (str.tail x) y))) 29 | 30 | ; extract1st_3 31 | (or (and (= x "") (= y "")) 32 | (and (not (= x "")) 33 | (extract1st_3 (str.tail x) y))) 34 | 35 | )) 36 | 37 | (declare-fun x0 () String) 38 | (declare-fun x1 () String) 39 | (declare-fun x2 () String) 40 | (declare-fun x3 () String) 41 | (declare-fun x4 () String) 42 | (declare-fun s0 () String) ; source variable 43 | 44 | (assert (str.in.re s0 (re.* (re.charrange (char.from-int 120) (char.from-int 122))))) 45 | (assert (str.in.re x0 (re.* (re.union (re.charrange (char.from-int 120) (char.from-int 122)) (str.to.re "="))))) 46 | 47 | (assert (extract1st x0 x1)) 48 | (assert (= x2 (str.++ x1 s0))) 49 | 50 | (assert (not (str.in.re x2 (re.* (re.charrange (char.from-int 120) (char.from-int 121)))))) 51 | 52 | (check-sat) 53 | 54 | -------------------------------------------------------------------------------- /src/main/scala/ostrich/cesolver/util/Exception.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Ostrich, an SMT solver for strings. 3 | * Copyright (c) 2023 Denghang Hu. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 15 | * * Neither the name of the authors nor the names of their 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package ostrich.cesolver.util 34 | 35 | case class UnknownException(val info: String) extends Exception 36 | 37 | case class TimeoutException(val time: Long) extends Exception 38 | --------------------------------------------------------------------------------