src/Tools/qed.doc
author wenzelm
Tue, 20 May 1997 19:29:50 +0200
changeset 3257 4e3724e0659f
parent 813 4a266c3d4cc0
permissions -rw-r--r--
README generation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     1
			Documentation for qed
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     2
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     3
qed is a utility that's able to (almost) automatically insert calls to
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     4
Isabelle's functions qed, qed_goal, qed_goalw and bind_thm into ML
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     5
files.  It does this by looking for certain patterns and changing the
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     6
line so that the theorems are added to Isabelle's theorem database.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     7
The intent of including it into the distribution is to enable you to
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     8
convert existing theory files.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     9
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    10
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    11
Compilation
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    12
-----------
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    13
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    14
qed was written in C++ and compiled using g++ 2.5.8. Executing "make qed"
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    15
should create the executable.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    16
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    17
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    18
Usage
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    19
-----
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    20
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    21
To start qed type:
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    22
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    23
qed <infile> <outfile>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    24
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    25
<infile> is the ML file you want to convert and <outfile> is the file
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    26
to which the output should be sent. If you want to convert a whole
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    27
directory of ML files and keep the original files as <name>.bak you
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    28
can use the script 'runqed'.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    29
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    30
During its execution qed will output the names of all theorems that it has
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    31
found.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    32
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    33
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    34
Recognized Theorems
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    35
-------------------
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    36
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    37
Because qed knows nothing about ML's syntax it has to rely on certain
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    38
assumptions about how typical definitions of theorems look. These
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    39
assumptions were made based on the files contained in the distribution
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    40
and therefore it's possible that they do not fit for the files you
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    41
want to convert. So if qed does not do what you expect it to do have a
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    42
look at the following list.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    43
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    44
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    45
-    val mono_Int = result();
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    46
  -> qed "mono_Int";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    47
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    48
  This kind of line is recognized if it contains "val ", "=" and the word
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    49
  "result();" and if the distance between "=" and "result()" is less
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    50
  than 5 characters.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    51
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    52
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    53
-    val XHlemma2 = result() RS mp;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    54
  -> bind_thm("XHlemma2", result() RS mp);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    55
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    56
  If the first case cannot be applied because the "=" and "result()" are too
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    57
  far apart or "result()" is not followed by a ";" this one is
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    58
  used.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    59
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    60
  
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    61
-    val sym = prove_goal HOL.thy "s=t ==> t=s"
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    62
  -> qed_goal "sym" HOL.thy "s=t ==> t=s"
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    63
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    64
  Lines containing the word "prove_goal" or "prove_goalw" and the strings
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    65
  "val " and "=" with a distance between "prove_goal" and "=" of less
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    66
  than 5 characters are matched by this case. Note that the ML command
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    67
  continues in the next line but is not changed further.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    68
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    69
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    70
-    val ssubst = standard (sym RS subst);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    71
  -> bind_thm ("ssubst", (sym RS subst));
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    72
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    73
  A line in which the word "standard" and the strings "val " and "=" can be
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    74
  found (with the usual distance limitation) and which ends with ";" is
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    75
  converted this way.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    76
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    77
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    78
At least for the standard theories these rules only match the desired
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    79
kind of lines. It is possible though that not all places for insertion
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    80
of the theorem database functions are found. Also qed has no way to
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    81
recognize ML commands such as "local ... in ... end" or "let ... in
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    82
... end". Processing files where theorems are defined inside these
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    83
commands leads to syntax errors during compilation of the generated
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    84
files like e.g. "end expected but bind_thm was found". One can avoid
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    85
this by changing the affected lines to "val _ = bind_thm ..." after the
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    86
conversion or by manually editing the original file.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    87
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    88
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    89
Problems?
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    90
--------
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    91
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    92
If qed does not do what you want it to do you could change the
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    93
sourcecode (qed.cc) yourself which should be fairly easy.  If qed does
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    94
not handle a case that you regard as a 'typical' way of defining a
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    95
theorem (i.e. one that occurs very often in your files) send an email
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    96
containg some examples to clasohm@informatik.tu-muenchen.de.
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    97