doc-src/IsarRef/pure.tex
author wenzelm
Tue Aug 03 18:56:51 1999 +0200 (1999-08-03)
changeset 7167 0b2e3ef1d8f4
parent 7141 a67dde8820c0
child 7175 8263d0b50e12
permissions -rw-r--r--
tuned;
much more material;
wenzelm@7046
     1
wenzelm@7167
     2
\chapter{Basic Isar elements}
wenzelm@7167
     3
wenzelm@7167
     4
Subsequently, we introduce most of the basic Isar theory and proof commands as
wenzelm@7167
     5
provided by Isabelle/Pure.  Chapter~\ref{ch:gen-tools} describes further Isar
wenzelm@7167
     6
elements as provided by generic tools and packages that are either part of
wenzelm@7167
     7
Pure Isabelle, or preloaded by most object logics (such as the simplifier).
wenzelm@7167
     8
See chapter~\ref{ch:hol-tools} for actual object-logic specific elements (for
wenzelm@7167
     9
Isabelle/HOL).
wenzelm@7046
    10
wenzelm@7167
    11
\medskip
wenzelm@7167
    12
wenzelm@7167
    13
Isar commands may be either \emph{proper} document constructors, or
wenzelm@7167
    14
\emph{improper commands} (indicated by $^*$).  Improper commands might be
wenzelm@7167
    15
helpful when developing proof documents, while their use is strongly
wenzelm@7167
    16
discouraged for the final outcome.  Typical examples are diagnostic commands
wenzelm@7167
    17
that print terms or theorems according to the current context; other commands
wenzelm@7167
    18
even emulate old-style tactical theorem proving, which facilitates porting of
wenzelm@7167
    19
legacy proof scripts.
wenzelm@7167
    20
wenzelm@7134
    21
wenzelm@7134
    22
\section{Theory commands}
wenzelm@7134
    23
wenzelm@7167
    24
\subsection{Defining theories}\label{sec:begin-thy}
wenzelm@7134
    25
wenzelm@7134
    26
\indexisarcmd{theory}\indexisarcmd{end}\indexisarcmd{context}
wenzelm@7134
    27
\begin{matharray}{rcl}
wenzelm@7134
    28
  \isarcmd{theory} & : & \isartrans{\cdot}{theory} \\
wenzelm@7134
    29
  \isarcmd{context}^* & : & \isartrans{\cdot}{theory} \\
wenzelm@7134
    30
  \isarcmd{end} & : & \isartrans{theory}{\cdot} \\
wenzelm@7134
    31
\end{matharray}
wenzelm@7134
    32
wenzelm@7134
    33
Isabelle/Isar ``new-style'' theories are either defined via theory files or
wenzelm@7167
    34
interactively.  Both actual theory specifications and proofs are handled
wenzelm@7167
    35
uniformly --- occasionally definitional mechanisms even require some proof.
wenzelm@7167
    36
In contrast, ``old-style'' Isabelle theories support batch processing only,
wenzelm@7167
    37
with the proof scripts collected in separate ML files.
wenzelm@7134
    38
wenzelm@7134
    39
The first command of any theory has to be $\THEORY$, starting a new theory
wenzelm@7167
    40
based on the merge of existing ones.  The theory context may be changed by
wenzelm@7167
    41
$\CONTEXT$ without creating a new theory.  In both cases $\END$ concludes the
wenzelm@7167
    42
theory development; it has to be the very last command of any proper theory
wenzelm@7167
    43
file.
wenzelm@7134
    44
wenzelm@7134
    45
\begin{rail}
wenzelm@7134
    46
  'theory' name '=' (name + '+') filespecs? ':'
wenzelm@7134
    47
  ;
wenzelm@7134
    48
  'context' name
wenzelm@7134
    49
  ;
wenzelm@7134
    50
  'end'
wenzelm@7134
    51
  ;;
wenzelm@7134
    52
wenzelm@7167
    53
  filespecs: 'files' ((name | parname) +);
wenzelm@7134
    54
\end{rail}
wenzelm@7134
    55
wenzelm@7167
    56
\begin{descr}
wenzelm@7134
    57
\item [$\THEORY~A = B@1 + \cdots + B@n$] commences a new theory $A$ based on
wenzelm@7134
    58
  existing ones $B@1 + \cdots + B@n$.  Note that Isabelle's theory loader
wenzelm@7134
    59
  system ensures that any of the base theories are properly loaded (and fully
wenzelm@7167
    60
  up-to-date when $\THEORY$ is executed interactively).  The optional
wenzelm@7167
    61
  $\isarkeyword{files}$ specification declares additional dependencies on ML
wenzelm@7167
    62
  files.  Unless put in in parentheses, any file will be loaded immediately
wenzelm@7167
    63
  via $\isarcmd{use}$ (see also \S\ref{sec:ML}).
wenzelm@7134
    64
  
wenzelm@7167
    65
\item [$\CONTEXT~B$] enters an existing theory context $B$, basically in
wenzelm@7134
    66
  read-only mode, so only a limited set of commands may be performed.  Just as
wenzelm@7134
    67
  for $\THEORY$, the theory loader ensures that $B$ is loaded and up-to-date.
wenzelm@7134
    68
wenzelm@7167
    69
\item [$\END$] concludes the current theory definition or context switch.
wenzelm@7167
    70
\end{descr}
wenzelm@7134
    71
wenzelm@7134
    72
wenzelm@7167
    73
\subsection{Formal comments}\label{sec:formal-cmt-thy}
wenzelm@7134
    74
wenzelm@7167
    75
\indexisarcmd{title}\indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
wenzelm@7167
    76
\indexisarcmd{subsubsection}\indexisarcmd{text}
wenzelm@7134
    77
\begin{matharray}{rcl}
wenzelm@7134
    78
  \isarcmd{title} & : & \isartrans{theory}{theory} \\
wenzelm@7134
    79
  \isarcmd{chapter} & : & \isartrans{theory}{theory} \\
wenzelm@7167
    80
  \isarcmd{section} & : & \isartrans{theory}{theory} \\
wenzelm@7134
    81
  \isarcmd{subsection} & : & \isartrans{theory}{theory} \\
wenzelm@7134
    82
  \isarcmd{subsubsection} & : & \isartrans{theory}{theory} \\
