#!/bin/bash # first # export STAREXEC_WALLCLOCK_LIMIT=300 # comment #set -x # run either with -t or STAREXEC_WALLCLOCK_LIMIT set -o pipefail #export TPTP=$(./get_tptp_variable.sh $1) export HERE=$(dirname $0) # does not work in StarExec bash.. #PROBLEM_SMT="${@: -1}" PROBLEM_SMT=$1 # Increase the soft ulimit ulimit -s 200000 #TFF_TMP=$(mktemp $HERE/iprover.tff.XXXXXX) TCF_TMP=$(mktemp $HERE/iprover.tcf.XXXXXX) OUT_TMP=$(mktemp $HERE/iprover.out.XXXXXX) # if option -t 300 is supplied while getopts t: option do case "${option}" in t) export STAREXEC_WALLCLOCK_LIMIT=${OPTARG} esac done #-----------kill children function killtree { local ppid=$1 if [ "$SYS" = "Darwin" ]; then local CHILDREN=`ps -o pid,ppid | awk -v ppid=$ppid '$2 ~ ppid' | awk '{print $1;}'` # local CHILDREN=`pstree -p $ppid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g"` #local CHILDREN=`ps -o pid,ppid | grep '^[0-9]' | grep ' '$ppid | cut -f 1 -d ' '` else local CHILDREN=`ps -o pid --no-heading --ppid $ppid` fi if [ ! -z "$CHILDREN" ]; then for child_pid in ${CHILDREN}; do killtree ${child_pid} done fi # kill -TERM ${ppid} kill -9 ${child_pid} 2>/dev/null } function killChildProcesses { killtree "$$" } function terminate { killChildProcesses # rm -r "$TMP" rm $TCF_TMP rm $OUT_TMP echo "Time Out Real" wait exit $1 } function interrupted { # echo "interrupted" >> $LOGFILE echo "Terminated" terminate 0 } trap interrupted SIGINT SIGQUIT SIGTERM #------------ end kill children # SMT to TFF #sed to remove quotes inside quotes in Vampire names e.g., tff(u52,axiom, ~'$is'Suc__''(zero__)).: ./res/vclausify_rel --input_syntax smtlib2 --mode tclausify --show_fool true $PROBLEM_SMT | sed -e "s/\([^\([:blank:]\|(\|)\|,\|~\)]\)\('\)\([^\([:blank:]\|(\|)\|,\|:\)]\)\([^']*\)\('\)/\1\3\4/g" > $TCF_TMP 2>/dev/null vclausify_exit_status=$? if [ $vclausify_exit_status -ne 0 ]; then echo unknown rm $TCF_TMP exit 1 else grep "(set-logic UF)" $PROBLEM_SMT &> /dev/null is_UF=$? if [ $is_UF -eq 0 ]; then #is UF problems, the translation is complete # echo "is UF problem" # TODO: change schedule to include finite models python3 prover_driver.py --no_cores 1 --schedule_mode internal --schedule test_single_core_300_super $TCF_TMP $STAREXEC_WALLCLOCK_LIMIT > $OUT_TMP 2>/dev/null if cat $OUT_TMP | grep -q "SZS status Theorem\|SZS status Unsatisfiable" then echo "unsat" else if cat $OUT_TMP | grep -q "SZS status Satisfiable\|SZS status CounterSatisfiable" then echo "sat" else echo "unknown" fi fi else # echo "is not an UF problem" # python3 prover_driver.py --no_cores 1 --schedule_mode internal --schedule test_single_core_300_super $TCF_TMP $STAREXEC_WALLCLOCK_LIMIT | grep "SZS status Unsatisfiable\|SZS status Theorem\|SZS status Unknown" # dbg python3 prover_driver.py --no_cores 1 --schedule_mode internal --schedule test_single_core_300_super $TCF_TMP $STAREXEC_WALLCLOCK_LIMIT > $OUT_TMP 2>/dev/null if cat $OUT_TMP | grep -q "SZS status Theorem\|SZS status Unsatisfiable" then echo "unsat" else echo "unknown" fi fi fi rm $TCF_TMP rm $OUT_TMP