1#!/bin/bash
2
3cvc4=./cvc4-application
4
5line=""
6while [[ -z "$line" ]]; do
7  read line
8done
9if [ "$line" != '(set-option :print-success true)' ]; then
10  echo 'ERROR: first line supposed to be set-option :print-success, but got: "'"$line"'"' >&2
11  exit 1
12fi
13echo success
14line=""
15while [[ -z "$line" ]]; do
16  read line
17done
18logic=$(expr "$line" : ' *(set-logic  *\([A-Z_]*\) *) *$')
19if [ -z "$logic" ]; then
20  echo 'ERROR: second line supposed to be set-logic, but got: "'"$line"'"' >&2
21  exit 1
22fi
23echo success
24
25function runcvc4 {
26  # we run in this way for line-buffered input, otherwise memory's a
27  # concern (plus it mimics what we'll end up getting from an
28  # application-track trace runner?)
29  $cvc4 --force-logic="$logic" -L smt2.6 --print-success --no-checking --no-interactive "$@" <&0-
30}
31
32case "$logic" in
33
34ALIA|QF_ALIA|QF_LRA|QF_UFLIA|QF_UFLRA|UFLRA)
35  runcvc4 --incremental
36  ;;
37ANIA|QF_ANIA|QF_NIA|QF_UFNIA|QF_NRA)
38  runcvc4 --tear-down-incremental=1
39  ;;
40LIA|LRA)
41  runcvc4 --incremental
42  ;;
43QF_AUFLIA)
44  runcvc4 --no-arrays-eager-index --arrays-eager-lemmas --incremental
45  ;;
46QF_BV)
47  runcvc4 --tear-down-incremental=4 --bv-eq-slicer=auto --bv-div-zero-const --bv-intro-pow2
48  ;;
49QF_LIA)
50  runcvc4 --tear-down-incremental=1 --unconstrained-simp
51  ;;
52QF_UFBV)
53  runcvc4 --incremental
54  ;;
55QF_UF)
56  runcvc4 --incremental
57  ;;
58QF_AUFBV)
59  runcvc4 --incremental
60  ;;
61QF_ABV)
62  runcvc4 --incremental
63  ;;
64ABVFP)
65  runcvc4 --incremental
66  ;;
67BVFP)
68  runcvc4 --incremental
69  ;;
70QF_ABVFP)
71  runcvc4 --incremental
72  ;;
73QF_BVFP)
74  runcvc4 --incremental
75  ;;
76QF_FP)
77  runcvc4 --incremental
78  ;;
79*)
80  # just run the default
81  runcvc4 --incremental
82  ;;
83
84esac
85