wenzelm@7134
    83
  \isarcmd{text} & : & \isartrans{theory}{theory} \\
wenzelm@7134
    84
\end{matharray}
wenzelm@7134
    85
wenzelm@7167
    86
There are several commands to include \emph{formal comments} in theory
wenzelm@7167
    87
specification (a few more are available for proofs, see
wenzelm@7167
    88
\S\ref{sec:formal-cmt-prf}).  In contrast to source-level comments
wenzelm@7134
    89
\verb|(*|\dots\verb|*)|, which are stripped at the lexical level, any text
wenzelm@7134
    90
given as formal comment is meant to be part of the actual document.
wenzelm@7134
    91
Consequently, it would be included in the final printed version.
wenzelm@7134
    92
wenzelm@7134
    93
Apart from plain prose, formal comments may also refer to logical entities of
wenzelm@7134
    94
the current theory context (types, terms, theorems etc.).  Proper processing
wenzelm@7134
    95
of the text would then include some further consistency checks with the items
wenzelm@7134
    96
declared in the current theory, e.g.\ type-checking of included terms.
wenzelm@7134
    97
\footnote{The current version of Isabelle/Isar does not process formal
wenzelm@7134
    98
  comments in any such way.  This will be available as part of the automatic
wenzelm@7134
    99
  theory and proof document preparation system (via (PDF)LaTeX) that is
wenzelm@7134
   100
  planned for the near future.}
wenzelm@7134
   101
wenzelm@7134
   102
\begin{rail}
wenzelm@7134
   103
  'title' text text? text?
wenzelm@7134
   104
  ;
wenzelm@7167
   105
  ('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text') text
wenzelm@7134
   106
  ;
wenzelm@7134
   107
\end{rail}
wenzelm@7134
   108
wenzelm@7167
   109
\begin{descr}
wenzelm@7134
   110
\item [$\isarkeyword{title}~title~author~date$] specifies the document title
wenzelm@7134
   111
  just as in typical LaTeX documents.
wenzelm@7167
   112
\item [$\isarkeyword{chapter}~text$, $\isarkeyword{section}~text$,
wenzelm@7167
   113
  $\isarkeyword{subsection}~text$, $\isarkeyword{subsubsection}~text$] specify
wenzelm@7167
   114
  chapter and subsection headings.
wenzelm@7134
   115
\item [$\TEXT~text$] specifies an actual body of prose text, including
wenzelm@7134
   116
  references to formal entities.\footnote{The latter feature is not yet
wenzelm@7134
   117
    exploited in any way.}
wenzelm@7167
   118
\end{descr}
wenzelm@7134
   119
wenzelm@7134
   120
wenzelm@7135
   121
\subsection{Type classes and sorts}\label{sec:classes}
wenzelm@7134
   122
wenzelm@7134
   123
\indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
wenzelm@7134
   124
\begin{matharray}{rcl}
wenzelm@7134
   125
  \isarcmd{classes} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   126
  \isarcmd{classrel} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   127
  \isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   128
\end{matharray}
wenzelm@7134
   129
wenzelm@7134
   130
\begin{rail}
wenzelm@7167
   131
  'classes' (classdecl comment? +)
wenzelm@7134
   132
  ;
wenzelm@7134
   133
  'classrel' nameref '<' nameref comment?
wenzelm@7134
   134
  ;
wenzelm@7134
   135
  'defaultsort' sort comment?
wenzelm@7134
   136
  ;
wenzelm@7134
   137
\end{rail}
wenzelm@7134
   138
wenzelm@7167
   139
\begin{descr}
wenzelm@7134
   140
\item [$\isarkeyword{classes}~c<cs ~\dots$] declares class $c$ to be a
wenzelm@7134
   141
  subclass of existing classes $cs$.  Cyclic class structures are ruled out.
wenzelm@7134
   142
\item [$\isarkeyword{classrel}~c@1<c@2$] states a subclass relation between
wenzelm@7134
   143
  existing classes $c@1$ and $c@2$.  This is done axiomatically!  The
wenzelm@7134
   144
  $\isarkeyword{instance}$ command provides a way introduce proven class
wenzelm@7134
   145
  relations (see \S\ref{sec:axclass}).
wenzelm@7134
   146
\item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
wenzelm@7134
   147
  any type variables input without sort constraints.  Typically, the default
wenzelm@7134
   148
  sort would be only changed when defining new logics.
wenzelm@7167
   149
\end{descr}
wenzelm@7134
   150
wenzelm@7134
   151
wenzelm@7141
   152
\subsection{Types}\label{sec:types-pure}
wenzelm@7134
   153
wenzelm@7134
   154
\indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
wenzelm@7134
   155
\begin{matharray}{rcl}
wenzelm@7134
   156
  \isarcmd{types} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   157
  \isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   158
  \isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   159
  \isarcmd{arities} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   160
\end{matharray}
wenzelm@7134
   161
wenzelm@7134
   162
\begin{rail}
wenzelm@7134
   163
  'types' (typespec '=' type infix? comment? +)
wenzelm@7134
   164
  ;
wenzelm@7134
   165
  'typedecl' typespec infix? comment?
wenzelm@7134
   166
  ;
wenzelm@7134
   167
  'nonterminals' (name +) comment?
wenzelm@7134
   168
  ;
wenzelm@7134
   169
  'arities' (nameref '::' arity comment? +)
wenzelm@7134
   170
  ;
wenzelm@7134
   171
\end{rail}
wenzelm@7134
   172
wenzelm@7167
   173
\begin{descr}
wenzelm@7134
   174
\item [$\TYPES~(\vec\alpha)t = \tau~\dots$] introduces \emph{type synonym}
wenzelm@7134
   175
  $(\vec\alpha)t$ for existing type $\tau$.  Unlike actual type definitions,
wenzelm@7134
   176
  as are available in Isabelle/HOL for example, type synonyms are just purely
wenzelm@7134
   177
  syntactic abbreviations, without any logical significance.  Internally, type
wenzelm@7134
   178
  synonyms are fully expanded, as may be observed when printing terms or
wenzelm@7134
   179
  theorems.
wenzelm@7134
   180
\item [$\isarkeyword{typedecl}~(\vec\alpha)t$] declares a new type constructor
wenzelm@7134
   181
  $t$, intended as an actual logical type.  Note that some logics such as
