src/HOL/Tools/Mirabelle/lib/Tools/mirabelle
author boehmes
Fri, 21 Aug 2009 09:46:14 +0200
changeset 32383 521065a499c6
parent 32382 src/HOL/ex/Mirabelle/lib/Tools/mirabelle@98674ac811c4
child 32385 594890623c46
permissions -rwxr-xr-x
moved Mirabelle to HOL/Tools
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     1
#!/usr/bin/env bash
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     2
#
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     3
# Author: Sascha Boehme
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     4
#
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     5
# DESCRIPTION: testing tool for automated proof tools
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
     6
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
     7
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
     8
PRG="$(basename "$0")"
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
     9
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    10
function usage() {
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    11
  out="$MIRABELLE_OUTPUT_PATH"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    12
  timeout="$MIRABELLE_TIMEOUT"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    13
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    14
  echo "Usage: isabelle $PRG [OPTIONS] ACTIONS FILES"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    15
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    16
  echo "  Options are:"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    17
  echo "    -L LOGIC     parent logic to use (default $ISABELLE_LOGIC)"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    18
  echo "    -O DIR       output directory for test data (default $out)"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    19
  echo "    -v           be verbose"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    20
  echo "    -t TIMEOUT   timeout for each action in seconds (default $timeout)"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    21
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    22
  echo "  Apply the given actions (i.e., automated proof tools)"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    23
  echo "  at all proof steps in the given theory files."
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    24
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    25
  echo "  ACTIONS is a colon-separated list of actions, where each action is"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    26
  echo "  either NAME or NAME[KEY=VALUE,...,KEY=VALUE]."
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    27
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    28
  echo "  FILES is a space-separated list of theory files, where each file is"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    29
  echo "  either NAME.thy or NAME.thy[START:END] and START and END are numbers"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    30
  echo "  indicating the range the given actions are to be applied."
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    31
  echo
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    32
  exit 1
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    33
}
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    34
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    35
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    36
## process command line
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    37
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    38
# options
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    39
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    40
while getopts "L:O:vt:" OPT
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    41
do
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    42
  case "$OPT" in
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    43
    L)
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    44
      MIRABELLE_LOGIC="$OPTARG"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    45
      ;;
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    46
    O)
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    47
      MIRABELLE_OUTPUT_PATH="$OPTARG"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    48
      ;;
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    49
    v)
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    50
      MIRABELLE_VERBOSE=true
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    51
      ;;
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    52
    t)
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    53
      MIRABELLE_TIMEOUT="$OPTARG"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    54
      ;;
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    55
    \?)
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    56
      usage
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    57
      ;;
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    58
  esac
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    59
done
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    60
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    61
shift $(($OPTIND - 1))
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    62
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    63
ACTIONS="$1"
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    64
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    65
shift
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    66
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    67
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    68
# setup
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    69
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    70
mkdir -p $MIRABELLE_OUTPUT_PATH
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    71
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    72
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    73
## main
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    74
32382
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    75
for FILE in "$@"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    76
do
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    77
  perl -w $MIRABELLE_HOME/lib/scripts/mirabelle.pl $ACTIONS "$FILE"
98674ac811c4 Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents: 32381
diff changeset
    78
done
32381
11542bebe4d4 made Mirabelle a component
boehmes
parents:
diff changeset
    79