doc-src/IsarRef/generic.tex
changeset 8619 63a0e1502e41
parent 8594 d2e2a3df6871
child 8638 21cb46716f32
equal deleted inserted replaced
8618:87cddace4432 8619:63a0e1502e41
    45 \end{descr}
    45 \end{descr}
    46 
    46 
    47 
    47 
    48 \section{Calculational proof}\label{sec:calculation}
    48 \section{Calculational proof}\label{sec:calculation}
    49 
    49 
    50 \indexisarcmd{also}\indexisarcmd{finally}\indexisaratt{trans}
    50 \indexisarcmd{also}\indexisarcmd{finally}
       
    51 \indexisarcmd{moreover}\indexisarcmd{ultimately}
       
    52 \indexisaratt{trans}
    51 \begin{matharray}{rcl}
    53 \begin{matharray}{rcl}
    52   \isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\
    54   \isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\
    53   \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
    55   \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
       
    56   \isarcmd{moreover} & : & \isartrans{proof(state)}{proof(state)} \\
       
    57   \isarcmd{ultimately} & : & \isartrans{proof(state)}{proof(chain)} \\
    54   trans & : & \isaratt \\
    58   trans & : & \isaratt \\
    55 \end{matharray}
    59 \end{matharray}
    56 
    60 
    57 Calculational proof is forward reasoning with implicit application of
    61 Calculational proof is forward reasoning with implicit application of
    58 transitivity rules (such those of $=$, $\le$, $<$).  Isabelle/Isar maintains
    62 transitivity rules (such those of $=$, $\le$, $<$).  Isabelle/Isar maintains
    60 results obtained by transitivity composed with the current result.  Command
    64 results obtained by transitivity composed with the current result.  Command
    61 $\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the
    65 $\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the
    62 final $calculation$ by forward chaining towards the next goal statement.  Both
    66 final $calculation$ by forward chaining towards the next goal statement.  Both
    63 commands require valid current facts, i.e.\ may occur only after commands that
    67 commands require valid current facts, i.e.\ may occur only after commands that
    64 produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of
    68 produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of
    65 $\HAVENAME$, $\SHOWNAME$ etc.
    69 $\HAVENAME$, $\SHOWNAME$ etc.  The $\MOREOVER$ and $\ULTIMATELY$ commands are
       
    70 similar to $\ALSO$ and $\FINALLY$, but only collect further results in
       
    71 $calculation$ without applying any rules yet.
    66 
    72 
    67 Also note that the automatic term abbreviation ``$\dots$'' has its canonical
    73 Also note that the automatic term abbreviation ``$\dots$'' has its canonical
    68 application with calculational proofs.  It automatically refers to the
    74 application with calculational proofs.  It refers to the argument\footnote{The
    69 argument\footnote{The argument of a curried infix expression is its right-hand
    75   argument of a curried infix expression is its right-hand side.} of the
    70   side.} of the preceding statement.
    76 preceding statement.
    71 
    77 
    72 Isabelle/Isar calculations are implicitly subject to block structure in the
    78 Isabelle/Isar calculations are implicitly subject to block structure in the
    73 sense that new threads of calculational reasoning are commenced for any new
    79 sense that new threads of calculational reasoning are commenced for any new
    74 block (as opened by a local goal, for example).  This means that, apart from
    80 block (as opened by a local goal, for example).  This means that, apart from
    75 being able to nest calculations, there is no separate \emph{begin-calculation}
    81 being able to nest calculations, there is no separate \emph{begin-calculation}
    76 command required.
    82 command required.
    77 
    83 
       
    84 \medskip
       
    85 
       
    86 The Isar calculation proof commands may be defined as
       
    87 follows:\footnote{Internal bookkeeping such as proper handling of
       
    88   block-structure has been suppressed.}
       
    89 \begin{matharray}{rcl}
       
    90   \ALSO@0 & \equiv & \NOTE{calculation}{this} \\
       
    91   \ALSO@{n+1} & \equiv & \NOTE{calculation}{trans~[OF~calculation~this]} \\
       
    92   \FINALLY & \equiv & \ALSO~\FROM{calculation} \\
       
    93   \MOREOVER & \equiv & \NOTE{calculation}{calculation~this} \\
       
    94   \ULTIMATELY & \equiv & \MOREOVER~\FROM{calculation} \\
       
    95 \end{matharray}
       
    96 
    78 \begin{rail}
    97 \begin{rail}
    79   ('also' | 'finally') transrules? comment?
    98   ('also' | 'finally') transrules? comment?
       
    99   ;
       
   100   ('moreover' | 'ultimately') comment?
    80   ;
   101   ;
    81   'trans' (() | 'add' | 'del')
   102   'trans' (() | 'add' | 'del')
    82   ;
   103   ;
    83 
   104 
    84   transrules: '(' thmrefs ')' interest?
   105   transrules: '(' thmrefs ')' interest?
    99   is exhibited as fact for forward chaining towards the next goal. Basically,
   120   is exhibited as fact for forward chaining towards the next goal. Basically,
   100   $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Note that
   121   $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Note that
   101   ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
   122   ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
   102   ``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding
   123   ``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding
   103   calculational proofs.
   124   calculational proofs.
       
   125   
       
   126 \item [$\MOREOVER$ and $\ULTIMATELY$] are analogous to $\ALSO$ and $\FINALLY$,
       
   127   but collect results only, without applying rules.
   104   
   128   
   105 \item [$trans$] declares theorems as transitivity rules.
   129 \item [$trans$] declares theorems as transitivity rules.
   106 \end{descr}
   130 \end{descr}
   107 
   131 
   108 
   132