wenzelm@7134
   182
  Isabelle/HOL provide their own version of $\isarkeyword{typedecl}$.
wenzelm@7134
   183
\item [$\isarkeyword{nonterminals}~c~\dots$] declares $0$-ary type
wenzelm@7134
   184
  constructors $c$ to act as purely syntactic types, i.e.\ nonterminal symbols
wenzelm@7134
   185
  of Isabelle's inner syntax of terms or types.
wenzelm@7134
   186
\item [$\isarkeyword{arities}~t::(\vec s)s~\dots$] augments Isabelle's
wenzelm@7134
   187
  order-sorted signature of types by new type constructor arities.  This is
wenzelm@7134
   188
  done axiomatically!  The $\isarkeyword{instance}$ command provides a way
wenzelm@7134
   189
  introduce proven type arities (see \S\ref{sec:axclass}).
wenzelm@7167
   190
\end{descr}
wenzelm@7134
   191
wenzelm@7134
   192
wenzelm@7134
   193
\subsection{Constants and simple definitions}
wenzelm@7134
   194
wenzelm@7134
   195
\indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}
wenzelm@7134
   196
\begin{matharray}{rcl}
wenzelm@7134
   197
  \isarcmd{consts} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   198
  \isarcmd{defs} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   199
  \isarcmd{constdefs} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   200
\end{matharray}
wenzelm@7134
   201
wenzelm@7134
   202
\begin{rail}
wenzelm@7134
   203
  'consts' (constdecl +)
wenzelm@7134
   204
  ;
wenzelm@7134
   205
  'defs' (thmdecl? prop comment? +)
wenzelm@7134
   206
  ;
wenzelm@7134
   207
  'constdefs' (constdecl prop comment? +)
wenzelm@7134
   208
  ;
wenzelm@7134
   209
wenzelm@7134
   210
  constdecl: name '::' type mixfix? comment?
wenzelm@7134
   211
  ;
wenzelm@7134
   212
\end{rail}
wenzelm@7134
   213
wenzelm@7167
   214
\begin{descr}
wenzelm@7134
   215
\item [$\CONSTS~c::\tau~\dots$] declares constant $c$ to have any instance of
wenzelm@7134
   216
  type scheme $\tau$.  The optional mixfix annotations may attach concrete
wenzelm@7134
   217
  syntax to the constant.
wenzelm@7134
   218
\item [$\DEFS~name: eqn~\dots$] introduces $eqn$ as a definitional axiom for
wenzelm@7134
   219
  some existing constant.  See \cite[\S6]{isabelle-ref} for more details on
wenzelm@7134
   220
  the form of equations admitted as constant definitions.
wenzelm@7134
   221
\item [$\isarkeyword{constdefs}~c::\tau~eqn~\dots$] combines constant
wenzelm@7134
   222
  declarations and definitions, using canonical name $c_def$ for the
wenzelm@7134
   223
  definitional axiom.
wenzelm@7167
   224
\end{descr}
wenzelm@7134
   225
wenzelm@7134
   226
wenzelm@7167
   227
\subsection{Syntax and translations}
wenzelm@7134
   228
wenzelm@7134
   229
\indexisarcmd{syntax}\indexisarcmd{translations}
wenzelm@7134
   230
\begin{matharray}{rcl}
wenzelm@7134
   231
  \isarcmd{syntax} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   232
  \isarcmd{translations} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   233
\end{matharray}
wenzelm@7134
   234
wenzelm@7134
   235
\begin{rail}
wenzelm@7134
   236
  'syntax' ('(' name 'output'? ')')? (constdecl +)
wenzelm@7134
   237
  ;
wenzelm@7134
   238
  'translations' (transpat ('==' | '=>' | '<=') transpat comment? +)
wenzelm@7134
   239
  ;
wenzelm@7134
   240
  transpat: ('(' nameref ')')? string
wenzelm@7134
   241
  ;
wenzelm@7134
   242
\end{rail}
wenzelm@7134
   243
wenzelm@7167
   244
\begin{descr}
wenzelm@7134
   245
\item [$\isarkeyword{syntax}~mode~decls$] is similar to $\CONSTS~decls$,
wenzelm@7134
   246
  except the actual logical signature extension.  Thus the context free
wenzelm@7134
   247
  grammar of Isabelle's inner syntax may be augmented in arbitrary ways.  The
wenzelm@7134
   248
  $mode$ argument refers to the print mode that the grammar rules belong;
wenzelm@7134
   249
  unless there is the \texttt{output} flag given, all productions are added
wenzelm@7134
   250
  both to the input and output grammar.
wenzelm@7134
   251
\item [$\isarkeyword{translations}~rule~\dots$] specifies syntactic
wenzelm@7134
   252
  translation rules (macros): parse/print rules (\texttt{==}), parse rules
wenzelm@7134
   253
  (\texttt{=>}), print rules (\texttt{<=}).  Translation patterns may be
wenzelm@7134
   254
  prefixed by the syntactic category to be used for parsing; the default is
wenzelm@7134
   255
  \texttt{logic}.
wenzelm@7167
   256
\end{descr}
wenzelm@7134
   257
wenzelm@7134
   258
wenzelm@7134
   259
\subsection{Axioms and theorems}
wenzelm@7134
   260
wenzelm@7134
   261
\indexisarcmd{axioms}\indexisarcmd{theorems}\indexisarcmd{lemmas}
wenzelm@7134
   262
\begin{matharray}{rcl}
wenzelm@7134
   263
  \isarcmd{axioms} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   264
  \isarcmd{theorems} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   265
  \isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   266
\end{matharray}
wenzelm@7134
   267
wenzelm@7134
   268
\begin{rail}
wenzelm@7135
   269
  'axioms' (axmdecl prop comment? +)
wenzelm@7134
   270
  ;
wenzelm@7134
   271
  ('theorems' | 'lemmas') thmdef? thmrefs
wenzelm@7134
   272
  ;
wenzelm@7134
   273
\end{rail}
wenzelm@7134
   274
wenzelm@7167
   275
\begin{descr}
wenzelm@7134
   276
\item [$\isarkeyword{axioms}~name: \phi~\dots$] introduces arbitrary
wenzelm@7134
   277
  statements as logical axioms.  In fact, axioms are ``axiomatic theorems'',
