doc-src/IsarRef/pure.tex
changeset 9199 7a1a856f0571
parent 9030 bb7622789bf2
child 9233 8c8399b9ecaa
equal deleted inserted replaced
9198:0ab3c81e9425 9199:7a1a856f0571
   295 \end{matharray}
   295 \end{matharray}
   296 
   296 
   297 \begin{rail}
   297 \begin{rail}
   298   'axioms' (axmdecl prop comment? +)
   298   'axioms' (axmdecl prop comment? +)
   299   ;
   299   ;
   300   ('theorems' | 'lemmas') thmdef? thmrefs
   300   ('theorems' | 'lemmas') (thmdef? thmrefs comment? + 'and')
   301   ;
   301   ;
   302 \end{rail}
   302 \end{rail}
   303 
   303 
   304 \begin{descr}
   304 \begin{descr}
   305 \item [$\isarkeyword{axioms}~a: \phi$] introduces arbitrary statements as
   305 \item [$\isarkeyword{axioms}~a: \phi$] introduces arbitrary statements as
   362 
   362 
   363 \subsection{Incorporating ML code}\label{sec:ML}
   363 \subsection{Incorporating ML code}\label{sec:ML}
   364 
   364 
   365 \indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{ML-command}
   365 \indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{ML-command}
   366 \indexisarcmd{ML-setup}\indexisarcmd{setup}
   366 \indexisarcmd{ML-setup}\indexisarcmd{setup}
       
   367 \indexisarcmd{method-setup}
   367 \begin{matharray}{rcl}
   368 \begin{matharray}{rcl}
   368   \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
   369   \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
   369   \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
   370   \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
   370   \isarcmd{ML_command} & : & \isartrans{\cdot}{\cdot} \\
   371   \isarcmd{ML_command} & : & \isartrans{\cdot}{\cdot} \\
   371   \isarcmd{ML_setup} & : & \isartrans{theory}{theory} \\
   372   \isarcmd{ML_setup} & : & \isartrans{theory}{theory} \\
   372   \isarcmd{setup} & : & \isartrans{theory}{theory} \\
   373   \isarcmd{setup} & : & \isartrans{theory}{theory} \\
       
   374   \isarcmd{method_setup} & : & \isartrans{theory}{theory} \\
   373 \end{matharray}
   375 \end{matharray}
   374 
   376 
   375 \railalias{MLsetup}{ML\_setup}
   377 \railalias{MLsetup}{ML\_setup}
   376 \railterm{MLsetup}
   378 \railterm{MLsetup}
   377 
   379 
       
   380 \railalias{methodsetup}{method\_setup}
       
   381 \railterm{methodsetup}
       
   382 
   378 \railalias{MLcommand}{ML\_command}
   383 \railalias{MLcommand}{ML\_command}
   379 \railterm{MLcommand}
   384 \railterm{MLcommand}
   380 
   385 
   381 \begin{rail}
   386 \begin{rail}
   382   'use' name
   387   'use' name
   383   ;
   388   ;
   384   ('ML' | MLcommand | MLsetup | 'setup') text
   389   ('ML' | MLcommand | MLsetup | 'setup') text
       
   390   ;
       
   391   methodsetup name '=' text text comment?
   385   ;
   392   ;
   386 \end{rail}
   393 \end{rail}
   387 
   394 
   388 \begin{descr}
   395 \begin{descr}
   389 \item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
   396 \item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
   404 \item [$\isarkeyword{setup}~text$] changes the current theory context by
   411 \item [$\isarkeyword{setup}~text$] changes the current theory context by
   405   applying $text$, which refers to an ML expression of type
   412   applying $text$, which refers to an ML expression of type
   406   \texttt{(theory~->~theory)~list}.  The $\isarkeyword{setup}$ command is the
   413   \texttt{(theory~->~theory)~list}.  The $\isarkeyword{setup}$ command is the
   407   canonical way to initialize any object-logic specific tools and packages
   414   canonical way to initialize any object-logic specific tools and packages
   408   written in ML.
   415   written in ML.
       
   416   
       
   417 \item [$\isarkeyword{method_setup}~name = text~description$] defines a proof
       
   418   method in the current theory.  The given $text$ has to be an ML expression
       
   419   of type \texttt{Args.src -> Proof.context -> Proof.method}.  Parsing
       
   420   concrete method syntax from \texttt{Args.src} input can be quite tedious in
       
   421   general.  The following simple examples are for methods without any explicit
       
   422   arguments, or a list of theorems, respectively.
       
   423 
       
   424 {\footnotesize
       
   425 \begin{verbatim}
       
   426 Method.no_args (Method.METHOD (fn facts => foobar_tac))
       
   427 Method.thms_args (fn thms => (Method.METHOD (fn facts => foobar_tac)))
       
   428 \end{verbatim}
       
   429 }
       
   430 
       
   431 Note that mere tactic emulations may ignore the \texttt{facts} parameter
       
   432 above.  Proper proof methods would do something ``appropriate'' with the list
       
   433 of current facts, though.  Single-rule methods usually do strict
       
   434 forward-chaining (e.g.\ by using \texttt{Method.multi_resolves}), while
       
   435 automatic ones just insert the facts using \texttt{Method.insert_tac} before
       
   436 applying the main tactic.
   409 \end{descr}
   437 \end{descr}
   410 
   438 
   411 
   439 
   412 \subsection{Syntax translation functions}
   440 \subsection{Syntax translation functions}
   413 
   441 
   598 Any fact will usually be involved in further proofs, either as explicit
   626 Any fact will usually be involved in further proofs, either as explicit
   599 arguments of proof methods, or when forward chaining towards the next goal via
   627 arguments of proof methods, or when forward chaining towards the next goal via
   600 $\THEN$ (and variants).  Note that the special theorem name
   628 $\THEN$ (and variants).  Note that the special theorem name
   601 $this$\indexisarthm{this} refers to the most recently established facts.
   629 $this$\indexisarthm{this} refers to the most recently established facts.
   602 \begin{rail}
   630 \begin{rail}
   603   'note' thmdef? thmrefs comment?
   631   'note' (thmdef? thmrefs comment? + 'and')
   604   ;
   632   ;
   605   'then' comment?
   633   'then' comment?
   606   ;
   634   ;
   607   ('from' | 'with') thmrefs comment?
   635   ('from' | 'with') (thmrefs comment? + 'and')
   608   ;
   636   ;
   609 \end{rail}
   637 \end{rail}
   610 
   638 
   611 \begin{descr}
   639 \begin{descr}
   612 \item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
   640 \item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
  1240   stepping forth and back itself.  Interfering by manual $\isarkeyword{undo}$,
  1268   stepping forth and back itself.  Interfering by manual $\isarkeyword{undo}$,
  1241   $\isarkeyword{redo}$, or even $\isarkeyword{kill}$ commands would quickly
  1269   $\isarkeyword{redo}$, or even $\isarkeyword{kill}$ commands would quickly
  1242   result in utter confusion.
  1270   result in utter confusion.
  1243 \end{warn}
  1271 \end{warn}
  1244 
  1272 
  1245 %FIXME remove
       
  1246 % \begin{descr}
       
  1247 % \item [$\isarkeyword{undo}$] revokes the latest state-transforming command.
       
  1248 % \item [$\isarkeyword{redo}$] undos the latest $\isarkeyword{undo}$.
       
  1249 % \item [$\isarkeyword{kill}$] aborts the current history level.
       
  1250 % \end{descr}
       
  1251 
       
  1252 
  1273 
  1253 \subsection{System operations}
  1274 \subsection{System operations}
  1254 
  1275 
  1255 \indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
  1276 \indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
  1256 \indexisarcmd{update-thy}\indexisarcmd{update-thy-only}
  1277 \indexisarcmd{update-thy}\indexisarcmd{update-thy-only}