src/HOL/TPTP/lib/Tools/tptp_translate
changeset 83354 ea5f530ccfc5
parent 81527 4f4159c2cad3
equal deleted inserted replaced
83353:19e7c4cece26 83354:ea5f530ccfc5
     1 #!/usr/bin/env bash
     1 #!/usr/bin/env bash
     2 #
     2 #
     3 # Author: Jasmin Blanchette
     3 # Author: Jasmin Blanchette
       
     4 # Author: Martin Desharnais-Schäfer
     4 #
     5 #
     5 # DESCRIPTION: translate between TPTP formats
     6 # DESCRIPTION: translate between TPTP formats
     6 
       
     7 
     7 
     8 PRG="$(basename "$0")"
     8 PRG="$(basename "$0")"
     9 
     9 
    10 function usage() {
    10 function usage() {
    11   echo
    11   echo
    18 }
    18 }
    19 
    19 
    20 [ "$#" -ne 2 -o "$1" = "-?" ] && usage
    20 [ "$#" -ne 2 -o "$1" = "-?" ] && usage
    21 
    21 
    22 SCRATCH="Scratch_${PRG}_$$_${RANDOM}"
    22 SCRATCH="Scratch_${PRG}_$$_${RANDOM}"
       
    23 SCRATCH_FILE=/tmp/${SCRATCH}.thy
    23 
    24 
    24 args=("$@")
    25 args=("$@")
    25 
    26 
    26 isabelle build -b HOL-TPTP 2>&1 | grep --line-buffered -v "elapsed time$"
    27 echo "theory ${SCRATCH} imports \"HOL-TPTP.ATP_Problem_Import\" begin \
       
    28 ML \<open> ATP_Problem_Import.translate_tptp_file @{theory} \"${args[0]}\" \"${args[1]}\" \<close> end" \
       
    29     > "${SCRATCH_FILE}"
    27 
    30 
    28 echo "theory $SCRATCH imports \"$TPTP_HOME/ATP_Problem_Import\" begin \
    31 isabelle process_theories -O -U -l HOL-TPTP -f "${SCRATCH_FILE}" "${SCRATCH}" \
    29 ML \<open> ATP_Problem_Import.translate_tptp_file @{theory} \"${args[0]}\" \"${args[1]}\" \<close> end" \
    32     | grep --line-buffered -vE \
    30   > /tmp/$SCRATCH.thy
    33         -e '^Running Draft ...$' \
    31 isabelle process -e "use_thy \"/tmp/$SCRATCH\"; exit 1;" -l HOL-TPTP | grep --line-buffered -v "^###\|^PROOF FAILED for depth\|^Failure node\|inferences so far.  Searching to depth\|^val \|^Loading theory\|^poly.*warning: The type of\|^   monotype.$"
    34         -e '^[[:space:]]*$' \
       
    35         -e '^Output \(line [[:digit:]]+ of ".*"):$' \
       
    36         -e '^val it = \(\): unit$' \
       
    37         -e '^Finished Draft \([0-9:]+ elapsed time(, [0-9:]+ cpu time, factor [0-9.]+)?\)$' \
       
    38         -e '^PROOF FAILED for depth' \
       
    39         -e '^Failure node' \
       
    40         -e 'inferences so far.  Searching to depth' \
       
    41         -e '^val ' \
       
    42         -e 'Loading theory' \
       
    43         -e '^poly.*warning: The type of' \
       
    44         -e '^   monotype.$'