wenzelm@7134
   278
  and may be referred as any other theorems later.
wenzelm@7134
   279
  
wenzelm@7134
   280
  Axioms are usually only introduced when declaring new logical systems.
wenzelm@7134
   281
  Everyday work is normally done the hard way, with proper definitions and
wenzelm@7134
   282
  actual theorems.
wenzelm@7134
   283
\item [$\isarkeyword{theorems}~name = thms$] stores lists of existing theorems
wenzelm@7134
   284
  as $name$.  Typical applications would also involve attributes to augment
wenzelm@7134
   285
  the default simpset, for example.
wenzelm@7134
   286
\item [$\isarkeyword{lemmas}$] is similar to $\isarkeyword{theorems}$, but
wenzelm@7134
   287
  tags the results as ``lemma''.
wenzelm@7167
   288
\end{descr}
wenzelm@7134
   289
wenzelm@7134
   290
wenzelm@7167
   291
\subsection{Name spaces}
wenzelm@7134
   292
wenzelm@7167
   293
Isabelle organizes any kind of names (of types, constants, theorems etc.)  by
wenzelm@7167
   294
hierarchically structured name spaces.  Normally the user never has to control
wenzelm@7167
   295
the behavior of name space entry by hand, yet the following commands provide
wenzelm@7167
   296
some way to do so.
wenzelm@7167
   297
wenzelm@7167
   298
\indexisarcmd{global}\indexisarcmd{local}
wenzelm@7134
   299
\begin{matharray}{rcl}
wenzelm@7134
   300
  \isarcmd{global} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   301
  \isarcmd{local} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   302
\end{matharray}
wenzelm@7134
   303
wenzelm@7167
   304
\begin{descr}
wenzelm@7167
   305
\item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
wenzelm@7167
   306
  name declaration mode.  Initially, theories start in $\isarkeyword{local}$
wenzelm@7167
   307
  mode, causing all names to be automatically qualified by the theory name.
wenzelm@7167
   308
  Changing this to $\isarkeyword{global}$ causes all names to be declared as
wenzelm@7167
   309
  base names only.
wenzelm@7167
   310
\end{descr}
wenzelm@7134
   311
wenzelm@7134
   312
wenzelm@7167
   313
\subsection{Incorporating ML code}\label{sec:ML}
wenzelm@7134
   314
wenzelm@7134
   315
\indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{setup}
wenzelm@7134
   316
\begin{matharray}{rcl}
wenzelm@7134
   317
  \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
wenzelm@7134
   318
  \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
wenzelm@7134
   319
  \isarcmd{setup} & : & \isartrans{\cdot}{\cdot} \\
wenzelm@7134
   320
\end{matharray}
wenzelm@7134
   321
wenzelm@7134
   322
\begin{rail}
wenzelm@7134
   323
  'use' name
wenzelm@7134
   324
  ;
wenzelm@7134
   325
  'ML' text
wenzelm@7134
   326
  ;
wenzelm@7134
   327
  'setup' text
wenzelm@7134
   328
  ;
wenzelm@7134
   329
\end{rail}
wenzelm@7134
   330
wenzelm@7167
   331
\begin{descr}
wenzelm@7167
   332
\item [$\isarkeyword{use}~file$] reads and execute ML commands from $file$.
wenzelm@7167
   333
  The current theory context as passed down to the ML session.  Furthermore,
wenzelm@7167
   334
  the file name is checked with the dependency declarations given in the
wenzelm@7167
   335
  theory header (see also \S\ref{sec:begin-thy}).
wenzelm@7167
   336
  \item [$\isarkeyword{ML}~text$] reads and executes ML commands from $text$.
wenzelm@7167
   337
  The theory context is passed just as in $\isarkeyword{use}$.
wenzelm@7167
   338
