| 1 | #!/bin/bashscip-shell filesystem . . `/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=`dirnamescip-shell system . . 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 | echoscip-shell system . . echo. "------- convert to smt2 : $bench..." |
| 19 | |
| 20 | $cvc5conv -o raw-benchmark --parse-only --output-lang=smt2 $bench > $here/$filename.smt2 |
| 21 | |
| 22 | echoscip-shell system . . echo. -n "------- get file name : " |
| 23 | |
| 24 | function processFileNamescip-shell shell cvc5 1.3.2-1 processFileName(). { |
| 25 | read pct file colon name colon; |
| 26 | echoscip-shell system . . echo. "$name" |
| 27 | } |
| 28 | tptpfilename=$(grepscip-shell system . . grep. "% File " $bench 2>/dev/nullscip-shell filesystem . . `/dev/null`. | processFileNamescip-shell shell cvc5 1.3.2-1 processFileName().) |
| 29 | echoscip-shell system . . echo. "TPTP file name is $tptpfilename" |
| 30 | |
| 31 | echoscip-shell system . . echo. "------- cvc5-fnt : $here/$filename.smt2..." |
| 32 | |
| 33 | function processresultscip-shell shell cvc5 1.3.2-1 processresult(). { |
| 34 | (read result; |
| 35 | case "$result" in |
| 36 | unsat) echoscip-shell system . . echo. "% SZS status $unsatResult for $tptpfilename";catscip-shell system . . cat.;exit 0;; |
| 37 | sat) |
| 38 | echoscip-shell system . . echo. "% SZS status $satResult for $tptpfilename"; |
| 39 | echoscip-shell system . . echo. "% SZS output start FiniteModel for $tptpfilename"; |
| 40 | catscip-shell system . . cat.; |
| 41 | echoscip-shell system . . 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 trywithscip-shell shell cvc5 1.3.2-1 trywith(). { |
| 51 | limit=$1; shift; |
| 52 | echoscip-shell system . . 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/nullscip-shell filesystem . . `/dev/null`. | processresultscip-shell shell cvc5 1.3.2-1 processresult(). |
| 54 | if [scip-shell system . . `[`. ${PIPESTATUS[1]} -eq 0 ]; then exit 0; fi |
| 55 | } |
| 56 | function finishwithscip-shell shell cvc5 1.3.2-1 finishwith(). { |
| 57 | echoscip-shell system . . echo. "--- Run $@..."; |
| 58 | $cvc5 --lang=smt2 --no-type-checking --no-interactive --dump-models --force-no-limit-cpu-while-dump -q "$@" $here/$filename.smt2 | processresultscip-shell shell cvc5 1.3.2-1 processresult(). |
| 59 | } |
| 60 | |
| 61 | # designed for 300 seconds |
| 62 | trywithscip-shell shell cvc5 1.3.2-1 trywith(). 30 --finite-model-find |
| 63 | finishwithscip-shell shell cvc5 1.3.2-1 finishwith(). --finite-model-find --macros-quant --macros-quant-mode=all --sort-inference |
| 64 | # echo "% SZS status" "GaveUp for $filename" |
| 65 |