| author | sultana |
| Sat, 14 Apr 2012 23:52:17 +0100 | |
| changeset 47479 | e6add51fd7ba |
| parent 47478 | d2392e6cba7f |
| child 47480 | 24d8c9e9dae4 |
| permissions | -rwxr-xr-x |
|
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 | 6 |
|
7 |
||
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
8 |
PRG="$(basename "$0")" |
| 32381 | 9 |
|
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
10 |
function print_action_names() {
|
|
47477
3fabf352243e
renamed mirabelle Tools directory to Actions, to make consistent with 'usage' description;
sultana
parents:
46824
diff
changeset
|
11 |
ACTIONS="$MIRABELLE_HOME/Actions/mirabelle_*.ML" |
|
3fabf352243e
renamed mirabelle Tools directory to Actions, to make consistent with 'usage' description;
sultana
parents:
46824
diff
changeset
|
12 |
for ACTION in $ACTIONS |
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
13 |
do |
|
47478
d2392e6cba7f
switched from using sed to perl in mirabelle tool
sultana
parents:
47477
diff
changeset
|
14 |
echo $ACTION | perl -w -p -e 's/.*mirabelle_(.*)\.ML/ $1/' |
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
15 |
done |
|
32385
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
16 |
} |
|
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
17 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
18 |
function usage() {
|
|
42069
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
19 |
[ -n "$MIRABELLE_OUTPUT_PATH" ] && out="$MIRABELLE_OUTPUT_PATH" || out="None" |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
20 |
timeout="$MIRABELLE_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 "Usage: isabelle $PRG [OPTIONS] ACTIONS FILES" |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
23 |
echo |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
24 |
echo " Options are:" |
| 40976 | 25 |
echo " -L LOGIC parent logic to use (default $MIRABELLE_LOGIC)" |
|
32385
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
26 |
echo " -T THEORY parent theory to use (default $MIRABELLE_THEORY)" |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
27 |
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
|
28 |
echo " -t TIMEOUT timeout for each action in seconds (default $timeout)" |
|
46824
1257c80988cd
added Mirabelle action info in its log file; tuned;
sultana
parents:
42069
diff
changeset
|
29 |
echo " -q be quiet (suppress output of Isabelle process)" |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
30 |
echo |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
31 |
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
|
32 |
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
|
33 |
echo |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
34 |
echo " ACTIONS is a colon-separated list of actions, where each action is" |
|
32522
1b70db55c811
Mirabelle: command-line action options may either be key=value or just key
boehmes
parents:
32521
diff
changeset
|
35 |
echo " either NAME or NAME[OPTION,...,OPTION]. Available actions are:" |
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
36 |
print_action_names |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
37 |
echo |
|
33248
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
38 |
echo " Available OPTIONs for the ACTION sledgehammer:" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
39 |
echo " * prover=NAME: name of the external prover to call" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
40 |
echo " * prover_timeout=TIME: timeout for invoked ATP (seconds of process time)" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
41 |
echo " * prover_hard_timeout=TIME: timeout for invoked ATP (seconds of elapsed" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
42 |
echo " time)" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
43 |
echo " * keep=PATH: path where to keep temporary files created by sledgehammer" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
44 |
echo " * full_types: enable fully-typed encoding" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
45 |
echo " * minimize: enable minimization of theorem set found by sledgehammer" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
46 |
echo " * minimize_timeout=TIME: timeout for each minimization step (seconds of" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
47 |
echo " process time)" |
|
95478a5b4c05
included description for sledgehammer options in Mirabelle script
boehmes
parents:
32522
diff
changeset
|
48 |
echo " * metis: apply metis to the theorems found by sledgehammer" |
|
34035
08d34921b7dd
also consider the fully-typed version of metis for Mirabelle measurements
boehmes
parents:
33248
diff
changeset
|
49 |
echo " * metis_ft: apply metis with fully-typed encoding to the theorems found" |
|
08d34921b7dd
also consider the fully-typed version of metis for Mirabelle measurements
boehmes
parents:
33248
diff
changeset
|
50 |
echo " by sledgehammer" |
|
32522
1b70db55c811
Mirabelle: command-line action options may either be key=value or just key
boehmes
parents:
32521
diff
changeset
|
51 |
echo |
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
52 |
echo " FILES is a list of theory files, where each file is either NAME.thy" |
|
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
53 |
echo " or NAME.thy[START:END] and START and END are numbers indicating the" |
|
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
54 |
echo " range the given actions are to be applied." |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
55 |
echo |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
56 |
exit 1 |
| 32381 | 57 |
} |
58 |
||
| 42034 | 59 |
function fail() |
60 |
{
|
|
61 |
echo "$1" >&2 |
|
62 |
exit 2 |
|
63 |
} |
|
64 |
||
| 32381 | 65 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
66 |
## process command line |
| 32381 | 67 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
68 |
# options |
| 32381 | 69 |
|
|
47479
e6add51fd7ba
Mirabelle now gives usage info when no arguments given
sultana
parents:
47478
diff
changeset
|
70 |
[ $# -eq 0 ] && usage |
|
e6add51fd7ba
Mirabelle now gives usage info when no arguments given
sultana
parents:
47478
diff
changeset
|
71 |
|
| 32521 | 72 |
while getopts "L:T:O:t:q?" OPT |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
73 |
do |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
74 |
case "$OPT" in |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
75 |
L) |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
76 |
MIRABELLE_LOGIC="$OPTARG" |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
77 |
;; |
|
32385
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
78 |
T) |
|
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
79 |
MIRABELLE_THEORY="$OPTARG" |
|
594890623c46
split actions from Mirabelle core (Mirabelle may thus be applied to basic theories in HOL)
boehmes
parents:
32383
diff
changeset
|
80 |
;; |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
81 |
O) |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
82 |
MIRABELLE_OUTPUT_PATH="$OPTARG" |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
83 |
;; |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
84 |
t) |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
85 |
MIRABELLE_TIMEOUT="$OPTARG" |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
86 |
;; |
| 32521 | 87 |
q) |
88 |
MIRABELLE_QUIET="true" |
|
89 |
;; |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
90 |
\?) |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
91 |
usage |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
92 |
;; |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
93 |
esac |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
94 |
done |
| 32381 | 95 |
|
| 32521 | 96 |
export MIRABELLE_QUIET |
97 |
||
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
98 |
shift $(($OPTIND - 1)) |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
99 |
|
| 32521 | 100 |
export MIRABELLE_ACTIONS="$1" |
| 32381 | 101 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
102 |
shift |
| 32381 | 103 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
104 |
|
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
105 |
# setup |
| 32381 | 106 |
|
|
42069
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
107 |
if [ -z "$MIRABELLE_OUTPUT_PATH" ]; then |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
108 |
MIRABELLE_OUTPUT_PATH="${ISABELLE_TMP_PREFIX}-mirabelle$$"
|
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
109 |
PURGE_OUTPUT="true" |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
110 |
fi |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
111 |
|
|
32397
1899b8c47961
more quoting for shell variables, canonical isabelle process
boehmes
parents:
32385
diff
changeset
|
112 |
mkdir -p "$MIRABELLE_OUTPUT_PATH" |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
113 |
|
|
42069
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
114 |
export MIRABELLE_OUTPUT_PATH |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
115 |
|
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
116 |
## main |
| 32381 | 117 |
|
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
118 |
for FILE in "$@" |
|
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
119 |
do |
| 42034 | 120 |
perl -w "$MIRABELLE_HOME/lib/scripts/mirabelle.pl" "$FILE" || fail "Mirabelle failed." |
|
32382
98674ac811c4
Mirabelle tool script conforming to standard Isabelle tool interface,
boehmes
parents:
32381
diff
changeset
|
121 |
done |
| 32381 | 122 |
|
|
42069
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
123 |
|
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
124 |
## cleanup |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
125 |
|
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
126 |
if [ -n "$PURGE_OUTPUT" ]; then |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
127 |
rm -rf "$MIRABELLE_OUTPUT_PATH" |
|
6a147393c62a
replace hardwired MIRABELLE_OUTPUT_PATH by temporary directory derived from ISABELLE_TMP_PREFIX and $$ -- old behaviour can be achieved by manually setting MIRABELLE_OUTPUT_PATH
krauss
parents:
42034
diff
changeset
|
128 |
fi |