CookBook/Intro.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 23 Jan 2009 17:50:35 +0000
changeset 75 f2dea0465bb4
parent 68 e7519207c2b7
child 80 95e9c4556221
permissions -rw-r--r--
tuned
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Intro
75
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
     2
imports Base
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
begin
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
64
9a6e5e0c4906 deleted old files and added code to give a special tag to the command ML
Christian Urban <urbanc@in.tum.de>
parents: 60
diff changeset
     6
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
chapter {* Introduction *}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
text {*
66
Christian Urban <urbanc@in.tum.de>
parents: 65
diff changeset
    10
  The purpose of this Cookbook is to guide the reader through the first steps
75
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    11
  of Isabelle programming, and to explain tricks of the trade. The code
66
Christian Urban <urbanc@in.tum.de>
parents: 65
diff changeset
    12
  provided in the Cookbook is as far as possible checked against recent
Christian Urban <urbanc@in.tum.de>
parents: 65
diff changeset
    13
  versions of Isabelle.  If something does not work, then please let us
Christian Urban <urbanc@in.tum.de>
parents: 65
diff changeset
    14
  know. If you have comments or like to add to the Cookbook, you are very
75
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    15
  welcome! The Cookbook will {\bf only} remain to be helpful, if it gets constantly 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    16
  updated.  
66
Christian Urban <urbanc@in.tum.de>
parents: 65
diff changeset
    17
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
*}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
section {* Intended Audience and Prior Knowledge *}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
text {* 
75
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    23
  This Cookbook targets readers who already know how to use Isabelle for
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    24
  writing theories and proofs. We also assume that readers are familiar with
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    25
  the functional programming language ML, the language in which most of
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    26
  Isabelle is implemented. If you are unfamiliar with either of these two
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    27
  subjects, you should first work through the Isabelle/HOL tutorial
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    28
  \cite{isa-tutorial} or Paulson's book on ML \cite{paulson-ml2}.
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
*}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
5
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    32
section {* Existing Documentation *}
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
text {*
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  
43
02f76f1b6e7b added positions to anti-quotations; removed old antiquotation_setup; tuned the text a bit
Christian Urban <urbanc@in.tum.de>
parents: 42
diff changeset
    36
  The following documentation about Isabelle programming already exists (and is
02f76f1b6e7b added positions to anti-quotations; removed old antiquotation_setup; tuned the text a bit
Christian Urban <urbanc@in.tum.de>
parents: 42
diff changeset
    37
  part of the distribution of Isabelle):
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  \begin{description}
5
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    40
  \item[The Implementation Manual] describes Isabelle
44
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    41
  from a high-level perspective, documenting both the underlying
6
007e09485351 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 5
diff changeset
    42
  concepts and some of the interfaces. 
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
5
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    44
  \item[The Isabelle Reference Manual] is an older document that used
44
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    45
  to be the main reference of Isabelle at a time when all proof scripts 
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    46
  were written on the ML level. Many parts of this manual are outdated 
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    47
  now, but some  parts, particularly the chapters on tactics, are still 
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    48
  useful.
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    49
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    50
  \item[The Isar Reference Manual] is also an older document that provides
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    51
  material about Isar and its implementation. Some material in it
dee4b3e66dfe added a readme chapter for prospective authors; added commands for referring to the Isar Reference Manual
Christian Urban <urbanc@in.tum.de>
parents: 43
diff changeset
    52
  is still useful.
5
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    53
  \end{description}
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
12
2f1736cb8f26 various changes by Alex and Christian
Christian Urban <urbanc@in.tum.de>
parents: 11
diff changeset
    55
  Then of course there is:
5
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    56
e91f54791e14 minor modifiations to the Intro and FirstSteps chapters
Christian Urban <urbanc@in.tum.de>
parents: 2
diff changeset
    57
  \begin{description}
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  \item[The code] is of course the ultimate reference for how
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  things really work. Therefore you should not hesitate to look at the
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  way things are actually implemented. More importantly, it is often
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  good to look at code that does similar things as you want to do, to
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
  learn from other people's code.
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  \end{description}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
*}
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
68
e7519207c2b7 added more to the "new command section" and tuning
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    67
section {* Conventions *}
e7519207c2b7 added more to the "new command section" and tuning
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    68
e7519207c2b7 added more to the "new command section" and tuning
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    69
text {*
75
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    70
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    71
  All ML-code in this Cookbook is shown in highlighed displays, such as:
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    72
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    73
  \begin{isabelle}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    74
  \begin{graybox}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    75
  \isa{\isacommand{ML}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    76
  \isacharverbatimopen\isanewline
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    77
  \hspace{5mm}@{ML "3 + 4"}\isanewline
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    78
  \isacharverbatimclose}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    79
  \end{graybox}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    80
  \end{isabelle}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    81
  
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    82
  This corresponds to how code can be processed inside the interactive 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    83
  environment of Isabelle. However, for better readability we will drop 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    84
  the enclosing \isacommand{ML} \isa{\isacharverbatimopen \ldots 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    85
  \isacharverbatimclose} and just show
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    86
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    87
  @{ML [display,gray] "3 + 4"}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    88
  
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    89
  for the code above. Whenever appropriate we show the response of the code 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    90
  when evaluated. The response is prefixed with a @{text [quotes] ">"}", like
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    91
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    92
  @{ML_response [display,gray] "3 + 4" "7"}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    93
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    94
  Isabelle commands are written in bold. For example \isacommand{lemma}, 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    95
  \isacommand{foobar} and so on.  We use @{text "$"} to indicate a command 
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    96
  needs to be run on the Unix-command line, like
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    97
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    98
  @{text [display] "$ ls -la"}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
    99
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   100
  Pointers to further information and files are indicated as follows:
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   101
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   102
  \begin{readmore}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   103
  Further information.
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   104
  \end{readmore}
Christian Urban <urbanc@in.tum.de>
parents: 68
diff changeset
   105
68
e7519207c2b7 added more to the "new command section" and tuning
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   106
*}
e7519207c2b7 added more to the "new command section" and tuning
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   107
2
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
978a3c2ed7ce split the document into smaller pieces;
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
end