| 13999 |      1 | %
 | 
|  |      2 | \begin{isabellebody}%
 | 
|  |      3 | \def\isabellecontext{Logic}%
 | 
| 17125 |      4 | %
 | 
|  |      5 | \isadelimtheory
 | 
|  |      6 | %
 | 
|  |      7 | \endisadelimtheory
 | 
|  |      8 | %
 | 
|  |      9 | \isatagtheory
 | 
|  |     10 | %
 | 
|  |     11 | \endisatagtheory
 | 
|  |     12 | {\isafoldtheory}%
 | 
|  |     13 | %
 | 
|  |     14 | \isadelimtheory
 | 
|  |     15 | %
 | 
|  |     16 | \endisadelimtheory
 | 
| 13999 |     17 | %
 | 
|  |     18 | \isamarkupsection{Logic \label{sec:Logic}%
 | 
|  |     19 | }
 | 
|  |     20 | \isamarkuptrue%
 | 
|  |     21 | %
 | 
|  |     22 | \isamarkupsubsection{Propositional logic%
 | 
|  |     23 | }
 | 
|  |     24 | \isamarkuptrue%
 | 
|  |     25 | %
 | 
|  |     26 | \isamarkupsubsubsection{Introduction rules%
 | 
|  |     27 | }
 | 
|  |     28 | \isamarkuptrue%
 | 
|  |     29 | %
 | 
|  |     30 | \begin{isamarkuptext}%
 | 
|  |     31 | We start with a really trivial toy proof to introduce the basic
 | 
|  |     32 | features of structured proofs.%
 | 
|  |     33 | \end{isamarkuptext}%
 | 
| 17175 |     34 | \isamarkuptrue%
 | 
|  |     35 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |     36 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |     37 | %
 | 
|  |     38 | \isadelimproof
 | 
|  |     39 | %
 | 
|  |     40 | \endisadelimproof
 | 
|  |     41 | %
 | 
|  |     42 | \isatagproof
 | 
| 17175 |     43 | \isacommand{proof}\isamarkupfalse%
 | 
|  |     44 | \ {\isacharparenleft}rule\ impI{\isacharparenright}\isanewline
 | 
|  |     45 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |     46 | \ a{\isacharcolon}\ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |     47 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |     48 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 | 
|  |     49 | {\isacharparenleft}rule\ a{\isacharparenright}\isanewline
 | 
|  |     50 | \isacommand{qed}\isamarkupfalse%
 | 
|  |     51 | %
 | 
| 17125 |     52 | \endisatagproof
 | 
|  |     53 | {\isafoldproof}%
 | 
|  |     54 | %
 | 
|  |     55 | \isadelimproof
 | 
|  |     56 | %
 | 
|  |     57 | \endisadelimproof
 | 
| 13999 |     58 | %
 | 
|  |     59 | \begin{isamarkuptext}%
 | 
|  |     60 | \noindent
 | 
|  |     61 | The operational reading: the \isakeyword{assume}-\isakeyword{show}
 | 
|  |     62 | block proves \isa{A\ {\isasymLongrightarrow}\ A} (\isa{a} is a degenerate rule (no
 | 
|  |     63 | assumptions) that proves \isa{A} outright), which rule
 | 
|  |     64 | \isa{impI} (\isa{{\isacharparenleft}{\isacharquery}P\ {\isasymLongrightarrow}\ {\isacharquery}Q{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isasymlongrightarrow}\ {\isacharquery}Q}) turns into the desired \isa{A\ {\isasymlongrightarrow}\ A}.  However, this text is much too detailed for comfort. Therefore
 | 
|  |     65 | Isar implements the following principle: \begin{quote}\em Command
 | 
|  |     66 | \isakeyword{proof} automatically tries to select an introduction rule
 | 
|  |     67 | based on the goal and a predefined list of rules.  \end{quote} Here
 | 
|  |     68 | \isa{impI} is applied automatically:%
 | 
|  |     69 | \end{isamarkuptext}%
 | 
| 17175 |     70 | \isamarkuptrue%
 | 
|  |     71 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |     72 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |     73 | %
 | 
|  |     74 | \isadelimproof
 | 
|  |     75 | %
 | 
|  |     76 | \endisadelimproof
 | 
|  |     77 | %
 | 
|  |     78 | \isatagproof
 | 
| 17175 |     79 | \isacommand{proof}\isamarkupfalse%
 | 
|  |     80 | \isanewline
 | 
|  |     81 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |     82 | \ a{\isacharcolon}\ A\isanewline
 | 
|  |     83 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |     84 | \ A\ \isacommand{by}\isamarkupfalse%
 | 
|  |     85 | {\isacharparenleft}rule\ a{\isacharparenright}\isanewline
 | 
|  |     86 | \isacommand{qed}\isamarkupfalse%
 | 
|  |     87 | %
 | 
| 17125 |     88 | \endisatagproof
 | 
|  |     89 | {\isafoldproof}%
 | 
|  |     90 | %
 | 
|  |     91 | \isadelimproof
 | 
|  |     92 | %
 | 
|  |     93 | \endisadelimproof
 | 
| 13999 |     94 | %
 | 
|  |     95 | \begin{isamarkuptext}%
 | 
|  |     96 | \noindent Single-identifier formulae such as \isa{A} need not
 | 
|  |     97 | be enclosed in double quotes. However, we will continue to do so for
 | 
|  |     98 | uniformity.
 | 
|  |     99 | 
 | 
|  |    100 | Trivial proofs, in particular those by assumption, should be trivial
 | 
|  |    101 | to perform. Proof ``.'' does just that (and a bit more). Thus
 | 
|  |    102 | naming of assumptions is often superfluous:%
 | 
|  |    103 | \end{isamarkuptext}%
 | 
| 17175 |    104 | \isamarkuptrue%
 | 
|  |    105 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    106 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    107 | %
 | 
|  |    108 | \isadelimproof
 | 
|  |    109 | %
 | 
|  |    110 | \endisadelimproof
 | 
|  |    111 | %
 | 
|  |    112 | \isatagproof
 | 
| 17175 |    113 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    114 | \isanewline
 | 
|  |    115 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    116 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |    117 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    118 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse%
 | 
|  |    119 | \isanewline
 | 
|  |    120 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    121 | %
 | 
| 17125 |    122 | \endisatagproof
 | 
|  |    123 | {\isafoldproof}%
 | 
|  |    124 | %
 | 
|  |    125 | \isadelimproof
 | 
|  |    126 | %
 | 
|  |    127 | \endisadelimproof
 | 
| 13999 |    128 | %
 | 
|  |    129 | \begin{isamarkuptext}%
 | 
|  |    130 | To hide proofs by assumption further, \isakeyword{by}\isa{{\isacharparenleft}method{\isacharparenright}}
 | 
|  |    131 | first applies \isa{method} and then tries to solve all remaining subgoals
 | 
|  |    132 | by assumption:%
 | 
|  |    133 | \end{isamarkuptext}%
 | 
| 17175 |    134 | \isamarkuptrue%
 | 
|  |    135 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    136 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ A\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    137 | %
 | 
|  |    138 | \isadelimproof
 | 
|  |    139 | %
 | 
|  |    140 | \endisadelimproof
 | 
|  |    141 | %
 | 
|  |    142 | \isatagproof
 | 
| 17175 |    143 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    144 | \isanewline
 | 
|  |    145 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    146 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |    147 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    148 | \ {\isachardoublequoteopen}A\ {\isasymand}\ A{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 | 
|  |    149 | {\isacharparenleft}rule\ conjI{\isacharparenright}\isanewline
 | 
|  |    150 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    151 | %
 | 
| 17125 |    152 | \endisatagproof
 | 
|  |    153 | {\isafoldproof}%
 | 
|  |    154 | %
 | 
|  |    155 | \isadelimproof
 | 
|  |    156 | %
 | 
|  |    157 | \endisadelimproof
 | 
| 13999 |    158 | %
 | 
|  |    159 | \begin{isamarkuptext}%
 | 
|  |    160 | \noindent Rule \isa{conjI} is of course \isa{{\isasymlbrakk}{\isacharquery}P{\isacharsemicolon}\ {\isacharquery}Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isasymand}\ {\isacharquery}Q}.
 | 
|  |    161 | A drawback of implicit proofs by assumption is that it
 | 
|  |    162 | is no longer obvious where an assumption is used.
 | 
|  |    163 | 
 | 
|  |    164 | Proofs of the form \isakeyword{by}\isa{{\isacharparenleft}rule}~\emph{name}\isa{{\isacharparenright}}
 | 
|  |    165 | can be abbreviated to ``..''  if \emph{name} refers to one of the
 | 
|  |    166 | predefined introduction rules (or elimination rules, see below):%
 | 
|  |    167 | \end{isamarkuptext}%
 | 
| 17175 |    168 | \isamarkuptrue%
 | 
|  |    169 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    170 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ A\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    171 | %
 | 
|  |    172 | \isadelimproof
 | 
|  |    173 | %
 | 
|  |    174 | \endisadelimproof
 | 
|  |    175 | %
 | 
|  |    176 | \isatagproof
 | 
| 17175 |    177 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    178 | \isanewline
 | 
|  |    179 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    180 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |    181 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    182 | \ {\isachardoublequoteopen}A\ {\isasymand}\ A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    183 | \isanewline
 | 
|  |    184 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    185 | %
 | 
| 17125 |    186 | \endisatagproof
 | 
|  |    187 | {\isafoldproof}%
 | 
|  |    188 | %
 | 
|  |    189 | \isadelimproof
 | 
|  |    190 | %
 | 
|  |    191 | \endisadelimproof
 | 
| 13999 |    192 | %
 | 
|  |    193 | \begin{isamarkuptext}%
 | 
|  |    194 | \noindent
 | 
|  |    195 | This is what happens: first the matching introduction rule \isa{conjI}
 | 
|  |    196 | is applied (first ``.''), then the two subgoals are solved by assumption
 | 
|  |    197 | (second ``.'').%
 | 
|  |    198 | \end{isamarkuptext}%
 | 
|  |    199 | \isamarkuptrue%
 | 
|  |    200 | %
 | 
|  |    201 | \isamarkupsubsubsection{Elimination rules%
 | 
|  |    202 | }
 | 
|  |    203 | \isamarkuptrue%
 | 
|  |    204 | %
 | 
|  |    205 | \begin{isamarkuptext}%
 | 
|  |    206 | A typical elimination rule is \isa{conjE}, $\land$-elimination:
 | 
|  |    207 | \begin{isabelle}%
 | 
|  |    208 | \ \ \ \ \ {\isasymlbrakk}{\isacharquery}P\ {\isasymand}\ {\isacharquery}Q{\isacharsemicolon}\ {\isasymlbrakk}{\isacharquery}P{\isacharsemicolon}\ {\isacharquery}Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}R{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}R%
 | 
|  |    209 | \end{isabelle}  In the following proof it is applied
 | 
|  |    210 | by hand, after its first (\emph{major}) premise has been eliminated via
 | 
|  |    211 | \isa{{\isacharbrackleft}OF\ AB{\isacharbrackright}}:%
 | 
|  |    212 | \end{isamarkuptext}%
 | 
| 17175 |    213 | \isamarkuptrue%
 | 
|  |    214 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    215 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    216 | %
 | 
|  |    217 | \isadelimproof
 | 
|  |    218 | %
 | 
|  |    219 | \endisadelimproof
 | 
|  |    220 | %
 | 
|  |    221 | \isatagproof
 | 
| 17175 |    222 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    223 | \isanewline
 | 
|  |    224 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    225 | \ AB{\isacharcolon}\ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    226 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    227 | \ {\isachardoublequoteopen}B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
|  |    228 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    229 | \ {\isacharparenleft}rule\ conjE{\isacharbrackleft}OF\ AB{\isacharbrackright}{\isacharparenright}\ \ %
 | 
| 16459 |    230 | \isamarkupcmt{\isa{conjE{\isacharbrackleft}OF\ AB{\isacharbrackright}}: \isa{{\isacharparenleft}{\isasymlbrakk}A{\isacharsemicolon}\ B{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}R{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharquery}R}%
 | 
|  |    231 | }
 | 
|  |    232 | \isanewline
 | 
| 17175 |    233 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    234 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ {\isachardoublequoteopen}B{\isachardoublequoteclose}\isanewline
 | 
|  |    235 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    236 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    237 | \isanewline
 | 
|  |    238 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    239 | \isanewline
 | 
|  |    240 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    241 | %
 | 
| 17125 |    242 | \endisatagproof
 | 
|  |    243 | {\isafoldproof}%
 | 
|  |    244 | %
 | 
|  |    245 | \isadelimproof
 | 
|  |    246 | %
 | 
|  |    247 | \endisadelimproof
 | 
| 13999 |    248 | %
 | 
|  |    249 | \begin{isamarkuptext}%
 | 
|  |    250 | \noindent Note that the term \isa{{\isacharquery}thesis} always stands for the
 | 
