doc-src/IsarRef/pure.tex
changeset 12621 48cafea0684b
parent 12618 43a97a2155d0
child 12879 8e1cae1de136
equal deleted inserted replaced
12620:4e6626725e21 12621:48cafea0684b
     3 
     3 
     4 Subsequently, we introduce the main part of Pure Isar theory and proof
     4 Subsequently, we introduce the main part of Pure Isar theory and proof
     5 commands, together with fundamental proof methods and attributes.
     5 commands, together with fundamental proof methods and attributes.
     6 Chapter~\ref{ch:gen-tools} describes further Isar elements provided by generic
     6 Chapter~\ref{ch:gen-tools} describes further Isar elements provided by generic
     7 tools and packages (such as the Simplifier) that are either part of Pure
     7 tools and packages (such as the Simplifier) that are either part of Pure
     8 Isabelle or pre-installed by most object logics.  Chapter~\ref{ch:hol-tools}
     8 Isabelle or pre-installed by most object logics.  Chapter~\ref{ch:logics}
     9 refers to actual object-logic specific elements of Isabelle/HOL.
     9 refers to object-logic specific elements (mainly for HOL and ZF).
    10 
    10 
    11 \medskip
    11 \medskip
    12 
    12 
    13 Isar commands may be either \emph{proper} document constructors, or
    13 Isar commands may be either \emph{proper} document constructors, or
    14 \emph{improper commands}.  Some proof methods and attributes introduced later
    14 \emph{improper commands}.  Some proof methods and attributes introduced later
    15 are classified as improper as well.  Improper Isar language elements, which
    15 are classified as improper as well.  Improper Isar language elements, which
    16 are subsequently marked by ``$^*$'', are often helpful when developing proof
    16 are subsequently marked by ``$^*$'', are often helpful when developing proof
    17 documents, while their use is discouraged for the final outcome.  Typical
    17 documents, while their use is discouraged for the final outcome.  Typical
    18 examples are diagnostic commands that print terms or theorems according to the
    18 examples are diagnostic commands that print terms or theorems according to the
    19 current context; other commands even emulate old-style tactical theorem
    19 current context; other commands emulate old-style tactical theorem proving.
    20 proving.
    20 
    21 
    21 
    22 
    22 \section{Theory commands}
    23 \section{Theory specification commands}
       
    24 
    23 
    25 \subsection{Defining theories}\label{sec:begin-thy}
    24 \subsection{Defining theories}\label{sec:begin-thy}
    26 
    25 
    27 \indexisarcmd{header}\indexisarcmd{theory}\indexisarcmd{end}\indexisarcmd{context}
    26 \indexisarcmd{header}\indexisarcmd{theory}\indexisarcmd{context}\indexisarcmd{end}
    28 \begin{matharray}{rcl}
    27 \begin{matharray}{rcl}
    29   \isarcmd{header} & : & \isarkeep{toplevel} \\
    28   \isarcmd{header} & : & \isarkeep{toplevel} \\
    30   \isarcmd{theory} & : & \isartrans{toplevel}{theory} \\
    29   \isarcmd{theory} & : & \isartrans{toplevel}{theory} \\
    31   \isarcmd{context}^* & : & \isartrans{toplevel}{theory} \\
    30   \isarcmd{context}^* & : & \isartrans{toplevel}{theory} \\
    32   \isarcmd{end} & : & \isartrans{theory}{toplevel} \\
    31   \isarcmd{end} & : & \isartrans{theory}{toplevel} \\
    36 interactively.  Both theory-level specifications and proofs are handled
    35 interactively.  Both theory-level specifications and proofs are handled
    37 uniformly --- occasionally definitional mechanisms even require some explicit
    36 uniformly --- occasionally definitional mechanisms even require some explicit
    38 proof as well.  In contrast, ``old-style'' Isabelle theories support batch
    37 proof as well.  In contrast, ``old-style'' Isabelle theories support batch
    39 processing only, with the proof scripts collected in separate ML files.
    38 processing only, with the proof scripts collected in separate ML files.
    40 
    39 
    41 The first actual command of any theory has to be $\THEORY$, starting a new
    40 The first ``real'' command of any theory has to be $\THEORY$, which starts a
    42 theory based on the merge of existing ones.  Just preceding $\THEORY$, there
    41 new theory based on the merge of existing ones.  Just preceding $\THEORY$,
    43 may be an optional $\isarkeyword{header}$ declaration, which is relevant to
    42 there may be an optional $\isarkeyword{header}$ declaration, which is relevant
    44 document preparation only; it acts very much like a special pre-theory markup
    43 to document preparation only; it acts very much like a special pre-theory
    45 command (cf.\ \S\ref{sec:markup-thy} and \S\ref{sec:markup-thy}).  The theory
    44 markup command (cf.\ \S\ref{sec:markup-thy} and \S\ref{sec:markup-thy}).  The
    46 context may be also changed by $\CONTEXT$ without creating a new theory.  In
    45 $\END$ commands concludes a theory development; it has to be the very last
    47 both cases, $\END$ concludes the theory development; it has to be the very
    46 command of any theory file to loaded in batch-mode.  The theory context may be
    48 last command of any theory file.
    47 also changed interactively by $\CONTEXT$ without creating a new theory.
    49 
    48 
    50 \begin{rail}
    49 \begin{rail}
    51   'header' text
    50   'header' text
    52   ;
    51   ;
    53   'theory' name '=' (name + '+') filespecs? ':'
    52   'theory' name '=' (name + '+') filespecs? ':'
    54   ;
    53   ;
    55   'context' name
    54   'context' name
    56   ;
    55   ;
    57   'end'
       
    58   ;;
       
    59 
    56 
    60   filespecs: 'files' ((name | parname) +);
    57   filespecs: 'files' ((name | parname) +);
    61 \end{rail}
    58 \end{rail}
    62 
    59 
    63 \begin{descr}
    60 \begin{descr}
    65   the formal beginning of a theory.  In actual document preparation the
    62   the formal beginning of a theory.  In actual document preparation the
    66   corresponding {\LaTeX} macro \verb,\isamarkupheader, may be redefined to
    63   corresponding {\LaTeX} macro \verb,\isamarkupheader, may be redefined to
    67   produce chapter or section headings.  See also \S\ref{sec:markup-thy} and
    64   produce chapter or section headings.  See also \S\ref{sec:markup-thy} and
    68   \S\ref{sec:markup-prf} for further markup commands.
    65   \S\ref{sec:markup-prf} for further markup commands.
    69   
    66   
    70 \item [$\THEORY~A = B@1 + \cdots + B@n\colon$] commences a new theory $A$
    67 \item [$\THEORY~A = B@1 + \cdots + B@n\colon$] starts a new theory $A$ based
    71   based on existing ones $B@1 + \cdots + B@n$.  Isabelle's theory loader
    68   on the merge of existing theories $B@1, \dots, B@n$.
    72   system ensures that any of the base theories are properly loaded (and fully
    69   
    73   up-to-date when $\THEORY$ is executed interactively).  The optional
    70   Due to inclusion of several ancestors, the overall theory structure emerging
    74   $\isarkeyword{files}$ specification declares additional dependencies on ML
    71   in an Isabelle session forms a directed acyclic graph (DAG).  Isabelle's
    75   files.  Unless put in parentheses, any file will be loaded immediately via
    72   theory loader ensures that the sources contributing to the development graph
    76   $\isarcmd{use}$ (see also \S\ref{sec:ML}).  The optional ML file
    73   are always up-to-date.  Changed files are automatically reloaded when
    77   \texttt{$A$.ML} that may be associated with any theory should \emph{not} be
    74   processing theory headers interactively; batch-mode explicitly distinguishes
    78   included in $\isarkeyword{files}$, though.
    75   \verb,update_thy, from \verb,use_thy,, see also \cite{isabelle-ref}.
       
    76   
       
    77   The optional $\isarkeyword{files}$ specification declares additional
       
    78   dependencies on ML files.  Files will be loaded immediately, unless the name
       
    79   is put in parentheses, which merely documents the dependency to be resolved
       
    80   later in the text (typically via explicit $\isarcmd{use}$ in the body text,
       
    81   see \S\ref{sec:ML}).  In reminiscence of the old-style theory system of
       
    82   Isabelle, \texttt{$A$.thy} may be also accompanied by an additional file
       
    83   \texttt{$A$.ML} consisting of ML code that is executed in the context of the
       
    84   \emph{finished} theory $A$.  That file should not be included in the
       
    85   $\isarkeyword{files}$ dependency declaration, though.
    79   
    86   
    80 \item [$\CONTEXT~B$] enters an existing theory context, basically in read-only
    87 \item [$\CONTEXT~B$] enters an existing theory context, basically in read-only
    81   mode, so only a limited set of commands may be performed without destroying
    88   mode, so only a limited set of commands may be performed without destroying
    82   the theory.  Just as for $\THEORY$, the theory loader ensures that $B$ is
    89   the theory.  Just as for $\THEORY$, the theory loader ensures that $B$ is
    83   loaded and up-to-date.
    90   loaded and up-to-date.
    84   
    91   
       
    92   This command is occasionally useful for quick interactive experiments;
       
    93   normally one should always commence a new context via $\THEORY$.
       
    94   
    85 \item [$\END$] concludes the current theory definition or context switch.
    95 \item [$\END$] concludes the current theory definition or context switch.
    86 Note that this command cannot be undone, but the whole theory definition has
    96   Note that this command cannot be undone, but the whole theory definition has
    87 to be retracted.
    97   to be retracted.
    88 \end{descr}
    98 
    89 
    99 \end{descr}
    90 
   100 
    91 \subsection{Theory markup commands}\label{sec:markup-thy}
   101 
       
   102 \subsection{Markup commands}\label{sec:markup-thy}
    92 
   103 
    93 \indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
   104 \indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
    94 \indexisarcmd{subsubsection}\indexisarcmd{text}\indexisarcmd{text-raw}
   105 \indexisarcmd{subsubsection}\indexisarcmd{text}\indexisarcmd{text-raw}
    95 \begin{matharray}{rcl}
   106 \begin{matharray}{rcl}
    96   \isarcmd{chapter} & : & \isartrans{theory}{theory} \\
   107   \isarcmd{chapter} & : & \isartrans{theory}{theory} \\
   142 
   153 
   143 
   154 
   144 \subsection{Type classes and sorts}\label{sec:classes}
   155 \subsection{Type classes and sorts}\label{sec:classes}
   145 
   156 
   146 \indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
   157 \indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
   147 \begin{matharray}{rcl}
   158 \begin{matharray}{rcll}
   148   \isarcmd{classes} & : & \isartrans{theory}{theory} \\
   159   \isarcmd{classes} & : & \isartrans{theory}{theory} \\
   149   \isarcmd{classrel} & : & \isartrans{theory}{theory} \\
   160   \isarcmd{classrel} & : & \isartrans{theory}{theory} & (axiomatic!) \\
   150   \isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
   161   \isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
   151 \end{matharray}
   162 \end{matharray}
   152 
   163 
   153 \begin{rail}
   164 \begin{rail}
   154   'classes' (classdecl comment? +)
   165   'classes' (classdecl comment? +)
   167   between existing classes $c@1$ and $c@2$.  This is done axiomatically!  The
   178   between existing classes $c@1$ and $c@2$.  This is done axiomatically!  The
   168   $\INSTANCE$ command (see \S\ref{sec:axclass}) provides a way to introduce
   179   $\INSTANCE$ command (see \S\ref{sec:axclass}) provides a way to introduce
   169   proven class relations.
   180   proven class relations.
   170 \item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
   181 \item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
   171   any type variables given without sort constraints.  Usually, the default
   182   any type variables given without sort constraints.  Usually, the default
   172   sort would be only changed when defining new object-logics.
   183   sort would be only changed when defining a new object-logic.
   173 \end{descr}
   184 \end{descr}
   174 
   185 
   175 
   186 
   176 \subsection{Primitive types and type abbreviations}\label{sec:types-pure}
   187 \subsection{Primitive types and type abbreviations}\label{sec:types-pure}
   177 
   188 
   178 \indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
   189 \indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
   179 \begin{matharray}{rcl}
   190 \begin{matharray}{rcll}
   180   \isarcmd{types} & : & \isartrans{theory}{theory} \\
   191   \isarcmd{types} & : & \isartrans{theory}{theory} \\
   181   \isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
   192   \isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
   182   \isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
   193   \isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
   183   \isarcmd{arities} & : & \isartrans{theory}{theory} \\
   194   \isarcmd{arities} & : & \isartrans{theory}{theory} & (axiomatic!) \\
   184 \end{matharray}
   195 \end{matharray}
   185 
   196 
   186 \begin{rail}
   197 \begin{rail}
   187   'types' (typespec '=' type infix? comment? +)
   198   'types' (typespec '=' type infix? comment? +)
   188   ;
   199   ;
   245   
   256   
   246   The $overloaded$ option declares definitions to be potentially overloaded.
   257   The $overloaded$ option declares definitions to be potentially overloaded.
   247   Unless this option is given, a warning message would be issued for any
   258   Unless this option is given, a warning message would be issued for any
   248   definitional equation with a more special type than that of the
   259   definitional equation with a more special type than that of the
   249   corresponding constant declaration.
   260   corresponding constant declaration.
   250 
   261   
   251 \item [$\isarkeyword{constdefs}~c::\sigma~eqn$] combines declarations and
   262 \item [$\CONSTDEFS~c::\sigma~eqn$] combines declarations and definitions of
   252   definitions of constants, using the canonical name $c_def$ for the
   263   constants, using the canonical name $c_def$ for the definitional axiom.
   253   definitional axiom.
       
   254 \end{descr}
   264 \end{descr}
   255 
   265 
   256 
   266 
   257 \subsection{Syntax and translations}\label{sec:syn-trans}
   267 \subsection{Syntax and translations}\label{sec:syn-trans}
   258 
   268 
   298 
   308 
   299 
   309 
   300 \subsection{Axioms and theorems}\label{sec:axms-thms}
   310 \subsection{Axioms and theorems}\label{sec:axms-thms}
   301 
   311 
   302 \indexisarcmd{axioms}\indexisarcmd{lemmas}\indexisarcmd{theorems}
   312 \indexisarcmd{axioms}\indexisarcmd{lemmas}\indexisarcmd{theorems}
   303 \begin{matharray}{rcl}
   313 \begin{matharray}{rcll}
   304   \isarcmd{axioms} & : & \isartrans{theory}{theory} \\
   314   \isarcmd{axioms} & : & \isartrans{theory}{theory} & (axiomatic!) \\
   305   \isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
   315   \isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
   306   \isarcmd{theorems} & : & \isartrans{theory}{theory} \\
   316   \isarcmd{theorems} & : & \isartrans{theory}{theory} \\
   307 \end{matharray}
   317 \end{matharray}
   308 
   318 
   309 \begin{rail}
   319 \begin{rail}
   364   
   374   
   365 \item [$\isarkeyword{hide}~space~names$] removes declarations from a given
   375 \item [$\isarkeyword{hide}~space~names$] removes declarations from a given
   366   name space (which may be $class$, $type$, or $const$).  Hidden objects
   376   name space (which may be $class$, $type$, or $const$).  Hidden objects
   367   remain valid within the logic, but are inaccessible from user input.  In
   377   remain valid within the logic, but are inaccessible from user input.  In
   368   output, the special qualifier ``$\mathord?\mathord?$'' is prefixed to the
   378   output, the special qualifier ``$\mathord?\mathord?$'' is prefixed to the
   369   full internal name.
   379   full internal name.  Unqualified (global) names may not be hidden.
   370   
       
   371   Unqualified (global) names may not be hidden deliberately.
       
   372 \end{descr}
   380 \end{descr}
   373 
   381 
   374 
   382 
   375 \subsection{Incorporating ML code}\label{sec:ML}
   383 \subsection{Incorporating ML code}\label{sec:ML}
   376 
   384 
   548   $proof(prove)$: existing facts (i.e.\ the contents of the special ``$this$''
   556   $proof(prove)$: existing facts (i.e.\ the contents of the special ``$this$''
   549   register) have been just picked up in order to be used when refining the
   557   register) have been just picked up in order to be used when refining the
   550   goal claimed next.
   558   goal claimed next.
   551 \end{descr}
   559 \end{descr}
   552 
   560 
   553 %FIXME diagram?
   561 The proof mode indicator may be read as a verb telling the writer what kind of
   554 
   562 operation may be performed next.  The corresponding typings of proof commands
   555 \subsection{Proof markup commands}\label{sec:markup-prf}
   563 restricts the shape of well-formed proof texts to particular command
       
   564 sequences.  So dynamic arrangements of commands eventually turn out as static
       
   565 texts.  Appendix~\ref{ap:refcard} gives a simplified grammar of the overall
       
   566 (extensible) language emerging that way.
       
   567 
       
   568 
       
   569 \subsection{Markup commands}\label{sec:markup-prf}
   556 
   570 
   557 \indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsubsect}
   571 \indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsubsect}
   558 \indexisarcmd{txt}\indexisarcmd{txt-raw}
   572 \indexisarcmd{txt}\indexisarcmd{txt-raw}
   559 \begin{matharray}{rcl}
   573 \begin{matharray}{rcl}
   560   \isarcmd{sect} & : & \isartrans{proof}{proof} \\
   574   \isarcmd{sect} & : & \isartrans{proof}{proof} \\
   574   ('sect' | 'subsect' | 'subsubsect' | 'txt' | txtraw) text
   588   ('sect' | 'subsect' | 'subsubsect' | 'txt' | txtraw) text
   575   ;
   589   ;
   576 \end{rail}
   590 \end{rail}
   577 
   591 
   578 
   592 
   579 \subsection{Proof context}\label{sec:proof-context}
   593 \subsection{Context elements}\label{sec:proof-context}
   580 
   594 
   581 \indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}
   595 \indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}
   582 \begin{matharray}{rcl}
   596 \begin{matharray}{rcl}
   583   \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
   597   \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
   584   \isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
   598   \isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
   697 bound in Isabelle/Pure as ``\texttt{_}''
   711 bound in Isabelle/Pure as ``\texttt{_}''
   698 (underscore).\indexisarthm{_@\texttt{_}}
   712 (underscore).\indexisarthm{_@\texttt{_}}
   699 
   713 
   700 Forward chaining with an empty list of theorems is the same as not chaining.
   714 Forward chaining with an empty list of theorems is the same as not chaining.
   701 Thus $\FROM{nothing}$ has no effect apart from entering $prove(chain)$ mode,
   715 Thus $\FROM{nothing}$ has no effect apart from entering $prove(chain)$ mode,
   702 since $nothing$\indexisarthm{nothing} is bound to the empty list of facts.
   716 since $nothing$\indexisarthm{nothing} is bound to the empty list of theorems.
   703 
   717 
   704 
   718 
   705 \subsection{Goal statements}
   719 \subsection{Goal statements}
   706 
   720 
   707 \indexisarcmd{lemma}\indexisarcmd{theorem}\indexisarcmd{corollary}
   721 \indexisarcmd{lemma}\indexisarcmd{theorem}\indexisarcmd{corollary}
   714   \isarcmd{show} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
   728   \isarcmd{show} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
   715   \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
   729   \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
   716   \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
   730   \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
   717 \end{matharray}
   731 \end{matharray}
   718 
   732 
   719 From a theory context, proof mode is entered from theory mode by initial goal
   733 From a theory context, proof mode is entered by an initial goal command such
   720 commands $\LEMMANAME$, $\THEOREMNAME$, and $\COROLLARYNAME$.  Within a proof,
   734 as $\LEMMANAME$, $\THEOREMNAME$, $\COROLLARYNAME$.  Within a proof, new claims
   721 new claims may be introduced locally as well; four variants are available,
   735 may be introduced locally as well; four variants are available here to
   722 indicating whether the result is meant to solve some pending goal or whether
   736 indicate whether forward chaining of facts should be performed initially (via
   723 forward chaining is indicated.
   737 $\THEN$), and whether the emerging result is meant to solve some pending goal.
   724 
   738 
   725 Goals may consist of multiple statements, resulting in a list of facts
   739 Goals may consist of multiple statements, resulting in a list of facts
   726 eventually.  A pending multi-goal is internally represented as a meta-level
   740 eventually.  A pending multi-goal is internally represented as a meta-level
   727 conjunction (printed as \verb,&&,), which is automatically split into the
   741 conjunction (printed as \verb,&&,), which is automatically split into the
   728 corresponding number of sub-goals prior to any initial method application, via
   742 corresponding number of sub-goals prior to any initial method application, via
   729 $\PROOFNAME$ (\S\ref{sec:proof-steps}) or $\APPLYNAME$
   743 $\PROOFNAME$ (\S\ref{sec:proof-steps}) or $\APPLYNAME$
   730 (\S\ref{sec:tactic-commands}).\footnote{Deviating from the latter principle,
   744 (\S\ref{sec:tactic-commands}).\footnote{Deviating from the latter principle,
   731   the $induct$ method covered in \S\ref{sec:cases-induct-meth} acts on
   745   the $induct$ method covered in \S\ref{sec:cases-induct-meth} acts on
   732   multiple claims simultaneously.}
   746   multiple claims simultaneously.}
   733 
   747 
   734 %FIXME define locale, context
   748 \begin{rail}
   735 
   749   ('lemma' | 'theorem' | 'corollary') goalprefix goal
   736 \begin{rail}
       
   737   ('lemma' | 'theorem' | 'corollary') locale context goal
       
   738   ;
   750   ;
   739   ('have' | 'show' | 'hence' | 'thus') goal
   751   ('have' | 'show' | 'hence' | 'thus') goal
   740   ;
   752   ;
   741 
   753 
   742   goal: (props comment? + 'and')
   754   goal: (props comment? + 'and')
       
   755   ;
       
   756 
       
   757   goalprefix: thmdecl? locale? context?
       
   758   ;
       
   759   locale: '(' 'in' name ')'
       
   760   ;
       
   761   context: '(' (contextelem +) ')'
   743   ;
   762   ;
   744 \end{rail}
   763 \end{rail}
   745 
   764 
   746 \begin{descr}
   765 \begin{descr}
   747 \item [$\LEMMA{a}{\vec\phi}$] enters proof mode with $\vec\phi$ as main goal,
   766 \item [$\LEMMA{a}{\vec\phi}$] enters proof mode with $\vec\phi$ as main goal,
   748   eventually resulting in some fact $\turn \vec\phi$ to be put back into the
   767   eventually resulting in some fact $\turn \vec\phi$ to be put back into the
   749   theory context, and optionally into the specified locale, cf.\ 
   768   theory context, and optionally into the specified locale, cf.\ 
   750   \S\ref{sec:locale}.  An additional \railnonterm{context} specification may
   769   \S\ref{sec:locale}.  An additional \railnonterm{context} specification may
   751   build an initial proof context for the subsequent claim; this may include
   770   build an initial proof context for the subsequent claim; this may include
   752   local definitions and syntax as well, see \S\ref{sec:locale} for more
   771   local definitions and syntax as well, see the definition of $contextelem$ in
   753   information.
   772   \S\ref{sec:locale}.
   754   
   773   
   755 \item [$\THEOREM{a}{\vec\phi}$ and $\COROLLARY{a}{\vec\phi}$] are essentially
   774 \item [$\THEOREM{a}{\vec\phi}$ and $\COROLLARY{a}{\vec\phi}$] are essentially
   756   the same as $\LEMMA{a}{\vec\phi}$, but the facts are internally marked as
   775   the same as $\LEMMA{a}{\vec\phi}$, but the facts are internally marked as
   757   being of a different kind.  This discrimination acts like a formal comment.
   776   being of a different kind.  This discrimination acts like a formal comment.
   758   
   777   
   830   
   849   
   831 \item A \emph{terminal} conclusion step $\QED{m@2}$ is intended to solve
   850 \item A \emph{terminal} conclusion step $\QED{m@2}$ is intended to solve
   832   remaining goals.  No facts are passed to $m@2$.
   851   remaining goals.  No facts are passed to $m@2$.
   833 \end{enumerate}
   852 \end{enumerate}
   834 
   853 
   835 The only other proper way to affect pending goals is by $\SHOWNAME$, which
   854 The only other proper way to affect pending goals in a proof body is by
   836 involves an explicit statement of what is to be solved.
   855 $\SHOWNAME$, which involves an explicit statement of what is to be solved
       
   856 eventually.  Thus we avoid the fundamental problem of unstructured tactic
       
   857 scripts that consist of numerous consecutive goal transformations, with
       
   858 invisible effects.
   837 
   859 
   838 \medskip
   860 \medskip
   839 
   861 
   840 Also note that initial proof methods should either solve the goal completely,
   862 As a general rule of thumb for good proof style, initial proof methods should
   841 or constitute some well-understood reduction to new sub-goals.  Arbitrary
   863 either solve the goal completely, or constitute some well-understood reduction
   842 automatic proof tools that are prone leave a large number of badly structured
   864 to new sub-goals.  Arbitrary automatic proof tools that are prone leave a
   843 sub-goals are no help in continuing the proof document in any intelligible
   865 large number of badly structured sub-goals are no help in continuing the proof
   844 way.
   866 document in any intelligible way.
   845 
       
   846 \medskip
       
   847 
   867 
   848 Unless given explicitly by the user, the default initial method is ``$rule$'',
   868 Unless given explicitly by the user, the default initial method is ``$rule$'',
   849 which applies a single standard elimination or introduction rule according to
   869 which applies a single standard elimination or introduction rule according to
   850 the topmost symbol involved.  There is no separate default terminal method.
   870 the topmost symbol involved.  There is no separate default terminal method.
   851 Any remaining goals are always solved by assumption in the very last step.
   871 Any remaining goals are always solved by assumption in the very last step.
   901 \subsection{Fundamental methods and attributes}\label{sec:pure-meth-att}
   921 \subsection{Fundamental methods and attributes}\label{sec:pure-meth-att}
   902 
   922 
   903 The following proof methods and attributes refer to basic logical operations
   923 The following proof methods and attributes refer to basic logical operations
   904 of Isar.  Further methods and attributes are provided by several generic and
   924 of Isar.  Further methods and attributes are provided by several generic and
   905 object-logic specific tools and packages (see chapters \ref{ch:gen-tools} and
   925 object-logic specific tools and packages (see chapters \ref{ch:gen-tools} and
   906 \ref{ch:hol-tools}).
   926 \ref{ch:logics}).
   907 
   927 
   908 \indexisarmeth{assumption}\indexisarmeth{this}\indexisarmeth{rule}\indexisarmeth{$-$}
   928 \indexisarmeth{assumption}\indexisarmeth{this}\indexisarmeth{rule}\indexisarmeth{$-$}
   909 \indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}\indexisaratt{rule}
       
   910 \indexisaratt{OF}\indexisaratt{of}
   929 \indexisaratt{OF}\indexisaratt{of}
       
   930 \indexisarattof{Pure}{intro}\indexisarattof{Pure}{elim}
       
   931 \indexisarattof{Pure}{dest}\indexisarattof{Pure}{rule}
   911 \begin{matharray}{rcl}
   932 \begin{matharray}{rcl}
   912   assumption & : & \isarmeth \\
   933   assumption & : & \isarmeth \\
   913   this & : & \isarmeth \\
   934   this & : & \isarmeth \\
   914   rule & : & \isarmeth \\
   935   rule & : & \isarmeth \\
   915   - & : & \isarmeth \\
   936   - & : & \isarmeth \\
   918   intro & : & \isaratt \\
   939   intro & : & \isaratt \\
   919   elim & : & \isaratt \\
   940   elim & : & \isaratt \\
   920   dest & : & \isaratt \\
   941   dest & : & \isaratt \\
   921   rule & : & \isaratt \\
   942   rule & : & \isaratt \\
   922 \end{matharray}
   943 \end{matharray}
       
   944 
       
   945 %FIXME intro!, intro, intro?
   923 
   946 
   924 \begin{rail}
   947 \begin{rail}
   925   'rule' thmrefs?
   948   'rule' thmrefs?
   926   ;
   949   ;
   927   'OF' thmrefs
   950   'OF' thmrefs
   988 variables of the form $\Var{x}$, or nameless dummies ``\texttt{_}''
  1011 variables of the form $\Var{x}$, or nameless dummies ``\texttt{_}''
   989 (underscore).\indexisarvar{_@\texttt{_}} Note that in the $\LETNAME$ form the
  1012 (underscore).\indexisarvar{_@\texttt{_}} Note that in the $\LETNAME$ form the
   990 patterns occur on the left-hand side, while the $\ISNAME$ patterns are in
  1013 patterns occur on the left-hand side, while the $\ISNAME$ patterns are in
   991 postfix position.
  1014 postfix position.
   992 
  1015 
   993 Polymorphism of term bindings is handled in Hindley-Milner style, as in ML.
  1016 Polymorphism of term bindings is handled in Hindley-Milner style, similar to
   994 Type variables referring to local assumptions or open goal statements are
  1017 ML.  Type variables referring to local assumptions or open goal statements are
   995 \emph{fixed}, while those of finished results or bound by $\LETNAME$ may occur
  1018 \emph{fixed}, while those of finished results or bound by $\LETNAME$ may occur
   996 in \emph{arbitrary} instances later.  Even though actual polymorphism should
  1019 in \emph{arbitrary} instances later.  Even though actual polymorphism should
   997 be rarely used in practice, this mechanism is essential to achieve proper
  1020 be rarely used in practice, this mechanism is essential to achieve proper
   998 incremental type-inference, as the user proceeds to build up the Isar proof
  1021 incremental type-inference, as the user proceeds to build up the Isar proof
   999 text.
  1022 text.