\item [$\isarkeyword{setup}~text$] changes the current theory context by
wenzelm@7167
   339
  applying setup functions $text$ (which has to be an ML expression of type
wenzelm@7167
   340
  $(theory -> theory)~list$.  The $\isarkeyword{setup}$ is the usual way to
wenzelm@7167
   341
  initialize object-logic specific tools and packages written in ML.
wenzelm@7167
   342
\end{descr}
wenzelm@7134
   343
wenzelm@7134
   344
wenzelm@7167
   345
\subsection{Syntax translation functions}
wenzelm@7134
   346
wenzelm@7167
   347
\indexisarcmd{parse-ast-translation}\indexisarcmd{parse-translation}
wenzelm@7167
   348
\indexisarcmd{print-translation}\indexisarcmd{typed-print-translation}
wenzelm@7167
   349
\indexisarcmd{print-ast-translation}\indexisarcmd{token-translation}
wenzelm@7134
   350
\begin{matharray}{rcl}
wenzelm@7134
   351
  \isarcmd{parse_ast_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   352
  \isarcmd{parse_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   353
  \isarcmd{print_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   354
  \isarcmd{typed_print_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   355
  \isarcmd{print_ast_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   356
  \isarcmd{token_translation} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   357
\end{matharray}
wenzelm@7134
   358
wenzelm@7134
   359
Syntax translation functions written in ML admit almost arbitrary
wenzelm@7134
   360
manipulations of Isabelle's inner syntax.  Any of the above commands have a
wenzelm@7134
   361
single \railqtoken{text} argument that refers to an ML expression of
wenzelm@7134
   362
appropriate type.  See \cite[\S8]{isabelle-ref} for more information on syntax
wenzelm@7134
   363
transformations.
wenzelm@7134
   364
wenzelm@7134
   365
wenzelm@7134
   366
\subsection{Oracles}
wenzelm@7134
   367
wenzelm@7134
   368
\indexisarcmd{oracle}
wenzelm@7134
   369
\begin{matharray}{rcl}
wenzelm@7134
   370
  \isarcmd{oracle} & : & \isartrans{theory}{theory} \\
wenzelm@7134
   371
\end{matharray}
wenzelm@7134
   372
wenzelm@7134
   373
\begin{rail}
wenzelm@7134
   374
  'oracle' name '=' text comment?
wenzelm@7134
   375
  ;
wenzelm@7134
   376
\end{rail}
wenzelm@7134
   377
wenzelm@7167
   378
\begin{descr}
wenzelm@7134
   379
\item [$\isarkeyword{oracle}~name=text$] FIXME
wenzelm@7167
   380
\end{descr}
wenzelm@7134
   381
wenzelm@7134
   382
wenzelm@7134
   383
\section{Proof commands}
wenzelm@7134
   384
wenzelm@7167
   385
Proof commands provide transitions of Isar/VM machine configurations.  There
wenzelm@7167
   386
are three different kinds of operation:
wenzelm@7167
   387
\begin{descr}
wenzelm@7167
   388
\item [$proof(prove)$] means that a new goal has just been stated that is now
wenzelm@7167
   389
  to be \emph{proven}; the next command may refine it by some proof method
wenzelm@7167
   390
  ($\approx$ tactic) and enter a sub-proof to establish the final result.
wenzelm@7167
   391
\item [$proof(state)$] is like an internal theory mode: the context may be
wenzelm@7167
   392
  augmented by \emph{stating} additional assumptions, intermediate result;
wenzelm@7167
   393
\item [$proof(chain)$] indicates an intermediate mode between $proof(state)$
wenzelm@7167
   394
  and $proof(state)$: some already established facts have been just picked up
wenzelm@7167
   395
  in order to use them when refining the subsequent goal.
wenzelm@7167
   396
\end{descr}
wenzelm@7134
   397
wenzelm@7167
   398
wenzelm@7167
   399
\subsection{Formal comments}\label{sec:formal-cmt-prf}
wenzelm@7167
   400
wenzelm@7167
   401
The following formal comments in proof mode closely correspond to the ones of
wenzelm@7167
   402
theory mode (see \S\ref{sec:formal-cmt-thy} for more information).
wenzelm@7167
   403
wenzelm@7167
   404
\indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsect}\indexisarcmd{txt}
wenzelm@7134
   405
\begin{matharray}{rcl}
wenzelm@7167
   406
  \isarcmd{sect} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7167
   407
  \isarcmd{subsect} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7167
   408
  \isarcmd{subsubsect} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7167
   409
  \isarcmd{txt} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   410
\end{matharray}
wenzelm@7134
   411
wenzelm@7134
   412
\begin{rail}
wenzelm@7167
   413
  ('sect' | 'subsect' | 'subsubsect' | 'txt') text
wenzelm@7134
   414
  ;
wenzelm@7134
   415
\end{rail}
wenzelm@7134
   416
wenzelm@7134
   417
wenzelm@7134
   418
\subsection{Proof context}
wenzelm@7134
   419
wenzelm@7167
   420
FIXME
wenzelm@7167
   421
wenzelm@7134
   422
\indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}\indexisarcmd{let}
wenzelm@7134
   423
\begin{matharray}{rcl}
wenzelm@7134
   424
  \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   425
  \isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   426
  \isarcmd{presume} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   427
  \isarcmd{def} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   428
  \isarcmd{let} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   429
\end{matharray}
wenzelm@7134
   430
wenzelm@7134
   431
\begin{rail}
wenzelm@7134
   432
  'fix' (var +) comment?
wenzelm@7134
   433
  ;
wenzelm@7134
   434
  ('assume' | 'presume') thmdecl? (proppat +) comment?
wenzelm@7134
   435
  ;
wenzelm@7134
   436
  'def' thmdecl? var '==' termpat comment?
wenzelm@7134
   437
  ;
wenzelm@7134
   438
  'let' ((term + 'as') '=' term comment? + 'and')
wenzelm@7134
   439
  ;
wenzelm@7134
   440
wenzelm@7134
   441
  var: name ('::' type)?
wenzelm@7134
   442
  ;
wenzelm@7134
   443
\end{rail}
wenzelm@7134
   444
wenzelm@7167
   445
\begin{descr}
wenzelm@7167
   446
\item [$\FIX{x}$] FIXME
wenzelm@7167
   447
\item [$\ASSUME{a}{\Phi}$ and $\PRESUME{a}{\Phi}$] FIXME
wenzelm@7167
   448
\item [$\DEF{a}{x \equiv t}$] FIXME
wenzelm@7167
   449
\item [$\LET{\vec p = \vec t}$] FIXME
wenzelm@7167
   450
\end{descr}
wenzelm@7167
   451
wenzelm@7167
   452
wenzelm@7167
   453
\subsection{Facts and forward chaining}
wenzelm@7167
   454
wenzelm@7167
   455
FIXME
wenzelm@7167
   456
wenzelm@7167
   457
\indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
wenzelm@7167
   458
\begin{matharray}{rcl}
wenzelm@7167
   459
  \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7167
   460
  \isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@7167
   461
  \isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@7167
   462
  \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@7167
   463
\end{matharray}
wenzelm@7167
   464
wenzelm@7167
   465
\begin{rail}
wenzelm@7167
   466
  'note' thmdef? thmrefs comment?
wenzelm@7167
   467
  ;
wenzelm@7167
   468
  'then' comment?
wenzelm@7167
   469
  ;
wenzelm@7167
   470
  ('from' | 'with') thmrefs comment?
wenzelm@7167
   471
  ;
wenzelm@7167
   472
\end{rail}
wenzelm@7167
   473
wenzelm@7167
   474
\begin{descr}
wenzelm@7167
   475
\item [$\NOTE{a}{bs}$] recalls existing facts $bs$, binding the result as $a$
wenzelm@7167
   476
  (and $facts$).  Note that attributes may be involved as well, both on the
wenzelm@7167
   477
  left and right hand side.
wenzelm@7167
   478
\item [$\THEN$] indicates forward chaining by the current facts in order to
wenzelm@7167
   479
  establish the subsequent goal.  The initial proof method invoked to solve
wenzelm@7167
   480
  that will be offered these facts to do anything ``appropriate'' (see also
wenzelm@7167
   481
  \S\ref{sec:proof-steps}).  For example, method $rule$ (see
wenzelm@7167
   482
  \S\ref{sec:pure-meth}) would do an elimination rather than an introduction.
wenzelm@7167
   483
\item [$\FROM{bs}$] abbreviates $\NOTE{facts}{bs}~\THEN$; also note that
wenzelm@7167
   484
  $\THEN$ is equivalent to $\FROM{facts}$.
wenzelm@7167
   485
\item [$\WITH{bs}$] abbreviates $\FROM{bs~facts}$; thus the forward chaining
wenzelm@7167
   486
  is from earlier facts together with the current ones.
wenzelm@7167
   487
\end{descr}
wenzelm@7167
   488
wenzelm@7167
   489
wenzelm@7167
   490
\subsection{Goal statements}
wenzelm@7167
   491
wenzelm@7167
   492
Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$
wenzelm@7167
   493
and $\LEMMANAME$.  New local goals may be claimed within proof mode: four
wenzelm@7167
   494
variants indicate whether the result is meant to solve some pending goal and
wenzelm@7167
   495
whether forward chaining is employed.
wenzelm@7167
   496
wenzelm@7167
   497
\indexisarcmd{theorem}\indexisarcmd{lemma}
wenzelm@7167
   498
\indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
wenzelm@7167
   499
\begin{matharray}{rcl}
wenzelm@7167
   500
  \isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
wenzelm@7167
   501
  \isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
wenzelm@7167
   502
  \isarcmd{have} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm@7167
   503
  \isarcmd{show} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm@7167
   504
  \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm@7167
   505
  \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
wenzelm@7167
   506
\end{matharray}
wenzelm@7167
   507
wenzelm@7167
   508
\begin{rail}
wenzelm@7167
   509
  ('theorem' | 'lemma') goal
wenzelm@7167
   510
  ;
wenzelm@7167
   511
  ('have' | 'show' | 'hence' | 'thus') goal
wenzelm@7167
   512
  ;
wenzelm@7167
   513
wenzelm@7167
   514
  goal: thmdecl? proppat comment?
wenzelm@7167
   515
  ;
wenzelm@7167
   516
\end{rail}
wenzelm@7167
   517
wenzelm@7167
   518
\begin{descr}
wenzelm@7167
   519
\item [$\THEOREM{name}{\phi}$] enters proof mode with $\phi$ as main goal,
wenzelm@7167
   520
  eventually resulting in some theorem $\turn \phi$, which stored in the
wenzelm@7167
   521
  theory.
wenzelm@7167
   522
\item [$\LEMMANAME$] is similar to $\THEOREMNAME$, but tags the result as
wenzelm@7167
   523
  ``lemma''.
wenzelm@7167
   524
\item [$\HAVE{name}{\phi}$] claims a local goal, eventually resulting in a
wenzelm@7167
   525
  theorem with the current assumption context as hypotheses.
wenzelm@7167
   526
\item [$\SHOW{name}{\phi}$] same as $\HAVE{name}{\phi}$, but solves some
wenzelm@7167
   527
  pending goal with the result exported to the enclosing assumption context.
wenzelm@7167
   528
\item [$\HENCE{name}{\phi}$] abbreviates $\THEN~\HAVE{name}{\phi}$, i.e.\ 
wenzelm@7167
   529
  claims a local goal to be proven by forward chaining the current facts.
wenzelm@7167
   530
\item [$\THUS{name}{\phi}$] abbreviates $\THEN~\SHOW{name}{\phi}$.
wenzelm@7167
   531
\end{descr}
wenzelm@7167
   532
wenzelm@7167
   533
wenzelm@7167
   534
\subsection{Initial and terminal proof steps}\label{sec:proof-steps}
wenzelm@7167
   535
wenzelm@7167
   536
Arbitrary goal refinements via tactics is considered harmful.  Consequently
wenzelm@7167
   537
the Isar framework admits proof methods to be invoked in two places only.
wenzelm@7167
   538
\begin{enumerate}
wenzelm@7167
   539
\item An \emph{initial} refinement step (via $\PROOF{m@1}$) reduces a newly
wenzelm@7167
   540
  stated intermediate goal to a number of sub-goals that are to be solved
wenzelm@7167
   541
  subsequently.  Facts are passed to $m@1$ for forward chaining if so
wenzelm@7167
   542
  indicated by $proof(chain)$ mode.
wenzelm@7167
   543
  
wenzelm@7167
   544
\item A \emph{terminal} conclusion step (via $\QED{m@2}$)) solves any remaining
wenzelm@7167
   545
  pending goals completely.  No facts are passed to $m@2$.
wenzelm@7167
   546
\end{enumerate}
wenzelm@7167
   547
wenzelm@7167
   548
The only other proper way to affect pending goals is by $\SHOWNAME$, which
wenzelm@7167
   549
involves an explicit statement of what is solved.
wenzelm@7167
   550
wenzelm@7167
   551
Also note that initial proof methods should either solve the goal completely,
wenzelm@7167
   552
or constitute some well-understood deterministic reduction to new sub-goals.
wenzelm@7167
   553
Arbitrary automatic proof tools that are prone leave a large number of badly
wenzelm@7167
   554
structured sub-goals are no help in continuing the proof document in any
wenzelm@7167
   555
intelligible way.  A much better technique is to $\SHOWNAME$ some non-trivial
wenzelm@7167
   556
reduction as an explicit rule, which is solved completely by some automated
wenzelm@7167
   557
method, and then applied to some pending goal.
wenzelm@7167
   558
wenzelm@7167
   559
\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
wenzelm@7167
   560
\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
wenzelm@7167
   561
\begin{matharray}{rcl}
wenzelm@7167
   562
  \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
wenzelm@7167
   563
  \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
wenzelm@7167
   564
  \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm@7167
   565
  \isarcmd{..} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm@7167
   566
  \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm@7167
   567
  \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
wenzelm@7167
   568
\end{matharray}
wenzelm@7167
   569
wenzelm@7167
   570
\begin{rail}
wenzelm@7167
   571
  'proof' interest? meth? comment?
wenzelm@7167
   572
  ;
wenzelm@7167
   573
  'qed' meth? comment?
wenzelm@7167
   574
  ;
wenzelm@7167
   575
  'by' meth meth? comment?
wenzelm@7167
   576
  ;
wenzelm@7167
   577
  ('.' | '..' | 'sorry') comment?
wenzelm@7167
   578
  ;
wenzelm@7167
   579
wenzelm@7167
   580
  meth: method interest?
wenzelm@7167
   581
  ;
wenzelm@7167
   582
\end{rail}
wenzelm@7167
   583
wenzelm@7167
   584
\begin{descr}
wenzelm@7167
   585
\item [$\PROOF{m}$] refines the pending goal by proof method $m$ (facts for
wenzelm@7167
   586
  forward chaining are passed if indicated by $proof(chain)$).
wenzelm@7167
   587
\item [$\QED{m}$] refines any remaining goals by proof method $m$ and
wenzelm@7167
   588
  concludes the sub-proof.  If the goal had been $\SHOWNAME$, some pending
wenzelm@7167
   589
  sub-goal is solved as well by the rule resulting from the result exported to
wenzelm@7167
   590
  the enclosing goal context.
wenzelm@7167
   591
  
wenzelm@7167
   592
  Thus $\QEDNAME$ may fail for two reasons: either $m$ fails to solve all
wenzelm@7167
   593
  remaining goals completely, or the resulting rule does not resolve with any
wenzelm@7167
   594
  enclosing goal.  Debugging such a situation might involve temporarily
wenzelm@7167
   595
  changing $\SHOWNAME$ into $\HAVENAME$, or weakening the local context by
wenzelm@7167
   596
  replacing $\ASSUMENAME$ by $\PRESUMENAME$.
wenzelm@7167
   597
\item [$\BY{m@1}{m@2}$] is a \emph{terminal proof}; it abbreviates
wenzelm@7167
   598
  $\PROOF{m@1}~\QED{m@2}$, automatically backtracking across both methods.
wenzelm@7167
   599
  
wenzelm@7167
   600
  Debugging an unsuccessful $\BY{m@1}{m@2}$ commands might be done by simply
wenzelm@7167
   601
  expanding the abbreviation by hand; usually $\PROOF{m@1}$ is already
wenzelm@7167
   602
  sufficient to see what goes wrong.
wenzelm@7167
   603
\item [$\isarkeyword{..}$] is a \emph{default proof}; it abbreviates
wenzelm@7167
   604
  $\BY{default}{finish}$, where method $default$ usually applies a single
wenzelm@7167
   605
  elimination or introduction rule according to the topmost symbol, and
wenzelm@7167
   606
  $finish$ solves all goals by assumption.
wenzelm@7167
   607
\item [$\isarkeyword{.}$] is a \emph{trivial proof}, it abbreviates
wenzelm@7167
   608
  $\BY{-}{finish}$, where method $-$ does nothing except inserting any facts
wenzelm@7167
   609
  into the proof state.
wenzelm@7167
   610
\item [$\isarkeyword{sorry}$] is a \emph{fake proof}; provided that
wenzelm@7167
   611
  \texttt{quick_and_dirty} is enabled, $\isarkeyword{sorry}$ pretends to solve
wenzelm@7167
   612
  the goal without much ado.  Of course, the result is a fake theorem only,
wenzelm@7167
   613
  involving some oracle in its internal derivation object.  Note that this is
wenzelm@7167
   614
  indicated as \texttt{[!]} in the printed result.  The main application of
wenzelm@7167
   615
  $\isarkeyword{sorry}$ is to support top-down proof development.
wenzelm@7167
   616
\end{descr}
wenzelm@7134
   617
wenzelm@7134
   618
wenzelm@7134
   619
\subsection{Block structure}
wenzelm@7134
   620
wenzelm@7167
   621
While Isar is inherently block-structured, opening and closing blocks is
wenzelm@7167
   622
mostly handled rather casually, with little explicit user-intervention.  Any
wenzelm@7167
   623
local goal statement automatically opens \emph{two} blocks, which are closed
wenzelm@7167
   624
again when concluding the sub-proof (by $\QEDNAME$ etc.).  Sections of
wenzelm@7167
   625
different context within a sub-proof are typically switched via
wenzelm@7167
   626
$\isarkeyword{next}$, which is just a single block-close followed by
wenzelm@7167
   627
block-open again.  Thus the effect of $\isarkeyword{next}$ is to reset the
wenzelm@7167
   628
proof context to that of the head of the sub-proof.  Note that there is no
wenzelm@7167
   629
goal focus involved!
wenzelm@7167
   630
wenzelm@7167
   631
There are explicit block parentheses as well.  These typically achieve a
wenzelm@7167
   632
strong forward style of reasoning.
wenzelm@7167
   633
wenzelm@7134
   634
\indexisarcmd{next}\indexisarcmd{\{\{}\indexisarcmd{\}\}}
wenzelm@7134
   635
\begin{matharray}{rcl}
wenzelm@7134
   636
  \isarcmd{next} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   637
  \isarcmd{\{\{} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   638
  \isarcmd{\}\}} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   639
\end{matharray}
wenzelm@7134
   640
wenzelm@7167
   641
\begin{descr}
wenzelm@7167
   642
\item [$\isarkeyword{next}$] switches to a fresh block within a sub-proof,
wenzelm@7167
   643
  resetting the context to the initial one.
wenzelm@7167
   644
\item [$\isarkeyword{\{\{}$ and $\isarkeyword{\}\}}$] explicitly open and
wenzelm@7167
   645
  close blocks.  Any current facts pass through $\isarkeyword{\{\{}$
wenzelm@7167
   646
  unchanged, while $\isarkeyword{\}\}}$ causes them to be \emph{exported} into
wenzelm@7167
   647
  the enclosing context.  Thus fixed variables are generalized, assumptions
wenzelm@7167
   648
  discharged, and local definitions eliminated.
wenzelm@7167
   649
\end{descr}
wenzelm@7134
   650
wenzelm@7134
   651
\subsection{Calculational proof}
wenzelm@7134
   652
wenzelm@7134
   653
\indexisarcmd{also}\indexisarcmd{finally}
wenzelm@7134
   654
\begin{matharray}{rcl}
wenzelm@7134
   655
  \isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\
wenzelm@7134
   656
  \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
wenzelm@7134
   657
\end{matharray}
wenzelm@7134
   658
wenzelm@7134
   659
\begin{rail}
wenzelm@7134
   660
  ('also' | 'finally') transrules? comment?
wenzelm@7134
   661
  ;
wenzelm@7134
   662
wenzelm@7134
   663
  transrules: '(' thmrefs ')' interest?
wenzelm@7134
   664
  ;
wenzelm@7134
   665
\end{rail}
wenzelm@7134
   666
wenzelm@7167
   667
\begin{descr}
wenzelm@7134
   668
\item [$ $] FIXME
wenzelm@7167
   669
\end{descr}
wenzelm@7134
   670
wenzelm@7134
   671
wenzelm@7134
   672
wenzelm@7134
   673
\subsection{Improper proof steps}
wenzelm@7134
   674
wenzelm@7167
   675
The following commands emulate tactic scripts to some extent.  While these are
wenzelm@7167
   676
anathema for writing proper Isar proof documents, they might come in handy for
wenzelm@7167
   677
exploring and debugging.
wenzelm@7167
   678
wenzelm@7167
   679
\indexisarcmd{apply}\indexisarcmd{then-apply}\indexisarcmd{back}
wenzelm@7134
   680
\begin{matharray}{rcl}
wenzelm@7134
   681
  \isarcmd{apply}^* & : & \isartrans{proof}{proof} \\
wenzelm@7134
   682
  \isarcmd{then_apply}^* & : & \isartrans{proof}{proof} \\
wenzelm@7134
   683
  \isarcmd{back}^* & : & \isartrans{proof}{proof} \\
wenzelm@7134
   684
\end{matharray}
wenzelm@7134
   685
wenzelm@7134
   686
\railalias{thenapply}{then\_apply}
wenzelm@7134
   687
\railterm{thenapply}
wenzelm@7134
   688
wenzelm@7134
   689
\begin{rail}
wenzelm@7134
   690
  'apply' method
wenzelm@7134
   691
  ;
wenzelm@7134
   692
  thenapply method
wenzelm@7134
   693
  ;
wenzelm@7134
   694
  'back'
wenzelm@7134
   695
  ;
wenzelm@7134
   696
\end{rail}
wenzelm@7134
   697
wenzelm@7167
   698
\begin{descr}
wenzelm@7134
   699
\item [$ $] FIXME
wenzelm@7167
   700
\end{descr}
wenzelm@7134
   701
wenzelm@7134
   702
wenzelm@7134
   703
\section{Other commands}
wenzelm@7134
   704
wenzelm@7134
   705
\subsection{Diagnostics}
wenzelm@7134
   706
wenzelm@7134
   707
\indexisarcmd{typ}\indexisarcmd{term}\indexisarcmd{prop}\indexisarcmd{thm}
wenzelm@7134
   708
\begin{matharray}{rcl}
wenzelm@7134
   709
  \isarcmd{typ} & : & \isarkeep{theory~|~proof} \\
wenzelm@7134
   710
  \isarcmd{term} & : & \isarkeep{theory~|~proof} \\
wenzelm@7134
   711
  \isarcmd{prop} & : & \isarkeep{theory~|~proof} \\
wenzelm@7134
   712
  \isarcmd{thm} & : & \isarkeep{theory~|~proof} \\
wenzelm@7134
   713
\end{matharray}
wenzelm@7134
   714
wenzelm@7134
   715
\begin{rail}
wenzelm@7134
   716
  'typ' type
wenzelm@7134
   717
  ;
wenzelm@7134
   718
  'term' term
wenzelm@7134
   719
  ;
wenzelm@7134
   720
  'prop' prop
wenzelm@7134
   721
  ;
wenzelm@7134
   722
  'thm' thmrefs
wenzelm@7134
   723
  ;
wenzelm@7134
   724
\end{rail}
wenzelm@7134
   725
wenzelm@7167
   726
\begin{descr}
wenzelm@7134
   727
\item [$\isarkeyword{typ}~\tau$, $\isarkeyword{term}~t$,
wenzelm@7134
   728
  $\isarkeyword{prop}~\phi$] read and print types / terms / propositions
wenzelm@7134
   729
  according to the current theory or proof context.
wenzelm@7134
   730
\item [$\isarkeyword{thm}~thms$] retrieves lists of theorems from the current
wenzelm@7134
   731
  theory or proof context.  Note that any attributes included in the theorem
wenzelm@7134
   732
  specifications are applied to a temporary proof context derived from the
wenzelm@7134
   733
  current theory or proof; the resulting context is discarded.
wenzelm@7167
   734
\end{descr}
wenzelm@7134
   735
wenzelm@7134
   736
wenzelm@7134
   737
\subsection{System operations}
wenzelm@7134
   738
wenzelm@7167
   739
\indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
wenzelm@7167
   740
\indexisarcmd{update-thy}\indexisarcmd{update-thy-only}
wenzelm@7134
   741
\begin{matharray}{rcl}
wenzelm@7134
   742
  \isarcmd{cd} & : & \isarkeep{\cdot} \\
wenzelm@7134
   743
  \isarcmd{pwd} & : & \isarkeep{\cdot} \\
wenzelm@7134
   744
  \isarcmd{use_thy} & : & \isarkeep{\cdot} \\
wenzelm@7134
   745
  \isarcmd{use_thy_only} & : & \isarkeep{\cdot} \\
wenzelm@7134
   746
  \isarcmd{update_thy} & : & \isarkeep{\cdot} \\
wenzelm@7134
   747
  \isarcmd{update_thy_only} & : & \isarkeep{\cdot} \\
wenzelm@7134
   748
\end{matharray}
wenzelm@7134
   749
wenzelm@7167
   750
\begin{descr}
wenzelm@7134
   751
\item [$\isarkeyword{cd}~name$] changes the current directory of the Isabelle
wenzelm@7134
   752
  process.
wenzelm@7134
   753
\item [$\isarkeyword{pwd}~$] prints the current working directory.
wenzelm@7134
   754
\item [$\isarkeyword{use_thy}~name$, $\isarkeyword{use_thy_only}~name$,
wenzelm@7134
   755
  $\isarkeyword{update_thy}~name$, $\isarkeyword{update_thy_only}~name$] load
wenzelm@7134
   756
  theory files.  These commands are exactly the same as the corresponding ML
wenzelm@7134
   757
  functions (see also \cite[\S1 and \S6]{isabelle-ref}).
wenzelm@7167
   758
\end{descr}
wenzelm@7134
   759
wenzelm@7134
   760
wenzelm@7046
   761
%%% Local Variables: 
wenzelm@7046
   762
%%% mode: latex
wenzelm@7046
   763
%%% TeX-master: "isar-ref"
wenzelm@7046
   764
%%% End: