1#!/bin/bash
2
3cvc4=./cvc4
4bench="$1"
5
6logic=$(expr "$(grep -m1 '^[^;]*set-logic' "$bench")" : ' *(set-logic  *\([A-Z_]*\) *) *$')
7
8# use: trywith [params..]
9# to attempt a run.  Only thing printed on stdout is "sat" or "unsat", in which
10# case this run script terminates immediately.  Otherwise, this function
11# returns normally and prints the output of the solver to stderr.
12function trywith {
13  limit=$1; shift;
14  result="$(ulimit -S -t "$limit";$cvc4 -L smt2.6 --no-incremental --no-checking --no-interactive "$@" $bench)"
15  case "$result" in
16    sat|unsat) echo "$result"; exit 0;;
17    *)         echo "$result" >&2;;
18  esac
19}
20
21# use: finishwith [params..]
22# to run cvc4 and let it output whatever it will to stdout.
23function finishwith {
24  $cvc4 -L smt2.6 --no-incremental --no-checking --no-interactive "$@" $bench
25}
26
27case "$logic" in
28
29QF_LRA)
30  trywith 200 --miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi
31  finishwith --no-restrict-pivots --use-soi --new-prop --unconstrained-simp
32  ;;
33QF_LIA)
34  # same as QF_LRA but add --pb-rewrites
35  finishwith --miplib-trick --miplib-trick-subs=4 --use-approx --lemmas-on-replay-failure --replay-early-close-depth=4 --replay-lemma-reject-cut=128 --replay-reject-cut=512 --unconstrained-simp --use-soi --pb-rewrites
36  ;;
37QF_NIA)
38  trywith 300 --nl-ext-tplanes --decision=internal
39  trywith 30 --no-nl-ext-tplanes --decision=internal
40  # this totals up to more than 20 minutes, although notice that smaller bit-widths may quickly fail
41  trywith 300 --solve-int-as-bv=2 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --no-bv-abstraction
42  trywith 300 --solve-int-as-bv=4 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --no-bv-abstraction
43  trywith 300 --solve-int-as-bv=8 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --no-bv-abstraction
44  trywith 300 --solve-int-as-bv=16 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --no-bv-abstraction
45  finishwith --solve-int-as-bv=32 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --no-bv-abstraction
46  ;;
47QF_NRA)
48  trywith 300 --nl-ext-tplanes --decision=internal
49  trywith 300 --nl-ext-tplanes --decision=justification --no-nl-ext-factor
50  trywith 30 --nl-ext-tplanes --decision=internal --solve-real-as-int
51  finishwith --nl-ext-tplanes --decision=justification
52  ;;
53# all logics with UF + quantifiers should either fall under this or special cases below
54ALIA|AUFLIA|AUFLIRA|AUFNIRA|UF|UFIDL|UFLIA|UFLRA|UFNIA|UFDT|UFDTLIA|AUFDTLIA|AUFBVDTLIA|AUFNIA)
55  # the following is designed for a run time of 20 min.
56  # initial runs 1min
57  trywith 30 --simplification=none --full-saturate-quant
58  trywith 30 --no-e-matching --full-saturate-quant
59  # trigger selections 3min
60  trywith 30 --relevant-triggers --full-saturate-quant
61  trywith 30 --trigger-sel=max --full-saturate-quant
62  trywith 30 --multi-trigger-when-single --full-saturate-quant
63  trywith 30 --multi-trigger-when-single --multi-trigger-priority --full-saturate-quant
64  trywith 30 --multi-trigger-cache --full-saturate-quant
65  trywith 30 --no-multi-trigger-linear --full-saturate-quant
66  # other 4min
67  trywith 30 --pre-skolem-quant --full-saturate-quant
68  trywith 30 --inst-when=full --full-saturate-quant
69  trywith 30 --no-e-matching --no-quant-cf --full-saturate-quant
70  trywith 30 --full-saturate-quant --quant-ind
71  trywith 30 --decision=internal --simplification=none --no-inst-no-entail --no-quant-cf --full-saturate-quant
72  trywith 30 --decision=internal --full-saturate-quant
73  trywith 30 --term-db-mode=relevant --full-saturate-quant
74  trywith 30 --fs-interleave --full-saturate-quant
75  # finite model find 3min
76  trywith 30 --finite-model-find --mbqi=none
77  trywith 30 --finite-model-find --decision=internal
78  trywith 30 --finite-model-find --macros-quant --macros-quant-mode=all
79  trywith 30 --finite-model-find --uf-ss=no-minimal
80  trywith 60 --finite-model-find --fmf-inst-engine
81  # long runs 9min
82  trywith 240 --finite-model-find --decision=internal
83  finishwith --full-saturate-quant
84  ;;
85ABVFP|BVFP|FP)
86  finishwith --full-saturate-quant
87  ;;
88UFBV)
89  # most problems in UFBV are essentially BV
90  trywith 300 --full-saturate-quant --decision=internal
91  trywith 300 --full-saturate-quant --cbqi-nested-qe --decision=internal
92  trywith 30 --full-saturate-quant --no-cbqi-innermost --global-negate
93  finishwith --finite-model-find
94  ;;
95BV)
96  trywith 120 --full-saturate-quant
97  trywith 120 --full-saturate-quant --no-cbqi-innermost
98  trywith 300 --full-saturate-quant --cbqi-nested-qe --decision=internal
99  trywith 30 --full-saturate-quant --no-cbqi-bv
100  trywith 30 --full-saturate-quant --cbqi-bv-ineq=eq-slack
101  # finish 10min
102  finishwith --full-saturate-quant --no-cbqi-innermost --global-negate
103  ;;
104LIA|LRA|NIA|NRA)
105  trywith 30 --full-saturate-quant --nl-ext-tplanes
106  trywith 300 --full-saturate-quant --no-cbqi-innermost
107  trywith 300 --full-saturate-quant --cbqi-nested-qe
108  finishwith --full-saturate-quant --cbqi-nested-qe --decision=internal
109  ;;
110QF_AUFBV)
111  trywith 600
112  finishwith --decision=justification-stoponly
113  ;;
114QF_ABV)
115  trywith 50 --ite-simp --simp-with-care --repeat-simp --arrays-weak-equiv
116  trywith 500 --arrays-weak-equiv
117  finishwith --ite-simp --simp-with-care --repeat-simp --arrays-weak-equiv
118  ;;
119QF_UFBV)
120  finishwith --bitblast=eager --bv-sat-solver=cadical
121  ;;
122QF_BV)
123  finishwith --unconstrained-simp --bv-div-zero-const --bv-intro-pow2 --bitblast=eager --bv-sat-solver=cadical --bitblast-aig --bv-eq-slicer=auto --no-bv-abstraction
124  ;;
125QF_AUFLIA)
126  finishwith --no-arrays-eager-index --arrays-eager-lemmas --decision=justification
127  ;;
128QF_AX)
129  finishwith --no-arrays-eager-index --arrays-eager-lemmas --decision=internal
130  ;;
131QF_AUFNIA)
132  finishwith --decision=justification --no-arrays-eager-index --arrays-eager-lemmas
133  ;;
134QF_ALIA)
135  trywith 70 --decision=justification --arrays-weak-equiv
136  finishwith --decision=justification-stoponly --no-arrays-eager-index --arrays-eager-lemmas
137  ;;
138QF_SLIA)
139  trywith 500 --strings-exp --rewrite-divk --lang=smt2.6.1
140  finishwith --strings-exp --rewrite-divk --lang=smt2.6.1 --strings-fmf
141  ;;
142QF_ABVFP)
143  finishwith
144  ;;
145QF_BVFP)
146  finishwith
147  ;;
148QF_FP)
149  finishwith
150  ;;
151*)
152  # just run the default
153  finishwith
154  ;;
155
156esac
157
158