|  |    251 | ``current goal'', i.e.\ the enclosing \isakeyword{show} (or
 | 
|  |    252 | \isakeyword{have}) statement.
 | 
|  |    253 | 
 | 
|  |    254 | This is too much proof text. Elimination rules should be selected
 | 
|  |    255 | automatically based on their major premise, the formula or rather connective
 | 
|  |    256 | to be eliminated. In Isar they are triggered by facts being fed
 | 
|  |    257 | \emph{into} a proof. Syntax:
 | 
|  |    258 | \begin{center}
 | 
|  |    259 | \isakeyword{from} \emph{fact} \isakeyword{show} \emph{proposition} \emph{proof}
 | 
|  |    260 | \end{center}
 | 
|  |    261 | where \emph{fact} stands for the name of a previously proved
 | 
|  |    262 | proposition, e.g.\ an assumption, an intermediate result or some global
 | 
|  |    263 | theorem, which may also be modified with \isa{OF} etc.
 | 
|  |    264 | The \emph{fact} is ``piped'' into the \emph{proof}, which can deal with it
 | 
|  |    265 | how it chooses. If the \emph{proof} starts with a plain \isakeyword{proof},
 | 
|  |    266 | an elimination rule (from a predefined list) is applied
 | 
|  |    267 | whose first premise is solved by the \emph{fact}. Thus the proof above
 | 
|  |    268 | is equivalent to the following one:%
 | 
|  |    269 | \end{isamarkuptext}%
 | 
| 17175 |    270 | \isamarkuptrue%
 | 
|  |    271 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    272 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    273 | %
 | 
|  |    274 | \isadelimproof
 | 
|  |    275 | %
 | 
|  |    276 | \endisadelimproof
 | 
|  |    277 | %
 | 
|  |    278 | \isatagproof
 | 
| 17175 |    279 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    280 | \isanewline
 | 
|  |    281 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    282 | \ AB{\isacharcolon}\ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    283 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    284 | \ AB\ \isacommand{show}\isamarkupfalse%
 | 
|  |    285 | \ {\isachardoublequoteopen}B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
|  |    286 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    287 | \isanewline
 | 
|  |    288 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    289 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ {\isachardoublequoteopen}B{\isachardoublequoteclose}\isanewline
 | 
|  |    290 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    291 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    292 | \isanewline
 | 
|  |    293 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    294 | \isanewline
 | 
|  |    295 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    296 | %
 | 
| 17125 |    297 | \endisatagproof
 | 
|  |    298 | {\isafoldproof}%
 | 
|  |    299 | %
 | 
|  |    300 | \isadelimproof
 | 
|  |    301 | %
 | 
|  |    302 | \endisadelimproof
 | 
| 13999 |    303 | %
 | 
|  |    304 | \begin{isamarkuptext}%
 | 
|  |    305 | Now we come to a second important principle:
 | 
|  |    306 | \begin{quote}\em
 | 
|  |    307 | Try to arrange the sequence of propositions in a UNIX-like pipe,
 | 
|  |    308 | such that the proof of each proposition builds on the previous proposition.
 | 
|  |    309 | \end{quote}
 | 
|  |    310 | The previous proposition can be referred to via the fact \isa{this}.
 | 
|  |    311 | This greatly reduces the need for explicit naming of propositions:%
 | 
|  |    312 | \end{isamarkuptext}%
 | 
| 17175 |    313 | \isamarkuptrue%
 | 
|  |    314 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    315 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    316 | %
 | 
|  |    317 | \isadelimproof
 | 
|  |    318 | %
 | 
|  |    319 | \endisadelimproof
 | 
|  |    320 | %
 | 
|  |    321 | \isatagproof
 | 
| 17175 |    322 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    323 | \isanewline
 | 
|  |    324 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    325 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    326 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    327 | \ this\ \isacommand{show}\isamarkupfalse%
 | 
|  |    328 | \ {\isachardoublequoteopen}B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
|  |    329 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    330 | \isanewline
 | 
|  |    331 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    332 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ {\isachardoublequoteopen}B{\isachardoublequoteclose}\isanewline
 | 
|  |    333 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    334 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    335 | \isanewline
 | 
|  |    336 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    337 | \isanewline
 | 
|  |    338 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    339 | %
 | 
| 17125 |    340 | \endisatagproof
 | 
|  |    341 | {\isafoldproof}%
 | 
|  |    342 | %
 | 
|  |    343 | \isadelimproof
 | 
|  |    344 | %
 | 
|  |    345 | \endisadelimproof
 | 
| 13999 |    346 | %
 | 
|  |    347 | \begin{isamarkuptext}%
 | 
|  |    348 | \noindent Because of the frequency of \isakeyword{from}~\isa{this}, Isar provides two abbreviations:
 | 
|  |    349 | \begin{center}
 | 
|  |    350 | \begin{tabular}{r@ {\quad=\quad}l}
 | 
|  |    351 | \isakeyword{then} & \isakeyword{from} \isa{this} \\
 | 
|  |    352 | \isakeyword{thus} & \isakeyword{then} \isakeyword{show}
 | 
|  |    353 | \end{tabular}
 | 
|  |    354 | \end{center}
 | 
|  |    355 | 
 | 
|  |    356 | Here is an alternative proof that operates purely by forward reasoning:%
 | 
|  |    357 | \end{isamarkuptext}%
 | 
| 17175 |    358 | \isamarkuptrue%
 | 
|  |    359 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    360 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    361 | %
 | 
|  |    362 | \isadelimproof
 | 
|  |    363 | %
 | 
|  |    364 | \endisadelimproof
 | 
|  |    365 | %
 | 
|  |    366 | \isatagproof
 | 
| 17175 |    367 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    368 | \isanewline
 | 
|  |    369 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    370 | \ ab{\isacharcolon}\ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    371 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    372 | \ ab\ \isacommand{have}\isamarkupfalse%
 | 
|  |    373 | \ a{\isacharcolon}\ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    374 | \isanewline
 | 
|  |    375 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    376 | \ ab\ \isacommand{have}\isamarkupfalse%
 | 
|  |    377 | \ b{\isacharcolon}\ {\isachardoublequoteopen}B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    378 | \isanewline
 | 
|  |    379 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    380 | \ b\ a\ \isacommand{show}\isamarkupfalse%
 | 
|  |    381 | \ {\isachardoublequoteopen}B\ {\isasymand}\ A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    382 | \isanewline
 | 
|  |    383 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    384 | %
 | 
| 17125 |    385 | \endisatagproof
 | 
|  |    386 | {\isafoldproof}%
 | 
|  |    387 | %
 | 
|  |    388 | \isadelimproof
 | 
|  |    389 | %
 | 
|  |    390 | \endisadelimproof
 | 
| 13999 |    391 | %
 | 
|  |    392 | \begin{isamarkuptext}%
 | 
|  |    393 | \noindent It is worth examining this text in detail because it
 | 
|  |    394 | exhibits a number of new concepts.  For a start, it is the first time
 | 
|  |    395 | we have proved intermediate propositions (\isakeyword{have}) on the
 | 
|  |    396 | way to the final \isakeyword{show}. This is the norm in nontrivial
 | 
|  |    397 | proofs where one cannot bridge the gap between the assumptions and the
 | 
|  |    398 | conclusion in one step. To understand how the proof works we need to
 | 
|  |    399 | explain more Isar details.
 | 
|  |    400 | 
 | 
|  |    401 | Method \isa{rule} can be given a list of rules, in which case
 | 
|  |    402 | \isa{{\isacharparenleft}rule}~\textit{rules}\isa{{\isacharparenright}} applies the first matching
 | 
|  |    403 | rule in the list \textit{rules}. Command \isakeyword{from} can be
 | 
|  |    404 | followed by any number of facts.  Given \isakeyword{from}~\isa{f}$_1$~\dots~\isa{f}$_n$, the proof step
 | 
|  |    405 | \isa{{\isacharparenleft}rule}~\textit{rules}\isa{{\isacharparenright}} following a \isakeyword{have}
 | 
|  |    406 | or \isakeyword{show} searches \textit{rules} for a rule whose first
 | 
|  |    407 | $n$ premises can be proved by \isa{f}$_1$~\dots~\isa{f}$_n$ in the
 | 
|  |    408 | given order. Finally one needs to know that ``..'' is short for
 | 
|  |    409 | \isa{by{\isacharparenleft}rule}~\textit{elim-rules intro-rules}\isa{{\isacharparenright}} (or
 | 
|  |    410 | \isa{by{\isacharparenleft}rule}~\textit{intro-rules}\isa{{\isacharparenright}} if there are no facts
 | 
|  |    411 | fed into the proof), i.e.\ elimination rules are tried before
 | 
|  |    412 | introduction rules.
 | 
|  |    413 | 
 | 
|  |    414 | Thus in the above proof both \isakeyword{have}s are proved via
 | 
|  |    415 | \isa{conjE} triggered by \isakeyword{from}~\isa{ab} whereas
 | 
|  |    416 | in the \isakeyword{show} step no elimination rule is applicable and
 | 
|  |    417 | the proof succeeds with \isa{conjI}. The latter would fail had
 | 
|  |    418 | we written \isakeyword{from}~\isa{a\ b} instead of
 | 
|  |    419 | \isakeyword{from}~\isa{b\ a}.
 | 
|  |    420 | 
 | 
|  |    421 | Proofs starting with a plain \isa{proof} behave the same because the
 | 
|  |    422 | latter is short for \isa{proof\ {\isacharparenleft}rule}~\textit{elim-rules
 | 
|  |    423 | intro-rules}\isa{{\isacharparenright}} (or \isa{proof\ {\isacharparenleft}rule}~\textit{intro-rules}\isa{{\isacharparenright}} if there are no facts fed into
 | 
|  |    424 | the proof).%
 | 
|  |    425 | \end{isamarkuptext}%
 | 
|  |    426 | \isamarkuptrue%
 | 
|  |    427 | %
 | 
|  |    428 | \isamarkupsubsection{More constructs%
 | 
|  |    429 | }
 | 
|  |    430 | \isamarkuptrue%
 | 
|  |    431 | %
 | 
|  |    432 | \begin{isamarkuptext}%
 | 
|  |    433 | In the previous proof of \isa{A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A} we needed to feed
 | 
|  |    434 | more than one fact into a proof step, a frequent situation. Then the
 | 
|  |    435 | UNIX-pipe model appears to break down and we need to name the different
 | 
|  |    436 | facts to refer to them. But this can be avoided:%
 | 
|  |    437 | \end{isamarkuptext}%
 | 
| 17175 |    438 | \isamarkuptrue%
 | 
|  |    439 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    440 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymlongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    441 | %
 | 
|  |    442 | \isadelimproof
 | 
|  |    443 | %
 | 
|  |    444 | \endisadelimproof
 | 
|  |    445 | %
 | 
|  |    446 | \isatagproof
 | 
| 17175 |    447 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    448 | \isanewline
 | 
|  |    449 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    450 | \ ab{\isacharcolon}\ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    451 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    452 | \ ab\ \isacommand{have}\isamarkupfalse%
 | 
|  |    453 | \ {\isachardoublequoteopen}B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    454 | \isanewline
 | 
|  |    455 | \ \ \isacommand{moreover}\isamarkupfalse%
 | 
|  |    456 | \isanewline
 | 
|  |    457 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    458 | \ ab\ \isacommand{have}\isamarkupfalse%
 | 
|  |    459 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    460 | \isanewline
 | 
|  |    461 | \ \ \isacommand{ultimately}\isamarkupfalse%
 | 
|  |    462 | \ \isacommand{show}\isamarkupfalse%
 | 
|  |    463 | \ {\isachardoublequoteopen}B\ {\isasymand}\ A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    464 | \isanewline
 | 
|  |    465 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    466 | %
 | 
| 17125 |    467 | \endisatagproof
 | 
|  |    468 | {\isafoldproof}%
 | 
|  |    469 | %
 | 
|  |    470 | \isadelimproof
 | 
|  |    471 | %
 | 
|  |    472 | \endisadelimproof
 | 
| 13999 |    473 | %
 | 
|  |    474 | \begin{isamarkuptext}%
 | 
|  |    475 | \noindent You can combine any number of facts \isa{A{\isadigit{1}}} \dots\ \isa{An} into a sequence by separating their proofs with
 | 
|  |    476 | \isakeyword{moreover}. After the final fact, \isakeyword{ultimately} stands
 | 
|  |    477 | for \isakeyword{from}~\isa{A{\isadigit{1}}}~\dots~\isa{An}.  This avoids having to
 | 
|  |    478 | introduce names for all of the sequence elements.%
 | 
|  |    479 | \end{isamarkuptext}%
 | 
|  |    480 | \isamarkuptrue%
 | 
|  |    481 | %
 | 
|  |    482 | \begin{isamarkuptext}%
 | 
|  |    483 | Although we have only seen a few introduction and elimination rules so
 | 
|  |    484 | far, Isar's predefined rules include all the usual natural deduction
 | 
