src/HOL/TPTP/lib/Tools/tptp_nitpick
author desharna
Tue, 28 Oct 2025 12:54:15 +0100
changeset 83348 ec8be2664645
parent 81527 4f4159c2cad3
child 83349 c460021a3448
permissions -rwxr-xr-x
adapted tptp_nitpick to use new process_theory command

#!/usr/bin/env bash
#
# Author: Jasmin Blanchette
# Author: Martin Desharnais-Schäfer
#
# DESCRIPTION: Nitpick for TPTP

PRG="$(basename "$0")"

function usage() {
  echo
  echo "Usage: isabelle $PRG TIMEOUT FILES"
  echo
  echo "  Runs Nitpick on TPTP problems."
  echo "  Each problem is allocated at most TIMEOUT seconds."
  echo
  exit 1
}

[ "$#" -eq 0 -o "$1" = "-?" ] && usage

SCRATCH="Scratch_${PRG}_$$_${RANDOM}"
SCRATCH_FILE=/tmp/${SCRATCH}.thy

TIMEOUT=$1
shift

for FILE in "$@"
do
  echo "theory ${SCRATCH} imports \"HOL-TPTP.ATP_Problem_Import\" begin \
ML \<open> ATP_Problem_Import.nitpick_tptp_file @{theory} (${TIMEOUT}) \"${FILE}\" \<close> end" \
    > "${SCRATCH_FILE}"

  isabelle process_theories -O -U -l HOL-TPTP -f "${SCRATCH_FILE}" "${SCRATCH}" \
      | grep --line-buffered -vE \
          -e '^Running Draft ...$' \
          -e '^[[:space:]]*$' \
          -e '^Output \(line [[:digit:]]+ of ".*"):$' \
          -e '^val it = \(\): unit$' \
          -e '^Finished Draft \([0-9:]+ elapsed time, [0-9:]+ cpu time, factor [0-9.]+\)$' \
          -e '^PROOF FAILED for depth' \
          -e '^Failure node' \
          -e 'inferences so far.  Searching to depth' \
          -e '^val ' \
          -e 'Loading theory' \
          -e '^poly.*warning: The type of' \
          -e '^   monotype.$'
done