doc-src/IsarRef/Thy/document/Spec.tex
author wenzelm
Sat, 10 May 2008 00:14:00 +0200
changeset 26870 94bedbb34b92
parent 26869 3bc332135aa7
child 26902 8db1e960d636
permissions -rw-r--r--
misc reorganization;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26869
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     1
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{Spec}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     4
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     5
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     6
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     7
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     8
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     9
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    10
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    11
\isatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    12
\isacommand{theory}\isamarkupfalse%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    13
\ Spec\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    14
\isakeyword{imports}\ Main\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    15
\isakeyword{begin}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    16
\endisatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    17
{\isafoldtheory}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    18
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    19
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    20
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    21
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    22
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    23
\isamarkupchapter{Specifications%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    24
}
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    25
\isamarkuptrue%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    26
%
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    27
\isamarkupsection{Defining theories \label{sec:begin-thy}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    28
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    29
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    30
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    31
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    32
\begin{matharray}{rcl}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    33
    \indexdef{}{command}{header}\mbox{\isa{\isacommand{header}}} & : & \isarkeep{toplevel} \\
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    34
    \indexdef{}{command}{theory}\mbox{\isa{\isacommand{theory}}} & : & \isartrans{toplevel}{theory} \\
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    35
    \indexdef{}{command}{end}\mbox{\isa{\isacommand{end}}} & : & \isartrans{theory}{toplevel} \\
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    36
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    37
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    38
  Isabelle/Isar theories are defined via theory, which contain both
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    39
  specifications and proofs; occasionally definitional mechanisms also
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    40
  require some explicit proof.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    41
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    42
  The first ``real'' command of any theory has to be \mbox{\isa{\isacommand{theory}}}, which starts a new theory based on the merge of existing
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    43
  ones.  Just preceding the \mbox{\isa{\isacommand{theory}}} keyword, there may be
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    44
  an optional \mbox{\isa{\isacommand{header}}} declaration, which is relevant to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    45
  document preparation only; it acts very much like a special
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    46
  pre-theory markup command (cf.\ \secref{sec:markup-thy} and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    47
  \secref{sec:markup-thy}).  The \mbox{\isa{\isacommand{end}}} command concludes a
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    48
  theory development; it has to be the very last command of any theory
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    49
  file loaded in batch-mode.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    50
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    51
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    52
    'header' text
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    53
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    54
    'theory' name 'imports' (name +) uses? 'begin'
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    55
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    56
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    57
    uses: 'uses' ((name | parname) +);
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    58
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    59
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    60
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    61
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    62
  \item [\mbox{\isa{\isacommand{header}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] provides plain text
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    63
  markup just preceding the formal beginning of a theory.  In actual
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    64
  document preparation the corresponding {\LaTeX} macro \verb|\isamarkupheader| may be redefined to produce chapter or section
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    65
  headings.  See also \secref{sec:markup-thy} and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    66
  \secref{sec:markup-prf} for further markup commands.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    67
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    68
  \item [\mbox{\isa{\isacommand{theory}}}~\isa{{\isachardoublequote}A\ {\isasymIMPORTS}\ B\isactrlsub {\isadigit{1}}\ {\isasymdots}\ B\isactrlsub n\ {\isasymBEGIN}{\isachardoublequote}}] starts a new theory \isa{A} based on the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    69
  merge of existing theories \isa{{\isachardoublequote}B\isactrlsub {\isadigit{1}}\ {\isasymdots}\ B\isactrlsub n{\isachardoublequote}}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    70
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    71
  Due to inclusion of several ancestors, the overall theory structure
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    72
  emerging in an Isabelle session forms a directed acyclic graph
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    73
  (DAG).  Isabelle's theory loader ensures that the sources
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    74
  contributing to the development graph are always up-to-date.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    75
  Changed files are automatically reloaded when processing theory
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    76
  headers.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    77
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    78
  The optional \indexdef{}{keyword}{uses}\mbox{\isa{\isakeyword{uses}}} specification declares additional
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    79
  dependencies on extra files (usually ML sources).  Files will be
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    80
  loaded immediately (as ML), unless the name is put in parentheses,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    81
  which merely documents the dependency to be resolved later in the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    82
  text (typically via explicit \indexref{}{command}{use}\mbox{\isa{\isacommand{use}}} in the body text,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    83
  see \secref{sec:ML}).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    84
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    85
  \item [\mbox{\isa{\isacommand{end}}}] concludes the current theory definition or
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    86
  context switch.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    87
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    88
  \end{descr}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    89
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    90
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    91
%
26869
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    92
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    93
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    94
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    95
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    96
\isatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    97
\isacommand{end}\isamarkupfalse%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    98
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    99
\endisatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   100
{\isafoldtheory}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   101
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   102
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   103
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   104
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   105
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   106
\end{isabellebody}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   107
%%% Local Variables:
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   108
%%% mode: latex
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   109
%%% TeX-master: "root"
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
   110
%%% End: