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