| 1 | #!/bin/bash |
| 2 | |
| 3 | # script is used for FNT division |
| 4 | |
| 5 | # Assumes a binary $cvc5conv for converting tptp (*.p) files to *.smt2. |
| 6 | # cvc5 version 1.0.5 is recommended for this purpose. |
| 7 | |
| 8 | here=`dirname $0` |
| 9 | cvc5=$here/cvc5 |
| 10 | cvc5conv=$here/cvc5-tptp-to-smt2 |
| 11 | bench="$1" |
| 12 | |
| 13 | file=${bench##*/} |
| 14 | filename=${file%.*} |
| 15 | unsatResult="Unsatisfiable" |
| 16 | satResult="Satisfiable" |
| 17 | |
| 18 | echo "------- convert to smt2 : $bench..." |
| 19 | |
| 20 | $cvc5conv -o raw-benchmark --parse-only --output-lang=smt2 $bench > $here/$filename.smt2 |
| 21 | |
| 22 | echo -n "------- get file name : " |
| 23 | |
| 24 | function processFileName { |
| 25 | read pct file colon name colon; |
| 26 | echo "$name" |
| 27 | } |
| 28 | tptpfilename=$(grep "% File " $bench 2>/dev/null | processFileName) |
| 29 | echo "TPTP file name is $tptpfilename" |
| 30 | |
| 31 | echo "------- cvc5-fnt : $here/$filename.smt2..." |
| 32 | |
| 33 | function processresult { |
| 34 | (read result; |
| 35 | case "$result" in |
| 36 | unsat) echo "% SZS status $unsatResult for $tptpfilename";cat;exit 0;; |
| 37 | sat) |
| 38 | echo "% SZS status $satResult for $tptpfilename"; |
| 39 | echo "% SZS output start FiniteModel for $tptpfilename"; |
| 40 | cat; |
| 41 | echo "% SZS output end FiniteModel for $tptpfilename"; |
| 42 | exit 0;; |
| 43 | esac; exit 1) |
| 44 | } |
| 45 | |
| 46 | # use: trywith [params..] |
| 47 | # to attempt a run. If an SZS ontology result is printed, then |
| 48 | # the run script terminates immediately. Otherwise, this |
| 49 | # function returns normally. |
| 50 | function trywith { |
| 51 | limit=$1; shift; |
| 52 | echo "--- Run $@ at $limit..."; |
| 53 | (ulimit -S -t "$limit";$cvc5 --lang=smt2 --no-type-checking --no-interactive --dump-models --force-no-limit-cpu-while-dump -q "$@" $here/$filename.smt2) 2>/dev/null | processresult |
| 54 | if [ ${PIPESTATUS[1]} -eq 0 ]; then exit 0; fi |
| 55 | } |
| 56 | function finishwith { |
| 57 | echo "--- Run $@..."; |
| 58 | $cvc5 --lang=smt2 --no-type-checking --no-interactive --dump-models --force-no-limit-cpu-while-dump -q "$@" $here/$filename.smt2 | processresult |
| 59 | } |
| 60 | |
| 61 | # designed for 300 seconds |
| 62 | trywith 30 --finite-model-find |
| 63 | finishwith --finite-model-find --macros-quant --macros-quant-mode=all --sort-inference |
| 64 | # echo "% SZS status" "GaveUp for $filename" |
| 65 |