iProver_SMT

loading
details
attribute current value
name iProver_SMT
description no description
owning solver iProver-v3.5-final-fix1
contents
#!/bin/bash
# first 
# export STAREXEC_WALLCLOCK_LIMIT=300
#
# starexec_run_iProver_SMT problem.smt2
#
# 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

if [ -z "$STAREXEC_WALLCLOCK_LIMIT" ]; then
  echo 	"error: time limit should be provided by setting env: export STAREXEC_WALLCLOCK_LIMIT=timilimt"
  exit 1
fi

if [ ! -f "$PROBLEM_SMT" ]; then
 echo "error: problem was not provided: run: starexec_run_iProver_SMT problem.smt2"
 exit 1
fi

# 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/[']\+/'/g" | sed -e "s/\([^[:blank:](),~]\)\('\)\([^[:blank:](),:]\)\([^']*\)\('\)/\1\3\4\5/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
        python3 prover_driver.py --suppress_proof_model_out --no_cores 4 --schedule_mode internal --schedule smt_2scp_default_with_sat_300_x4 $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
        python3 prover_driver.py --suppress_proof_model_out --no_cores 4 --schedule_mode internal --schedule smt_3scp_default_300_x4 $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

back to iProver-v3.5-final-fix1