├── simba.opam ├── test ├── simba.ml └── dune ├── dune-project ├── .gitignore ├── .vscode └── settings.json ├── dune-workspace ├── lib ├── synthLang │ └── dune ├── common │ └── dune ├── synthBase │ └── dune ├── synthProblem │ └── dune ├── analyzer │ ├── dune │ └── addrMap.ml ├── dom │ ├── dune │ └── bitVec │ │ └── bitVecCommon.ml └── synthBidir │ └── dune ├── bin └── dune ├── array_sum_2_5_sample.sl ├── testcases ├── bitvec │ └── hd │ │ ├── hd-03-d0-prog.sl │ │ ├── hd-06-d0-prog.sl │ │ ├── hd-05-d0-prog.sl │ │ ├── hd-02-d0-prog.sl │ │ ├── hd-07-d0-prog.sl │ │ ├── hd-04-d0-prog.sl │ │ ├── hd-13-d0-prog.sl │ │ ├── hd-08-d0-prog.sl │ │ ├── hd-09-d0-prog.sl │ │ ├── hd-17-d0-prog.sl │ │ ├── hd-03-d1-prog.sl │ │ ├── hd-15-d0-prog.sl │ │ ├── hd-14-d0-prog.sl │ │ ├── hd-06-d1-prog.sl │ │ ├── hd-02-d1-prog.sl │ │ ├── hd-01-d1-prog.sl │ │ ├── hd-05-d1-prog.sl │ │ ├── hd-19-d0-prog.sl │ │ ├── hd-07-d1-prog.sl │ │ ├── hd-04-d1-prog.sl │ │ ├── hd-17-d1-prog.sl │ │ ├── hd-08-d1-prog.sl │ │ ├── hd-20-d0-prog.sl │ │ ├── hd-09-d1-prog.sl │ │ ├── hd-13-d1-prog.sl │ │ ├── hd-14-d1-prog.sl │ │ ├── hd-15-d1-prog.sl │ │ ├── hd-19-d1-prog.sl │ │ ├── hd-20-d1-prog.sl │ │ ├── hd-03-d5-prog.sl │ │ ├── hd-06-d5-prog.sl │ │ ├── hd-07-d5-prog.sl │ │ ├── hd-02-d5-prog.sl │ │ ├── hd-05-d5-prog.sl │ │ ├── hd-01-d5-prog.sl │ │ ├── hd-08-d5-prog.sl │ │ ├── hd-13-d5-prog.sl │ │ ├── hd-04-d5-prog.sl │ │ ├── hd-09-d5-prog.sl │ │ ├── hd-17-d5-prog.sl │ │ ├── hd-14-d5-prog.sl │ │ ├── hd-15-d5-prog.sl │ │ └── hd-20-d5-prog.sl ├── sygus2018-hd │ ├── hd-03-d0-prog.sl │ ├── hd-06-d0-prog.sl │ ├── hd-05-d0-prog.sl │ ├── hd-02-d0-prog.sl │ ├── hd-07-d0-prog.sl │ ├── hd-13-d0-prog.sl │ ├── hd-04-d0-prog.sl │ ├── hd-08-d0-prog.sl │ ├── hd-09-d0-prog.sl │ ├── hd-17-d0-prog.sl │ ├── hd-03-d1-prog.sl │ ├── hd-14-d0-prog.sl │ ├── hd-15-d0-prog.sl │ ├── hd-06-d1-prog.sl │ ├── hd-02-d1-prog.sl │ ├── hd-01-d1-prog.sl │ ├── hd-05-d1-prog.sl │ ├── hd-07-d1-prog.sl │ ├── hd-17-d1-prog.sl │ ├── hd-04-d1-prog.sl │ ├── hd-08-d1-prog.sl │ ├── hd-19-d0-prog.sl │ ├── hd-09-d1-prog.sl │ ├── hd-13-d1-prog.sl │ ├── hd-20-d0-prog.sl │ ├── hd-14-d1-prog.sl │ ├── hd-15-d1-prog.sl │ ├── hd-pareto │ │ ├── hd-05-d5-pareto_0.sl │ │ ├── hd-05-d5-prog_0.sl │ │ ├── hd-05-d5-sort_0.sl │ │ ├── hd-05-d5-prog-prob_0.sl │ │ ├── hd-07-d5-pareto_0.sl │ │ ├── hd-07-d5-prog_0.sl │ │ ├── hd-07-d5-sort_0.sl │ │ ├── hd-07-d5-prog-prob_0.sl │ │ ├── hd-05-d5-prog_2.sl │ │ ├── hd-05-d5-sort_2.sl │ │ └── hd-05-d5-pareto_2.sl │ ├── hd-20-d1-prog.sl │ ├── hd-19-d1-prog.sl │ ├── hd-03-d5-prog.sl │ ├── hd-06-d5-prog.sl │ ├── hd-02-d5-prog.sl │ ├── hd-05-d5-prog.sl │ ├── hd-07-d5-prog.sl │ ├── hd-01-d5-prog.sl │ ├── hd-13-d5-prog.sl │ ├── hd-08-d5-prog.sl │ ├── hd-04-d5-prog.sl │ ├── hd-09-d5-prog.sl │ ├── hd-17-d5-prog.sl │ ├── hd-15-d5-prog.sl │ ├── hd-14-d5-prog.sl │ └── hd-20-d5-prog.sl ├── circuit │ ├── crypto │ │ └── CrCy_5-P9_5-P9.sl │ └── lobster │ │ ├── hd07.eqn_sygus_iter_140_0.sl │ │ ├── p19-8bit.eqn_sygus_iter_2_1.sl │ │ ├── p19.eqn_sygus_iter_114_0.sl │ │ ├── p19.eqn_sygus_iter_149_0.sl │ │ ├── p19-8bit.eqn_sygus_iter_10_0.sl │ │ ├── p19-8bit.eqn_sygus_iter_18_0.sl │ │ ├── hd07.eqn_sygus_iter_18_0.sl │ │ ├── hd07.eqn_sygus_iter_19_2.sl │ │ ├── p19.eqn_sygus_iter_127_1.sl │ │ ├── p19.eqn_sygus_iter_48_0.sl │ │ ├── p19.eqn_sygus_iter_79_0.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_124_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_3_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_116_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_54_2.sl │ │ ├── hd01.eqn_sygus_iter_10_2.sl │ │ ├── hd09.eqn_sygus_iter_55_3.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_32_3.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_85_2.sl │ │ ├── p03.eqn_sygus_iter_24_2.sl │ │ ├── p03.eqn_sygus_iter_38_2.sl │ │ ├── p03.eqn_sygus_iter_52_2.sl │ │ ├── p19.eqn_sygus_iter_163_2.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_88_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_162_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_17_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_63_1.sl │ │ ├── longest_1bit-opt.eqn_sygus_iter_97_1.sl │ │ └── hd11.eqn_sygus_iter_2_2.sl ├── hackers-delight │ ├── hd-04.sl │ ├── hd-14.sl │ ├── hd-15.sl │ ├── hd-21.sl │ ├── hd-26.sl │ ├── hd-01.sl │ ├── hd-03.sl │ ├── hd-06.sl │ ├── hd-27.sl │ ├── hd-05.sl │ ├── hd-07.sl │ └── hd-02.sl ├── string │ ├── initials.sl │ ├── initials_small.sl │ ├── exceljet2.sl │ ├── firstname.sl │ ├── 36462127.sl │ ├── extract-text-between-parentheses.sl │ ├── firstname_small.sl │ ├── convert-text-to-numbers.sl │ ├── lastname.sl │ ├── 17212077.sl │ ├── count-total-words-in-a-cell.sl │ ├── get-last-word.sl │ ├── convert-numbers-to-text.sl │ ├── lastname_small.sl │ ├── stackoverflow9.sl │ ├── strip-html-from-text-or-numbers.sl │ ├── stackoverflow2.sl │ ├── get-last-name-from-name-with-comma.sl │ ├── count-total-characters-in-a-cell.sl │ ├── phone-1.sl │ ├── phone.sl │ ├── phone_short.sl │ ├── stackoverflow4.sl │ ├── 37281007.sl │ ├── phone-1_short.sl │ ├── phone-2.sl │ ├── stackoverflow8.sl │ ├── phone-2_short.sl │ ├── strip-non-numeric-characters.sl │ ├── 19274448.sl │ ├── bikes.sl │ ├── clean-and-reformat-telephone-numbers.sl │ ├── extract-word-containing-specific-text.sl │ ├── phone-5.sl │ ├── remove-text-by-matching.sl │ ├── stackoverflow5.sl │ ├── strip-numeric-characters-from-cell.sl │ ├── get-middle-name-from-full-name.sl │ ├── phone-5-short.sl │ ├── phone-6.sl │ ├── phone-7.sl │ ├── stackoverflow1.sl │ ├── stackoverflow7.sl │ ├── bikes_small.sl │ ├── exceljet3.sl │ ├── phone-6-short.sl │ ├── phone-7-short.sl │ ├── remove-text-by-position.sl │ ├── get-first-word.sl │ ├── stackoverflow6.sl │ ├── 38871714.sl │ ├── get-domain-name-from-url.sl │ ├── join-first-and-last-name.sl │ ├── 39060015.sl │ ├── replace-one-character-with-another.sl │ ├── find-nth-occurrence-of-character.sl │ ├── get-first-name-from-name-with-comma.sl │ ├── get-last-name-from-name.sl │ ├── 31753108.sl │ ├── get-first-name-from-name.sl │ ├── name-combine-2.sl │ ├── name-combine-2_short.sl │ ├── count-line-breaks-in-cell.sl │ ├── remove-characters-from-left.sl │ ├── dr-name.sl │ ├── extract-word-that-begins-with-specific-character.sl │ ├── change-negative-numbers-to-positive.sl │ └── dr-name_small.sl ├── hd-04-d5-4bit.sl └── hd-04-d5-8bit.sl ├── first_build.sh └── error_problem.sl /simba.opam: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/simba.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name simba)) 3 | -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 3.3) 2 | (name simba) 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /_build/** 2 | /_install/** 3 | /*.json 4 | /*.txt 5 | /*.log 6 | /*.exe 7 | /**/.DS_Store 8 | /**/*.swp -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ocaml.sandbox": { 3 | "kind": "opam", 4 | "switch": "simba" 5 | } 6 | } -------------------------------------------------------------------------------- /dune-workspace: -------------------------------------------------------------------------------- 1 | (lang dune 3.3) 2 | (context 3 | (opam 4 | (switch simba) 5 | (merlin) 6 | ) 7 | ) 8 | -------------------------------------------------------------------------------- /lib/synthLang/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name synthLang) 3 | (modules :standard) 4 | (libraries common ocamlgraph) 5 | ) 6 | (env 7 | (dev 8 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -50 -w -67)))) 9 | -------------------------------------------------------------------------------- /lib/common/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name common) 3 | (modules :standard) 4 | (libraries batteries yojson dune-build-info) 5 | ) 6 | (env 7 | (dev 8 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -50 -w -67)))) 9 | -------------------------------------------------------------------------------- /lib/synthBase/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name synthBase) 3 | (modules :standard) 4 | (libraries common synthLang dom synthProblem) 5 | ) 6 | (env 7 | (dev 8 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -50 -w -67)))) 9 | -------------------------------------------------------------------------------- /lib/synthProblem/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name synthProblem) 3 | (modules :standard) 4 | (libraries common synthLang unix z3 core_kernel) 5 | ) 6 | (env 7 | (dev 8 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -50 -w -67)))) 9 | -------------------------------------------------------------------------------- /lib/analyzer/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name analyzer) 3 | (modules :standard \ addrMapBackup) 4 | (libraries common synthLang synthBase dom) 5 | ) 6 | (env 7 | (dev 8 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -49 -w -50 -w -67)))) 9 | -------------------------------------------------------------------------------- /bin/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (public_name simba) 3 | (name main) 4 | (modes byte exe) 5 | (libraries common synthLang dom analyzer synthBidir) 6 | ) 7 | (env 8 | (dev 9 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -50 -w -67)))) 10 | -------------------------------------------------------------------------------- /lib/dom/dune: -------------------------------------------------------------------------------- 1 | (include_subdirs unqualified) 2 | 3 | (library 4 | (name dom) 5 | (modules :standard \ aBitSeqBackup) 6 | (libraries common synthLang) 7 | ) 8 | (env 9 | (dev 10 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -49 -w -50 -w -67)))) 11 | -------------------------------------------------------------------------------- /lib/synthBidir/dune: -------------------------------------------------------------------------------- 1 | (include_subdirs unqualified) 2 | 3 | (library 4 | (name synthBidir) 5 | (modules :standard) 6 | (libraries common synthLang synthBase analyzer) 7 | ) 8 | (env 9 | (dev 10 | (flags (:standard -w -26 -w -27 -w -32 -w -33 -w -49 -w -50 -w -67)))) 11 | -------------------------------------------------------------------------------- /array_sum_2_5_sample.sl: -------------------------------------------------------------------------------- 1 | (set-logic LIA) 2 | (synth-fun findSum ( (y1 Int) (y2 Int) )Int ((Start Int ( 0 1 2 y1 y2 (+ Start Start) (ite BoolExpr Start Start))) (BoolExpr Bool ((< Start Start) (<= Start Start) (> Start Start) (>= Start Start))))) 3 | (declare-var x1 Int) 4 | (declare-var x2 Int) 5 | (constraint (=> (> (+ x1 x2) 5) (= (findSum x1 x2 ) (+ x1 x2)))) 6 | (constraint (=> (<= (+ x1 x2) 5) (= (findSum x1 x2 ) 0))) 7 | (check-synth) 8 | -------------------------------------------------------------------------------- /lib/dom/bitVec/bitVecCommon.ml: -------------------------------------------------------------------------------- 1 | open Common 2 | open Vocab 3 | open Int64Util 4 | open SynthLang 5 | 6 | exception BitLengthMismatch of int * int * string 7 | exception EarlyBotReduction 8 | 9 | let failwith_bit_length (len1: int) (len2: int) (msg: string): 'a = 10 | raise (BitLengthMismatch (len1, len2, msg)) 11 | 12 | let failwith_bit_length_f (len1: int) (len2: int) fmt: 'a = 13 | Printf.ksprintf (failwith_bit_length len1 len2) fmt 14 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-03-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, minimal grammar 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 64))) (BitVec 64) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvneg Start) 10 | (bvand Start Start) 11 | x)))) 12 | 13 | (declare-var x (BitVec 64)) 14 | (constraint (= (hd03 x) (f x))) 15 | (check-synth) 16 | 17 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-03-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, minimal grammar 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 32))) (BitVec 32) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvneg Start) 10 | (bvand Start Start) 11 | x)))) 12 | 13 | (declare-var x (BitVec 32)) 14 | (constraint (= (hd03 x) (f x))) 15 | (check-synth) 16 | 17 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-06-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, minimal grammar 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 32))) (BitVec 32) (bvor x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvadd Start Start) 10 | (bvor Start Start) 11 | #x00000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 32)) 15 | (constraint (= (hd06 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-05-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, minimal grammar 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 32))) (BitVec 32) (bvor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvor Start Start) 11 | #x00000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 32)) 15 | (constraint (= (hd05 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-06-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, minimal grammar 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 64))) (BitVec 64) (bvor x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvadd Start Start) 10 | (bvor Start Start) 11 | #x0000000000000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 64)) 15 | (constraint (= (hd06 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-05-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, minimal grammar 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 64))) (BitVec 64) (bvor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvor Start Start) 11 | #x0000000000000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 64)) 15 | (constraint (= (hd05 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-02-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, minimal grammar 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 32))) (BitVec 32) (bvand x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvadd Start Start) 11 | x 12 | #x00000001)))) 13 | 14 | (declare-var x (BitVec 32)) 15 | (constraint (= (hd02 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-07-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, minimal grammar 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvadd Start Start) 10 | (bvnot Start) 11 | (bvand Start Start) 12 | #x00000001 13 | x)))) 14 | 15 | (declare-var x (BitVec 32)) 16 | (constraint (= (hd07 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-13-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, minimal grammar 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 32))) (BitVec 32) (bvor (bvashr x #x0000001F) (bvlshr (bvneg x) #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvor Start Start) 12 | (bvneg Start) 13 | x 14 | #x0000001F)))) 15 | 16 | (declare-var x (BitVec 32)) 17 | (constraint (= (hd13 x) (f x))) 18 | (check-synth) 19 | 20 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-02-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, minimal grammar 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 64))) (BitVec 64) (bvand x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvadd Start Start) 11 | x 12 | #x0000000000000001)))) 13 | 14 | (declare-var x (BitVec 64)) 15 | (constraint (= (hd02 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-07-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, minimal grammar 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvadd Start Start) 10 | (bvnot Start) 11 | (bvand Start Start) 12 | #x0000000000000001 13 | x)))) 14 | 15 | (declare-var x (BitVec 64)) 16 | (constraint (= (hd07 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-04-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, minimal grammar 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 32))) (BitVec 32) (bvxor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvxor Start Start) 11 | #x00000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 32)) 15 | (constraint (= (hd04 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /first_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -d "$HOME/.opam" ] 4 | then 5 | opam init --auto-setup --disable-sandboxing --yes && opam clean 6 | fi 7 | 8 | if [ ! -d "$HOME/.opam/simba" ] 9 | then 10 | opam switch create simba 4.12.0 11 | fi 12 | 13 | opam switch simba 14 | opam install --yes dune merlin ocaml-lsp-server dune-build-info batteries ocamlgraph core_kernel yojson containers-data containers z3 15 | 16 | eval $(opam config env) 17 | 18 | ./build.sh 19 | 20 | # NOTE: if z3 install failed, install z3.4.8.5 instead of latest 21 | # opam install --yes z3.4.8.5 22 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-08-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, minimal grammar 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvnot Start) 11 | (bvand Start Start) 12 | #x00000001 13 | x)))) 14 | 15 | (declare-var x (BitVec 32)) 16 | (constraint (= (hd08 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-04-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, minimal grammar 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 64))) (BitVec 64) (bvxor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvxor Start Start) 11 | #x0000000000000001 12 | x)))) 13 | 14 | (declare-var x (BitVec 64)) 15 | (constraint (= (hd04 x) (f x))) 16 | (check-synth) 17 | 18 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-13-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, minimal grammar 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 64))) (BitVec 64) (bvor (bvashr x #x000000000000003F) (bvlshr (bvneg x) #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvor Start Start) 12 | (bvneg Start) 13 | x 14 | #x000000000000003F)))) 15 | 16 | (declare-var x (BitVec 64)) 17 | (constraint (= (hd13 x) (f x))) 18 | (check-synth) 19 | 20 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-09-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, minimal grammar 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 32))) (BitVec 32) (bvsub (bvxor x (bvashr x #x0000001F)) (bvashr x #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | #x0000001F 13 | x)))) 14 | 15 | (declare-var x (BitVec 32)) 16 | (constraint (= (hd09 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-08-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, minimal grammar 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvnot Start) 11 | (bvand Start Start) 12 | #x0000000000000001 13 | x)))) 14 | 15 | (declare-var x (BitVec 64)) 16 | (constraint (= (hd08 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-17-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, minimal grammar 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 32))) (BitVec 32) (bvand (bvadd (bvor x (bvsub x #x00000001)) #x00000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvadd Start Start) 11 | (bvsub Start Start) 12 | (bvor Start Start) 13 | x 14 | #x00000001)))) 15 | 16 | (declare-var x (BitVec 32)) 17 | (constraint (= (hd17 x) (f x))) 18 | (check-synth) 19 | 20 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-09-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, minimal grammar 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 64))) (BitVec 64) (bvsub (bvxor x (bvashr x #x000000000000003F)) (bvashr x #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | #x000000000000003F 13 | x)))) 14 | 15 | (declare-var x (BitVec 64)) 16 | (constraint (= (hd09 x) (f x))) 17 | (check-synth) 18 | 19 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-17-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, minimal grammar 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 64))) (BitVec 64) (bvand (bvadd (bvor x (bvsub x #x0000000000000001)) #x0000000000000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvadd Start Start) 11 | (bvsub Start Start) 12 | (bvor Start Start) 13 | x 14 | #x0000000000000001)))) 15 | 16 | (declare-var x (BitVec 64)) 17 | (constraint (= (hd17 x) (f x))) 18 | (check-synth) 19 | 20 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-03-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, difficulty 1 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 32))) (BitVec 32) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvneg Start) 10 | (bvand Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvsub Start Start) 14 | #x00000001 15 | #x00000000 16 | #xFFFFFFFF 17 | x)))) 18 | 19 | (declare-var x (BitVec 32)) 20 | (constraint (= (hd03 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-14-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, minimal grammar 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvadd (bvand x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvxor Start Start) 11 | (bvadd Start Start) 12 | (bvand Start Start) 13 | x 14 | y 15 | #x00000001)))) 16 | 17 | (declare-var x (BitVec 32)) 18 | (declare-var y (BitVec 32)) 19 | (constraint (= (hd14 x y) (f x y))) 20 | (check-synth) 21 | 22 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-15-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, minimal grammar 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvsub (bvor x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvxor Start Start) 11 | (bvsub Start Start) 12 | (bvor Start Start) 13 | x 14 | y 15 | #x00000001)))) 16 | 17 | (declare-var x (BitVec 32)) 18 | (declare-var y (BitVec 32)) 19 | (constraint (= (hd15 x y) (f x y))) 20 | (check-synth) 21 | 22 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-03-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, difficulty 1 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 64))) (BitVec 64) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvneg Start) 10 | (bvand Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvsub Start Start) 14 | #x0000000000000001 15 | #x0000000000000000 16 | #xFFFFFFFFFFFFFFFF 17 | x)))) 18 | 19 | (declare-var x (BitVec 64)) 20 | (constraint (= (hd03 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-15-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, minimal grammar 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvsub (bvor x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvxor Start Start) 11 | (bvsub Start Start) 12 | (bvor Start Start) 13 | x 14 | y 15 | #x0000000000000001)))) 16 | 17 | (declare-var x (BitVec 64)) 18 | (declare-var y (BitVec 64)) 19 | (constraint (= (hd15 x y) (f x y))) 20 | (check-synth) 21 | 22 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-14-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, minimal grammar 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvadd (bvand x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvxor Start Start) 11 | (bvadd Start Start) 12 | (bvand Start Start) 13 | x 14 | y 15 | #x0000000000000001)))) 16 | 17 | (declare-var x (BitVec 64)) 18 | (declare-var y (BitVec 64)) 19 | (constraint (= (hd14 x y) (f x y))) 20 | (check-synth) 21 | 22 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-06-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, difficulty 1 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 32))) (BitVec 32) (bvor x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvadd Start Start) 10 | (bvsub Start Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvneg Start) 14 | (bvor Start Start) 15 | #x00000000 16 | #xFFFFFFFF 17 | #x00000001 18 | x)))) 19 | 20 | (declare-var x (BitVec 32)) 21 | (constraint (= (hd06 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-02-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, difficulty 1 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 32))) (BitVec 32) (bvand x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvxor Start Start) 14 | x 15 | #x00000000 16 | #xFFFFFFFF 17 | #x00000001)))) 18 | 19 | (declare-var x (BitVec 32)) 20 | (constraint (= (hd02 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-01-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 01, difficulty 1 2 | ; Turn off the rightmost 1-bit in a bit-vector. 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd01 ((x (BitVec 32))) (BitVec 32) (bvand x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvxor Start Start) 14 | x 15 | #x00000000 16 | #xFFFFFFFF 17 | #x00000001)))) 18 | 19 | (declare-var x (BitVec 32)) 20 | (constraint (= (hd01 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-05-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, difficulty 1 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 32))) (BitVec 32) (bvor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvneg Start) 11 | (bvadd Start Start) 12 | (bvand Start Start) 13 | (bvxor Start Start) 14 | (bvor Start Start) 15 | #x00000001 16 | #x00000000 17 | #xFFFFFFFF 18 | x)))) 19 | 20 | (declare-var x (BitVec 32)) 21 | (constraint (= (hd05 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-06-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, difficulty 1 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 64))) (BitVec 64) (bvor x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvadd Start Start) 10 | (bvsub Start Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvneg Start) 14 | (bvor Start Start) 15 | #x0000000000000000 16 | #xFFFFFFFFFFFFFFFF 17 | #x0000000000000001 18 | x)))) 19 | 20 | (declare-var x (BitVec 64)) 21 | (constraint (= (hd06 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-02-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, difficulty 1 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 64))) (BitVec 64) (bvand x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvxor Start Start) 14 | x 15 | #x0000000000000000 16 | #xFFFFFFFFFFFFFFFF 17 | #x0000000000000001)))) 18 | 19 | (declare-var x (BitVec 64)) 20 | (constraint (= (hd02 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-07-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, difficulty 1 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvadd Start Start) 10 | (bvsub Start Start) 11 | (bvnot Start) 12 | (bvneg Start) 13 | (bvand Start Start) 14 | (bvor Start Start) 15 | (bvxor Start Start) 16 | #x00000000 17 | #x00000001 18 | #xFFFFFFFF 19 | x)))) 20 | 21 | (declare-var x (BitVec 32)) 22 | (constraint (= (hd07 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-01-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 01, difficulty 1 2 | ; Turn off the rightmost 1-bit in a bit-vector. 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd01 ((x (BitVec 64))) (BitVec 64) (bvand x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvor Start Start) 12 | (bvadd Start Start) 13 | (bvxor Start Start) 14 | x 15 | #x0000000000000000 16 | #xFFFFFFFFFFFFFFFF 17 | #x0000000000000001)))) 18 | 19 | (declare-var x (BitVec 64)) 20 | (constraint (= (hd01 x) (f x))) 21 | (check-synth) 22 | 23 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-05-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, difficulty 1 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 64))) (BitVec 64) (bvor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvneg Start) 11 | (bvadd Start Start) 12 | (bvand Start Start) 13 | (bvxor Start Start) 14 | (bvor Start Start) 15 | #x0000000000000001 16 | #x0000000000000000 17 | #xFFFFFFFFFFFFFFFF 18 | x)))) 19 | 20 | (declare-var x (BitVec 64)) 21 | (constraint (= (hd05 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-17-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, difficulty 1 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 32))) (BitVec 32) (bvand (bvadd (bvor x (bvsub x #x00000001)) #x00000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvadd Start Start) 11 | (bvxor Start Start) 12 | (bvsub Start Start) 13 | (bvor Start Start) 14 | (bvnot Start) 15 | (bvneg Start) 16 | x 17 | #x00000001 18 | #x00000000 19 | #xFFFFFFFF)))) 20 | 21 | (declare-var x (BitVec 32)) 22 | (constraint (= (hd17 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-04-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 1 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 32))) (BitVec 32) (bvxor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvxor Start Start) 11 | (bvneg Start) 12 | (bvadd Start Start) 13 | (bvor Start Start) 14 | (bvand Start Start) 15 | #x00000000 16 | #x00000001 17 | #xFFFFFFFF 18 | x)))) 19 | 20 | (declare-var x (BitVec 32)) 21 | (constraint (= (hd04 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-08-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, difficulty 1 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvadd Start Start) 11 | (bvnot Start) 12 | (bvneg Start) 13 | (bvand Start Start) 14 | (bvor Start Start) 15 | (bvxor Start Start) 16 | #x00000000 17 | #x00000001 18 | #xFFFFFFFF 19 | x)))) 20 | 21 | (declare-var x (BitVec 32)) 22 | (constraint (= (hd08 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-19-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 19, minimal grammar 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd19 ((x (BitVec 64)) (m (BitVec 64)) (k (BitVec 64))) (BitVec 64) 6 | (bvxor x (bvxor (bvshl (bvand (bvxor (bvlshr x k) x) m) k) (bvand (bvxor (bvlshr x k) x) m)))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (m (BitVec 64)) (k (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvxor Start Start) 11 | (bvshl Start Start) 12 | (bvlshr Start Start) 13 | x 14 | m 15 | k)))) 16 | 17 | 18 | (declare-var x (BitVec 64)) 19 | (declare-var m (BitVec 64)) 20 | (declare-var k (BitVec 64)) 21 | 22 | (constraint (= (hd19 x m k) (f x m k))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-07-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, difficulty 1 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvadd Start Start) 10 | (bvsub Start Start) 11 | (bvnot Start) 12 | (bvneg Start) 13 | (bvand Start Start) 14 | (bvor Start Start) 15 | (bvxor Start Start) 16 | #x0000000000000000 17 | #x0000000000000001 18 | #xFFFFFFFFFFFFFFFF 19 | x)))) 20 | 21 | (declare-var x (BitVec 64)) 22 | (constraint (= (hd07 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-19-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 19, minimal grammar 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd19 ((x (BitVec 32)) (m (BitVec 32)) (k (BitVec 32))) (BitVec 32) 6 | (bvxor x (bvxor (bvshl (bvand (bvxor (bvlshr x k) x) m) k) (bvand (bvxor (bvlshr x k) x) m)))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (m (BitVec 32)) (k (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvxor Start Start) 11 | (bvshl Start Start) 12 | (bvlshr Start Start) 13 | x 14 | m 15 | k)))) 16 | 17 | 18 | (declare-var x (BitVec 32)) 19 | (declare-var m (BitVec 32)) 20 | (declare-var k (BitVec 32)) 21 | 22 | (constraint (= (hd19 x m k) (f x m k))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-04-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 1 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 64))) (BitVec 64) (bvxor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvxor Start Start) 11 | (bvneg Start) 12 | (bvadd Start Start) 13 | (bvor Start Start) 14 | (bvand Start Start) 15 | #x0000000000000000 16 | #x0000000000000001 17 | #xFFFFFFFFFFFFFFFF 18 | x)))) 19 | 20 | (declare-var x (BitVec 64)) 21 | (constraint (= (hd04 x) (f x))) 22 | (check-synth) 23 | 24 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-17-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, difficulty 1 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 64))) (BitVec 64) (bvand (bvadd (bvor x (bvsub x #x0000000000000001)) #x0000000000000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvadd Start Start) 11 | (bvxor Start Start) 12 | (bvsub Start Start) 13 | (bvor Start Start) 14 | (bvnot Start) 15 | (bvneg Start) 16 | x 17 | #x0000000000000001 18 | #x0000000000000000 19 | #xFFFFFFFFFFFFFFFF)))) 20 | 21 | (declare-var x (BitVec 64)) 22 | (constraint (= (hd17 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-08-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, difficulty 1 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvadd Start Start) 11 | (bvnot Start) 12 | (bvneg Start) 13 | (bvand Start Start) 14 | (bvor Start Start) 15 | (bvxor Start Start) 16 | #x0000000000000000 17 | #x0000000000000001 18 | #xFFFFFFFFFFFFFFFF 19 | x)))) 20 | 21 | (declare-var x (BitVec 64)) 22 | (constraint (= (hd08 x) (f x))) 23 | (check-synth) 24 | 25 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-09-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, difficulty 1 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 32))) (BitVec 32) (bvsub (bvxor x (bvashr x #x0000001F)) (bvashr x #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvsub Start Start) 10 | (bvadd Start Start) 11 | (bvashr Start Start) 12 | (bvlshr Start Start) 13 | (bvxor Start Start) 14 | (bvand Start Start) 15 | (bvor Start Start) 16 | #x00000001 17 | #x00000000 18 | #x0000001F 19 | #xFFFFFFFF 20 | x)))) 21 | 22 | (declare-var x (BitVec 32)) 23 | (constraint (= (hd09 x) (f x))) 24 | (check-synth) 25 | 26 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-13-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, difficulty 1 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 32))) (BitVec 32) (bvor (bvashr x #x0000001F) (bvlshr (bvneg x) #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvand Start Start) 12 | (bvxor Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvnot Start) 16 | (bvadd Start Start) 17 | (bvsub Start Start) 18 | x 19 | #x0000001F 20 | #x00000001 21 | #x00000000 22 | #xFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 32)) 25 | (constraint (= (hd13 x) (f x))) 26 | (check-synth) 27 | 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-20-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, minimal grammar 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 32))) (BitVec 32) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x00000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 10 | ((Start (BitVec 32) ((bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvlshr Start Start) 15 | (bvneg Start) 16 | (bvudiv Start Start) 17 | x 18 | #x00000002)))) 19 | 20 | 21 | 22 | (declare-var x (BitVec 32)) 23 | 24 | (constraint (= (hd20 x) (f x))) 25 | (check-synth) 26 | 27 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-20-d0-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, minimal grammar 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 64))) (BitVec 64) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x0000000000000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 10 | ((Start (BitVec 64) ((bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvlshr Start Start) 15 | (bvneg Start) 16 | (bvudiv Start Start) 17 | x 18 | #x0000000000000002)))) 19 | 20 | 21 | 22 | (declare-var x (BitVec 64)) 23 | 24 | (constraint (= (hd20 x) (f x))) 25 | (check-synth) 26 | 27 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-09-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, difficulty 1 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 64))) (BitVec 64) (bvsub (bvxor x (bvashr x #x000000000000003F)) (bvashr x #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvsub Start Start) 10 | (bvadd Start Start) 11 | (bvashr Start Start) 12 | (bvlshr Start Start) 13 | (bvxor Start Start) 14 | (bvand Start Start) 15 | (bvor Start Start) 16 | #x0000000000000001 17 | #x0000000000000000 18 | #x000000000000003F 19 | #xFFFFFFFFFFFFFFFF 20 | x)))) 21 | 22 | (declare-var x (BitVec 64)) 23 | (constraint (= (hd09 x) (f x))) 24 | (check-synth) 25 | 26 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-13-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, difficulty 1 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 64))) (BitVec 64) (bvor (bvashr x #x000000000000003F) (bvlshr (bvneg x) #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvand Start Start) 12 | (bvxor Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvnot Start) 16 | (bvadd Start Start) 17 | (bvsub Start Start) 18 | x 19 | #x000000000000003F 20 | #x0000000000000001 21 | #x0000000000000000 22 | #xFFFFFFFFFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 64)) 25 | (constraint (= (hd13 x) (f x))) 26 | (check-synth) 27 | 28 | -------------------------------------------------------------------------------- /testcases/circuit/crypto/CrCy_5-P9_5-P9.sl: -------------------------------------------------------------------------------- 1 | ;synthesize a countermeasure for the following program 2 | ;int compute(int k1, int k2, int k3){ 3 | ;int fx; 4 | ;fx = k1 ^ ( (~k2) & k3 ); 5 | ;return(fx); 6 | ;} 7 | 8 | (set-logic BV) 9 | 10 | (define-fun Spec ((k1 Bool) (k2 Bool) (k3 Bool) ) Bool 11 | (xor k1 (and k3 (not k2))) 12 | ) 13 | 14 | (synth-fun Imp ((k1 Bool) (k2 Bool) (k3 Bool)) Bool 15 | ((Start Bool ( (and d1 d1) (or d1 d1) (xor d1 d1) (not d1) ) ) 16 | (d1 Bool ( (and d2 d2) (or d2 d2) (xor d2 d2) (not d2) ) ) 17 | (d2 Bool ( k1 k2 k3) ) ) 18 | ) 19 | 20 | (declare-var k1 Bool) 21 | (declare-var k2 Bool) 22 | (declare-var k3 Bool) 23 | 24 | (constraint (= (Spec k1 k2 k3) (Imp k1 k2 k3))) 25 | (check-synth) 26 | 27 | (define-fun Imp_1 ((k1 Bool) (k2 Bool) (k3 Bool)) Bool (xor (xor k3 k1) (and k3 k2))) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-14-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, difficulty 1 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvadd (bvand x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvsub Start Start) 15 | (bvand Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | x 19 | y 20 | #x00000001 21 | #x00000000 22 | #xFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 32)) 25 | (declare-var y (BitVec 32)) 26 | (constraint (= (hd14 x y) (f x y))) 27 | (check-synth) 28 | 29 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-15-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, difficulty 1 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvsub (bvor x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | (bvsub Start Start) 13 | (bvadd Start Start) 14 | (bvor Start Start) 15 | (bvand Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | x 19 | y 20 | #x00000001 21 | #x00000000 22 | #xFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 32)) 25 | (declare-var y (BitVec 32)) 26 | (constraint (= (hd15 x y) (f x y))) 27 | (check-synth) 28 | 29 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd07.eqn_sygus_iter_140_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i0 Bool) (i2 Bool) (i1 Bool) ) Bool 6 | (and (not (and (not i1) (not i0))) (not (and i2 i1))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i0 Bool) (i2 Bool) (i1 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i0 i2 i1 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i0 Bool) 35 | (declare-var i2 Bool) 36 | (declare-var i1 Bool) 37 | 38 | (constraint (= (origCir i0 i2 i1 ) (skel i0 i2 i1 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19-8bit.eqn_sygus_iter_2_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool 6 | (and (not (and (not i3) (not i2))) (not (and i4 i3))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i2 i4 i3 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i2 Bool) 35 | (declare-var i4 Bool) 36 | (declare-var i3 Bool) 37 | 38 | (constraint (= (origCir i2 i4 i3 ) (skel i2 i4 i3 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_114_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i0 Bool) (i2 Bool) (i1 Bool) ) Bool 6 | (and (not (and (not i1) (not i0))) (not (and i2 i1))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i0 Bool) (i2 Bool) (i1 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i0 i2 i1 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i0 Bool) 35 | (declare-var i2 Bool) 36 | (declare-var i1 Bool) 37 | 38 | (constraint (= (origCir i0 i2 i1 ) (skel i0 i2 i1 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_149_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool 6 | (and (not (and (not i3) (not i2))) (not (and i4 i3))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i2 i4 i3 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i2 Bool) 35 | (declare-var i4 Bool) 36 | (declare-var i3 Bool) 37 | 38 | (constraint (= (origCir i2 i4 i3 ) (skel i2 i4 i3 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-pareto_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000001 20 | #x00000000 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-prog_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000001 20 | #x00000000 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-sort_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000001 20 | #x00000000 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19-8bit.eqn_sygus_iter_10_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool 6 | (and (not (and (not i3) (not i2))) (not (and i4 i3))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i2 Bool) (i4 Bool) (i3 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i2 i4 i3 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i2 Bool) 35 | (declare-var i4 Bool) 36 | (declare-var i3 Bool) 37 | 38 | (constraint (= (origCir i2 i4 i3 ) (skel i2 i4 i3 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19-8bit.eqn_sygus_iter_18_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i4 Bool) (i6 Bool) (i5 Bool) ) Bool 6 | (and (not (and (not i5) i4)) (not (and (not i6) i5))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i4 Bool) (i6 Bool) (i5 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i4 i6 i5 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i4 Bool) 35 | (declare-var i6 Bool) 36 | (declare-var i5 Bool) 37 | 38 | (constraint (= (origCir i4 i6 i5 ) (skel i4 i6 i5 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-prog-prob_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | x 20 | #x00000000 21 | #xffffffff 22 | #x00000001 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-07-d5-pareto_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd07 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvand ( bvnot x ) ( bvadd x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000001 20 | #x00000000 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd07 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-07-d5-prog_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd07 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvand ( bvnot x ) ( bvadd x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000000 20 | #x00000001 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd07 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-07-d5-sort_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd07 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvand ( bvnot x ) ( bvadd x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | #x00000001 20 | #x00000000 21 | #xffffffff 22 | x 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd07 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd07.eqn_sygus_iter_18_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i18 Bool) (i17 Bool) (i16 Bool) ) Bool 6 | (and (not (and (not i18) i17)) (not (and (not i17) i16))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i18 Bool) (i17 Bool) (i16 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i18 i17 i16 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i18 Bool) 35 | (declare-var i17 Bool) 36 | (declare-var i16 Bool) 37 | 38 | (constraint (= (origCir i18 i17 i16 ) (skel i18 i17 i16 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd07.eqn_sygus_iter_19_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i16 Bool) (i15 Bool) (i14 Bool) ) Bool 6 | (and (not (and (not i16) i15)) (not (and (not i15) i14))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i16 Bool) (i15 Bool) (i14 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i16 i15 i14 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i16 Bool) 35 | (declare-var i15 Bool) 36 | (declare-var i14 Bool) 37 | 38 | (constraint (= (origCir i16 i15 i14 ) (skel i16 i15 i14 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_127_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i25 Bool) (i24 Bool) (i23 Bool) ) Bool 6 | (and (not (and (not i25) i24)) (not (and (not i24) i23))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i25 Bool) (i24 Bool) (i23 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i25 i24 i23 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i25 Bool) 35 | (declare-var i24 Bool) 36 | (declare-var i23 Bool) 37 | 38 | (constraint (= (origCir i25 i24 i23 ) (skel i25 i24 i23 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_48_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i18 Bool) (i17 Bool) (i16 Bool) ) Bool 6 | (and (not (and (not i18) i17)) (not (and (not i17) i16))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i18 Bool) (i17 Bool) (i16 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i18 i17 i16 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i18 Bool) 35 | (declare-var i17 Bool) 36 | (declare-var i16 Bool) 37 | 38 | (constraint (= (origCir i18 i17 i16 ) (skel i18 i17 i16 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_79_0.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i22 Bool) (i21 Bool) (i20 Bool) ) Bool 6 | (and (not (and (not i22) i21)) (not (and (not i21) i20))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i22 Bool) (i21 Bool) (i20 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i22 i21 i20 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i22 Bool) 35 | (declare-var i21 Bool) 36 | (declare-var i20 Bool) 37 | 38 | (constraint (= (origCir i22 i21 i20 ) (skel i22 i21 i20 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-07-d5-prog-prob_0.sl: -------------------------------------------------------------------------------- 1 | ( set-logic BV ) 2 | ( define-fun hd07 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvand ( bvnot x ) ( bvadd x #x00000001 ) ) ) 3 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 4 | (Start ( BitVec 32 ) ( (bvnot Start) 5 | (bvxor Start Start) 6 | (bvand Start Start) 7 | (bvor Start Start) 8 | (bvneg Start) 9 | (bvadd Start Start) 10 | (bvmul Start Start) 11 | (bvudiv Start Start) 12 | (bvurem Start Start) 13 | (bvlshr Start Start) 14 | (bvashr Start Start) 15 | (bvshl Start Start) 16 | (bvsdiv Start Start) 17 | (bvsrem Start Start) 18 | (bvsub Start Start) 19 | x 20 | #x00000000 21 | #xffffffff 22 | #x00000001 23 | )) 24 | )) 25 | ( declare-var x ( BitVec 32 ) ) 26 | ( constraint ( = ( hd07 x ) ( f x ) ) ) 27 | ( check-synth ) 28 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-14-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, difficulty 1 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvadd (bvand x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvsub Start Start) 15 | (bvand Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | x 19 | y 20 | #x0000000000000001 21 | #x0000000000000000 22 | #xFFFFFFFFFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 64)) 25 | (declare-var y (BitVec 64)) 26 | (constraint (= (hd14 x y) (f x y))) 27 | (check-synth) 28 | 29 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-15-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, difficulty 1 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvsub (bvor x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvlshr Start Start) 10 | (bvashr Start Start) 11 | (bvxor Start Start) 12 | (bvsub Start Start) 13 | (bvadd Start Start) 14 | (bvor Start Start) 15 | (bvand Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | x 19 | y 20 | #x0000000000000001 21 | #x0000000000000000 22 | #xFFFFFFFFFFFFFFFF)))) 23 | 24 | (declare-var x (BitVec 64)) 25 | (declare-var y (BitVec 64)) 26 | (constraint (= (hd15 x y) (f x y))) 27 | (check-synth) 28 | 29 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_124_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_4 Bool) (i_8 Bool) (i_6 Bool) ) Bool 6 | (and (not (and (not i_6) i_4)) (not (and i_8 i_6))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_4 Bool) (i_8 Bool) (i_6 Bool) ) Bool ( 11 | (Start Bool (depth1) ) 12 | 13 | (depth1 Bool ( 14 | (and depth0 depth0) 15 | (or depth0 depth0) 16 | (xor depth1 depth1) 17 | (not depth1) 18 | depth0 19 | 20 | ) 21 | ) 22 | 23 | (depth0 Bool ( 24 | true 25 | false 26 | (xor depth0 depth0) 27 | (not depth0) 28 | i_4 i_8 i_6 29 | ) 30 | ) 31 | 32 | ) 33 | ) 34 | (declare-var i_4 Bool) 35 | (declare-var i_8 Bool) 36 | (declare-var i_6 Bool) 37 | 38 | (constraint (= (origCir i_4 i_8 i_6 ) (skel i_4 i_8 i_6 ))) 39 | (check-synth) 40 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-04.sl: -------------------------------------------------------------------------------- 1 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd04 ((x (BitVec 64))) (BitVec 64) (bvxor x (bvsub x #x0000000000000001))) 6 | 7 | (synth-fun f ( (x (BitVec 64)) ) (BitVec 64) 8 | ((Start (BitVec 64) 9 | ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000000000000000 26 | #x0000000000000001 27 | #xffffffffffffffff 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd04 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /lib/analyzer/addrMap.ml: -------------------------------------------------------------------------------- 1 | open Common 2 | open Vocab 3 | 4 | (** specialized map with Generator.addr key *) 5 | 6 | type 'a addr_map = (int list, 'a) BatMap.t 7 | 8 | type 'a t = 'a addr_map 9 | 10 | let empty: 'a addr_map = BatMap.empty 11 | 12 | let is_pure_empty (m: 'a addr_map): bool = BatMap.is_empty m 13 | 14 | let is_empty (m: 'a addr_map): bool = is_pure_empty m 15 | 16 | let add (k: int list) (v: 'a) (m: 'a addr_map): 'a addr_map = 17 | BatMap.add k v m 18 | 19 | let find (k: int list) (m: 'a addr_map): 'a = 20 | BatMap.find k m 21 | 22 | let mem (k: int list) (m: 'a addr_map): bool = 23 | BatMap.mem k m 24 | 25 | let remove (k: int list) (m: 'a addr_map): 'a addr_map = 26 | BatMap.remove k m 27 | 28 | let size (m: 'a addr_map): int = BatMap.cardinal m 29 | 30 | let keys (m: 'a addr_map): int list BatEnum.t = BatMap.keys m 31 | 32 | let values (m: 'a addr_map): 'a BatEnum.t = BatMap.values m -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-19-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 19, difficulty 1 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd19 ((x (BitVec 64)) (m (BitVec 64)) (k (BitVec 64))) (BitVec 64) 6 | (bvxor x (bvxor (bvshl (bvand (bvxor (bvlshr x k) x) m) k) (bvand (bvxor (bvlshr x k) x) m)))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (m (BitVec 64)) (k (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvand Start Start) 14 | (bvshl Start Start) 15 | (bvlshr Start Start) 16 | (bvashr Start Start) 17 | (bvnot Start) 18 | (bvneg Start) 19 | x 20 | m 21 | k)))) 22 | 23 | 24 | (declare-var x (BitVec 64)) 25 | (declare-var m (BitVec 64)) 26 | (declare-var k (BitVec 64)) 27 | 28 | (constraint (= (hd19 x m k) (f x m k))) 29 | (check-synth) 30 | 31 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-20-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, difficulty 1 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 32))) (BitVec 32) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x00000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 10 | ((Start (BitVec 32) ((bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvsub Start Start) 15 | (bvlshr Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | (bvudiv Start Start) 19 | (bvsdiv Start Start) 20 | x 21 | #x00000002 22 | #x00000000 23 | #x00000001)))) 24 | 25 | 26 | 27 | (declare-var x (BitVec 32)) 28 | 29 | (constraint (= (hd20 x) (f x))) 30 | (check-synth) 31 | 32 | -------------------------------------------------------------------------------- /testcases/string/initials.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "N.F.")) 27 | (constraint (= (f "Andrew Cencici") "A.C.")) 28 | (constraint (= (f "Jan Kotas") "J.K.")) 29 | (constraint (= (f "Mariya Sergienko") "M.S.")) 30 | 31 | (check-synth) 32 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-19-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 19, difficulty 1 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd19 ((x (BitVec 32)) (m (BitVec 32)) (k (BitVec 32))) (BitVec 32) 6 | (bvxor x (bvxor (bvshl (bvand (bvxor (bvlshr x k) x) m) k) (bvand (bvxor (bvlshr x k) x) m)))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (m (BitVec 32)) (k (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvand Start Start) 10 | (bvsub Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvand Start Start) 14 | (bvshl Start Start) 15 | (bvlshr Start Start) 16 | (bvashr Start Start) 17 | (bvnot Start) 18 | (bvneg Start) 19 | x 20 | m 21 | k)))) 22 | 23 | 24 | (declare-var x (BitVec 32)) 25 | (declare-var m (BitVec 32)) 26 | (declare-var k (BitVec 32)) 27 | 28 | (constraint (= (hd19 x m k) (f x m k))) 29 | (check-synth) 30 | 31 | -------------------------------------------------------------------------------- /testcases/string/initials_small.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "N.F.")) 27 | (constraint (= (f "Andrew Cencici") "A.C.")) 28 | (constraint (= (f "Jan Kotas") "J.K.")) 29 | (constraint (= (f "Mariya Sergienko") "M.S.")) 30 | 31 | (check-synth) 32 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-prog_2.sl: -------------------------------------------------------------------------------- 1 | ; constraint : w1 < 2.0 2 | ; constraint : w1 > 0.0 3 | ( set-logic BV ) 4 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 5 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 6 | (Start ( BitVec 32 ) ( #x00000001 7 | #x00000000 8 | #xffffffff 9 | x 10 | (bvnot NT1) 11 | (bvneg NT1) 12 | (bvxor NT1 NT1) 13 | (bvand NT1 NT1) 14 | (bvor NT1 NT1) 15 | (bvsdiv NT1 NT1) 16 | (bvadd NT1 NT1) 17 | (bvmul NT1 NT1) 18 | (bvudiv NT1 NT1) 19 | (bvurem NT1 NT1) 20 | (bvlshr NT1 NT1) 21 | (bvashr NT1 NT1) 22 | (bvshl NT1 NT1) 23 | (bvsub NT1 NT1) 24 | (bvsrem NT1 NT1) 25 | )) 26 | (NT1 ( BitVec 32 ) ( #x00000001 27 | #x00000000 28 | #xffffffff 29 | x 30 | )) 31 | )) 32 | ( declare-var x ( BitVec 32 ) ) 33 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 34 | ( check-synth ) 35 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-20-d1-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, difficulty 1 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 64))) (BitVec 64) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x0000000000000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 10 | ((Start (BitVec 64) ((bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvadd Start Start) 14 | (bvsub Start Start) 15 | (bvlshr Start Start) 16 | (bvneg Start) 17 | (bvnot Start) 18 | (bvudiv Start Start) 19 | (bvsdiv Start Start) 20 | x 21 | #x0000000000000002 22 | #x0000000000000000 23 | #x0000000000000001)))) 24 | 25 | 26 | 27 | (declare-var x (BitVec 64)) 28 | 29 | (constraint (= (hd20 x) (f x))) 30 | (check-synth) 31 | 32 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-sort_2.sl: -------------------------------------------------------------------------------- 1 | ; constraint : w2 < 2.0 2 | ; constraint : w1 < 0.0 3 | ; constraint : w1 > 0.0 4 | ( set-logic BV ) 5 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 6 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 7 | (Start ( BitVec 32 ) ( #x00000001 8 | #x00000000 9 | #xffffffff 10 | x 11 | (bvnot NT0) 12 | (bvneg NT0) 13 | (bvlshr NT0 NT0) 14 | (bvxor NT0 NT0) 15 | (bvor NT0 NT0) 16 | (bvadd NT0 NT0) 17 | (bvmul NT0 NT0) 18 | (bvudiv NT0 NT0) 19 | (bvurem NT0 NT0) 20 | (bvashr NT0 NT0) 21 | (bvsub NT0 NT0) 22 | (bvshl NT0 NT0) 23 | (bvsdiv NT0 NT0) 24 | (bvsrem NT0 NT0) 25 | )) 26 | (NT0 ( BitVec 32 ) ( #x00000001 27 | #x00000000 28 | #xffffffff 29 | x 30 | )) 31 | )) 32 | ( declare-var x ( BitVec 32 ) ) 33 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 34 | ( check-synth ) 35 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-pareto/hd-05-d5-pareto_2.sl: -------------------------------------------------------------------------------- 1 | ; constraint : w2 < 2.0 2 | ; constraint : w1 < 0.0 3 | ; constraint : w1 > 0.0 4 | ( set-logic BV ) 5 | ( define-fun hd05 ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( bvor x ( bvsub x #x00000001 ) ) ) 6 | ( synth-fun f ( ( x ( BitVec 32 ) ) ) ( BitVec 32 ) ( 7 | (Start ( BitVec 32 ) ( #x00000001 8 | #x00000000 9 | #xffffffff 10 | x 11 | (bvnot NT0) 12 | (bvneg NT0) 13 | (bvurem NT0 NT0) 14 | (bvxor NT0 NT0) 15 | (bvor NT0 NT0) 16 | (bvadd NT0 NT0) 17 | (bvmul NT0 NT0) 18 | (bvudiv NT0 NT0) 19 | (bvsub NT0 NT0) 20 | (bvlshr NT0 NT0) 21 | (bvsrem NT0 NT0) 22 | (bvashr NT0 NT0) 23 | (bvshl NT0 NT0) 24 | (bvsdiv NT0 NT0) 25 | )) 26 | (NT0 ( BitVec 32 ) ( #x00000001 27 | #x00000000 28 | #xffffffff 29 | x 30 | )) 31 | )) 32 | ( declare-var x ( BitVec 32 ) ) 33 | ( constraint ( = ( hd05 x ) ( f x ) ) ) 34 | ( check-synth ) 35 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-03-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, difficulty 5 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 32))) (BitVec 32) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000001 25 | #x00000000 26 | #xFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd03 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/hd-04-d5-4bit.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 5 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 4))) (BitVec 4) (bvxor x (bvsub x #x1))) 7 | 8 | (synth-fun f ((x (BitVec 4))) (BitVec 4) 9 | ((Start (BitVec 4) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0 25 | #x1 26 | #xF 27 | x)))) 28 | 29 | (declare-var x (BitVec 4)) 30 | (constraint (= (hd04 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/hd-04-d5-8bit.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 5 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 8))) (BitVec 8) (bvxor x (bvsub x #x01))) 7 | 8 | (synth-fun f ((x (BitVec 8))) (BitVec 8) 9 | ((Start (BitVec 8) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00 25 | #x01 26 | #xFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 8)) 30 | (constraint (= (hd04 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-06-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, difficulty 5 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 32))) (BitVec 32) (bvor x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000000 25 | #xFFFFFFFF 26 | #x00000001 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd06 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-02-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, difficulty 5 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 32))) (BitVec 32) (bvand x (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x00000000 26 | #xFFFFFFFF 27 | #x00000001)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd02 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-05-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, difficulty 5 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 32))) (BitVec 32) (bvor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000001 25 | #x00000000 26 | #xFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd05 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-07-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, difficulty 5 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvadd x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000000 25 | #x00000001 26 | #xFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd07 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-03-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, difficulty 5 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 64))) (BitVec 64) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000001 25 | #x0000000000000000 26 | #xFFFFFFFFFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd03 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-14.sl: -------------------------------------------------------------------------------- 1 | ; floor of average of two integers 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd14 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvadd (bvand x y) (bvlshr (bvxor x y) #x0000000000000001))) 6 | 7 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 8 | 9 | ((Start (BitVec 64) 10 | ((bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvudiv Start Start) 18 | (bvurem Start Start) 19 | (bvlshr Start Start) 20 | (bvashr Start Start) 21 | (bvshl Start Start) 22 | (bvsdiv Start Start) 23 | (bvsrem Start Start) 24 | (bvsub Start Start) 25 | #x0000000000000000 26 | #x0000000000000001 27 | #x000000000000001f 28 | #xffffffffffffffff 29 | x 30 | y 31 | )) 32 | 33 | (StartBool Bool 34 | ((= Start Start) 35 | )))) 36 | 37 | (declare-var x (BitVec 64)) 38 | (declare-var y (BitVec 64)) 39 | (constraint (= (hd14 x y) (f x y))) 40 | (check-synth) 41 | 42 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-15.sl: -------------------------------------------------------------------------------- 1 | ; floor of average of two integers 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd15 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvsub (bvor x y) (bvlshr (bvxor x y) #x0000000000000001))) 6 | 7 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 8 | 9 | ((Start (BitVec 64) 10 | ((bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvudiv Start Start) 18 | (bvurem Start Start) 19 | (bvlshr Start Start) 20 | (bvashr Start Start) 21 | (bvshl Start Start) 22 | (bvsdiv Start Start) 23 | (bvsrem Start Start) 24 | (bvsub Start Start) 25 | #x0000000000000000 26 | #x0000000000000001 27 | #x000000000000001f 28 | #xffffffffffffffff 29 | x 30 | y 31 | )) 32 | 33 | (StartBool Bool 34 | ((= Start Start) 35 | )))) 36 | 37 | (declare-var x (BitVec 64)) 38 | (declare-var y (BitVec 64)) 39 | (constraint (= (hd15 x y) (f x y))) 40 | (check-synth) 41 | 42 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-01-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 01, difficulty 5 2 | ; Turn off the rightmost 1-bit in a bit-vector. 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd01 ((x (BitVec 32))) (BitVec 32) (bvand x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x00000000 26 | #xFFFFFFFF 27 | #x00000001)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd01 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-13-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, difficulty 5 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 32))) (BitVec 32) (bvor (bvashr x #x0000001F) (bvlshr (bvneg x) #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000001F 26 | #x00000001 27 | #x00000000 28 | #xFFFFFFFF)))) 29 | 30 | (declare-var x (BitVec 32)) 31 | (constraint (= (hd13 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-08-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, difficulty 5 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 32))) (BitVec 32) (bvand (bvnot x) (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvor Start Start) 12 | (bvxor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000000 25 | #x00000001 26 | #xFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd08 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-06-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, difficulty 5 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 64))) (BitVec 64) (bvor x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #xFFFFFFFFFFFFFFFF 26 | #x0000000000000001 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd06 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-07-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, difficulty 5 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #x0000000000000001 26 | #xFFFFFFFFFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd07 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-02-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, difficulty 5 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 64))) (BitVec 64) (bvand x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000000000000000 26 | #xFFFFFFFFFFFFFFFF 27 | #x0000000000000001)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd02 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-05-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, difficulty 5 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 64))) (BitVec 64) (bvor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000001 25 | #x0000000000000000 26 | #xFFFFFFFFFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd05 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-01-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 01, difficulty 5 2 | ; Turn off the rightmost 1-bit in a bit-vector. 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd01 ((x (BitVec 64))) (BitVec 64) (bvand x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000000000000000 26 | #xFFFFFFFFFFFFFFFF 27 | #x0000000000000001)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd01 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/string/exceljet2.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-top-level-domain-tld 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "." 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "www.domain.com") "com")) 34 | (constraint (= (f "mail.net") "net")) 35 | (constraint (= (f "www.amaon.co.uk") "uk")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-04-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 5 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 32))) (BitVec 32) (bvxor x (bvsub x #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000000 25 | #x00000001 26 | #xFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 32)) 30 | (constraint (= (hd04 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/string/firstname.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "Nancy")) 27 | (constraint (= (f "Andrew Cencici") "Andrew")) 28 | (constraint (= (f "Jan Kotas") "Jan")) 29 | (constraint (= (f "Mariya Sergienko") "Mariya")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((name String)) String (str.substr name 0 (str.indexof name " " 0))) 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-09-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, difficulty 5 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 32))) (BitVec 32) (bvsub (bvxor x (bvashr x #x0000001F)) (bvashr x #x0000001F))) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x00000001 25 | #x00000000 26 | #x0000001F 27 | #xFFFFFFFF 28 | x)))) 29 | 30 | (declare-var x (BitVec 32)) 31 | (constraint (= (hd09 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-08-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 08, difficulty 5 2 | ; Form a mask that identifies the trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd08 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvor Start Start) 12 | (bvxor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #x0000000000000001 26 | #xFFFFFFFFFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd08 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-21.sl: -------------------------------------------------------------------------------- 1 | ; Cycling through 3 values a, b, c. 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd21 ((x (BitVec 64)) (a (BitVec 64)) (b (BitVec 64)) (c (BitVec 64))) (BitVec 64) 6 | (ite (= x a) b (ite (= x b) c a))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (a (BitVec 64)) (b (BitVec 64)) (c (BitVec 64))) (BitVec 64) 9 | 10 | ((Start (BitVec 64) 11 | ((bvnot Start) 12 | (bvxor Start Start) 13 | (bvand Start Start) 14 | (bvor Start Start) 15 | (bvneg Start) 16 | (bvadd Start Start) 17 | (bvmul Start Start) 18 | (bvudiv Start Start) 19 | (bvurem Start Start) 20 | (bvlshr Start Start) 21 | (bvashr Start Start) 22 | (bvshl Start Start) 23 | (bvsdiv Start Start) 24 | (bvsrem Start Start) 25 | (bvsub Start Start) 26 | x 27 | a 28 | b 29 | c 30 | )) 31 | (StartBool Bool 32 | ((= Start Start))))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (declare-var a (BitVec 64)) 36 | (declare-var b (BitVec 64)) 37 | (declare-var c (BitVec 64)) 38 | 39 | (constraint (= (hd21 x a b c) (f x a b c))) 40 | (check-synth) 41 | 42 | -------------------------------------------------------------------------------- /testcases/string/36462127.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/36462127/populate-cell-in-excel-wtih-substring-of-another-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "ABCDE/FGHI/JKL/MNOPQR") "MNOPQR")) 34 | (constraint (= (f "A/ABCDE/FGHI/JKL") "JKL")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/extract-text-between-parentheses.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/extract-text-between-parentheses 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "<" ">" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Jones <60>") 60)) 34 | (constraint (= (f "Jones <57>") 57)) 35 | (constraint (= (f "Jones <55>") 55)) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/firstname_small.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "Nancy")) 27 | (constraint (= (f "Andrew Cencici") "Andrew")) 28 | (constraint (= (f "Jan Kotas") "Jan")) 29 | (constraint (= (f "Mariya Sergienko") "Mariya")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((name String)) String (str.substr name 0 (str.indexof name " " 0))) 33 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-17-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, difficulty 5 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 32))) (BitVec 32) (bvand (bvadd (bvor x (bvsub x #x00000001)) #x00000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000001F 26 | #x00000001 27 | #x00000000 28 | #xFFFFFFFF)))) 29 | 30 | (declare-var x (BitVec 32)) 31 | (constraint (= (hd17 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-13-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 13, difficulty 5 2 | ; sign function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd13 ((x (BitVec 64))) (BitVec 64) (bvor (bvashr x #x000000000000003F) (bvlshr (bvneg x) #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x000000000000003F 26 | #x0000000000000001 27 | #x0000000000000000 28 | #xFFFFFFFFFFFFFFFF)))) 29 | 30 | (declare-var x (BitVec 64)) 31 | (constraint (= (hd13 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-04-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 04, difficulty 5 2 | ; Form a bit mask that identifies the rightmost one bit and trailing zeros 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd04 ((x (BitVec 64))) (BitVec 64) (bvxor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #x0000000000000001 26 | #xFFFFFFFFFFFFFFFF 27 | x)))) 28 | 29 | (declare-var x (BitVec 64)) 30 | (constraint (= (hd04 x) (f x))) 31 | (check-synth) 32 | 33 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-26.sl: -------------------------------------------------------------------------------- 1 | ; Round up x to a multiple of k-th power of 2 2 | 3 | (set-logic BV) 4 | 5 | (define-fun hd26 ((x (BitVec 64)) (k (BitVec 64))) (BitVec 64) (bvand (bvsub (bvsub x (bvshl #xffffffffffffffff k)) #xffffffffffffffff) (bvshl #xffffffffffffffff k))) 6 | 7 | (synth-fun f ((x (BitVec 64)) (k (BitVec 64))) (BitVec 64) 8 | 9 | ((Start (BitVec 64) 10 | ((bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvudiv Start Start) 18 | (bvurem Start Start) 19 | (bvlshr Start Start) 20 | (bvashr Start Start) 21 | (bvshl Start Start) 22 | (bvsdiv Start Start) 23 | (bvsrem Start Start) 24 | (bvsub Start Start) 25 | #x0000000000000000 26 | #x0000000000000001 27 | #x000000000000001f 28 | #xffffffffffffffff 29 | x 30 | k 31 | )) 32 | 33 | (StartBool Bool 34 | ((= Start Start) 35 | )))) 36 | 37 | (declare-var x (BitVec 64)) 38 | (declare-var k (BitVec 64)) 39 | (constraint (= (hd26 x k) (f x k))) 40 | (check-synth) 41 | 42 | -------------------------------------------------------------------------------- /testcases/string/convert-text-to-numbers.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/convert-text-to-numbers 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "101") 101)) 34 | (constraint (= (f "1002") 1002)) 35 | (constraint (= (f "743") 743)) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) Int (str.to.int _arg_0)) 38 | -------------------------------------------------------------------------------- /testcases/string/lastname.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "FreeHafer")) 27 | (constraint (= (f "Andrew Cencici") "Cencici")) 28 | (constraint (= (f "Jan Kotas") "Kotas")) 29 | (constraint (= (f "Mariya Sergienko") "Sergienko")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((name String)) String (str.substr name (+ (str.indexof name " " 0) 1) (str.len name))) 33 | -------------------------------------------------------------------------------- /error_problem.sl: -------------------------------------------------------------------------------- 1 | (set-logic BV) 2 | (define-fun obfucated ( (x (BitVec 64)) (y (BitVec 64)) ) (BitVec 64) 3 | (bvadd (bvnot (bvmul #x0000000000000003 (bvxor x y))) (bvmul #x0000000000000003 (bvand y (bvnot x)))) 4 | ) 5 | 6 | (synth-fun deobfucated ( (x (BitVec 64)) (y (BitVec 64)) ) (BitVec 64) 7 | ( 8 | (Start (BitVec 64) 9 | ( 10 | (bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvsub Start Start) 18 | (bvsrem Start Start) 19 | (bvlshr Start Start) 20 | (bvsdiv Start Start) 21 | x y 22 | #x0000000000000000 #x0000000000000001 #x0000000000000002 #x0000000000000003 #x0000000000000004 #x0000000000000008 23 | ) 24 | ) 25 | ) 26 | ) 27 | 28 | (declare-var x (BitVec 64)) 29 | (declare-var y (BitVec 64)) 30 | 31 | (constraint (= (obfucated x y) (deobfucated x y))) 32 | (check-synth) -------------------------------------------------------------------------------- /testcases/string/17212077.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/17212077/stuck-substring-month-and-year-in-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "01/15/2013") "01/2013")) 34 | (constraint (= (f "03/07/2011") "03/2011")) 35 | (constraint (= (f "05/09/2009") "05/2009")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/count-total-words-in-a-cell.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/count-total-words-in-a-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "humpty dumpty") 2)) 34 | (constraint (= (f "humpty dumpty sat on a wall,") 6)) 35 | (constraint (= (f "couldnt put humpty together again.") 5)) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/get-last-word.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-last-word 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "focus on one thing at a time") "time")) 34 | (constraint (= (f "premature opt is the root of all evil") "evil")) 35 | (constraint (= (f "where is life") "life")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/convert-numbers-to-text.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/convert-numbers-to-text 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 Int)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | _arg_0 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f 101) "101")) 34 | (constraint (= (f 1002) "1002")) 35 | (constraint (= (f 743) "743")) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 Int)) String (int.to.str _arg_0)) 38 | -------------------------------------------------------------------------------- /testcases/string/lastname_small.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy FreeHafer") "FreeHafer")) 27 | (constraint (= (f "Andrew Cencici") "Cencici")) 28 | (constraint (= (f "Jan Kotas") "Kotas")) 29 | (constraint (= (f "Mariya Sergienko") "Sergienko")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((name String)) String (str.substr name (+ (str.indexof name " " 0) 1) (str.len name))) 33 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow9.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/38605460/find-the-second-space-and-copy-remaining-text-using-mid-and-search-in-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Sarah Jane Jones") "Jones")) 34 | (constraint (= (f "Bob Jane Smithfield") "Smithfield")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/strip-html-from-text-or-numbers.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/strip-html-from-text-or-numbers 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "<" ">" "b" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "0.66") "0.66")) 34 | (constraint (= (f "0.409") "0.409")) 35 | (constraint (= (f "0.7268") "0.7268")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-09-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 09, difficulty 5 2 | ; Absolute value function 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd09 ((x (BitVec 64))) (BitVec 64) (bvsub (bvxor x (bvashr x #x000000000000003F)) (bvashr x #x000000000000003F))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000001 25 | #x0000000000000000 26 | #x000000000000003F 27 | #xFFFFFFFFFFFFFFFF 28 | x)))) 29 | 30 | (declare-var x (BitVec 64)) 31 | (constraint (= (hd09 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow2.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/26262269/how-to-find-all-the-strings-in-a-cell-that-contains-a-given-substring-in-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "in" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "india china japan") "india china")) 34 | (constraint (= (f "indonesia korea") "indonesia")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-17-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 17, difficulty 5 2 | ; turn off the rightmost string of contiguous ones 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd17 ((x (BitVec 64))) (BitVec 64) (bvand (bvadd (bvor x (bvsub x #x0000000000000001)) #x0000000000000001) x)) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x000000000000003F 26 | #x0000000000000001 27 | #x0000000000000000 28 | #xFFFFFFFFFFFFFFFF)))) 29 | 30 | (declare-var x (BitVec 64)) 31 | (constraint (= (hd17 x) (f x))) 32 | (check-synth) 33 | 34 | -------------------------------------------------------------------------------- /testcases/string/get-last-name-from-name-with-comma.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-last-name-from-name-with-comma 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "," 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "chang,amy") "amy,chang")) 34 | (constraint (= (f "smith,bobby") "bobby,smith")) 35 | (constraint (= (f "lennox,aaron") "aaron,lennox")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/count-total-characters-in-a-cell.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/count-total-characters-in-a-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "The") 3)) 34 | (constraint (= (f "The quick fox") 13)) 35 | (constraint (= (f "The quick fox") 14)) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) Int (str.len _arg_0)) 38 | -------------------------------------------------------------------------------- /testcases/string/phone-1.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "242")) 27 | (constraint (= (f "308-916-545") "916")) 28 | (constraint (= (f "623-599-749") "599")) 29 | (constraint (= (f "981-424-843") "424")) 30 | (constraint (= (f "118-980-214") "980")) 31 | (constraint (= (f "244-655-094") "655")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 4 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/phone.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "938")) 27 | (constraint (= (f "308-916-545") "308")) 28 | (constraint (= (f "623-599-749") "623")) 29 | (constraint (= (f "981-424-843") "981")) 30 | (constraint (= (f "118-980-214") "118")) 31 | (constraint (= (f "244-655-094") "244")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 0 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/phone_short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "938")) 27 | (constraint (= (f "308-916-545") "308")) 28 | (constraint (= (f "623-599-749") "623")) 29 | (constraint (= (f "981-424-843") "981")) 30 | (constraint (= (f "118-980-214") "118")) 31 | (constraint (= (f "244-655-094") "244")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 0 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow4.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/2727679/substring-in-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "<" ">" "," "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "R/V<208,0,32>") "R/V 208 0 32")) 34 | (constraint (= (f "R/S<184,28,16>") "R/S 184 28 16")) 35 | (constraint (= (f "R/B<255,88,80>") "R/B 255 88 80")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/37281007.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/37281007/excel-test-if-proper-substring 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 String)) Bool 4 | ( (Start Bool (ntBool)) 5 | (ntString String ( 6 | _arg_0 _arg_1 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "ABC" "D") false)) 34 | (constraint (= (f "ABC" "BC") true)) 35 | (check-synth) 36 | (define-fun f_1 ((_arg_0 String) (_arg_1 String)) Bool (str.suffixof _arg_1 _arg_0)) 37 | -------------------------------------------------------------------------------- /testcases/string/phone-1_short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "242")) 27 | (constraint (= (f "308-916-545") "916")) 28 | (constraint (= (f "623-599-749") "599")) 29 | (constraint (= (f "981-424-843") "424")) 30 | (constraint (= (f "118-980-214") "980")) 31 | (constraint (= (f "244-655-094") "655")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 4 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/phone-2.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "504")) 27 | (constraint (= (f "308-916-545") "545")) 28 | (constraint (= (f "623-599-749") "749")) 29 | (constraint (= (f "981-424-843") "843")) 30 | (constraint (= (f "118-980-214") "214")) 31 | (constraint (= (f "244-655-094") "094")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name (+ 5 3) 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow8.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/31135150/excel-vba-how-to-extract-the-substring-if-we-know-the-positions-of-first-and-la 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 2 3 4 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "home/Excel/Sheet1.xls") "Sheet1.xls")) 34 | (constraint (= (f "home/user/Sheet1.xls") "Sheet1.xls")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-15-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, difficulty 5 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvsub (bvor x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | y 26 | #x0000001F 27 | #x00000001 28 | #x00000000 29 | #xFFFFFFFF)))) 30 | 31 | (declare-var x (BitVec 32)) 32 | (declare-var y (BitVec 32)) 33 | (constraint (= (hd15 x y) (f x y))) 34 | (check-synth) 35 | 36 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-01.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 01, difficulty 5 2 | ; Turn off the rightmost 1-bit in a bit-vector. 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd01 ((x (BitVec 64))) (BitVec 64) (bvand x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000000000000000 26 | #xffffffffffffffff 27 | #x0000000000000001 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd01 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/string/phone-2_short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "938-242-504") "504")) 27 | (constraint (= (f "308-916-545") "545")) 28 | (constraint (= (f "623-599-749") "749")) 29 | (constraint (= (f "981-424-843") "843")) 30 | (constraint (= (f "118-980-214") "214")) 31 | (constraint (= (f "244-655-094") "094")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name (+ 5 3) 3)) 35 | -------------------------------------------------------------------------------- /testcases/string/strip-non-numeric-characters.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/strip-non-numeric-characters 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "%" "%" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 1 2 3 4 5 6 7 8 9 0 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "100 apples") "100")) 34 | (constraint (= (f "the price is %500 dollars") "500")) 35 | (constraint (= (f "serial number %003399") "003399")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-14-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, difficulty 5 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) (bvadd (bvand x y) (bvlshr (bvxor x y) #x00000001))) 7 | 8 | (synth-fun f ((x (BitVec 32)) (y (BitVec 32))) (BitVec 32) 9 | ((Start (BitVec 32) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | y 26 | #x0000001F 27 | #x00000001 28 | #x00000000 29 | #xFFFFFFFF)))) 30 | 31 | (declare-var x (BitVec 32)) 32 | (declare-var y (BitVec 32)) 33 | (constraint (= (hd14 x y) (f x y))) 34 | (check-synth) 35 | 36 | -------------------------------------------------------------------------------- /testcases/string/19274448.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/19274448/how-to-find-if-a-cell-contains-a-substring-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Bool 4 | ( (Start Bool (ntBool)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "9999999" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "dhfjd9999999dfda") true)) 34 | (constraint (= (f "ddsss999dfdfsfd") false)) 35 | (check-synth) 36 | (define-fun f_1 ((_arg_0 String)) Bool (str.contains _arg_0 "9999999")) 37 | -------------------------------------------------------------------------------- /testcases/string/bikes.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Ducati100") "Ducati")) 27 | (constraint (= (f "Honda125") "Honda")) 28 | (constraint (= (f "Ducati250") "Ducati")) 29 | (constraint (= (f "Honda250") "Honda")) 30 | (constraint (= (f "Honda550") "Honda")) 31 | (constraint (= (f "Ducati125") "Ducati")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 0 (- (str.len name) 3))) 35 | -------------------------------------------------------------------------------- /testcases/string/clean-and-reformat-telephone-numbers.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/clean-and-reformat-telephone-numbers 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "," "-" "." "<" ">" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "801-456-8765") "8014568765")) 34 | (constraint (= (f "<978> 654-0299") "9786540299")) 35 | (constraint (= (f "978.654.0299") "9786540299")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/extract-word-containing-specific-text.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/extract-word-containing-specific-text 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "_" "." 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 1 2 3 4 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "send email to json_acme.com") "json_acme.com")) 34 | (constraint (= (f "contact help_robot.com for all support requests") "help_robot.com")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/phone-5.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "106")) 27 | (constraint (= (f "+83 973-757-831") "83")) 28 | (constraint (= (f "+62 647-787-775") "62")) 29 | (constraint (= (f "+172 027-507-632") "172")) 30 | (constraint (= (f "+72 001-050-856") "72")) 31 | (constraint (= (f "+95 310-537-401") "95")) 32 | (constraint (= (f "+6 775-969-238") "6")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/remove-text-by-matching.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/remove-text-by-matching 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "-" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "801-345-1987") "8013451987")) 34 | (constraint (= (f "612-554-2000") "6125542000")) 35 | (check-synth) 36 | (define-fun f_1 ((_arg_0 String)) String (str.replace (str.replace _arg_0 "-" "") "-" "")) 37 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow5.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/28616046/excel-substrings/28618923%28618923 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "0" "1" "4" "5" "9" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "valentine day=1915=50==7.1=45") "valentine day")) 34 | (constraint (= (f "movie blah=2blahblah, The=1914=54==7.9=17") "movie blah=2blahblah, The")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/strip-numeric-characters-from-cell.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/strip-numeric-characters-from-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 1 2 3 4 5 6 7 8 9 0 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "34653 jim mcdonald") " jim mcdonald")) 34 | (constraint (= (f "price is 500") " price is ")) 35 | (constraint (= (f "100 apples") " apples")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_3_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_7 Bool) (i_9 Bool) (i_3 Bool) ) Bool 6 | (and (and (not (and (not i_9) i_3)) i_7) (not (and i_9 (not i_3)))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_7 Bool) (i_9 Bool) (i_3 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_7 i_9 i_3 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_7 Bool) 45 | (declare-var i_9 Bool) 46 | (declare-var i_3 Bool) 47 | 48 | (constraint (= (origCir i_7 i_9 i_3 ) (skel i_7 i_9 i_3 ))) 49 | (check-synth) 50 | -------------------------------------------------------------------------------- /testcases/string/get-middle-name-from-full-name.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-middle-name-from-full-name 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "susan ann chang") "ann")) 34 | (constraint (= (f "ayako tanaka") "")) 35 | (constraint (= (f "bobby t. smith") "t.")) 36 | (constraint (= (f "anthory r. tom brown") "r. tom")) 37 | (check-synth) 38 | -------------------------------------------------------------------------------- /testcases/string/phone-5-short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "106")) 27 | (constraint (= (f "+83 973-757-831") "83")) 28 | (constraint (= (f "+62 647-787-775") "62")) 29 | (constraint (= (f "+172 027-507-632") "172")) 30 | (constraint (= (f "+72 001-050-856") "72")) 31 | (constraint (= (f "+95 310-537-401") "95")) 32 | (constraint (= (f "+6 775-969-238") "6")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/phone-6.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "769")) 27 | (constraint (= (f "+83 973-757-831") "973")) 28 | (constraint (= (f "+62 647-787-775") "647")) 29 | (constraint (= (f "+172 027-507-632") "027")) 30 | (constraint (= (f "+72 001-050-856") "001")) 31 | (constraint (= (f "+95 310-537-401") "310")) 32 | (constraint (= (f "+6 775-969-238") "775")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/phone-7.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "858")) 27 | (constraint (= (f "+83 973-757-831") "757")) 28 | (constraint (= (f "+62 647-787-775") "787")) 29 | (constraint (= (f "+172 027-507-632") "507")) 30 | (constraint (= (f "+72 001-050-856") "050")) 31 | (constraint (= (f "+95 310-537-401") "537")) 32 | (constraint (= (f "+6 775-969-238") "969")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow1.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/11891093/excel-function-to-replace-substring 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "Inc" "." "," "LLC" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Trucking Inc.") "Trucking")) 34 | (constraint (= (f "New Truck Inc") "New Truck")) 35 | (constraint (= (f "ABV Trucking Inc, LLC") "ABV Trucking")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow7.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/29935088/how-to-remove-substring-that-is-in-another-column-in-excel 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 _arg_1 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Item 1 AQ-S810W-2AVDF" "AQ-S810W-2AVDF") "Item 1")) 34 | (constraint (= (f "Item 2 AQ-230A-1DUQ" "AQ-230A") "Item 2 -1DUQ")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/bikes_small.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Ducati100") "Ducati")) 27 | (constraint (= (f "Honda125") "Honda")) 28 | (constraint (= (f "Ducati250") "Ducati")) 29 | (constraint (= (f "Honda250") "Honda")) 30 | (constraint (= (f "Honda550") "Honda")) 31 | (constraint (= (f "Ducati125") "Ducati")) 32 | 33 | (check-synth) 34 | (define-fun f_1 ((name String)) String (str.substr name 0 (- (str.len name) 3))) 35 | -------------------------------------------------------------------------------- /testcases/string/exceljet3.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/remove-text-by-variable-position 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "=" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "year= 2016") "2016")) 34 | (constraint (= (f "make= subaru") "subaru")) 35 | (constraint (= (f "model= outback wagon") "outback wagon")) 36 | (constraint (= (f "fuel economy= 25/33") "25/33")) 37 | (check-synth) 38 | -------------------------------------------------------------------------------- /testcases/string/phone-6-short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "769")) 27 | (constraint (= (f "+83 973-757-831") "973")) 28 | (constraint (= (f "+62 647-787-775") "647")) 29 | (constraint (= (f "+172 027-507-632") "027")) 30 | (constraint (= (f "+72 001-050-856") "001")) 31 | (constraint (= (f "+95 310-537-401") "310")) 32 | (constraint (= (f "+6 775-969-238") "775")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/phone-7-short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "+" "-" "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 3 4 5 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "+106 769-858-438") "858")) 27 | (constraint (= (f "+83 973-757-831") "757")) 28 | (constraint (= (f "+62 647-787-775") "787")) 29 | (constraint (= (f "+172 027-507-632") "507")) 30 | (constraint (= (f "+72 001-050-856") "050")) 31 | (constraint (= (f "+95 310-537-401") "537")) 32 | (constraint (= (f "+6 775-969-238") "969")) 33 | 34 | (check-synth) 35 | -------------------------------------------------------------------------------- /testcases/string/remove-text-by-position.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/remove-text-by-position 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "c=/users/dave/shotcut.xls") "shotcut.xls")) 34 | (constraint (= (f "c=/users/dave/formulas.xls") "formulas.xls")) 35 | (constraint (= (f "c=/users/dave/pivot table.xls") "pivot table.xls")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_116_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_9 Bool) (i_8 Bool) (i_7 Bool) ) Bool 6 | (and (and (not (and i_8 (not i_7))) (not i_9)) (not (and (not i_8) i_7))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_9 Bool) (i_8 Bool) (i_7 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_9 i_8 i_7 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_9 Bool) 45 | (declare-var i_8 Bool) 46 | (declare-var i_7 Bool) 47 | 48 | (constraint (= (origCir i_9 i_8 i_7 ) (skel i_9 i_8 i_7 ))) 49 | (check-synth) 50 | -------------------------------------------------------------------------------- /testcases/string/get-first-word.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-first-word 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "The quick brown fox.") "The")) 34 | (constraint (= (f "quick brown fox.") "quick")) 35 | (constraint (= (f "fox") "")) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) String (str.substr _arg_0 0 (str.indexof _arg_0 " " 1))) 38 | -------------------------------------------------------------------------------- /testcases/string/stackoverflow6.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/28627624/excel-single-cell-to-multiple-rows-and-get-substring 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "=" "-" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Dec 2, 2014, 11=23 PM - +91 90000 80000= loren ipsum") "loren ipsum")) 34 | (constraint (= (f "Dec 2, 2014, 11=24 PM - +91 90000 80000= loren") "loren")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/38871714.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/38871714/excel-vba-how-to-remove-substrings-from-a-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "<" ">" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "This is a , It should be to number.") "This is a string, It should be changed to a number.")) 34 | (constraint (= (f "a < 4 and a > 0") "a 4 and a 0")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/get-domain-name-from-url.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-domain-name-from-url 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 0 -1 1 2 3 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "https=//abc.com/def") "https=//abc.com/")) 34 | (constraint (= (f "http=//www.abc.com/def/cef") "http=//www.abc.com")) 35 | (constraint (= (f "http=//chandoo.org/wp/def-def") "http=//chandoo.org/")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/join-first-and-last-name.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/join-first-and-last-name 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 _arg_1 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "susan" "chang") "susan chang")) 34 | (constraint (= (f "aaron" "kim") "aaron kim")) 35 | (check-synth) 36 | (define-fun f_1 ((_arg_0 String) (_arg_1 String)) String (str.++ (str.++ _arg_0 " ") _arg_1)) 37 | -------------------------------------------------------------------------------- /testcases/sygus2018-hd/hd-20-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, difficulty 5 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 32))) (BitVec 32) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x00000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 32))) (BitVec 32) 10 | ((Start (BitVec 32) ((bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvudiv Start Start) 18 | (bvurem Start Start) 19 | (bvlshr Start Start) 20 | (bvashr Start Start) 21 | (bvshl Start Start) 22 | (bvsdiv Start Start) 23 | (bvsrem Start Start) 24 | (bvsub Start Start) 25 | x 26 | #x0000001F 27 | #x00000001 28 | #x00000000 29 | #xFFFFFFFF)))) 30 | 31 | 32 | 33 | (declare-var x (BitVec 32)) 34 | 35 | (constraint (= (hd20 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-14-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 14, difficulty 5 2 | ; floor of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd14 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvadd (bvand x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | y 26 | #x000000000000003F 27 | #x0000000000000001 28 | #x0000000000000000 29 | #xFFFFFFFFFFFFFFFF)))) 30 | 31 | (declare-var x (BitVec 64)) 32 | (declare-var y (BitVec 64)) 33 | (constraint (= (hd14 x y) (f x y))) 34 | (check-synth) 35 | 36 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-15-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 15, difficulty 5 2 | ; ceil of average of two integers 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd15 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (bvsub (bvor x y) (bvlshr (bvxor x y) #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | y 26 | #x000000000000003F 27 | #x0000000000000001 28 | #x0000000000000000 29 | #xFFFFFFFFFFFFFFFF)))) 30 | 31 | (declare-var x (BitVec 64)) 32 | (declare-var y (BitVec 64)) 33 | (constraint (= (hd15 x y) (f x y))) 34 | (check-synth) 35 | 36 | -------------------------------------------------------------------------------- /testcases/string/39060015.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/39060015/excel-vba-how-to-remove-substrings-from-a-cell-with-same-beginning-and-ending 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "This is a line. /delete words in the area /keep this part") "This is a line. keep this part")) 34 | (constraint (= (f "/delete words in the area /") "")) 35 | (check-synth) 36 | -------------------------------------------------------------------------------- /testcases/string/replace-one-character-with-another.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/replace-one-character-with-another 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "-" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "801 456 8756") "801-456-8756")) 34 | (constraint (= (f "978 456 8756") "978-456-8756")) 35 | (check-synth) 36 | (define-fun f_1 ((_arg_0 String)) String (str.replace (str.replace _arg_0 " " "-") " " "-")) 37 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-03.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 03, difficulty 5 2 | ; Isolate the right most one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd03 ((x (BitVec 64))) (BitVec 64) (bvand x (bvneg x))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000001 25 | #x0000000000000000 26 | #xffffffffffffffff 27 | x 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd03 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/string/find-nth-occurrence-of-character.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/find-nth-occurrence-of-character 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 Int)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "_" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | _arg_1 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "replies to _aya, _tasisuke, and _chan" 1) 12)) 34 | (constraint (= (f "replies to _aya, _tasisuke, and _chan" 2) 18)) 35 | (constraint (= (f "replies to _aya, _tasisuke, and _chan" 3) 33)) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/get-first-name-from-name-with-comma.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-first-name-from-name-with-comma 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 Int)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "," 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | _arg_1 17 | 1 0 -1 1 2 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Chang,Amy" 1) "Amy")) 34 | (constraint (= (f "Chang,Amy" 2) "Chang")) 35 | (constraint (= (f "smith,bobby" 2) "smith")) 36 | (constraint (= (f "smith,bobby" 1) "bobby")) 37 | (check-synth) 38 | -------------------------------------------------------------------------------- /testcases/string/get-last-name-from-name.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-last-name-from-name 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Park Kim") "Kim")) 34 | (constraint (= (f "Lee Kim") "Kim")) 35 | (constraint (= (f "Kim Lee") "Lee")) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) String (str.substr _arg_0 (+ (str.indexof _arg_0 " " 1) 1) (str.len _arg_0))) 38 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_54_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_9 Bool) ) Bool 6 | (and (and (and i_8 i_6) i_7) (not i_9)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_9 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_7 i_8 i_6 i_9 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_7 Bool) 45 | (declare-var i_8 Bool) 46 | (declare-var i_6 Bool) 47 | (declare-var i_9 Bool) 48 | 49 | (constraint (= (origCir i_7 i_8 i_6 i_9 ) (skel i_7 i_8 i_6 i_9 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/string/31753108.sl: -------------------------------------------------------------------------------- 1 | ; https=//stackoverflow.com/questions/31753108/how-to-pull-keywords-from-an-excel-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 1 2 3 4 5 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Tire Pressure ABC123873 Monitor") "ABC123873")) 34 | (constraint (= (f " Oil Life ABC849999999021 gauge") "ABC849999999021")) 35 | (constraint (= (f " Air conditioner GHF211 maintenance") "GHF211")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/string/get-first-name-from-name.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/get-first-name-from-name 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "Susan Ann Chang") "Susan")) 34 | (constraint (= (f "Ayako Tanaka") "Ayako")) 35 | (constraint (= (f "Bobby T. smth") "Bobby")) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) String (str.substr _arg_0 0 (str.indexof _arg_0 " " 1))) 38 | -------------------------------------------------------------------------------- /testcases/string/name-combine-2.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((firstname String) (lastname String)) String 3 | ((Start String (ntString)) 4 | (ntString String (firstname lastname " " "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy" "FreeHafer") "Nancy F.")) 27 | (constraint (= (f "Andrew" "Cencici") "Andrew C.")) 28 | (constraint (= (f "Jan" "Kotas") "Jan K.")) 29 | (constraint (= (f "Mariya" "Sergienko") "Mariya S.")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((firstname String) (lastname String)) String (str.++ (str.++ (str.++ firstname " ") (str.at lastname 0)) ".")) 33 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd01.eqn_sygus_iter_10_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i18 Bool) (i17 Bool) (i16 Bool) (i19 Bool) ) Bool 6 | (and (and (and (not i17) (not i16)) (not i18)) (not i19)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i18 Bool) (i17 Bool) (i16 Bool) (i19 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i18 i17 i16 i19 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i18 Bool) 45 | (declare-var i17 Bool) 46 | (declare-var i16 Bool) 47 | (declare-var i19 Bool) 48 | 49 | (constraint (= (origCir i18 i17 i16 i19 ) (skel i18 i17 i16 i19 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd09.eqn_sygus_iter_55_3.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i23 Bool) (i22 Bool) (i21 Bool) (i20 Bool) ) Bool 6 | (and (and (and (not i22) (not i21)) (not i23)) (not i20)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i23 Bool) (i22 Bool) (i21 Bool) (i20 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i23 i22 i21 i20 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i23 Bool) 45 | (declare-var i22 Bool) 46 | (declare-var i21 Bool) 47 | (declare-var i20 Bool) 48 | 49 | (constraint (= (origCir i23 i22 i21 i20 ) (skel i23 i22 i21 i20 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_32_3.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_4 Bool) (i_7 Bool) (i_5 Bool) (i_8 Bool) ) Bool 6 | (and (not (and (and (not i_7) i_5) i_4)) i_8) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_4 Bool) (i_7 Bool) (i_5 Bool) (i_8 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_4 i_7 i_5 i_8 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_4 Bool) 45 | (declare-var i_7 Bool) 46 | (declare-var i_5 Bool) 47 | (declare-var i_8 Bool) 48 | 49 | (constraint (= (origCir i_4 i_7 i_5 i_8 ) (skel i_4 i_7 i_5 i_8 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_85_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_4 Bool) ) Bool 6 | (and (not (and (and i_8 i_6) i_7)) (not i_4)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_4 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_7 i_8 i_6 i_4 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_7 Bool) 45 | (declare-var i_8 Bool) 46 | (declare-var i_6 Bool) 47 | (declare-var i_4 Bool) 48 | 49 | (constraint (= (origCir i_7 i_8 i_6 i_4 ) (skel i_7 i_8 i_6 i_4 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p03.eqn_sygus_iter_24_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i26 Bool) (i25 Bool) (i24 Bool) (i27 Bool) ) Bool 6 | (and (and (and (not i25) (not i24)) (not i26)) (not i27)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i26 Bool) (i25 Bool) (i24 Bool) (i27 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i26 i25 i24 i27 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i26 Bool) 45 | (declare-var i25 Bool) 46 | (declare-var i24 Bool) 47 | (declare-var i27 Bool) 48 | 49 | (constraint (= (origCir i26 i25 i24 i27 ) (skel i26 i25 i24 i27 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p03.eqn_sygus_iter_38_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i22 Bool) (i21 Bool) (i20 Bool) (i23 Bool) ) Bool 6 | (and (and (and (not i21) (not i20)) (not i22)) (not i23)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i22 Bool) (i21 Bool) (i20 Bool) (i23 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i22 i21 i20 i23 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i22 Bool) 45 | (declare-var i21 Bool) 46 | (declare-var i20 Bool) 47 | (declare-var i23 Bool) 48 | 49 | (constraint (= (origCir i22 i21 i20 i23 ) (skel i22 i21 i20 i23 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p03.eqn_sygus_iter_52_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i18 Bool) (i17 Bool) (i16 Bool) (i19 Bool) ) Bool 6 | (and (and (and (not i17) (not i16)) (not i18)) (not i19)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i18 Bool) (i17 Bool) (i16 Bool) (i19 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i18 i17 i16 i19 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i18 Bool) 45 | (declare-var i17 Bool) 46 | (declare-var i16 Bool) 47 | (declare-var i19 Bool) 48 | 49 | (constraint (= (origCir i18 i17 i16 i19 ) (skel i18 i17 i16 i19 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/string/name-combine-2_short.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((firstname String) (lastname String)) String 3 | ((Start String (ntString)) 4 | (ntString String (firstname lastname " " "." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (ite ntBool ntString ntString) 10 | (str.substr ntString ntInt ntInt) 11 | )) 12 | (ntInt Int (0 1 2 13 | (+ ntInt ntInt) 14 | (- ntInt ntInt) 15 | (str.len ntString) 16 | (str.to.int ntString) 17 | (str.indexof ntString ntString ntInt) 18 | )) 19 | (ntBool Bool (true false 20 | (= ntInt ntInt) 21 | (str.prefixof ntString ntString) 22 | (str.suffixof ntString ntString) 23 | (str.contains ntString ntString) 24 | )) 25 | )) 26 | (constraint (= (f "Nancy" "FreeHafer") "Nancy F.")) 27 | (constraint (= (f "Andrew" "Cencici") "Andrew C.")) 28 | (constraint (= (f "Jan" "Kotas") "Jan K.")) 29 | (constraint (= (f "Mariya" "Sergienko") "Mariya S.")) 30 | 31 | (check-synth) 32 | (define-fun f_1 ((firstname String) (lastname String)) String (str.++ (str.++ (str.++ firstname " ") (str.at lastname 0)) ".")) 33 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/p19.eqn_sygus_iter_163_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i4 Bool) (i7 Bool) (i6 Bool) (i5 Bool) ) Bool 6 | (and (and (not (and (not i7) i6)) (not (and (not i5) i4))) (not (and (not i6) i5))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i4 Bool) (i7 Bool) (i6 Bool) (i5 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i4 i7 i6 i5 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i4 Bool) 45 | (declare-var i7 Bool) 46 | (declare-var i6 Bool) 47 | (declare-var i5 Bool) 48 | 49 | (constraint (= (origCir i4 i7 i6 i5 ) (skel i4 i7 i6 i5 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-06.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 06, difficulty 5 2 | ; Turn on the right most 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd06 ((x (BitVec 64))) (BitVec 64) (bvor x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #xffffffffffffffff 26 | #x0000000000000001 27 | x 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd06 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/string/count-line-breaks-in-cell.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/count-line-breaks-in-cell 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) Int 4 | ( (Start Int (ntInt)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "/n" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 0 1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "one") 1)) 34 | (constraint (= (f "one/ntwo") 2)) 35 | (constraint (= (f "one/ntwo/nthree") 3)) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String)) Int (str.len (str.++ (int.to.str (str.indexof _arg_0 "/n" 1)) (int.to.str (str.len _arg_0))))) 38 | -------------------------------------------------------------------------------- /testcases/string/remove-characters-from-left.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/remove-characters-from-left 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String) (_arg_1 Int)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | _arg_1 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "1234" 1) "234")) 34 | (constraint (= (f "**512A" 2) "512A")) 35 | (constraint (= (f "343DMX" 3) "DMX")) 36 | (check-synth) 37 | (define-fun f_1 ((_arg_0 String) (_arg_1 Int)) String (str.substr _arg_0 _arg_1 (str.len _arg_0))) 38 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_88_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_4 Bool) (i_8 Bool) (i_7 Bool) (i_6 Bool) ) Bool 6 | (and (xor (and (and i_6 i_8) i_7) i_4) (and i_7 i_6)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_4 Bool) (i_8 Bool) (i_7 Bool) (i_6 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_4 i_8 i_7 i_6 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_4 Bool) 45 | (declare-var i_8 Bool) 46 | (declare-var i_7 Bool) 47 | (declare-var i_6 Bool) 48 | 49 | (constraint (= (origCir i_4 i_8 i_7 i_6 ) (skel i_4 i_8 i_7 i_6 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-27.sl: -------------------------------------------------------------------------------- 1 | (set-logic BV) 2 | 3 | (define-fun hd27 ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) (ite (bvslt x y) x y)) 4 | 5 | (synth-fun f ((x (BitVec 64)) (y (BitVec 64))) (BitVec 64) 6 | ((Start (BitVec 64) (x y 7 | (bvnot Start) 8 | (bvxor Start Start) 9 | (bvand Start Start) 10 | (bvor Start Start) 11 | (bvneg Start) 12 | (bvadd Start Start) 13 | (bvmul Start Start) 14 | (bvudiv Start Start) 15 | (bvurem Start Start) 16 | (bvlshr Start Start) 17 | (bvashr Start Start) 18 | (bvshl Start Start) 19 | (bvsdiv Start Start) 20 | (bvsrem Start Start) 21 | (bvsub Start Start) 22 | )) 23 | 24 | (StartBool Bool 25 | ((= Start Start) 26 | (bvslt Start Start) 27 | (bvule Start Start) 28 | (bvult Start Start) 29 | (bvsle Start Start) 30 | (bvugt Start Start) 31 | )))) 32 | 33 | (declare-var x (BitVec 64)) 34 | (declare-var y (BitVec 64)) 35 | (constraint (= (hd27 x y) (f x y))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/string/dr-name.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "." "Dr." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (str.substr ntString ntInt ntInt) 10 | )) 11 | (ntInt Int (0 1 2 12 | (+ ntInt ntInt) 13 | (- ntInt ntInt) 14 | (str.len ntString) 15 | (str.to.int ntString) 16 | (str.indexof ntString ntString ntInt) 17 | )) 18 | (ntBool Bool (true false 19 | (= ntInt ntInt) 20 | (str.prefixof ntString ntString) 21 | (str.suffixof ntString ntString) 22 | (str.contains ntString ntString) 23 | )) 24 | )) 25 | (constraint (= (f "Nancy FreeHafer") "Dr. Nancy")) 26 | (constraint (= (f "Andrew Cencici") "Dr. Andrew")) 27 | (constraint (= (f "Jan Kotas") "Dr. Jan")) 28 | (constraint (= (f "Mariya Sergienko") "Dr. Mariya")) 29 | 30 | (check-synth) 31 | (define-fun f_1 ((name String)) String (str.++ (str.substr "Dr." 0 2) (str.++ "." (str.++ " " (str.substr name 0 (str.indexof name " " 0)))))) 32 | -------------------------------------------------------------------------------- /testcases/string/extract-word-that-begins-with-specific-character.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/extract-word-that-begins-with-specific-character 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "_" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 1 2 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "this is a _username in the middle") "_username")) 34 | (constraint (= (f "twitter names look like= _name") "_name")) 35 | (constraint (= (f "with two _name1 and _name2") "_name1")) 36 | (check-synth) 37 | -------------------------------------------------------------------------------- /testcases/bitvec/hd/hd-20-d5-prog.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 20, difficulty 5 2 | ; next higher unsigned number with same number of 1 bits 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd20 ((x (BitVec 64))) (BitVec 64) 7 | (bvor (bvadd x (bvand (bvneg x) x)) (bvudiv (bvlshr (bvxor x (bvand (bvneg x) x)) #x0000000000000002) (bvand (bvneg x) x)))) 8 | 9 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 10 | ((Start (BitVec 64) ((bvnot Start) 11 | (bvxor Start Start) 12 | (bvand Start Start) 13 | (bvor Start Start) 14 | (bvneg Start) 15 | (bvadd Start Start) 16 | (bvmul Start Start) 17 | (bvudiv Start Start) 18 | (bvurem Start Start) 19 | (bvlshr Start Start) 20 | (bvashr Start Start) 21 | (bvshl Start Start) 22 | (bvsdiv Start Start) 23 | (bvsrem Start Start) 24 | (bvsub Start Start) 25 | x 26 | #x000000000000003F 27 | #x0000000000000001 28 | #x0000000000000000 29 | #xFFFFFFFFFFFFFFFF)))) 30 | 31 | 32 | 33 | (declare-var x (BitVec 64)) 34 | 35 | (constraint (= (hd20 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_162_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_9 Bool) (i_7 Bool) (i_6 Bool) (i_8 Bool) ) Bool 6 | (and (not (and (not (and i_7 (not i_6))) (not i_9))) i_8) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_9 Bool) (i_7 Bool) (i_6 Bool) (i_8 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_9 i_7 i_6 i_8 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_9 Bool) 45 | (declare-var i_7 Bool) 46 | (declare-var i_6 Bool) 47 | (declare-var i_8 Bool) 48 | 49 | (constraint (= (origCir i_9 i_7 i_6 i_8 ) (skel i_9 i_7 i_6 i_8 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-05.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 05, difficulty 5 2 | ; Right propagate the rightmost one bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd05 ((x (BitVec 64))) (BitVec 64) (bvor x (bvsub x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000001 25 | #x0000000000000000 26 | #xffffffffffffffff 27 | x 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd05 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-07.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 07, difficulty 5 2 | ; Isolate the rightmost 0 bit 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd07 ((x (BitVec 64))) (BitVec 64) (bvand (bvnot x) (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvand Start Start) 11 | (bvxor Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | #x0000000000000000 25 | #x0000000000000001 26 | #xffffffffffffffff 27 | x 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd07 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/string/change-negative-numbers-to-positive.sl: -------------------------------------------------------------------------------- 1 | ; https=//exceljet.net/formula/change-negative-numbers-to-positive 2 | (set-logic SLIA) 3 | (synth-fun f ((_arg_0 String)) String 4 | ( (Start String (ntString)) 5 | (ntString String ( 6 | _arg_0 7 | "" " " "-" 8 | (str.++ ntString ntString) 9 | (str.replace ntString ntString ntString) 10 | (str.at ntString ntInt) 11 | (int.to.str ntInt) 12 | (ite ntBool ntString ntString) 13 | (str.substr ntString ntInt ntInt) 14 | )) 15 | (ntInt Int ( 16 | 17 | 1 0 -1 18 | (+ ntInt ntInt) 19 | (- ntInt ntInt) 20 | (str.len ntString) 21 | (str.to.int ntString) 22 | (ite ntBool ntInt ntInt) 23 | (str.indexof ntString ntString ntInt) 24 | )) 25 | (ntBool Bool ( 26 | 27 | true false 28 | (= ntInt ntInt) 29 | (str.prefixof ntString ntString) 30 | (str.suffixof ntString ntString) 31 | (str.contains ntString ntString) 32 | )) )) 33 | (constraint (= (f "-%134") "%134")) 34 | (constraint (= (f "500") "500")) 35 | (constraint (= (f "5.125") "5.125")) 36 | (constraint (= (f "-%43.00") "%43.00")) 37 | (check-synth) 38 | (define-fun f_1 ((_arg_0 String)) String (str.replace _arg_0 "-" "")) 39 | -------------------------------------------------------------------------------- /testcases/string/dr-name_small.sl: -------------------------------------------------------------------------------- 1 | (set-logic SLIA) 2 | (synth-fun f ((name String)) String 3 | ((Start String (ntString)) 4 | (ntString String (name " " "." "Dr." 5 | (str.++ ntString ntString) 6 | (str.replace ntString ntString ntString) 7 | (str.at ntString ntInt) 8 | (int.to.str ntInt) 9 | (str.substr ntString ntInt ntInt) 10 | )) 11 | (ntInt Int (0 1 2 12 | (+ ntInt ntInt) 13 | (- ntInt ntInt) 14 | (str.len ntString) 15 | (str.to.int ntString) 16 | (str.indexof ntString ntString ntInt) 17 | )) 18 | (ntBool Bool (true false 19 | (= ntInt ntInt) 20 | (str.prefixof ntString ntString) 21 | (str.suffixof ntString ntString) 22 | (str.contains ntString ntString) 23 | )) 24 | )) 25 | (constraint (= (f "Nancy FreeHafer") "Dr. Nancy")) 26 | (constraint (= (f "Andrew Cencici") "Dr. Andrew")) 27 | (constraint (= (f "Jan Kotas") "Dr. Jan")) 28 | (constraint (= (f "Mariya Sergienko") "Dr. Mariya")) 29 | 30 | (check-synth) 31 | (define-fun f_1 ((name String)) String (str.++ (str.substr "Dr." 0 2) (str.++ "." (str.++ " " (str.substr name 0 (str.indexof name " " 0)))))) 32 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_17_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_8 Bool) (i_9 Bool) (i_7 Bool) (i_4 Bool) ) Bool 6 | (and (not (and (not (and i_9 i_7)) i_8)) (not (and i_7 i_4))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_8 Bool) (i_9 Bool) (i_7 Bool) (i_4 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_8 i_9 i_7 i_4 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_8 Bool) 45 | (declare-var i_9 Bool) 46 | (declare-var i_7 Bool) 47 | (declare-var i_4 Bool) 48 | 49 | (constraint (= (origCir i_8 i_9 i_7 i_4 ) (skel i_8 i_9 i_7 i_4 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_63_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_3 Bool) (i_7 Bool) (i_6 Bool) (i_2 Bool) ) Bool 6 | (and (and (not (and (not i_7) i_6)) i_3) (xor i_6 (not i_2))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_3 Bool) (i_7 Bool) (i_6 Bool) (i_2 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_3 i_7 i_6 i_2 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_3 Bool) 45 | (declare-var i_7 Bool) 46 | (declare-var i_6 Bool) 47 | (declare-var i_2 Bool) 48 | 49 | (constraint (= (origCir i_3 i_7 i_6 i_2 ) (skel i_3 i_7 i_6 i_2 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/longest_1bit-opt.eqn_sygus_iter_97_1.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_5 Bool) ) Bool 6 | (and (not (and (and (not i_8) i_6) i_7)) (not (and i_6 i_5))) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_7 Bool) (i_8 Bool) (i_6 Bool) (i_5 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_7 i_8 i_6 i_5 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_7 Bool) 45 | (declare-var i_8 Bool) 46 | (declare-var i_6 Bool) 47 | (declare-var i_5 Bool) 48 | 49 | (constraint (= (origCir i_7 i_8 i_6 i_5 ) (skel i_7 i_8 i_6 i_5 ))) 50 | (check-synth) 51 | -------------------------------------------------------------------------------- /testcases/hackers-delight/hd-02.sl: -------------------------------------------------------------------------------- 1 | ; Hacker's delight 02, difficulty 5 2 | ; Test if unsigned int is of form 2^n - 1 3 | 4 | (set-logic BV) 5 | 6 | (define-fun hd02 ((x (BitVec 64))) (BitVec 64) (bvand x (bvadd x #x0000000000000001))) 7 | 8 | (synth-fun f ((x (BitVec 64))) (BitVec 64) 9 | ((Start (BitVec 64) ((bvnot Start) 10 | (bvxor Start Start) 11 | (bvand Start Start) 12 | (bvor Start Start) 13 | (bvneg Start) 14 | (bvadd Start Start) 15 | (bvmul Start Start) 16 | (bvudiv Start Start) 17 | (bvurem Start Start) 18 | (bvlshr Start Start) 19 | (bvashr Start Start) 20 | (bvshl Start Start) 21 | (bvsdiv Start Start) 22 | (bvsrem Start Start) 23 | (bvsub Start Start) 24 | x 25 | #x0000000000000000 26 | #xffffffffffffffff 27 | #x0000000000000001 28 | )) 29 | 30 | (StartBool Bool 31 | ((= Start Start) 32 | )))) 33 | 34 | (declare-var x (BitVec 64)) 35 | (constraint (= (hd02 x) (f x))) 36 | (check-synth) 37 | 38 | -------------------------------------------------------------------------------- /testcases/circuit/lobster/hd11.eqn_sygus_iter_2_2.sl: -------------------------------------------------------------------------------- 1 | 2 | 3 | (set-logic BV) 4 | 5 | (define-fun origCir ((i_14 Bool) (i_15 Bool) (i_13 Bool) (i_12 Bool) ) Bool 6 | (and (and (and i_14 i_13) (and i_15 i_14)) (and i_13 i_12)) 7 | ) 8 | 9 | 10 | (synth-fun skel ((i_14 Bool) (i_15 Bool) (i_13 Bool) (i_12 Bool) ) Bool ( 11 | (Start Bool (depth2) ) 12 | 13 | (depth2 Bool ( 14 | (and depth1 depth1) 15 | (or depth1 depth1) 16 | (xor depth2 depth2) 17 | (not depth2) 18 | depth1 19 | 20 | ) 21 | ) 22 | 23 | (depth1 Bool ( 24 | (and depth0 depth0) 25 | (or depth0 depth0) 26 | (xor depth1 depth1) 27 | (not depth1) 28 | depth0 29 | 30 | ) 31 | ) 32 | 33 | (depth0 Bool ( 34 | true 35 | false 36 | (xor depth0 depth0) 37 | (not depth0) 38 | i_14 i_15 i_13 i_12 39 | ) 40 | ) 41 | 42 | ) 43 | ) 44 | (declare-var i_14 Bool) 45 | (declare-var i_15 Bool) 46 | (declare-var i_13 Bool) 47 | (declare-var i_12 Bool) 48 | 49 | (constraint (= (origCir i_14 i_15 i_13 i_12 ) (skel i_14 i_15 i_13 i_12 ))) 50 | (check-synth) 51 | --------------------------------------------------------------------------------