|  |    485 | rules. We conclude our exposition of propositional logic with an extended
 | 
|  |    486 | example --- which rules are used implicitly where?%
 | 
|  |    487 | \end{isamarkuptext}%
 | 
| 17175 |    488 | \isamarkuptrue%
 | 
|  |    489 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    490 | \ {\isachardoublequoteopen}{\isasymnot}\ {\isacharparenleft}A\ {\isasymand}\ B{\isacharparenright}\ {\isasymlongrightarrow}\ {\isasymnot}\ A\ {\isasymor}\ {\isasymnot}\ B{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    491 | %
 | 
|  |    492 | \isadelimproof
 | 
|  |    493 | %
 | 
|  |    494 | \endisadelimproof
 | 
|  |    495 | %
 | 
|  |    496 | \isatagproof
 | 
| 17175 |    497 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    498 | \isanewline
 | 
|  |    499 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    500 | \ n{\isacharcolon}\ {\isachardoublequoteopen}{\isasymnot}\ {\isacharparenleft}A\ {\isasymand}\ B{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
|  |    501 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    502 | \ {\isachardoublequoteopen}{\isasymnot}\ A\ {\isasymor}\ {\isasymnot}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    503 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    504 | \ {\isacharparenleft}rule\ ccontr{\isacharparenright}\isanewline
 | 
|  |    505 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    506 | \ nn{\isacharcolon}\ {\isachardoublequoteopen}{\isasymnot}\ {\isacharparenleft}{\isasymnot}\ A\ {\isasymor}\ {\isasymnot}\ B{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
|  |    507 | \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
|  |    508 | \ {\isachardoublequoteopen}{\isasymnot}\ A{\isachardoublequoteclose}\isanewline
 | 
|  |    509 | \ \ \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    510 | \isanewline
 | 
|  |    511 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    512 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |    513 | \ \ \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
|  |    514 | \ {\isachardoublequoteopen}{\isasymnot}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |    515 | \ \ \ \ \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    516 | \isanewline
 | 
|  |    517 | \ \ \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    518 | \ {\isachardoublequoteopen}B{\isachardoublequoteclose}\isanewline
 | 
|  |    519 | \ \ \ \ \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
|  |    520 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    521 | \isanewline
 | 
|  |    522 | \ \ \ \ \ \ \ \ \isacommand{with}\isamarkupfalse%
 | 
|  |    523 | \ n\ \isacommand{show}\isamarkupfalse%
 | 
|  |    524 | \ False\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    525 | \isanewline
 | 
|  |    526 | \ \ \ \ \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    527 | \isanewline
 | 
|  |    528 | \ \ \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |    529 | \ {\isachardoublequoteopen}{\isasymnot}\ A\ {\isasymor}\ {\isasymnot}\ B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    530 | \isanewline
 | 
|  |    531 | \ \ \ \ \ \ \isacommand{with}\isamarkupfalse%
 | 
|  |    532 | \ nn\ \isacommand{show}\isamarkupfalse%
 | 
|  |    533 | \ False\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    534 | \isanewline
 | 
|  |    535 | \ \ \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    536 | \isanewline
 | 
|  |    537 | \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |    538 | \ {\isachardoublequoteopen}{\isasymnot}\ A\ {\isasymor}\ {\isasymnot}\ B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    539 | \isanewline
 | 
|  |    540 | \ \ \ \ \isacommand{with}\isamarkupfalse%
 | 
|  |    541 | \ nn\ \isacommand{show}\isamarkupfalse%
 | 
|  |    542 | \ False\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    543 | \isanewline
 | 
|  |    544 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    545 | \isanewline
 | 
|  |    546 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    547 | %
 | 
| 17125 |    548 | \endisatagproof
 | 
|  |    549 | {\isafoldproof}%
 | 
|  |    550 | %
 | 
|  |    551 | \isadelimproof
 | 
|  |    552 | %
 | 
|  |    553 | \endisadelimproof
 | 
| 13999 |    554 | %
 | 
|  |    555 | \begin{isamarkuptext}%
 | 
|  |    556 | \noindent
 | 
|  |    557 | Rule \isa{ccontr} (``classical contradiction'') is
 | 
|  |    558 | \isa{{\isacharparenleft}{\isasymnot}\ P\ {\isasymLongrightarrow}\ False{\isacharparenright}\ {\isasymLongrightarrow}\ P}.
 | 
|  |    559 | Apart from demonstrating the strangeness of classical
 | 
|  |    560 | arguments by contradiction, this example also introduces two new
 | 
|  |    561 | abbreviations:
 | 
|  |    562 | \begin{center}
 | 
|  |    563 | \begin{tabular}{l@ {\quad=\quad}l}
 | 
|  |    564 | \isakeyword{hence} & \isakeyword{then} \isakeyword{have} \\
 | 
|  |    565 | \isakeyword{with}~\emph{facts} &
 | 
|  |    566 | \isakeyword{from}~\emph{facts} \isa{this}
 | 
|  |    567 | \end{tabular}
 | 
|  |    568 | \end{center}%
 | 
|  |    569 | \end{isamarkuptext}%
 | 
|  |    570 | \isamarkuptrue%
 | 
|  |    571 | %
 | 
|  |    572 | \isamarkupsubsection{Avoiding duplication%
 | 
|  |    573 | }
 | 
|  |    574 | \isamarkuptrue%
 | 
|  |    575 | %
 | 
|  |    576 | \begin{isamarkuptext}%
 | 
|  |    577 | So far our examples have been a bit unnatural: normally we want to
 | 
|  |    578 | prove rules expressed with \isa{{\isasymLongrightarrow}}, not \isa{{\isasymlongrightarrow}}. Here is an example:%
 | 
|  |    579 | \end{isamarkuptext}%
 | 
| 17175 |    580 | \isamarkuptrue%
 | 
|  |    581 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    582 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B\ {\isasymLongrightarrow}\ B\ {\isasymand}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    583 | %
 | 
|  |    584 | \isadelimproof
 | 
|  |    585 | %
 | 
|  |    586 | \endisadelimproof
 | 
|  |    587 | %
 | 
|  |    588 | \isatagproof
 | 
| 17175 |    589 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    590 | \isanewline
 | 
|  |    591 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    592 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\ \isacommand{thus}\isamarkupfalse%
 | 
|  |    593 | \ {\isachardoublequoteopen}B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    594 | \isanewline
 | 
|  |    595 | \isacommand{next}\isamarkupfalse%
 | 
|  |    596 | \isanewline
 | 
|  |    597 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    598 | \ {\isachardoublequoteopen}A\ {\isasymand}\ B{\isachardoublequoteclose}\ \isacommand{thus}\isamarkupfalse%
 | 
|  |    599 | \ {\isachardoublequoteopen}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    600 | \isanewline
 | 
|  |    601 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    602 | %
 | 
| 17125 |    603 | \endisatagproof
 | 
|  |    604 | {\isafoldproof}%
 | 
|  |    605 | %
 | 
|  |    606 | \isadelimproof
 | 
|  |    607 | %
 | 
|  |    608 | \endisadelimproof
 | 
| 13999 |    609 | %
 | 
|  |    610 | \begin{isamarkuptext}%
 | 
|  |    611 | \noindent The \isakeyword{proof} always works on the conclusion,
 | 
|  |    612 | \isa{B\ {\isasymand}\ A} in our case, thus selecting $\land$-introduction. Hence
 | 
|  |    613 | we must show \isa{B} and \isa{A}; both are proved by
 | 
|  |    614 | $\land$-elimination and the proofs are separated by \isakeyword{next}:
 | 
|  |    615 | \begin{description}
 | 
|  |    616 | \item[\isakeyword{next}] deals with multiple subgoals. For example,
 | 
|  |    617 | when showing \isa{A\ {\isasymand}\ B} we need to show both \isa{A} and \isa{B}.  Each subgoal is proved separately, in \emph{any} order. The
 | 
|  |    618 | individual proofs are separated by \isakeyword{next}.  \footnote{Each
 | 
|  |    619 | \isakeyword{show} must prove one of the pending subgoals.  If a
 | 
|  |    620 | \isakeyword{show} matches multiple subgoals, e.g.\ if the subgoals
 | 
|  |    621 | contain ?-variables, the first one is proved. Thus the order in which
 | 
|  |    622 | the subgoals are proved can matter --- see
 | 
|  |    623 | \S\ref{sec:CaseDistinction} for an example.}
 | 
|  |    624 | 
 | 
|  |    625 | Strictly speaking \isakeyword{next} is only required if the subgoals
 | 
|  |    626 | are proved in different assumption contexts which need to be
 | 
|  |    627 | separated, which is not the case above. For clarity we
 | 
|  |    628 | have employed \isakeyword{next} anyway and will continue to do so.
 | 
|  |    629 | \end{description}
 | 
|  |    630 | 
 | 
|  |    631 | This is all very well as long as formulae are small. Let us now look at some
 | 
|  |    632 | devices to avoid repeating (possibly large) formulae. A very general method
 | 
|  |    633 | is pattern matching:%
 | 
|  |    634 | \end{isamarkuptext}%
 | 
| 17175 |    635 | \isamarkuptrue%
 | 
|  |    636 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    637 | \ {\isachardoublequoteopen}large{\isacharunderscore}A\ {\isasymand}\ large{\isacharunderscore}B\ {\isasymLongrightarrow}\ large{\isacharunderscore}B\ {\isasymand}\ large{\isacharunderscore}A{\isachardoublequoteclose}\isanewline
 | 
|  |    638 | \ \ \ \ \ \ {\isacharparenleft}\isakeyword{is}\ {\isachardoublequoteopen}{\isacharquery}AB\ {\isasymLongrightarrow}\ {\isacharquery}B\ {\isasymand}\ {\isacharquery}A{\isachardoublequoteclose}{\isacharparenright}\isanewline
 | 
| 17125 |    639 | %
 | 
|  |    640 | \isadelimproof
 | 
|  |    641 | %
 | 
|  |    642 | \endisadelimproof
 | 
|  |    643 | %
 | 
|  |    644 | \isatagproof
 | 
| 17175 |    645 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    646 | \isanewline
 | 
|  |    647 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    648 | \ {\isachardoublequoteopen}{\isacharquery}AB{\isachardoublequoteclose}\ \isacommand{thus}\isamarkupfalse%
 | 
|  |    649 | \ {\isachardoublequoteopen}{\isacharquery}B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    650 | \isanewline
 | 
|  |    651 | \isacommand{next}\isamarkupfalse%
 | 
|  |    652 | \isanewline
 | 
|  |    653 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    654 | \ {\isachardoublequoteopen}{\isacharquery}AB{\isachardoublequoteclose}\ \isacommand{thus}\isamarkupfalse%
 | 
|  |    655 | \ {\isachardoublequoteopen}{\isacharquery}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    656 | \isanewline
 | 
|  |    657 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    658 | %
 | 
| 17125 |    659 | \endisatagproof
 | 
|  |    660 | {\isafoldproof}%
 | 
|  |    661 | %
 | 
|  |    662 | \isadelimproof
 | 
|  |    663 | %
 | 
|  |    664 | \endisadelimproof
 | 
| 13999 |    665 | %
 | 
|  |    666 | \begin{isamarkuptext}%
 | 
|  |    667 | \noindent Any formula may be followed by
 | 
|  |    668 | \isa{{\isacharparenleft}}\isakeyword{is}~\emph{pattern}\isa{{\isacharparenright}} which causes the pattern
 | 
|  |    669 | to be matched against the formula, instantiating the \isa{{\isacharquery}}-variables in
 | 
|  |    670 | the pattern. Subsequent uses of these variables in other terms causes
 | 
|  |    671 | them to be replaced by the terms they stand for.
 | 
|  |    672 | 
 | 
|  |    673 | We can simplify things even more by stating the theorem by means of the
 | 
|  |    674 | \isakeyword{assumes} and \isakeyword{shows} elements which allow direct
 | 
|  |    675 | naming of assumptions:%
 | 
|  |    676 | \end{isamarkuptext}%
 | 
| 17175 |    677 | \isamarkuptrue%
 | 
|  |    678 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    679 | \ \isakeyword{assumes}\ AB{\isacharcolon}\ {\isachardoublequoteopen}large{\isacharunderscore}A\ {\isasymand}\ large{\isacharunderscore}B{\isachardoublequoteclose}\isanewline
 | 
|  |    680 | \ \ \isakeyword{shows}\ {\isachardoublequoteopen}large{\isacharunderscore}B\ {\isasymand}\ large{\isacharunderscore}A{\isachardoublequoteclose}\ {\isacharparenleft}\isakeyword{is}\ {\isachardoublequoteopen}{\isacharquery}B\ {\isasymand}\ {\isacharquery}A{\isachardoublequoteclose}{\isacharparenright}\isanewline
 | 
| 17125 |    681 | %
 | 
|  |    682 | \isadelimproof
 | 
|  |    683 | %
 | 
|  |    684 | \endisadelimproof
 | 
|  |    685 | %
 | 
|  |    686 | \isatagproof
 | 
| 17175 |    687 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    688 | \isanewline
 | 
|  |    689 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    690 | \ AB\ \isacommand{show}\isamarkupfalse%
 | 
|  |    691 | \ {\isachardoublequoteopen}{\isacharquery}B{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    692 | \isanewline
 | 
|  |    693 | \isacommand{next}\isamarkupfalse%
 | 
|  |    694 | \isanewline
 | 
|  |    695 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    696 | \ AB\ \isacommand{show}\isamarkupfalse%
 | 
|  |    697 | \ {\isachardoublequoteopen}{\isacharquery}A{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    698 | \isanewline
 | 
|  |    699 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    700 | %
 | 
| 17125 |    701 | \endisatagproof
 | 
|  |    702 | {\isafoldproof}%
 | 
|  |    703 | %
 | 
|  |    704 | \isadelimproof
 | 
|  |    705 | %
 | 
|  |    706 | \endisadelimproof
 | 
| 13999 |    707 | %
 | 
|  |    708 | \begin{isamarkuptext}%
 | 
|  |    709 | \noindent Note the difference between \isa{{\isacharquery}AB}, a term, and
 | 
|  |    710 | \isa{AB}, a fact.
 | 
|  |    711 | 
 | 
|  |    712 | Finally we want to start the proof with $\land$-elimination so we
 | 
|  |    713 | don't have to perform it twice, as above. Here is a slick way to
 | 
|  |    714 | achieve this:%
 | 
|  |    715 | \end{isamarkuptext}%
 | 
| 17175 |    716 | \isamarkuptrue%
 | 
|  |    717 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    718 | \ \isakeyword{assumes}\ AB{\isacharcolon}\ {\isachardoublequoteopen}large{\isacharunderscore}A\ {\isasymand}\ large{\isacharunderscore}B{\isachardoublequoteclose}\isanewline
 | 
|  |    719 | \ \ \isakeyword{shows}\ {\isachardoublequoteopen}large{\isacharunderscore}B\ {\isasymand}\ large{\isacharunderscore}A{\isachardoublequoteclose}\ {\isacharparenleft}\isakeyword{is}\ {\isachardoublequoteopen}{\isacharquery}B\ {\isasymand}\ {\isacharquery}A{\isachardoublequoteclose}{\isacharparenright}\isanewline
 | 
| 17125 |    720 | %
 | 
|  |    721 | \isadelimproof
 | 
|  |    722 | %
 | 
|  |    723 | \endisadelimproof
 | 
|  |    724 | %
 | 
|  |    725 | \isatagproof
 | 
| 17175 |    726 | \isacommand{using}\isamarkupfalse%
 | 
|  |    727 | \ AB\isanewline
 | 
|  |    728 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    729 | \isanewline
 | 
|  |    730 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    731 | \ {\isachardoublequoteopen}{\isacharquery}A{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharquery}B{\isachardoublequoteclose}\ \isacommand{show}\isamarkupfalse%
 | 
|  |    732 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    733 | \isanewline
 | 
|  |    734 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    735 | %
 | 
| 17125 |    736 | \endisatagproof
 | 
|  |    737 | {\isafoldproof}%
 | 
|  |    738 | %
 | 
|  |    739 | \isadelimproof
 | 
|  |    740 | %
 | 
|  |    741 | \endisadelimproof
 | 
| 13999 |    742 | %
 | 
|  |    743 | \begin{isamarkuptext}%
 | 
|  |    744 | \noindent Command \isakeyword{using} can appear before a proof
 | 
|  |    745 | and adds further facts to those piped into the proof. Here \isa{AB}
 | 
|  |    746 | is the only such fact and it triggers $\land$-elimination. Another
 | 
|  |    747 | frequent idiom is as follows:
 | 
|  |    748 | \begin{center}
 | 
|  |    749 | \isakeyword{from} \emph{major-facts}~
 | 
|  |    750 | \isakeyword{show} \emph{proposition}~
 | 
|  |    751 | \isakeyword{using} \emph{minor-facts}~
 | 
|  |    752 | \emph{proof}
 | 
|  |    753 | \end{center}
 | 
|  |    754 | 
 | 
|  |    755 | Sometimes it is necessary to suppress the implicit application of rules in a
 | 
|  |    756 | \isakeyword{proof}. For example \isakeyword{show}~\isa{A\ {\isasymor}\ B} would
 | 
|  |    757 | trigger $\lor$-introduction, requiring us to prove \isa{A}. A simple
 | 
|  |    758 | ``\isa{{\isacharminus}}'' prevents this \emph{faux pas}:%
 | 
|  |    759 | \end{isamarkuptext}%
 | 
| 17175 |    760 | \isamarkuptrue%
 | 
|  |    761 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    762 | \ \isakeyword{assumes}\ AB{\isacharcolon}\ {\isachardoublequoteopen}A\ {\isasymor}\ B{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}B\ {\isasymor}\ A{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    763 | %
 | 
|  |    764 | \isadelimproof
 | 
|  |    765 | %
 | 
|  |    766 | \endisadelimproof
 | 
|  |    767 | %
 | 
|  |    768 | \isatagproof
 | 
| 17175 |    769 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    770 | \ {\isacharminus}\isanewline
 | 
|  |    771 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    772 | \ AB\ \isacommand{show}\isamarkupfalse%
 | 
|  |    773 | \ {\isacharquery}thesis\isanewline
 | 
|  |    774 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    775 | \isanewline
 | 
|  |    776 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    777 | \ A\ \isacommand{show}\isamarkupfalse%
 | 
|  |    778 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    779 | \isanewline
 | 
|  |    780 | \ \ \isacommand{next}\isamarkupfalse%
 | 
|  |    781 | \isanewline
 | 
|  |    782 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    783 | \ B\ \isacommand{show}\isamarkupfalse%
 | 
|  |    784 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    785 | \isanewline
 | 
|  |    786 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    787 | \isanewline
 | 
|  |    788 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    789 | %
 | 
| 17125 |    790 | \endisatagproof
 | 
|  |    791 | {\isafoldproof}%
 | 
|  |    792 | %
 | 
|  |    793 | \isadelimproof
 | 
|  |    794 | %
 | 
|  |    795 | \endisadelimproof
 | 
| 13999 |    796 | %
 | 
| 19840 |    797 | \begin{isamarkuptext}%
 | 
|  |    798 | Too many names can easily clutter a proof.  We already learned
 | 
|  |    799 | about \isa{this} as a means of avoiding explicit names. Another
 | 
|  |    800 | handy device is to refer to a fact not by name but by contents: for
 | 
|  |    801 | example, writing \isa{{\isacharbackquote}A\ {\isasymor}\ B{\isacharbackquote}} (enclosing the formula in back quotes)
 | 
|  |    802 | refers to the fact \isa{A\ {\isasymor}\ B}
 | 
|  |    803 | without the need to name it. Here is a simple example, a revised version
 | 
|  |    804 | of the previous proof%
 | 
|  |    805 | \end{isamarkuptext}%
 | 
|  |    806 | \isamarkuptrue%
 | 
|  |    807 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    808 | \ \isakeyword{assumes}\ {\isachardoublequoteopen}A\ {\isasymor}\ B{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}B\ {\isasymor}\ A{\isachardoublequoteclose}\isanewline
 | 
|  |    809 | %
 | 
|  |    810 | \isadelimproof
 | 
|  |    811 | %
 | 
|  |    812 | \endisadelimproof
 | 
|  |    813 | %
 | 
|  |    814 | \isatagproof
 | 
|  |    815 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    816 | \ {\isacharminus}\isanewline
 | 
|  |    817 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    818 | \ {\isacharbackquoteopen}A\ {\isasymor}\ B{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 | 
|  |    819 | \ {\isacharquery}thesis%
 | 
|  |    820 | \endisatagproof
 | 
|  |    821 | {\isafoldproof}%
 | 
|  |    822 | %
 | 
|  |    823 | \isadelimproof
 | 
|  |    824 | %
 | 
|  |    825 | \endisadelimproof
 | 
|  |    826 | %
 | 
|  |    827 | \begin{isamarkuptext}%
 | 
|  |    828 | \noindent which continues as before.
 | 
|  |    829 | 
 | 
|  |    830 | Clearly, this device of quoting facts by contents is only advisable
 | 
|  |    831 | for small formulae. In such cases it is superior to naming because the
 | 
|  |    832 | reader immediately sees what the fact is without needing to search for
 | 
|  |    833 | it in the preceding proof text.%
 | 
|  |    834 | \end{isamarkuptext}%
 | 
|  |    835 | \isamarkuptrue%
 | 
|  |    836 | %
 | 
| 13999 |    837 | \isamarkupsubsection{Predicate calculus%
 | 
|  |    838 | }
 | 
|  |    839 | \isamarkuptrue%
 | 
|  |    840 | %
 | 
|  |    841 | \begin{isamarkuptext}%
 | 
|  |    842 | Command \isakeyword{fix} introduces new local variables into a
 | 
|  |    843 | proof. The pair \isakeyword{fix}-\isakeyword{show} corresponds to \isa{{\isasymAnd}}
 | 
|  |    844 | (the universal quantifier at the
 | 
|  |    845 | meta-level) just like \isakeyword{assume}-\isakeyword{show} corresponds to
 | 
|  |    846 | \isa{{\isasymLongrightarrow}}. Here is a sample proof, annotated with the rules that are
 | 
|  |    847 | applied implicitly:%
 | 
|  |    848 | \end{isamarkuptext}%
 | 
| 17175 |    849 | \isamarkuptrue%
 | 
|  |    850 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    851 | \ \isakeyword{assumes}\ P{\isacharcolon}\ {\isachardoublequoteopen}{\isasymforall}x{\isachardot}\ P\ x{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}{\isasymforall}x{\isachardot}\ P{\isacharparenleft}f\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    852 | %
 | 
|  |    853 | \isadelimproof
 | 
|  |    854 | %
 | 
|  |    855 | \endisadelimproof
 | 
|  |    856 | %
 | 
|  |    857 | \isatagproof
 | 
| 17175 |    858 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    859 | \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ %
 | 
| 16459 |    860 | \isamarkupcmt{\isa{allI}: \isa{{\isacharparenleft}{\isasymAnd}x{\isachardot}\ {\isacharquery}P\ x{\isacharparenright}\ {\isasymLongrightarrow}\ {\isasymforall}x{\isachardot}\ {\isacharquery}P\ x}%
 | 
|  |    861 | }
 | 
|  |    862 | \isanewline
 | 
| 17175 |    863 | \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |    864 | \ a\isanewline
 | 
|  |    865 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    866 | \ P\ \isacommand{show}\isamarkupfalse%
 | 
|  |    867 | \ {\isachardoublequoteopen}P{\isacharparenleft}f\ a{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    868 | \ \ %
 | 
| 16459 |    869 | \isamarkupcmt{\isa{allE}: \isa{{\isasymlbrakk}{\isasymforall}x{\isachardot}\ {\isacharquery}P\ x{\isacharsemicolon}\ {\isacharquery}P\ {\isacharquery}x\ {\isasymLongrightarrow}\ {\isacharquery}R{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}R}%
 | 
|  |    870 | }
 | 
|  |    871 | \isanewline
 | 
| 17175 |    872 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    873 | %
 | 
| 17125 |    874 | \endisatagproof
 | 
|  |    875 | {\isafoldproof}%
 | 
|  |    876 | %
 | 
|  |    877 | \isadelimproof
 | 
|  |    878 | %
 | 
|  |    879 | \endisadelimproof
 | 
| 13999 |    880 | %
 | 
|  |    881 | \begin{isamarkuptext}%
 | 
|  |    882 | \noindent Note that in the proof we have chosen to call the bound
 | 
|  |    883 | variable \isa{a} instead of \isa{x} merely to show that the choice of
 | 
|  |    884 | local names is irrelevant.
 | 
|  |    885 | 
 | 
|  |    886 | Next we look at \isa{{\isasymexists}} which is a bit more tricky.%
 | 
|  |    887 | \end{isamarkuptext}%
 | 
| 17175 |    888 | \isamarkuptrue%
 | 
|  |    889 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    890 | \ \isakeyword{assumes}\ Pf{\isacharcolon}\ {\isachardoublequoteopen}{\isasymexists}x{\isachardot}\ P{\isacharparenleft}f\ x{\isacharparenright}{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}{\isasymexists}y{\isachardot}\ P\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    891 | %
 | 
|  |    892 | \isadelimproof
 | 
|  |    893 | %
 | 
|  |    894 | \endisadelimproof
 | 
|  |    895 | %
 | 
|  |    896 | \isatagproof
 | 
| 17175 |    897 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    898 | \ {\isacharminus}\isanewline
 | 
|  |    899 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    900 | \ Pf\ \isacommand{show}\isamarkupfalse%
 | 
|  |    901 | \ {\isacharquery}thesis\isanewline
 | 
|  |    902 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |    903 | \ \ \ \ \ \ \ \ \ \ \ \ \ \ %
 | 
| 16459 |    904 | \isamarkupcmt{\isa{exE}: \isa{{\isasymlbrakk}{\isasymexists}x{\isachardot}\ {\isacharquery}P\ x{\isacharsemicolon}\ {\isasymAnd}x{\isachardot}\ {\isacharquery}P\ x\ {\isasymLongrightarrow}\ {\isacharquery}Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}Q}%
 | 
|  |    905 | }
 | 
|  |    906 | \isanewline
 | 
| 17175 |    907 | \ \ \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |    908 | \ x\isanewline
 | 
|  |    909 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |    910 | \ {\isachardoublequoteopen}P{\isacharparenleft}f\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
|  |    911 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |    912 | \ {\isacharquery}thesis\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    913 | \ \ %
 | 
| 16459 |    914 | \isamarkupcmt{\isa{exI}: \isa{{\isacharquery}P\ {\isacharquery}x\ {\isasymLongrightarrow}\ {\isasymexists}x{\isachardot}\ {\isacharquery}P\ x}%
 | 
|  |    915 | }
 | 
|  |    916 | \isanewline
 | 
| 17175 |    917 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |    918 | \isanewline
 | 
|  |    919 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    920 | %
 | 
| 17125 |    921 | \endisatagproof
 | 
|  |    922 | {\isafoldproof}%
 | 
|  |    923 | %
 | 
|  |    924 | \isadelimproof
 | 
|  |    925 | %
 | 
|  |    926 | \endisadelimproof
 | 
| 13999 |    927 | %
 | 
|  |    928 | \begin{isamarkuptext}%
 | 
|  |    929 | \noindent Explicit $\exists$-elimination as seen above can become
 | 
|  |    930 | cumbersome in practice.  The derived Isar language element
 | 
|  |    931 | \isakeyword{obtain} provides a more appealing form of generalised
 | 
|  |    932 | existence reasoning:%
 | 
|  |    933 | \end{isamarkuptext}%
 | 
| 17175 |    934 | \isamarkuptrue%
 | 
|  |    935 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    936 | \ \isakeyword{assumes}\ Pf{\isacharcolon}\ {\isachardoublequoteopen}{\isasymexists}x{\isachardot}\ P{\isacharparenleft}f\ x{\isacharparenright}{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}{\isasymexists}y{\isachardot}\ P\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    937 | %
 | 
|  |    938 | \isadelimproof
 | 
|  |    939 | %
 | 
|  |    940 | \endisadelimproof
 | 
|  |    941 | %
 | 
|  |    942 | \isatagproof
 | 
| 17175 |    943 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    944 | \ {\isacharminus}\isanewline
 | 
|  |    945 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    946 | \ Pf\ \isacommand{obtain}\isamarkupfalse%
 | 
|  |    947 | \ x\ \isakeyword{where}\ {\isachardoublequoteopen}P{\isacharparenleft}f\ x{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    948 | \isanewline
 | 
|  |    949 | \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |    950 | \ {\isachardoublequoteopen}{\isasymexists}y{\isachardot}\ P\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    951 | \isanewline
 | 
|  |    952 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    953 | %
 | 
| 17125 |    954 | \endisatagproof
 | 
|  |    955 | {\isafoldproof}%
 | 
|  |    956 | %
 | 
|  |    957 | \isadelimproof
 | 
|  |    958 | %
 | 
|  |    959 | \endisadelimproof
 | 
| 13999 |    960 | %
 | 
|  |    961 | \begin{isamarkuptext}%
 | 
|  |    962 | \noindent Note how the proof text follows the usual mathematical style
 | 
|  |    963 | of concluding $P(x)$ from $\exists x. P(x)$, while carefully introducing $x$
 | 
|  |    964 | as a new local variable.  Technically, \isakeyword{obtain} is similar to
 | 
|  |    965 | \isakeyword{fix} and \isakeyword{assume} together with a soundness proof of
 | 
|  |    966 | the elimination involved.
 | 
|  |    967 | 
 | 
|  |    968 | Here is a proof of a well known tautology.
 | 
|  |    969 | Which rule is used where?%
 | 
|  |    970 | \end{isamarkuptext}%
 | 
| 17175 |    971 | \isamarkuptrue%
 | 
|  |    972 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |    973 | \ \isakeyword{assumes}\ ex{\isacharcolon}\ {\isachardoublequoteopen}{\isasymexists}x{\isachardot}\ {\isasymforall}y{\isachardot}\ P\ x\ y{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}{\isasymforall}y{\isachardot}\ {\isasymexists}x{\isachardot}\ P\ x\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |    974 | %
 | 
|  |    975 | \isadelimproof
 | 
|  |    976 | %
 | 
|  |    977 | \endisadelimproof
 | 
|  |    978 | %
 | 
|  |    979 | \isatagproof
 | 
| 17175 |    980 | \isacommand{proof}\isamarkupfalse%
 | 
|  |    981 | \isanewline
 | 
|  |    982 | \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |    983 | \ y\isanewline
 | 
|  |    984 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |    985 | \ ex\ \isacommand{obtain}\isamarkupfalse%
 | 
|  |    986 | \ x\ \isakeyword{where}\ {\isachardoublequoteopen}{\isasymforall}y{\isachardot}\ P\ x\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    987 | \isanewline
 | 
|  |    988 | \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |    989 | \ {\isachardoublequoteopen}P\ x\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    990 | \isanewline
 | 
|  |    991 | \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |    992 | \ {\isachardoublequoteopen}{\isasymexists}x{\isachardot}\ P\ x\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
|  |    993 | \isanewline
 | 
|  |    994 | \isacommand{qed}\isamarkupfalse%
 | 
|  |    995 | %
 | 
| 17125 |    996 | \endisatagproof
 | 
|  |    997 | {\isafoldproof}%
 | 
|  |    998 | %
 | 
|  |    999 | \isadelimproof
 | 
|  |   1000 | %
 | 
|  |   1001 | \endisadelimproof
 | 
| 13999 |   1002 | %
 | 
|  |   1003 | \isamarkupsubsection{Making bigger steps%
 | 
|  |   1004 | }
 | 
|  |   1005 | \isamarkuptrue%
 | 
|  |   1006 | %
 | 
|  |   1007 | \begin{isamarkuptext}%
 | 
|  |   1008 | So far we have confined ourselves to single step proofs. Of course
 | 
|  |   1009 | powerful automatic methods can be used just as well. Here is an example,
 | 
|  |   1010 | Cantor's theorem that there is no surjective function from a set to its
 | 
|  |   1011 | powerset:%
 | 
|  |   1012 | \end{isamarkuptext}%
 | 
| 17175 |   1013 | \isamarkuptrue%
 | 
|  |   1014 | \isacommand{theorem}\isamarkupfalse%
 | 
|  |   1015 | \ {\isachardoublequoteopen}{\isasymexists}S{\isachardot}\ S\ {\isasymnotin}\ range\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ set{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1016 | %
 | 
|  |   1017 | \isadelimproof
 | 
|  |   1018 | %
 | 
|  |   1019 | \endisadelimproof
 | 
|  |   1020 | %
 | 
|  |   1021 | \isatagproof
 | 
| 17175 |   1022 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1023 | \isanewline
 | 
|  |   1024 | \ \ \isacommand{let}\isamarkupfalse%
 | 
|  |   1025 | \ {\isacharquery}S\ {\isacharequal}\ {\isachardoublequoteopen}{\isacharbraceleft}x{\isachardot}\ x\ {\isasymnotin}\ f\ x{\isacharbraceright}{\isachardoublequoteclose}\isanewline
 | 
|  |   1026 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1027 | \ {\isachardoublequoteopen}{\isacharquery}S\ {\isasymnotin}\ range\ f{\isachardoublequoteclose}\isanewline
 | 
|  |   1028 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1029 | \isanewline
 | 
|  |   1030 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1031 | \ {\isachardoublequoteopen}{\isacharquery}S\ {\isasymin}\ range\ f{\isachardoublequoteclose}\isanewline
 | 
|  |   1032 | \ \ \ \ \isacommand{then}\isamarkupfalse%
 | 
|  |   1033 | \ \isacommand{obtain}\isamarkupfalse%
 | 
| 19840 |   1034 | \ y\ \isakeyword{where}\ {\isachardoublequoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
| 17175 |   1035 | \isanewline
 | 
|  |   1036 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1037 | \ False\isanewline
 | 
|  |   1038 | \ \ \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1039 | \ cases\isanewline
 | 
|  |   1040 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1041 | \ {\isachardoublequoteopen}y\ {\isasymin}\ {\isacharquery}S{\isachardoublequoteclose}\isanewline
 | 
|  |   1042 | \ \ \ \ \ \ \isacommand{with}\isamarkupfalse%
 | 
| 19840 |   1043 | \ {\isacharbackquoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 | 
| 17175 |   1044 | \ False\ \isacommand{by}\isamarkupfalse%
 | 
|  |   1045 | \ blast\isanewline
 | 
|  |   1046 | \ \ \ \ \isacommand{next}\isamarkupfalse%
 | 
|  |   1047 | \isanewline
 | 
|  |   1048 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1049 | \ {\isachardoublequoteopen}y\ {\isasymnotin}\ {\isacharquery}S{\isachardoublequoteclose}\isanewline
 | 
|  |   1050 | \ \ \ \ \ \ \isacommand{with}\isamarkupfalse%
 | 
| 19840 |   1051 | \ {\isacharbackquoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 | 
| 17175 |   1052 | \ False\ \isacommand{by}\isamarkupfalse%
 | 
|  |   1053 | \ blast\isanewline
 | 
|  |   1054 | \ \ \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1055 | \isanewline
 | 
|  |   1056 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1057 | \isanewline
 | 
|  |   1058 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1059 | %
 | 
| 17125 |   1060 | \endisatagproof
 | 
|  |   1061 | {\isafoldproof}%
 | 
|  |   1062 | %
 | 
|  |   1063 | \isadelimproof
 | 
|  |   1064 | %
 | 
|  |   1065 | \endisadelimproof
 | 
| 13999 |   1066 | %
 | 
|  |   1067 | \begin{isamarkuptext}%
 | 
|  |   1068 | \noindent
 | 
|  |   1069 | For a start, the example demonstrates two new constructs:
 | 
|  |   1070 | \begin{itemize}
 | 
|  |   1071 | \item \isakeyword{let} introduces an abbreviation for a term, in our case
 | 
|  |   1072 | the witness for the claim.
 | 
|  |   1073 | \item Proof by \isa{cases} starts a proof by cases. Note that it remains
 | 
|  |   1074 | implicit what the two cases are: it is merely expected that the two subproofs
 | 
|  |   1075 | prove \isa{P\ {\isasymLongrightarrow}\ {\isacharquery}thesis} and \isa{{\isasymnot}P\ {\isasymLongrightarrow}\ {\isacharquery}thesis} (in that order)
 | 
|  |   1076 | for some \isa{P}.
 | 
|  |   1077 | \end{itemize}
 | 
|  |   1078 | If you wonder how to \isakeyword{obtain} \isa{y}:
 | 
|  |   1079 | via the predefined elimination rule \isa{{\isasymlbrakk}b\ {\isasymin}\ range\ f{\isacharsemicolon}\ {\isasymAnd}x{\isachardot}\ b\ {\isacharequal}\ f\ x\ {\isasymLongrightarrow}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ P}.
 | 
|  |   1080 | 
 | 
|  |   1081 | Method \isa{blast} is used because the contradiction does not follow easily
 | 
|  |   1082 | by just a single rule. If you find the proof too cryptic for human
 | 
|  |   1083 | consumption, here is a more detailed version; the beginning up to
 | 
|  |   1084 | \isakeyword{obtain} stays unchanged.%
 | 
|  |   1085 | \end{isamarkuptext}%
 | 
| 17175 |   1086 | \isamarkuptrue%
 | 
|  |   1087 | \isacommand{theorem}\isamarkupfalse%
 | 
|  |   1088 | \ {\isachardoublequoteopen}{\isasymexists}S{\isachardot}\ S\ {\isasymnotin}\ range\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ set{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1089 | %
 | 
|  |   1090 | \isadelimproof
 | 
|  |   1091 | %
 | 
|  |   1092 | \endisadelimproof
 | 
|  |   1093 | %
 | 
|  |   1094 | \isatagproof
 | 
| 17175 |   1095 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1096 | \isanewline
 | 
|  |   1097 | \ \ \isacommand{let}\isamarkupfalse%
 | 
|  |   1098 | \ {\isacharquery}S\ {\isacharequal}\ {\isachardoublequoteopen}{\isacharbraceleft}x{\isachardot}\ x\ {\isasymnotin}\ f\ x{\isacharbraceright}{\isachardoublequoteclose}\isanewline
 | 
|  |   1099 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1100 | \ {\isachardoublequoteopen}{\isacharquery}S\ {\isasymnotin}\ range\ f{\isachardoublequoteclose}\isanewline
 | 
|  |   1101 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1102 | \isanewline
 | 
|  |   1103 | \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1104 | \ {\isachardoublequoteopen}{\isacharquery}S\ {\isasymin}\ range\ f{\isachardoublequoteclose}\isanewline
 | 
|  |   1105 | \ \ \ \ \isacommand{then}\isamarkupfalse%
 | 
|  |   1106 | \ \isacommand{obtain}\isamarkupfalse%
 | 
| 19840 |   1107 | \ y\ \isakeyword{where}\ {\isachardoublequoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 | 
| 17175 |   1108 | \isanewline
 | 
|  |   1109 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1110 | \ False\isanewline
 | 
|  |   1111 | \ \ \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1112 | \ cases\isanewline
 | 
|  |   1113 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1114 | \ {\isachardoublequoteopen}y\ {\isasymin}\ {\isacharquery}S{\isachardoublequoteclose}\isanewline
 | 
|  |   1115 | \ \ \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |   1116 | \ {\isachardoublequoteopen}y\ {\isasymnotin}\ f\ y{\isachardoublequoteclose}\ \ \ \isacommand{by}\isamarkupfalse%
 | 
|  |   1117 | \ simp\isanewline
 | 
|  |   1118 | \ \ \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |   1119 | \ {\isachardoublequoteopen}y\ {\isasymnotin}\ {\isacharquery}S{\isachardoublequoteclose}\ \ \ \ \isacommand{by}\isamarkupfalse%
 | 
| 19840 |   1120 | {\isacharparenleft}simp\ add{\isacharcolon}\ {\isacharbackquoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isacharbackquoteclose}{\isacharparenright}\isanewline
 | 
| 17175 |   1121 | \ \ \ \ \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |   1122 | \ False\ \ \ \ \ \ \ \ \ \isacommand{by}\isamarkupfalse%
 | 
|  |   1123 | \ contradiction\isanewline
 | 
|  |   1124 | \ \ \ \ \isacommand{next}\isamarkupfalse%
 | 
|  |   1125 | \isanewline
 | 
|  |   1126 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1127 | \ {\isachardoublequoteopen}y\ {\isasymnotin}\ {\isacharquery}S{\isachardoublequoteclose}\isanewline
 | 
|  |   1128 | \ \ \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |   1129 | \ {\isachardoublequoteopen}y\ {\isasymin}\ f\ y{\isachardoublequoteclose}\ \ \ \isacommand{by}\isamarkupfalse%
 | 
|  |   1130 | \ simp\isanewline
 | 
|  |   1131 | \ \ \ \ \ \ \isacommand{hence}\isamarkupfalse%
 | 
|  |   1132 | \ {\isachardoublequoteopen}y\ {\isasymin}\ {\isacharquery}S{\isachardoublequoteclose}\ \ \ \ \isacommand{by}\isamarkupfalse%
 | 
| 19840 |   1133 | {\isacharparenleft}simp\ add{\isacharcolon}\ {\isacharbackquoteopen}{\isacharquery}S\ {\isacharequal}\ f\ y{\isacharbackquoteclose}{\isacharparenright}\isanewline
 | 
| 17175 |   1134 | \ \ \ \ \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |   1135 | \ False\ \ \ \ \ \ \ \ \ \isacommand{by}\isamarkupfalse%
 | 
|  |   1136 | \ contradiction\isanewline
 | 
|  |   1137 | \ \ \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1138 | \isanewline
 | 
|  |   1139 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1140 | \isanewline
 | 
|  |   1141 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1142 | %
 | 
| 17125 |   1143 | \endisatagproof
 | 
|  |   1144 | {\isafoldproof}%
 | 
|  |   1145 | %
 | 
|  |   1146 | \isadelimproof
 | 
|  |   1147 | %
 | 
|  |   1148 | \endisadelimproof
 | 
| 13999 |   1149 | %
 | 
|  |   1150 | \begin{isamarkuptext}%
 | 
|  |   1151 | \noindent Method \isa{contradiction} succeeds if both $P$ and
 | 
|  |   1152 | $\neg P$ are among the assumptions and the facts fed into that step, in any order.
 | 
|  |   1153 | 
 | 
|  |   1154 | As it happens, Cantor's theorem can be proved automatically by best-first
 | 
|  |   1155 | search. Depth-first search would diverge, but best-first search successfully
 | 
|  |   1156 | navigates through the large search space:%
 | 
|  |   1157 | \end{isamarkuptext}%
 | 
| 17175 |   1158 | \isamarkuptrue%
 | 
|  |   1159 | \isacommand{theorem}\isamarkupfalse%
 | 
|  |   1160 | \ {\isachardoublequoteopen}{\isasymexists}S{\isachardot}\ S\ {\isasymnotin}\ range\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ set{\isacharparenright}{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1161 | %
 | 
|  |   1162 | \isadelimproof
 | 
|  |   1163 | %
 | 
|  |   1164 | \endisadelimproof
 | 
|  |   1165 | %
 | 
|  |   1166 | \isatagproof
 | 
| 17175 |   1167 | \isacommand{by}\isamarkupfalse%
 | 
|  |   1168 | \ best%
 | 
| 17125 |   1169 | \endisatagproof
 | 
|  |   1170 | {\isafoldproof}%
 | 
|  |   1171 | %
 | 
|  |   1172 | \isadelimproof
 | 
|  |   1173 | %
 | 
|  |   1174 | \endisadelimproof
 | 
| 13999 |   1175 | %
 | 
|  |   1176 | \isamarkupsubsection{Raw proof blocks%
 | 
|  |   1177 | }
 | 
|  |   1178 | \isamarkuptrue%
 | 
|  |   1179 | %
 | 
|  |   1180 | \begin{isamarkuptext}%
 | 
|  |   1181 | Although we have shown how to employ powerful automatic methods like
 | 
|  |   1182 | \isa{blast} to achieve bigger proof steps, there may still be the
 | 
|  |   1183 | tendency to use the default introduction and elimination rules to
 | 
|  |   1184 | decompose goals and facts. This can lead to very tedious proofs:%
 | 
|  |   1185 | \end{isamarkuptext}%
 | 
| 17175 |   1186 | \isamarkuptrue%
 | 
| 17125 |   1187 | %
 | 
|  |   1188 | \isadelimML
 | 
|  |   1189 | %
 | 
|  |   1190 | \endisadelimML
 | 
|  |   1191 | %
 | 
|  |   1192 | \isatagML
 | 
|  |   1193 | %
 | 
|  |   1194 | \endisatagML
 | 
|  |   1195 | {\isafoldML}%
 | 
|  |   1196 | %
 | 
|  |   1197 | \isadelimML
 | 
|  |   1198 | %
 | 
|  |   1199 | \endisadelimML
 | 
| 17175 |   1200 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1201 | \ {\isachardoublequoteopen}{\isasymforall}x\ y{\isachardot}\ A\ x\ y\ {\isasymand}\ B\ x\ y\ {\isasymlongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1202 | %
 | 
|  |   1203 | \isadelimproof
 | 
|  |   1204 | %
 | 
|  |   1205 | \endisadelimproof
 | 
|  |   1206 | %
 | 
|  |   1207 | \isatagproof
 | 
| 17175 |   1208 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1209 | \isanewline
 | 
|  |   1210 | \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |   1211 | \ x\ \isacommand{show}\isamarkupfalse%
 | 
|  |   1212 | \ {\isachardoublequoteopen}{\isasymforall}y{\isachardot}\ A\ x\ y\ {\isasymand}\ B\ x\ y\ {\isasymlongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1213 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1214 | \isanewline
 | 
|  |   1215 | \ \ \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |   1216 | \ y\ \isacommand{show}\isamarkupfalse%
 | 
|  |   1217 | \ {\isachardoublequoteopen}A\ x\ y\ {\isasymand}\ B\ x\ y\ {\isasymlongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1218 | \ \ \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1219 | \isanewline
 | 
|  |   1220 | \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1221 | \ {\isachardoublequoteopen}A\ x\ y\ {\isasymand}\ B\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1222 | \ \ \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1223 | \ {\isachardoublequoteopen}C\ x\ y{\isachardoublequoteclose}\ \isacommand{sorry}\isamarkupfalse%
 | 
|  |   1224 | \isanewline
 | 
|  |   1225 | \ \ \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1226 | \isanewline
 | 
|  |   1227 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1228 | \isanewline
 | 
|  |   1229 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1230 | %
 | 
| 17125 |   1231 | \endisatagproof
 | 
|  |   1232 | {\isafoldproof}%
 | 
|  |   1233 | %
 | 
|  |   1234 | \isadelimproof
 | 
|  |   1235 | %
 | 
|  |   1236 | \endisadelimproof
 | 
| 13999 |   1237 | %
 | 
|  |   1238 | \begin{isamarkuptext}%
 | 
|  |   1239 | \noindent Since we are only interested in the decomposition and not the
 | 
|  |   1240 | actual proof, the latter has been replaced by
 | 
|  |   1241 | \isakeyword{sorry}. Command \isakeyword{sorry} proves anything but is
 | 
|  |   1242 | only allowed in quick and dirty mode, the default interactive mode. It
 | 
|  |   1243 | is very convenient for top down proof development.
 | 
|  |   1244 | 
 | 
|  |   1245 | Luckily we can avoid this step by step decomposition very easily:%
 | 
|  |   1246 | \end{isamarkuptext}%
 | 
| 17175 |   1247 | \isamarkuptrue%
 | 
|  |   1248 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1249 | \ {\isachardoublequoteopen}{\isasymforall}x\ y{\isachardot}\ A\ x\ y\ {\isasymand}\ B\ x\ y\ {\isasymlongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1250 | %
 | 
|  |   1251 | \isadelimproof
 | 
|  |   1252 | %
 | 
|  |   1253 | \endisadelimproof
 | 
|  |   1254 | %
 | 
|  |   1255 | \isatagproof
 | 
| 17175 |   1256 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1257 | \ {\isacharminus}\isanewline
 | 
|  |   1258 | \ \ \isacommand{have}\isamarkupfalse%
 | 
|  |   1259 | \ {\isachardoublequoteopen}{\isasymAnd}x\ y{\isachardot}\ {\isasymlbrakk}\ A\ x\ y{\isacharsemicolon}\ B\ x\ y\ {\isasymrbrakk}\ {\isasymLongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1260 | \ \ \isacommand{proof}\isamarkupfalse%
 | 
|  |   1261 | \ {\isacharminus}\isanewline
 | 
|  |   1262 | \ \ \ \ \isacommand{fix}\isamarkupfalse%
 | 
|  |   1263 | \ x\ y\ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1264 | \ {\isachardoublequoteopen}A\ x\ y{\isachardoublequoteclose}\ {\isachardoublequoteopen}B\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1265 | \ \ \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1266 | \ {\isachardoublequoteopen}C\ x\ y{\isachardoublequoteclose}\ \isacommand{sorry}\isamarkupfalse%
 | 
|  |   1267 | \isanewline
 | 
|  |   1268 | \ \ \isacommand{qed}\isamarkupfalse%
 | 
|  |   1269 | \isanewline
 | 
|  |   1270 | \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |   1271 | \ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
 | 
|  |   1272 | \ blast\isanewline
 | 
|  |   1273 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1274 | %
 | 
| 17125 |   1275 | \endisatagproof
 | 
|  |   1276 | {\isafoldproof}%
 | 
|  |   1277 | %
 | 
|  |   1278 | \isadelimproof
 | 
|  |   1279 | %
 | 
|  |   1280 | \endisadelimproof
 | 
| 13999 |   1281 | %
 | 
|  |   1282 | \begin{isamarkuptext}%
 | 
|  |   1283 | \noindent
 | 
|  |   1284 | This can be simplified further by \emph{raw proof blocks}, i.e.\
 | 
|  |   1285 | proofs enclosed in braces:%
 | 
|  |   1286 | \end{isamarkuptext}%
 | 
| 17175 |   1287 | \isamarkuptrue%
 | 
|  |   1288 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1289 | \ {\isachardoublequoteopen}{\isasymforall}x\ y{\isachardot}\ A\ x\ y\ {\isasymand}\ B\ x\ y\ {\isasymlongrightarrow}\ C\ x\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1290 | %
 | 
|  |   1291 | \isadelimproof
 | 
|  |   1292 | %
 | 
|  |   1293 | \endisadelimproof
 | 
|  |   1294 | %
 | 
|  |   1295 | \isatagproof
 | 
| 17175 |   1296 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1297 | \ {\isacharminus}\isanewline
 | 
|  |   1298 | \ \ \isacommand{{\isacharbraceleft}}\isamarkupfalse%
 | 
|  |   1299 | \ \isacommand{fix}\isamarkupfalse%
 | 
|  |   1300 | \ x\ y\ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1301 | \ {\isachardoublequoteopen}A\ x\ y{\isachardoublequoteclose}\ {\isachardoublequoteopen}B\ x\ y{\isachardoublequoteclose}\isanewline
 | 
|  |   1302 | \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
|  |   1303 | \ {\isachardoublequoteopen}C\ x\ y{\isachardoublequoteclose}\ \isacommand{sorry}\isamarkupfalse%
 | 
|  |   1304 | \ \isacommand{{\isacharbraceright}}\isamarkupfalse%
 | 
|  |   1305 | \isanewline
 | 
|  |   1306 | \ \ \isacommand{thus}\isamarkupfalse%
 | 
|  |   1307 | \ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
 | 
|  |   1308 | \ blast\isanewline
 | 
|  |   1309 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1310 | %
 | 
| 17125 |   1311 | \endisatagproof
 | 
|  |   1312 | {\isafoldproof}%
 | 
|  |   1313 | %
 | 
|  |   1314 | \isadelimproof
 | 
|  |   1315 | %
 | 
|  |   1316 | \endisadelimproof
 | 
| 13999 |   1317 | %
 | 
|  |   1318 | \begin{isamarkuptext}%
 | 
|  |   1319 | \noindent The result of the raw proof block is the same theorem
 | 
|  |   1320 | as above, namely \isa{{\isasymAnd}x\ y{\isachardot}\ {\isasymlbrakk}A\ x\ y{\isacharsemicolon}\ B\ x\ y{\isasymrbrakk}\ {\isasymLongrightarrow}\ C\ x\ y}.  Raw
 | 
|  |   1321 | proof blocks are like ordinary proofs except that they do not prove
 | 
|  |   1322 | some explicitly stated property but that the property emerges directly
 | 
|  |   1323 | out of the \isakeyword{fixe}s, \isakeyword{assume}s and
 | 
|  |   1324 | \isakeyword{have} in the block. Thus they again serve to avoid
 | 
|  |   1325 | duplication. Note that the conclusion of a raw proof block is stated with
 | 
|  |   1326 | \isakeyword{have} rather than \isakeyword{show} because it is not the
 | 
|  |   1327 | conclusion of some pending goal but some independent claim.
 | 
|  |   1328 | 
 | 
|  |   1329 | The general idea demonstrated in this subsection is very
 | 
|  |   1330 | important in Isar and distinguishes it from tactic-style proofs:
 | 
|  |   1331 | \begin{quote}\em
 | 
|  |   1332 | Do not manipulate the proof state into a particular form by applying
 | 
|  |   1333 | tactics but state the desired form explicitly and let the tactic verify
 | 
|  |   1334 | that from this form the original goal follows.
 | 
|  |   1335 | \end{quote}
 | 
| 14617 |   1336 | This yields more readable and also more robust proofs.
 | 
|  |   1337 | 
 | 
|  |   1338 | \subsubsection{General case distinctions}
 | 
|  |   1339 | 
 | 
|  |   1340 | As an important application of raw proof blocks we show how to deal
 | 
|  |   1341 | with general case distinctions --- more specific kinds are treated in
 | 
|  |   1342 | \S\ref{sec:CaseDistinction}. Imagine that you would like to prove some
 | 
|  |   1343 | goal by distinguishing $n$ cases $P_1$, \dots, $P_n$. You show that
 | 
|  |   1344 | the $n$ cases are exhaustive (i.e.\ $P_1 \lor \dots \lor P_n$) and
 | 
|  |   1345 | that each case $P_i$ implies the goal. Taken together, this proves the
 | 
|  |   1346 | goal. The corresponding Isar proof pattern (for $n = 3$) is very handy:%
 | 
| 13999 |   1347 | \end{isamarkuptext}%
 | 
| 17175 |   1348 | \isamarkuptrue%
 | 
| 13999 |   1349 | %
 | 
| 14617 |   1350 | \renewcommand{\isamarkupcmt}[1]{#1}
 | 
| 17125 |   1351 | %
 | 
|  |   1352 | \isadelimproof
 | 
|  |   1353 | %
 | 
|  |   1354 | \endisadelimproof
 | 
|  |   1355 | %
 | 
|  |   1356 | \isatagproof
 | 
| 17175 |   1357 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1358 | \ {\isacharminus}\isanewline
 | 
|  |   1359 | \ \ \isacommand{have}\isamarkupfalse%
 | 
| 17181 |   1360 | \ {\isachardoublequoteopen}P\isactrlisub {\isadigit{1}}\ {\isasymor}\ P\isactrlisub {\isadigit{2}}\ {\isasymor}\ P\isactrlisub {\isadigit{3}}{\isachardoublequoteclose}\ \ %
 | 
| 16459 |   1361 | \isamarkupcmt{\dots%
 | 
|  |   1362 | }
 | 
|  |   1363 | \isanewline
 | 
| 17175 |   1364 | \ \ \isacommand{moreover}\isamarkupfalse%
 | 
|  |   1365 | \isanewline
 | 
|  |   1366 | \ \ \isacommand{{\isacharbraceleft}}\isamarkupfalse%
 | 
|  |   1367 | \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1368 | \ P\isactrlisub {\isadigit{1}}\isanewline
 | 
| 16459 |   1369 | \ \ \ \ %
 | 
|  |   1370 | \isamarkupcmt{\dots%
 | 
|  |   1371 | }
 | 
|  |   1372 | \isanewline
 | 
| 17175 |   1373 | \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
| 17181 |   1374 | \ {\isacharquery}thesis\ \ %
 | 
| 16459 |   1375 | \isamarkupcmt{\dots%
 | 
|  |   1376 | }
 | 
| 17175 |   1377 | \ \isacommand{{\isacharbraceright}}\isamarkupfalse%
 | 
|  |   1378 | \isanewline
 | 
|  |   1379 | \ \ \isacommand{moreover}\isamarkupfalse%
 | 
|  |   1380 | \isanewline
 | 
|  |   1381 | \ \ \isacommand{{\isacharbraceleft}}\isamarkupfalse%
 | 
|  |   1382 | \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1383 | \ P\isactrlisub {\isadigit{2}}\isanewline
 | 
| 16459 |   1384 | \ \ \ \ %
 | 
|  |   1385 | \isamarkupcmt{\dots%
 | 
|  |   1386 | }
 | 
|  |   1387 | \isanewline
 | 
| 17175 |   1388 | \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
| 17181 |   1389 | \ {\isacharquery}thesis\ \ %
 | 
| 16459 |   1390 | \isamarkupcmt{\dots%
 | 
|  |   1391 | }
 | 
| 17175 |   1392 | \ \isacommand{{\isacharbraceright}}\isamarkupfalse%
 | 
|  |   1393 | \isanewline
 | 
|  |   1394 | \ \ \isacommand{moreover}\isamarkupfalse%
 | 
|  |   1395 | \isanewline
 | 
|  |   1396 | \ \ \isacommand{{\isacharbraceleft}}\isamarkupfalse%
 | 
|  |   1397 | \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1398 | \ P\isactrlisub {\isadigit{3}}\isanewline
 | 
| 16459 |   1399 | \ \ \ \ %
 | 
|  |   1400 | \isamarkupcmt{\dots%
 | 
|  |   1401 | }
 | 
|  |   1402 | \isanewline
 | 
| 17175 |   1403 | \ \ \ \ \isacommand{have}\isamarkupfalse%
 | 
| 17181 |   1404 | \ {\isacharquery}thesis\ \ %
 | 
| 16459 |   1405 | \isamarkupcmt{\dots%
 | 
|  |   1406 | }
 | 
| 17175 |   1407 | \ \isacommand{{\isacharbraceright}}\isamarkupfalse%
 | 
|  |   1408 | \isanewline
 | 
|  |   1409 | \ \ \isacommand{ultimately}\isamarkupfalse%
 | 
|  |   1410 | \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1411 | \ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
 | 
|  |   1412 | \ blast\isanewline
 | 
|  |   1413 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1414 | %
 | 
| 17125 |   1415 | \endisatagproof
 | 
|  |   1416 | {\isafoldproof}%
 | 
|  |   1417 | %
 | 
|  |   1418 | \isadelimproof
 | 
|  |   1419 | %
 | 
|  |   1420 | \endisadelimproof
 | 
| 14617 |   1421 | %
 | 
|  |   1422 | \renewcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
 | 
|  |   1423 | %
 | 
| 13999 |   1424 | \isamarkupsubsection{Further refinements%
 | 
|  |   1425 | }
 | 
|  |   1426 | \isamarkuptrue%
 | 
|  |   1427 | %
 | 
|  |   1428 | \begin{isamarkuptext}%
 | 
|  |   1429 | This subsection discusses some further tricks that can make
 | 
|  |   1430 | life easier although they are not essential.%
 | 
|  |   1431 | \end{isamarkuptext}%
 | 
|  |   1432 | \isamarkuptrue%
 | 
|  |   1433 | %
 | 
|  |   1434 | \isamarkupsubsubsection{\isakeyword{and}%
 | 
|  |   1435 | }
 | 
|  |   1436 | \isamarkuptrue%
 | 
|  |   1437 | %
 | 
|  |   1438 | \begin{isamarkuptext}%
 | 
|  |   1439 | Propositions (following \isakeyword{assume} etc) may but need not be
 | 
|  |   1440 | separated by \isakeyword{and}. This is not just for readability
 | 
|  |   1441 | (\isakeyword{from} \isa{A} \isakeyword{and} \isa{B} looks nicer than
 | 
|  |   1442 | \isakeyword{from} \isa{A} \isa{B}) but for structuring lists of propositions
 | 
|  |   1443 | into possibly named blocks. In
 | 
|  |   1444 | \begin{center}
 | 
|  |   1445 | \isakeyword{assume} \isa{A:} $A_1$ $A_2$ \isakeyword{and} \isa{B:} $A_3$
 | 
|  |   1446 | \isakeyword{and} $A_4$
 | 
|  |   1447 | \end{center}
 | 
|  |   1448 | label \isa{A} refers to the list of propositions $A_1$ $A_2$ and
 | 
|  |   1449 | label \isa{B} to $A_3$.%
 | 
|  |   1450 | \end{isamarkuptext}%
 | 
|  |   1451 | \isamarkuptrue%
 | 
|  |   1452 | %
 | 
|  |   1453 | \isamarkupsubsubsection{\isakeyword{note}%
 | 
|  |   1454 | }
 | 
|  |   1455 | \isamarkuptrue%
 | 
|  |   1456 | %
 | 
|  |   1457 | \begin{isamarkuptext}%
 | 
|  |   1458 | If you want to remember intermediate fact(s) that cannot be
 | 
|  |   1459 | named directly, use \isakeyword{note}. For example the result of raw
 | 
|  |   1460 | proof block can be named by following it with
 | 
|  |   1461 | \isakeyword{note}~\isa{some{\isacharunderscore}name\ {\isacharequal}\ this}.  As a side effect,
 | 
|  |   1462 | \isa{this} is set to the list of facts on the right-hand side. You
 | 
|  |   1463 | can also say \isa{note\ some{\isacharunderscore}fact}, which simply sets \isa{this},
 | 
|  |   1464 | i.e.\ recalls \isa{some{\isacharunderscore}fact}, e.g.\ in a \isakeyword{moreover} sequence.%
 | 
|  |   1465 | \end{isamarkuptext}%
 | 
|  |   1466 | \isamarkuptrue%
 | 
|  |   1467 | %
 | 
|  |   1468 | \isamarkupsubsubsection{\isakeyword{fixes}%
 | 
|  |   1469 | }
 | 
|  |   1470 | \isamarkuptrue%
 | 
|  |   1471 | %
 | 
|  |   1472 | \begin{isamarkuptext}%
 | 
|  |   1473 | Sometimes it is necessary to decorate a proposition with type
 | 
|  |   1474 | constraints, as in Cantor's theorem above. These type constraints tend
 | 
|  |   1475 | to make the theorem less readable. The situation can be improved a
 | 
|  |   1476 | little by combining the type constraint with an outer \isa{{\isasymAnd}}:%
 | 
|  |   1477 | \end{isamarkuptext}%
 | 
| 17175 |   1478 | \isamarkuptrue%
 | 
|  |   1479 | \isacommand{theorem}\isamarkupfalse%
 | 
|  |   1480 | \ {\isachardoublequoteopen}{\isasymAnd}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ set{\isachardot}\ {\isasymexists}S{\isachardot}\ S\ {\isasymnotin}\ range\ f{\isachardoublequoteclose}%
 | 
| 17125 |   1481 | \isadelimproof
 | 
|  |   1482 | %
 | 
|  |   1483 | \endisadelimproof
 | 
|  |   1484 | %
 | 
|  |   1485 | \isatagproof
 | 
|  |   1486 | %
 | 
|  |   1487 | \endisatagproof
 | 
|  |   1488 | {\isafoldproof}%
 | 
|  |   1489 | %
 | 
|  |   1490 | \isadelimproof
 | 
|  |   1491 | %
 | 
|  |   1492 | \endisadelimproof
 | 
| 13999 |   1493 | %
 | 
|  |   1494 | \begin{isamarkuptext}%
 | 
|  |   1495 | \noindent However, now \isa{f} is bound and we need a
 | 
|  |   1496 | \isakeyword{fix}~\isa{f} in the proof before we can refer to \isa{f}.
 | 
|  |   1497 | This is avoided by \isakeyword{fixes}:%
 | 
|  |   1498 | \end{isamarkuptext}%
 | 
| 17175 |   1499 | \isamarkuptrue%
 | 
|  |   1500 | \isacommand{theorem}\isamarkupfalse%
 | 
|  |   1501 | \ \isakeyword{fixes}\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ set{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}{\isasymexists}S{\isachardot}\ S\ {\isasymnotin}\ range\ f{\isachardoublequoteclose}%
 | 
| 17125 |   1502 | \isadelimproof
 | 
|  |   1503 | %
 | 
|  |   1504 | \endisadelimproof
 | 
|  |   1505 | %
 | 
|  |   1506 | \isatagproof
 | 
|  |   1507 | %
 | 
|  |   1508 | \endisatagproof
 | 
|  |   1509 | {\isafoldproof}%
 | 
|  |   1510 | %
 | 
|  |   1511 | \isadelimproof
 | 
|  |   1512 | %
 | 
|  |   1513 | \endisadelimproof
 | 
| 13999 |   1514 | %
 | 
|  |   1515 | \begin{isamarkuptext}%
 | 
|  |   1516 | \noindent
 | 
|  |   1517 | Even better, \isakeyword{fixes} allows to introduce concrete syntax locally:%
 | 
|  |   1518 | \end{isamarkuptext}%
 | 
| 17175 |   1519 | \isamarkuptrue%
 | 
|  |   1520 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1521 | \ comm{\isacharunderscore}mono{\isacharcolon}\isanewline
 | 
|  |   1522 | \ \ \isakeyword{fixes}\ r\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ {\isacharparenleft}\isakeyword{infix}\ {\isachardoublequoteopen}{\isachargreater}{\isachardoublequoteclose}\ {\isadigit{6}}{\isadigit{0}}{\isacharparenright}\ \isakeyword{and}\isanewline
 | 
|  |   1523 | \ \ \ \ \ \ \ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isacharplus}{\isacharplus}{\isachardoublequoteclose}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
 | 
|  |   1524 | \ \ \isakeyword{assumes}\ comm{\isacharcolon}\ {\isachardoublequoteopen}{\isasymAnd}x\ y{\isacharcolon}{\isacharcolon}{\isacharprime}a{\isachardot}\ x\ {\isacharplus}{\isacharplus}\ y\ {\isacharequal}\ y\ {\isacharplus}{\isacharplus}\ x{\isachardoublequoteclose}\ \isakeyword{and}\isanewline
 | 
|  |   1525 | \ \ \ \ \ \ \ \ \ \ mono{\isacharcolon}\ {\isachardoublequoteopen}{\isasymAnd}x\ y\ z{\isacharcolon}{\isacharcolon}{\isacharprime}a{\isachardot}\ x\ {\isachargreater}\ y\ {\isasymLongrightarrow}\ x\ {\isacharplus}{\isacharplus}\ z\ {\isachargreater}\ y\ {\isacharplus}{\isacharplus}\ z{\isachardoublequoteclose}\isanewline
 | 
|  |   1526 | \ \ \isakeyword{shows}\ {\isachardoublequoteopen}x\ {\isachargreater}\ y\ {\isasymLongrightarrow}\ z\ {\isacharplus}{\isacharplus}\ x\ {\isachargreater}\ z\ {\isacharplus}{\isacharplus}\ y{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1527 | %
 | 
|  |   1528 | \isadelimproof
 | 
|  |   1529 | %
 | 
|  |   1530 | \endisadelimproof
 | 
|  |   1531 | %
 | 
|  |   1532 | \isatagproof
 | 
| 17175 |   1533 | \isacommand{by}\isamarkupfalse%
 | 
|  |   1534 | {\isacharparenleft}simp\ add{\isacharcolon}\ comm\ mono{\isacharparenright}%
 | 
| 17125 |   1535 | \endisatagproof
 | 
|  |   1536 | {\isafoldproof}%
 | 
|  |   1537 | %
 | 
|  |   1538 | \isadelimproof
 | 
|  |   1539 | %
 | 
|  |   1540 | \endisadelimproof
 | 
| 13999 |   1541 | %
 | 
|  |   1542 | \begin{isamarkuptext}%
 | 
|  |   1543 | \noindent The concrete syntax is dropped at the end of the proof and the
 | 
|  |   1544 | theorem becomes \begin{isabelle}%
 | 
|  |   1545 | {\isasymlbrakk}{\isasymAnd}x\ y{\isachardot}\ {\isacharquery}f\ x\ y\ {\isacharequal}\ {\isacharquery}f\ y\ x{\isacharsemicolon}\isanewline
 | 
| 14617 |   1546 | \isaindent{\ }{\isasymAnd}x\ y\ z{\isachardot}\ {\isacharquery}r\ x\ y\ {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ x\ z{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ y\ z{\isacharparenright}{\isacharsemicolon}\ {\isacharquery}r\ {\isacharquery}x\ {\isacharquery}y{\isasymrbrakk}\isanewline
 | 
| 13999 |   1547 | {\isasymLongrightarrow}\ {\isacharquery}r\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}x{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f\ {\isacharquery}z\ {\isacharquery}y{\isacharparenright}%
 | 
|  |   1548 | \end{isabelle}
 | 
|  |   1549 | \tweakskip%
 | 
|  |   1550 | \end{isamarkuptext}%
 | 
|  |   1551 | \isamarkuptrue%
 | 
|  |   1552 | %
 | 
|  |   1553 | \isamarkupsubsubsection{\isakeyword{obtain}%
 | 
|  |   1554 | }
 | 
|  |   1555 | \isamarkuptrue%
 | 
|  |   1556 | %
 | 
|  |   1557 | \begin{isamarkuptext}%
 | 
|  |   1558 | The \isakeyword{obtain} construct can introduce multiple
 | 
|  |   1559 | witnesses and propositions as in the following proof fragment:%
 | 
|  |   1560 | \end{isamarkuptext}%
 | 
| 17175 |   1561 | \isamarkuptrue%
 | 
|  |   1562 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1563 | \ \isakeyword{assumes}\ A{\isacharcolon}\ {\isachardoublequoteopen}{\isasymexists}x\ y{\isachardot}\ P\ x\ y\ {\isasymand}\ Q\ x\ y{\isachardoublequoteclose}\ \isakeyword{shows}\ {\isachardoublequoteopen}R{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1564 | %
 | 
|  |   1565 | \isadelimproof
 | 
|  |   1566 | %
 | 
|  |   1567 | \endisadelimproof
 | 
|  |   1568 | %
 | 
|  |   1569 | \isatagproof
 | 
| 17175 |   1570 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1571 | \ {\isacharminus}\isanewline
 | 
|  |   1572 | \ \ \isacommand{from}\isamarkupfalse%
 | 
|  |   1573 | \ A\ \isacommand{obtain}\isamarkupfalse%
 | 
|  |   1574 | \ x\ y\ \isakeyword{where}\ P{\isacharcolon}\ {\isachardoublequoteopen}P\ x\ y{\isachardoublequoteclose}\ \isakeyword{and}\ Q{\isacharcolon}\ {\isachardoublequoteopen}Q\ x\ y{\isachardoublequoteclose}\ \ \isacommand{by}\isamarkupfalse%
 | 
| 17181 |   1575 | \ blast%
 | 
| 17125 |   1576 | \endisatagproof
 | 
|  |   1577 | {\isafoldproof}%
 | 
|  |   1578 | %
 | 
|  |   1579 | \isadelimproof
 | 
|  |   1580 | %
 | 
|  |   1581 | \endisadelimproof
 | 
| 13999 |   1582 | %
 | 
|  |   1583 | \begin{isamarkuptext}%
 | 
|  |   1584 | Remember also that one does not even need to start with a formula
 | 
|  |   1585 | containing \isa{{\isasymexists}} as we saw in the proof of Cantor's theorem.%
 | 
|  |   1586 | \end{isamarkuptext}%
 | 
|  |   1587 | \isamarkuptrue%
 | 
|  |   1588 | %
 | 
|  |   1589 | \isamarkupsubsubsection{Combining proof styles%
 | 
|  |   1590 | }
 | 
|  |   1591 | \isamarkuptrue%
 | 
|  |   1592 | %
 | 
|  |   1593 | \begin{isamarkuptext}%
 | 
|  |   1594 | Finally, whole ``scripts'' (tactic-based proofs in the style of
 | 
|  |   1595 | \cite{LNCS2283}) may appear in the leaves of the proof tree, although this is
 | 
|  |   1596 | best avoided.  Here is a contrived example:%
 | 
|  |   1597 | \end{isamarkuptext}%
 | 
| 17175 |   1598 | \isamarkuptrue%
 | 
|  |   1599 | \isacommand{lemma}\isamarkupfalse%
 | 
|  |   1600 | \ {\isachardoublequoteopen}A\ {\isasymlongrightarrow}\ {\isacharparenleft}A\ {\isasymlongrightarrow}\ B{\isacharparenright}\ {\isasymlongrightarrow}\ B{\isachardoublequoteclose}\isanewline
 | 
| 17125 |   1601 | %
 | 
|  |   1602 | \isadelimproof
 | 
|  |   1603 | %
 | 
|  |   1604 | \endisadelimproof
 | 
|  |   1605 | %
 | 
|  |   1606 | \isatagproof
 | 
| 17175 |   1607 | \isacommand{proof}\isamarkupfalse%
 | 
|  |   1608 | \isanewline
 | 
|  |   1609 | \ \ \isacommand{assume}\isamarkupfalse%
 | 
|  |   1610 | \ a{\isacharcolon}\ {\isachardoublequoteopen}A{\isachardoublequoteclose}\isanewline
 | 
|  |   1611 | \ \ \isacommand{show}\isamarkupfalse%
 | 
|  |   1612 | \ {\isachardoublequoteopen}{\isacharparenleft}A\ {\isasymlongrightarrow}B{\isacharparenright}\ {\isasymlongrightarrow}\ B{\isachardoublequoteclose}\isanewline
 | 
|  |   1613 | \ \ \ \ \isacommand{apply}\isamarkupfalse%
 | 
|  |   1614 | {\isacharparenleft}rule\ impI{\isacharparenright}\isanewline
 | 
|  |   1615 | \ \ \ \ \isacommand{apply}\isamarkupfalse%
 | 
|  |   1616 | {\isacharparenleft}erule\ impE{\isacharparenright}\isanewline
 | 
|  |   1617 | \ \ \ \ \isacommand{apply}\isamarkupfalse%
 | 
|  |   1618 | {\isacharparenleft}rule\ a{\isacharparenright}\isanewline
 | 
|  |   1619 | \ \ \ \ \isacommand{apply}\isamarkupfalse%
 | 
|  |   1620 | \ assumption\isanewline
 | 
|  |   1621 | \ \ \ \ \isacommand{done}\isamarkupfalse%
 | 
|  |   1622 | \isanewline
 | 
|  |   1623 | \isacommand{qed}\isamarkupfalse%
 | 
|  |   1624 | %
 | 
| 17125 |   1625 | \endisatagproof
 | 
|  |   1626 | {\isafoldproof}%
 | 
|  |   1627 | %
 | 
|  |   1628 | \isadelimproof
 | 
|  |   1629 | %
 | 
|  |   1630 | \endisadelimproof
 | 
| 13999 |   1631 | %
 | 
|  |   1632 | \begin{isamarkuptext}%
 | 
|  |   1633 | \noindent You may need to resort to this technique if an
 | 
|  |   1634 | automatic step fails to prove the desired proposition.
 | 
|  |   1635 | 
 | 
|  |   1636 | When converting a proof from tactic-style into Isar you can proceed
 | 
|  |   1637 | in a top-down manner: parts of the proof can be left in script form
 | 
|  |   1638 | while the outer structure is already expressed in Isar.%
 | 
|  |   1639 | \end{isamarkuptext}%
 | 
| 17175 |   1640 | \isamarkuptrue%
 | 
| 17125 |   1641 | %
 | 
|  |   1642 | \isadelimtheory
 | 
|  |   1643 | %
 | 
|  |   1644 | \endisadelimtheory
 | 
|  |   1645 | %
 | 
|  |   1646 | \isatagtheory
 | 
|  |   1647 | %
 | 
|  |   1648 | \endisatagtheory
 | 
|  |   1649 | {\isafoldtheory}%
 | 
|  |   1650 | %
 | 
|  |   1651 | \isadelimtheory
 | 
|  |   1652 | %
 | 
|  |   1653 | \endisadelimtheory
 | 
| 13999 |   1654 | \end{isabellebody}%
 | 
|  |   1655 | %%% Local Variables:
 | 
|  |   1656 | %%% mode: latex
 | 
|  |   1657 | %%% TeX-master: "root"
 | 
|  |   1658 | %%% End:
 |