47269
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Isar}%
|
|
4 |
%
|
|
5 |
\isadelimtheory
|
|
6 |
%
|
|
7 |
\endisadelimtheory
|
|
8 |
%
|
|
9 |
\isatagtheory
|
|
10 |
%
|
|
11 |
\endisatagtheory
|
|
12 |
{\isafoldtheory}%
|
|
13 |
%
|
|
14 |
\isadelimtheory
|
|
15 |
%
|
|
16 |
\endisadelimtheory
|
|
17 |
%
|
|
18 |
\isadelimML
|
|
19 |
%
|
|
20 |
\endisadelimML
|
|
21 |
%
|
|
22 |
\isatagML
|
|
23 |
%
|
|
24 |
\endisatagML
|
|
25 |
{\isafoldML}%
|
|
26 |
%
|
|
27 |
\isadelimML
|
|
28 |
%
|
|
29 |
\endisadelimML
|
|
30 |
%
|
|
31 |
\begin{isamarkuptext}%
|
|
32 |
Apply-scripts are unreadable and hard to maintain. The language of choice
|
|
33 |
for larger proofs is \concept{Isar}. The two key features of Isar are:
|
|
34 |
\begin{itemize}
|
|
35 |
\item It is structured, not linear.
|
|
36 |
\item It is readable without running it because
|
|
37 |
you need to state what you are proving at any given point.
|
|
38 |
\end{itemize}
|
|
39 |
Whereas apply-scripts are like assembly language programs, Isar proofs
|
|
40 |
are like structured programs with comments. A typical Isar proof looks like this:%
|
|
41 |
\end{isamarkuptext}%
|
|
42 |
\isamarkuptrue%
|
|
43 |
%
|
|
44 |
\begin{isamarkuptext}%
|
|
45 |
\begin{tabular}{@ {}l}
|
|
46 |
\isacom{proof}\\
|
|
47 |
\quad\isacom{assume} \isa{{\isaliteral{22}{\isachardoublequote}}}$\mathit{formula}_0$\isa{{\isaliteral{22}{\isachardoublequote}}}\\
|
|
48 |
\quad\isacom{have} \isa{{\isaliteral{22}{\isachardoublequote}}}$\mathit{formula}_1$\isa{{\isaliteral{22}{\isachardoublequote}}} \quad\isacom{by} \isa{simp}\\
|
|
49 |
\quad\vdots\\
|
|
50 |
\quad\isacom{have} \isa{{\isaliteral{22}{\isachardoublequote}}}$\mathit{formula}_n$\isa{{\isaliteral{22}{\isachardoublequote}}} \quad\isacom{by} \isa{blast}\\
|
|
51 |
\quad\isacom{show} \isa{{\isaliteral{22}{\isachardoublequote}}}$\mathit{formula}_{n+1}$\isa{{\isaliteral{22}{\isachardoublequote}}} \quad\isacom{by} \isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}\\
|
|
52 |
\isacom{qed}
|
|
53 |
\end{tabular}%
|
|
54 |
\end{isamarkuptext}%
|
|
55 |
\isamarkuptrue%
|
|
56 |
%
|
|
57 |
\begin{isamarkuptext}%
|
|
58 |
It proves $\mathit{formula}_0 \Longrightarrow \mathit{formula}_{n+1}$
|
47704
|
59 |
(provided each proof step succeeds).
|
47269
|
60 |
The intermediate \isacom{have} statements are merely stepping stones
|
|
61 |
on the way towards the \isacom{show} statement that proves the actual
|
|
62 |
goal. In more detail, this is the Isar core syntax:
|
|
63 |
\medskip
|
|
64 |
|
|
65 |
\begin{tabular}{@ {}lcl@ {}}
|
|
66 |
\textit{proof} &=& \isacom{by} \textit{method}\\
|
|
67 |
&$\mid$& \isacom{proof} [\textit{method}] \ \textit{step}$^*$ \ \isacom{qed}
|
|
68 |
\end{tabular}
|
|
69 |
\medskip
|
|
70 |
|
|
71 |
\begin{tabular}{@ {}lcl@ {}}
|
|
72 |
\textit{step} &=& \isacom{fix} \textit{variables} \\
|
|
73 |
&$\mid$& \isacom{assume} \textit{proposition} \\
|
|
74 |
&$\mid$& [\isacom{from} \textit{fact}$^+$] (\isacom{have} $\mid$ \isacom{show}) \ \textit{proposition} \ \textit{proof}
|
|
75 |
\end{tabular}
|
|
76 |
\medskip
|
|
77 |
|
|
78 |
\begin{tabular}{@ {}lcl@ {}}
|
|
79 |
\textit{proposition} &=& [\textit{name}:] \isa{{\isaliteral{22}{\isachardoublequote}}}\textit{formula}\isa{{\isaliteral{22}{\isachardoublequote}}}
|
|
80 |
\end{tabular}
|
|
81 |
\medskip
|
|
82 |
|
|
83 |
\begin{tabular}{@ {}lcl@ {}}
|
|
84 |
\textit{fact} &=& \textit{name} \ $\mid$ \ \dots
|
|
85 |
\end{tabular}
|
|
86 |
\medskip
|
|
87 |
|
|
88 |
\noindent A proof can either be an atomic \isacom{by} with a single proof
|
|
89 |
method which must finish off the statement being proved, for example \isa{auto}. Or it can be a \isacom{proof}--\isacom{qed} block of multiple
|
|
90 |
steps. Such a block can optionally begin with a proof method that indicates
|
|
91 |
how to start off the proof, e.g.\ \mbox{\isa{{\isaliteral{28}{\isacharparenleft}}induction\ xs{\isaliteral{29}{\isacharparenright}}}}.
|
|
92 |
|
|
93 |
A step either assumes a proposition or states a proposition
|
|
94 |
together with its proof. The optional \isacom{from} clause
|
|
95 |
indicates which facts are to be used in the proof.
|
|
96 |
Intermediate propositions are stated with \isacom{have}, the overall goal
|
|
97 |
with \isacom{show}. A step can also introduce new local variables with
|
|
98 |
\isacom{fix}. Logically, \isacom{fix} introduces \isa{{\isaliteral{5C3C416E643E}{\isasymAnd}}}-quantified
|
|
99 |
variables, \isacom{assume} introduces the assumption of an implication
|
|
100 |
(\isa{{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}}) and \isacom{have}/\isacom{show} the conclusion.
|
|
101 |
|
|
102 |
Propositions are optionally named formulas. These names can be referred to in
|
|
103 |
later \isacom{from} clauses. In the simplest case, a fact is such a name.
|
|
104 |
But facts can also be composed with \isa{OF} and \isa{of} as shown in
|
|
105 |
\S\ref{sec:forward-proof}---hence the \dots\ in the above grammar. Note
|
|
106 |
that assumptions, intermediate \isacom{have} statements and global lemmas all
|
|
107 |
have the same status and are thus collectively referred to as
|
|
108 |
\concept{facts}.
|
|
109 |
|
|
110 |
Fact names can stand for whole lists of facts. For example, if \isa{f} is
|
|
111 |
defined by command \isacom{fun}, \isa{f{\isaliteral{2E}{\isachardot}}simps} refers to the whole list of
|
|
112 |
recursion equations defining \isa{f}. Individual facts can be selected by
|
|
113 |
writing \isa{f{\isaliteral{2E}{\isachardot}}simps{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}}, whole sublists by \isa{f{\isaliteral{2E}{\isachardot}}simps{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{2D}{\isacharminus}}{\isadigit{4}}{\isaliteral{29}{\isacharparenright}}}.
|
|
114 |
|
|
115 |
|
|
116 |
\section{Isar by example}
|
|
117 |
|
47704
|
118 |
We show a number of proofs of Cantor's theorem that a function from a set to
|
47269
|
119 |
its powerset cannot be surjective, illustrating various features of Isar. The
|
|
120 |
constant \isa{surj} is predefined.%
|
|
121 |
\end{isamarkuptext}%
|
|
122 |
\isamarkuptrue%
|
|
123 |
\isacommand{lemma}\isamarkupfalse%
|
|
124 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ surj{\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
|
|
125 |
%
|
|
126 |
\isadelimproof
|
|
127 |
%
|
|
128 |
\endisadelimproof
|
|
129 |
%
|
|
130 |
\isatagproof
|
|
131 |
\isacommand{proof}\isamarkupfalse%
|
|
132 |
\isanewline
|
|
133 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
134 |
\ {\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}surj\ f{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
135 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
136 |
\ {\isadigit{0}}\ \isacommand{have}\isamarkupfalse%
|
|
137 |
\ {\isadigit{1}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}A{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C6578697374733E}{\isasymexists}}a{\isaliteral{2E}{\isachardot}}\ A\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
138 |
{\isaliteral{28}{\isacharparenleft}}simp\ add{\isaliteral{3A}{\isacharcolon}}\ surj{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
139 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
140 |
\ {\isadigit{1}}\ \isacommand{have}\isamarkupfalse%
|
|
141 |
\ {\isadigit{2}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}a{\isaliteral{2E}{\isachardot}}\ {\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
142 |
\ blast\isanewline
|
|
143 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
144 |
\ {\isadigit{2}}\ \isacommand{show}\isamarkupfalse%
|
|
145 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
146 |
\ blast\isanewline
|
|
147 |
\isacommand{qed}\isamarkupfalse%
|
|
148 |
%
|
|
149 |
\endisatagproof
|
|
150 |
{\isafoldproof}%
|
|
151 |
%
|
|
152 |
\isadelimproof
|
|
153 |
%
|
|
154 |
\endisadelimproof
|
|
155 |
%
|
|
156 |
\begin{isamarkuptext}%
|
|
157 |
The \isacom{proof} command lacks an explicit method how to perform
|
|
158 |
the proof. In such cases Isabelle tries to use some standard introduction
|
|
159 |
rule, in the above case for \isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}}:
|
|
160 |
\[
|
|
161 |
\inferrule{
|
|
162 |
\mbox{\isa{P\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ False}}}
|
|
163 |
{\mbox{\isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ P}}}
|
|
164 |
\]
|
|
165 |
In order to prove \isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ P}, assume \isa{P} and show \isa{False}.
|
|
166 |
Thus we may assume \isa{surj\ f}. The proof shows that names of propositions
|
|
167 |
may be (single!) digits---meaningful names are hard to invent and are often
|
|
168 |
not necessary. Both \isacom{have} steps are obvious. The second one introduces
|
|
169 |
the diagonal set \isa{{\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}}, the key idea in the proof.
|
|
170 |
If you wonder why \isa{{\isadigit{2}}} directly implies \isa{False}: from \isa{{\isadigit{2}}}
|
|
171 |
it follows that \isa{{\isaliteral{28}{\isacharparenleft}}a\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ a{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{28}{\isacharparenleft}}a\ {\isaliteral{5C3C696E3E}{\isasymin}}\ f\ a{\isaliteral{29}{\isacharparenright}}}.
|
|
172 |
|
|
173 |
\subsection{\isa{this}, \isa{then}, \isa{hence} and \isa{thus}}
|
|
174 |
|
|
175 |
Labels should be avoided. They interrupt the flow of the reader who has to
|
|
176 |
scan the context for the point where the label was introduced. Ideally, the
|
|
177 |
proof is a linear flow, where the output of one step becomes the input of the
|
|
178 |
next step, piping the previously proved fact into the next proof, just like
|
|
179 |
in a UNIX pipe. In such cases the predefined name \isa{this} can be used
|
|
180 |
to refer to the proposition proved in the previous step. This allows us to
|
|
181 |
eliminate all labels from our proof (we suppress the \isacom{lemma} statement):%
|
|
182 |
\end{isamarkuptext}%
|
|
183 |
\isamarkuptrue%
|
|
184 |
%
|
|
185 |
\isadelimproof
|
|
186 |
%
|
|
187 |
\endisadelimproof
|
|
188 |
%
|
|
189 |
\isatagproof
|
|
190 |
\isacommand{proof}\isamarkupfalse%
|
|
191 |
\isanewline
|
|
192 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
193 |
\ {\isaliteral{22}{\isachardoublequoteopen}}surj\ f{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
194 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
195 |
\ this\ \isacommand{have}\isamarkupfalse%
|
|
196 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}a{\isaliteral{2E}{\isachardot}}\ {\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
197 |
{\isaliteral{28}{\isacharparenleft}}auto\ simp{\isaliteral{3A}{\isacharcolon}}\ surj{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
198 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
199 |
\ this\ \isacommand{show}\isamarkupfalse%
|
|
200 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
201 |
\ blast\isanewline
|
|
202 |
\isacommand{qed}\isamarkupfalse%
|
|
203 |
%
|
|
204 |
\endisatagproof
|
|
205 |
{\isafoldproof}%
|
|
206 |
%
|
|
207 |
\isadelimproof
|
|
208 |
%
|
|
209 |
\endisadelimproof
|
|
210 |
%
|
|
211 |
\begin{isamarkuptext}%
|
|
212 |
We have also taken the opportunity to compress the two \isacom{have}
|
|
213 |
steps into one.
|
|
214 |
|
|
215 |
To compact the text further, Isar has a few convenient abbreviations:
|
|
216 |
\medskip
|
|
217 |
|
|
218 |
\begin{tabular}{rcl}
|
|
219 |
\isacom{then} &=& \isacom{from} \isa{this}\\
|
|
220 |
\isacom{thus} &=& \isacom{then} \isacom{show}\\
|
|
221 |
\isacom{hence} &=& \isacom{then} \isacom{have}
|
|
222 |
\end{tabular}
|
|
223 |
\medskip
|
|
224 |
|
|
225 |
\noindent
|
|
226 |
With the help of these abbreviations the proof becomes%
|
|
227 |
\end{isamarkuptext}%
|
|
228 |
\isamarkuptrue%
|
|
229 |
%
|
|
230 |
\isadelimproof
|
|
231 |
%
|
|
232 |
\endisadelimproof
|
|
233 |
%
|
|
234 |
\isatagproof
|
|
235 |
\isacommand{proof}\isamarkupfalse%
|
|
236 |
\isanewline
|
|
237 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
238 |
\ {\isaliteral{22}{\isachardoublequoteopen}}surj\ f{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
239 |
\ \ \isacommand{hence}\isamarkupfalse%
|
|
240 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}a{\isaliteral{2E}{\isachardot}}\ {\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
241 |
{\isaliteral{28}{\isacharparenleft}}auto\ simp{\isaliteral{3A}{\isacharcolon}}\ surj{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
242 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
243 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
244 |
\ blast\isanewline
|
|
245 |
\isacommand{qed}\isamarkupfalse%
|
|
246 |
%
|
|
247 |
\endisatagproof
|
|
248 |
{\isafoldproof}%
|
|
249 |
%
|
|
250 |
\isadelimproof
|
|
251 |
%
|
|
252 |
\endisadelimproof
|
|
253 |
%
|
|
254 |
\begin{isamarkuptext}%
|
|
255 |
There are two further linguistic variations:
|
|
256 |
\medskip
|
|
257 |
|
|
258 |
\begin{tabular}{rcl}
|
|
259 |
(\isacom{have}$\mid$\isacom{show}) \ \textit{prop} \ \isacom{using} \ \textit{facts}
|
|
260 |
&=&
|
|
261 |
\isacom{from} \ \textit{facts} \ (\isacom{have}$\mid$\isacom{show}) \ \textit{prop}\\
|
|
262 |
\isacom{with} \ \textit{facts} &=& \isacom{from} \ \textit{facts} \isa{this}
|
|
263 |
\end{tabular}
|
|
264 |
\medskip
|
|
265 |
|
47711
|
266 |
\noindent The \isacom{using} idiom de-emphasizes the used facts by moving them
|
47269
|
267 |
behind the proposition.
|
|
268 |
|
|
269 |
\subsection{Structured lemma statements: \isacom{fixes}, \isacom{assumes}, \isacom{shows}}
|
|
270 |
|
|
271 |
Lemmas can also be stated in a more structured fashion. To demonstrate this
|
47306
|
272 |
feature with Cantor's theorem, we rephrase \isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ surj\ f}
|
47269
|
273 |
a little:%
|
|
274 |
\end{isamarkuptext}%
|
|
275 |
\isamarkuptrue%
|
|
276 |
\isacommand{lemma}\isamarkupfalse%
|
|
277 |
\isanewline
|
|
278 |
\ \ \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}}\isanewline
|
|
279 |
\ \ \isakeyword{assumes}\ s{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}surj\ f{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
280 |
\ \ \isakeyword{shows}\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
281 |
\isadelimproof
|
|
282 |
%
|
|
283 |
\endisadelimproof
|
|
284 |
%
|
|
285 |
\isatagproof
|
|
286 |
%
|
|
287 |
\begin{isamarkuptxt}%
|
|
288 |
The optional \isacom{fixes} part allows you to state the types of
|
|
289 |
variables up front rather than by decorating one of their occurrences in the
|
|
290 |
formula with a type constraint. The key advantage of the structured format is
|
47306
|
291 |
the \isacom{assumes} part that allows you to name each assumption; multiple
|
|
292 |
assumptions can be separated by \isacom{and}. The
|
47269
|
293 |
\isacom{shows} part gives the goal. The actual theorem that will come out of
|
|
294 |
the proof is \isa{surj\ f\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ False}, but during the proof the assumption
|
|
295 |
\isa{surj\ f} is available under the name \isa{s} like any other fact.%
|
|
296 |
\end{isamarkuptxt}%
|
|
297 |
\isamarkuptrue%
|
|
298 |
\isacommand{proof}\isamarkupfalse%
|
|
299 |
\ {\isaliteral{2D}{\isacharminus}}\isanewline
|
|
300 |
\ \ \isacommand{have}\isamarkupfalse%
|
|
301 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}\ a{\isaliteral{2E}{\isachardot}}\ {\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{using}\isamarkupfalse%
|
|
302 |
\ s\isanewline
|
|
303 |
\ \ \ \ \isacommand{by}\isamarkupfalse%
|
|
304 |
{\isaliteral{28}{\isacharparenleft}}auto\ simp{\isaliteral{3A}{\isacharcolon}}\ surj{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
305 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
306 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
307 |
\ blast\isanewline
|
|
308 |
\isacommand{qed}\isamarkupfalse%
|
|
309 |
%
|
|
310 |
\endisatagproof
|
|
311 |
{\isafoldproof}%
|
|
312 |
%
|
|
313 |
\isadelimproof
|
|
314 |
%
|
|
315 |
\endisadelimproof
|
|
316 |
%
|
|
317 |
\begin{isamarkuptext}%
|
|
318 |
In the \isacom{have} step the assumption \isa{surj\ f} is now
|
|
319 |
referenced by its name \isa{s}. The duplication of \isa{surj\ f} in the
|
|
320 |
above proofs (once in the statement of the lemma, once in its proof) has been
|
|
321 |
eliminated.
|
|
322 |
|
|
323 |
\begin{warn}
|
|
324 |
Note the dash after the \isacom{proof}
|
|
325 |
command. It is the null method that does nothing to the goal. Leaving it out
|
|
326 |
would ask Isabelle to try some suitable introduction rule on the goal \isa{False}---but there is no suitable introduction rule and \isacom{proof}
|
|
327 |
would fail.
|
|
328 |
\end{warn}
|
|
329 |
|
47704
|
330 |
Stating a lemma with \isacom{assumes}-\isacom{shows} implicitly introduces the
|
47269
|
331 |
name \isa{assms} that stands for the list of all assumptions. You can refer
|
|
332 |
to individual assumptions by \isa{assms{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}}, \isa{assms{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}} etc,
|
|
333 |
thus obviating the need to name them individually.
|
|
334 |
|
|
335 |
\section{Proof patterns}
|
|
336 |
|
|
337 |
We show a number of important basic proof patterns. Many of them arise from
|
|
338 |
the rules of natural deduction that are applied by \isacom{proof} by
|
|
339 |
default. The patterns are phrased in terms of \isacom{show} but work for
|
|
340 |
\isacom{have} and \isacom{lemma}, too.
|
|
341 |
|
47711
|
342 |
We start with two forms of \concept{case analysis}:
|
47269
|
343 |
starting from a formula \isa{P} we have the two cases \isa{P} and
|
|
344 |
\isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ P}, and starting from a fact \isa{P\ {\isaliteral{5C3C6F723E}{\isasymor}}\ Q}
|
|
345 |
we have the two cases \isa{P} and \isa{Q}:%
|
|
346 |
\end{isamarkuptext}%
|
|
347 |
\isamarkuptrue%
|
|
348 |
%
|
|
349 |
\begin{tabular}{@ {}ll@ {}}
|
|
350 |
\begin{minipage}[t]{.4\textwidth}
|
|
351 |
\isa{%
|
|
352 |
%
|
|
353 |
\isadelimproof
|
|
354 |
%
|
|
355 |
\endisadelimproof
|
|
356 |
%
|
|
357 |
\isatagproof
|
|
358 |
\isacommand{show}\isamarkupfalse%
|
|
359 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
360 |
\isacommand{proof}\isamarkupfalse%
|
|
361 |
\ cases\isanewline
|
|
362 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
363 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
364 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
365 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
366 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
367 |
\ $\dots$\\
|
|
368 |
\isacommand{next}\isamarkupfalse%
|
|
369 |
\isanewline
|
|
370 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
371 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
372 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
373 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
374 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
375 |
\ $\dots$\\
|
|
376 |
\isacommand{qed}\isamarkupfalse%
|
|
377 |
%
|
|
378 |
\endisatagproof
|
|
379 |
{\isafoldproof}%
|
|
380 |
%
|
|
381 |
\isadelimproof
|
|
382 |
%
|
|
383 |
\endisadelimproof
|
|
384 |
%
|
|
385 |
}
|
|
386 |
\end{minipage}
|
|
387 |
&
|
|
388 |
\begin{minipage}[t]{.4\textwidth}
|
|
389 |
\isa{%
|
|
390 |
%
|
|
391 |
\isadelimproof
|
|
392 |
%
|
|
393 |
\endisadelimproof
|
|
394 |
%
|
|
395 |
\isatagproof
|
|
396 |
\isacommand{have}\isamarkupfalse%
|
|
397 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P\ {\isaliteral{5C3C6F723E}{\isasymor}}\ Q{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
398 |
\ $\dots$\\
|
|
399 |
\isacommand{then}\isamarkupfalse%
|
|
400 |
\ \isacommand{show}\isamarkupfalse%
|
|
401 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
402 |
\isacommand{proof}\isamarkupfalse%
|
|
403 |
\isanewline
|
|
404 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
405 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
406 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
407 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
408 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
409 |
\ $\dots$\\
|
|
410 |
\isacommand{next}\isamarkupfalse%
|
|
411 |
\isanewline
|
|
412 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
413 |
\ {\isaliteral{22}{\isachardoublequoteopen}}Q{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
414 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
415 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
416 |
\ {\isaliteral{22}{\isachardoublequoteopen}}R{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
417 |
\ $\dots$\\
|
|
418 |
\isacommand{qed}\isamarkupfalse%
|
|
419 |
%
|
|
420 |
\endisatagproof
|
|
421 |
{\isafoldproof}%
|
|
422 |
%
|
|
423 |
\isadelimproof
|
|
424 |
%
|
|
425 |
\endisadelimproof
|
|
426 |
%
|
|
427 |
}
|
|
428 |
\end{minipage}
|
|
429 |
\end{tabular}
|
|
430 |
\medskip
|
|
431 |
\begin{isamarkuptext}%
|
|
432 |
How to prove a logical equivalence:
|
|
433 |
\end{isamarkuptext}%
|
|
434 |
\isa{%
|
|
435 |
%
|
|
436 |
\isadelimproof
|
|
437 |
%
|
|
438 |
\endisadelimproof
|
|
439 |
%
|
|
440 |
\isatagproof
|
|
441 |
\isacommand{show}\isamarkupfalse%
|
|
442 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P\ {\isaliteral{5C3C6C6F6E676C65667472696768746172726F773E}{\isasymlongleftrightarrow}}\ Q{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
443 |
\isacommand{proof}\isamarkupfalse%
|
|
444 |
\isanewline
|
|
445 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
446 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
447 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
448 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
449 |
\ {\isaliteral{22}{\isachardoublequoteopen}}Q{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
450 |
\ $\dots$\\
|
|
451 |
\isacommand{next}\isamarkupfalse%
|
|
452 |
\isanewline
|
|
453 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
454 |
\ {\isaliteral{22}{\isachardoublequoteopen}}Q{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
455 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
456 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
457 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
458 |
\ $\dots$\\
|
|
459 |
\isacommand{qed}\isamarkupfalse%
|
|
460 |
%
|
|
461 |
\endisatagproof
|
|
462 |
{\isafoldproof}%
|
|
463 |
%
|
|
464 |
\isadelimproof
|
|
465 |
%
|
|
466 |
\endisadelimproof
|
|
467 |
%
|
|
468 |
}
|
|
469 |
\medskip
|
|
470 |
\begin{isamarkuptext}%
|
|
471 |
Proofs by contradiction:
|
|
472 |
\end{isamarkuptext}%
|
|
473 |
\begin{tabular}{@ {}ll@ {}}
|
|
474 |
\begin{minipage}[t]{.4\textwidth}
|
|
475 |
\isa{%
|
|
476 |
%
|
|
477 |
\isadelimproof
|
|
478 |
%
|
|
479 |
\endisadelimproof
|
|
480 |
%
|
|
481 |
\isatagproof
|
|
482 |
\isacommand{show}\isamarkupfalse%
|
|
483 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ P{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
484 |
\isacommand{proof}\isamarkupfalse%
|
|
485 |
\isanewline
|
|
486 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
487 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
488 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
489 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
490 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
491 |
\ $\dots$\\
|
|
492 |
\isacommand{qed}\isamarkupfalse%
|
|
493 |
%
|
|
494 |
\endisatagproof
|
|
495 |
{\isafoldproof}%
|
|
496 |
%
|
|
497 |
\isadelimproof
|
|
498 |
%
|
|
499 |
\endisadelimproof
|
|
500 |
%
|
|
501 |
}
|
|
502 |
\end{minipage}
|
|
503 |
&
|
|
504 |
\begin{minipage}[t]{.4\textwidth}
|
|
505 |
\isa{%
|
|
506 |
%
|
|
507 |
\isadelimproof
|
|
508 |
%
|
|
509 |
\endisadelimproof
|
|
510 |
%
|
|
511 |
\isatagproof
|
|
512 |
\isacommand{show}\isamarkupfalse%
|
|
513 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
514 |
\isacommand{proof}\isamarkupfalse%
|
|
515 |
\ {\isaliteral{28}{\isacharparenleft}}rule\ ccontr{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
516 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
517 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}P{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
518 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
519 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
520 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
521 |
\ $\dots$\\
|
|
522 |
\isacommand{qed}\isamarkupfalse%
|
|
523 |
%
|
|
524 |
\endisatagproof
|
|
525 |
{\isafoldproof}%
|
|
526 |
%
|
|
527 |
\isadelimproof
|
|
528 |
%
|
|
529 |
\endisadelimproof
|
|
530 |
%
|
|
531 |
}
|
|
532 |
\end{minipage}
|
|
533 |
\end{tabular}
|
|
534 |
\medskip
|
|
535 |
\begin{isamarkuptext}%
|
|
536 |
The name \isa{ccontr} stands for ``classical contradiction''.
|
|
537 |
|
|
538 |
How to prove quantified formulas:
|
|
539 |
\end{isamarkuptext}%
|
|
540 |
\begin{tabular}{@ {}ll@ {}}
|
|
541 |
\begin{minipage}[t]{.4\textwidth}
|
|
542 |
\isa{%
|
|
543 |
%
|
|
544 |
\isadelimproof
|
|
545 |
%
|
|
546 |
\endisadelimproof
|
|
547 |
%
|
|
548 |
\isatagproof
|
|
549 |
\isacommand{show}\isamarkupfalse%
|
|
550 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
551 |
\isacommand{proof}\isamarkupfalse%
|
|
552 |
\isanewline
|
|
553 |
\ \ \isacommand{fix}\isamarkupfalse%
|
|
554 |
\ x%
|
|
555 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
556 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
557 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
558 |
\ $\dots$\\
|
|
559 |
\isacommand{qed}\isamarkupfalse%
|
|
560 |
%
|
|
561 |
\endisatagproof
|
|
562 |
{\isafoldproof}%
|
|
563 |
%
|
|
564 |
\isadelimproof
|
|
565 |
%
|
|
566 |
\endisadelimproof
|
|
567 |
%
|
|
568 |
}
|
|
569 |
\end{minipage}
|
|
570 |
&
|
|
571 |
\begin{minipage}[t]{.4\textwidth}
|
|
572 |
\isa{%
|
|
573 |
%
|
|
574 |
\isadelimproof
|
|
575 |
%
|
|
576 |
\endisadelimproof
|
|
577 |
%
|
|
578 |
\isatagproof
|
|
579 |
\isacommand{show}\isamarkupfalse%
|
|
580 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
581 |
\isacommand{proof}\isamarkupfalse%
|
|
582 |
%
|
|
583 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
584 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
585 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{28}{\isacharparenleft}}witness{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
586 |
\ $\dots$\\
|
|
587 |
\isacommand{qed}\isamarkupfalse%
|
|
588 |
%
|
|
589 |
\endisatagproof
|
|
590 |
{\isafoldproof}%
|
|
591 |
%
|
|
592 |
\isadelimproof
|
|
593 |
%
|
|
594 |
\endisadelimproof
|
|
595 |
%
|
|
596 |
}
|
|
597 |
\end{minipage}
|
|
598 |
\end{tabular}
|
|
599 |
\medskip
|
|
600 |
\begin{isamarkuptext}%
|
|
601 |
In the proof of \noquotes{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}},
|
47704
|
602 |
the step \isacom{fix}~\isa{x} introduces a locally fixed variable \isa{x}
|
47269
|
603 |
into the subproof, the proverbial ``arbitrary but fixed value''.
|
|
604 |
Instead of \isa{x} we could have chosen any name in the subproof.
|
|
605 |
In the proof of \noquotes{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}},
|
|
606 |
\isa{witness} is some arbitrary
|
|
607 |
term for which we can prove that it satisfies \isa{P}.
|
|
608 |
|
|
609 |
How to reason forward from \noquotes{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}}:
|
|
610 |
\end{isamarkuptext}%
|
|
611 |
%
|
|
612 |
\isadelimproof
|
|
613 |
%
|
|
614 |
\endisadelimproof
|
|
615 |
%
|
|
616 |
\isatagproof
|
|
617 |
\isacommand{have}\isamarkupfalse%
|
|
618 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
619 |
\ $\dots$\\
|
|
620 |
\isacommand{then}\isamarkupfalse%
|
|
621 |
\ \isacommand{obtain}\isamarkupfalse%
|
|
622 |
\ x\ \isakeyword{where}\ p{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
623 |
\ blast%
|
|
624 |
\endisatagproof
|
|
625 |
{\isafoldproof}%
|
|
626 |
%
|
|
627 |
\isadelimproof
|
|
628 |
%
|
|
629 |
\endisadelimproof
|
|
630 |
%
|
|
631 |
\begin{isamarkuptext}%
|
|
632 |
After the \isacom{obtain} step, \isa{x} (we could have chosen any name)
|
|
633 |
is a fixed local
|
|
634 |
variable, and \isa{p} is the name of the fact
|
|
635 |
\noquotes{\isa{{\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}}.
|
|
636 |
This pattern works for one or more \isa{x}.
|
|
637 |
As an example of the \isacom{obtain} command, here is the proof of
|
|
638 |
Cantor's theorem in more detail:%
|
|
639 |
\end{isamarkuptext}%
|
|
640 |
\isamarkuptrue%
|
|
641 |
\isacommand{lemma}\isamarkupfalse%
|
|
642 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ surj{\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
|
|
643 |
%
|
|
644 |
\isadelimproof
|
|
645 |
%
|
|
646 |
\endisadelimproof
|
|
647 |
%
|
|
648 |
\isatagproof
|
|
649 |
\isacommand{proof}\isamarkupfalse%
|
|
650 |
\isanewline
|
|
651 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
652 |
\ {\isaliteral{22}{\isachardoublequoteopen}}surj\ f{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
653 |
\ \ \isacommand{hence}\isamarkupfalse%
|
|
654 |
\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}a{\isaliteral{2E}{\isachardot}}\ {\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
655 |
{\isaliteral{28}{\isacharparenleft}}auto\ simp{\isaliteral{3A}{\isacharcolon}}\ surj{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
656 |
\ \ \isacommand{then}\isamarkupfalse%
|
|
657 |
\ \isacommand{obtain}\isamarkupfalse%
|
|
658 |
\ a\ \isakeyword{where}\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ x{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \ \isacommand{by}\isamarkupfalse%
|
|
659 |
\ blast\isanewline
|
|
660 |
\ \ \isacommand{hence}\isamarkupfalse%
|
|
661 |
\ \ {\isaliteral{22}{\isachardoublequoteopen}}a\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ f\ a\ {\isaliteral{5C3C6C6F6E676C65667472696768746172726F773E}{\isasymlongleftrightarrow}}\ a\ {\isaliteral{5C3C696E3E}{\isasymin}}\ f\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \ \isacommand{by}\isamarkupfalse%
|
|
662 |
\ blast\isanewline
|
|
663 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
664 |
\ {\isaliteral{22}{\isachardoublequoteopen}}False{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
665 |
\ blast\isanewline
|
|
666 |
\isacommand{qed}\isamarkupfalse%
|
|
667 |
%
|
|
668 |
\endisatagproof
|
|
669 |
{\isafoldproof}%
|
|
670 |
%
|
|
671 |
\isadelimproof
|
|
672 |
%
|
|
673 |
\endisadelimproof
|
|
674 |
%
|
|
675 |
\begin{isamarkuptext}%
|
47306
|
676 |
|
|
677 |
Finally, how to prove set equality and subset relationship:
|
47269
|
678 |
\end{isamarkuptext}%
|
|
679 |
\begin{tabular}{@ {}ll@ {}}
|
|
680 |
\begin{minipage}[t]{.4\textwidth}
|
|
681 |
\isa{%
|
|
682 |
%
|
|
683 |
\isadelimproof
|
|
684 |
%
|
|
685 |
\endisadelimproof
|
|
686 |
%
|
|
687 |
\isatagproof
|
|
688 |
\isacommand{show}\isamarkupfalse%
|
|
689 |
\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{3D}{\isacharequal}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
690 |
\isacommand{proof}\isamarkupfalse%
|
|
691 |
\isanewline
|
|
692 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
693 |
\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
694 |
\ $\dots$\\
|
|
695 |
\isacommand{next}\isamarkupfalse%
|
|
696 |
\isanewline
|
|
697 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
698 |
\ {\isaliteral{22}{\isachardoublequoteopen}}B\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
699 |
\ $\dots$\\
|
|
700 |
\isacommand{qed}\isamarkupfalse%
|
|
701 |
%
|
|
702 |
\endisatagproof
|
|
703 |
{\isafoldproof}%
|
|
704 |
%
|
|
705 |
\isadelimproof
|
|
706 |
%
|
|
707 |
\endisadelimproof
|
|
708 |
%
|
|
709 |
}
|
|
710 |
\end{minipage}
|
|
711 |
&
|
|
712 |
\begin{minipage}[t]{.4\textwidth}
|
|
713 |
\isa{%
|
|
714 |
%
|
|
715 |
\isadelimproof
|
|
716 |
%
|
|
717 |
\endisadelimproof
|
|
718 |
%
|
|
719 |
\isatagproof
|
|
720 |
\isacommand{show}\isamarkupfalse%
|
|
721 |
\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
722 |
\isacommand{proof}\isamarkupfalse%
|
|
723 |
\isanewline
|
|
724 |
\ \ \isacommand{fix}\isamarkupfalse%
|
|
725 |
\ x\isanewline
|
|
726 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
727 |
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
728 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
729 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
730 |
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
731 |
\ $\dots$\\
|
|
732 |
\isacommand{qed}\isamarkupfalse%
|
|
733 |
%
|
|
734 |
\endisatagproof
|
|
735 |
{\isafoldproof}%
|
|
736 |
%
|
|
737 |
\isadelimproof
|
|
738 |
%
|
|
739 |
\endisadelimproof
|
|
740 |
%
|
|
741 |
}
|
|
742 |
\end{minipage}
|
|
743 |
\end{tabular}
|
|
744 |
\begin{isamarkuptext}%
|
|
745 |
\section{Streamlining proofs}
|
|
746 |
|
|
747 |
\subsection{Pattern matching and quotations}
|
|
748 |
|
|
749 |
In the proof patterns shown above, formulas are often duplicated.
|
|
750 |
This can make the text harder to read, write and maintain. Pattern matching
|
|
751 |
is an abbreviation mechanism to avoid such duplication. Writing
|
|
752 |
\begin{quote}
|
|
753 |
\isacom{show} \ \textit{formula} \isa{{\isaliteral{28}{\isacharparenleft}}}\isacom{is} \textit{pattern}\isa{{\isaliteral{29}{\isacharparenright}}}
|
|
754 |
\end{quote}
|
|
755 |
matches the pattern against the formula, thus instantiating the unknowns in
|
|
756 |
the pattern for later use. As an example, consider the proof pattern for
|
|
757 |
\isa{{\isaliteral{5C3C6C6F6E676C65667472696768746172726F773E}{\isasymlongleftrightarrow}}}:
|
|
758 |
\end{isamarkuptext}%
|
|
759 |
%
|
|
760 |
\isadelimproof
|
|
761 |
%
|
|
762 |
\endisadelimproof
|
|
763 |
%
|
|
764 |
\isatagproof
|
|
765 |
\isacommand{show}\isamarkupfalse%
|
|
766 |
\ {\isaliteral{22}{\isachardoublequoteopen}}formula\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C6C6F6E676C65667472696768746172726F773E}{\isasymlongleftrightarrow}}\ formula\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{is}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}L\ {\isaliteral{5C3C6C6F6E676C65667472696768746172726F773E}{\isasymlongleftrightarrow}}\ {\isaliteral{3F}{\isacharquery}}R{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
767 |
\isacommand{proof}\isamarkupfalse%
|
|
768 |
\isanewline
|
|
769 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
770 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}L{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
771 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
772 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
773 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}R{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
774 |
\ $\dots$\\
|
|
775 |
\isacommand{next}\isamarkupfalse%
|
|
776 |
\isanewline
|
|
777 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
778 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}R{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
779 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
780 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
781 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}L{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
782 |
\ $\dots$\\
|
|
783 |
\isacommand{qed}\isamarkupfalse%
|
|
784 |
%
|
|
785 |
\endisatagproof
|
|
786 |
{\isafoldproof}%
|
|
787 |
%
|
|
788 |
\isadelimproof
|
|
789 |
%
|
|
790 |
\endisadelimproof
|
|
791 |
%
|
|
792 |
\begin{isamarkuptext}%
|
|
793 |
Instead of duplicating \isa{formula\isaliteral{5C3C5E697375623E}{}\isactrlisub i} in the text, we introduce
|
|
794 |
the two abbreviations \isa{{\isaliteral{3F}{\isacharquery}}L} and \isa{{\isaliteral{3F}{\isacharquery}}R} by pattern matching.
|
|
795 |
Pattern matching works wherever a formula is stated, in particular
|
|
796 |
with \isacom{have} and \isacom{lemma}.
|
|
797 |
|
|
798 |
The unknown \isa{{\isaliteral{3F}{\isacharquery}}thesis} is implicitly matched against any goal stated by
|
|
799 |
\isacom{lemma} or \isacom{show}. Here is a typical example:%
|
|
800 |
\end{isamarkuptext}%
|
|
801 |
\isamarkuptrue%
|
|
802 |
\isacommand{lemma}\isamarkupfalse%
|
|
803 |
\ {\isaliteral{22}{\isachardoublequoteopen}}formula{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
804 |
%
|
|
805 |
\isadelimproof
|
|
806 |
%
|
|
807 |
\endisadelimproof
|
|
808 |
%
|
|
809 |
\isatagproof
|
|
810 |
\isacommand{proof}\isamarkupfalse%
|
|
811 |
\ {\isaliteral{2D}{\isacharminus}}%
|
|
812 |
\\\mbox{}\quad$\vdots$\\\mbox{}\hspace{-1.4ex}
|
|
813 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
814 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ %
|
|
815 |
\ $\dots$\\
|
|
816 |
\isacommand{qed}\isamarkupfalse%
|
|
817 |
%
|
|
818 |
\endisatagproof
|
|
819 |
{\isafoldproof}%
|
|
820 |
%
|
|
821 |
\isadelimproof
|
|
822 |
%
|
|
823 |
\endisadelimproof
|
|
824 |
%
|
|
825 |
\begin{isamarkuptext}%
|
|
826 |
Unknowns can also be instantiated with \isacom{let} commands
|
|
827 |
\begin{quote}
|
|
828 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}t} = \isa{{\isaliteral{22}{\isachardoublequote}}}\textit{some-big-term}\isa{{\isaliteral{22}{\isachardoublequote}}}
|
|
829 |
\end{quote}
|
|
830 |
Later proof steps can refer to \isa{{\isaliteral{3F}{\isacharquery}}t}:
|
|
831 |
\begin{quote}
|
|
832 |
\isacom{have} \isa{{\isaliteral{22}{\isachardoublequote}}}\dots \isa{{\isaliteral{3F}{\isacharquery}}t} \dots\isa{{\isaliteral{22}{\isachardoublequote}}}
|
|
833 |
\end{quote}
|
|
834 |
\begin{warn}
|
|
835 |
Names of facts are introduced with \isa{name{\isaliteral{3A}{\isacharcolon}}} and refer to proved
|
|
836 |
theorems. Unknowns \isa{{\isaliteral{3F}{\isacharquery}}X} refer to terms or formulas.
|
|
837 |
\end{warn}
|
|
838 |
|
|
839 |
Although abbreviations shorten the text, the reader needs to remember what
|
|
840 |
they stand for. Similarly for names of facts. Names like \isa{{\isadigit{1}}}, \isa{{\isadigit{2}}}
|
|
841 |
and \isa{{\isadigit{3}}} are not helpful and should only be used in short proofs. For
|
47704
|
842 |
longer proofs, descriptive names are better. But look at this example:
|
47269
|
843 |
\begin{quote}
|
|
844 |
\isacom{have} \ \isa{x{\isaliteral{5F}{\isacharunderscore}}gr{\isaliteral{5F}{\isacharunderscore}}{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3E}{\isachargreater}}\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
845 |
$\vdots$\\
|
|
846 |
\isacom{from} \isa{x{\isaliteral{5F}{\isacharunderscore}}gr{\isaliteral{5F}{\isacharunderscore}}{\isadigit{0}}} \dots
|
|
847 |
\end{quote}
|
|
848 |
The name is longer than the fact it stands for! Short facts do not need names,
|
|
849 |
one can refer to them easily by quoting them:
|
|
850 |
\begin{quote}
|
|
851 |
\isacom{have} \ \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3E}{\isachargreater}}\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
852 |
$\vdots$\\
|
|
853 |
\isacom{from} \isa{{\isaliteral{60}{\isacharbackquote}}x{\isaliteral{3E}{\isachargreater}}{\isadigit{0}}{\isaliteral{60}{\isacharbackquote}}} \dots
|
|
854 |
\end{quote}
|
|
855 |
Note that the quotes around \isa{x{\isaliteral{3E}{\isachargreater}}{\isadigit{0}}} are \concept{back quotes}.
|
|
856 |
They refer to the fact not by name but by value.
|
|
857 |
|
|
858 |
\subsection{\isacom{moreover}}
|
|
859 |
|
|
860 |
Sometimes one needs a number of facts to enable some deduction. Of course
|
|
861 |
one can name these facts individually, as shown on the right,
|
|
862 |
but one can also combine them with \isacom{moreover}, as shown on the left:%
|
|
863 |
\end{isamarkuptext}%
|
|
864 |
\isamarkuptrue%
|
|
865 |
%
|
|
866 |
\begin{tabular}{@ {}ll@ {}}
|
|
867 |
\begin{minipage}[t]{.4\textwidth}
|
|
868 |
\isa{%
|
|
869 |
%
|
|
870 |
\isadelimproof
|
|
871 |
%
|
|
872 |
\endisadelimproof
|
|
873 |
%
|
|
874 |
\isatagproof
|
|
875 |
\isacommand{have}\isamarkupfalse%
|
|
876 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
877 |
\ $\dots$\\
|
|
878 |
\isacommand{moreover}\isamarkupfalse%
|
|
879 |
\ \isacommand{have}\isamarkupfalse%
|
|
880 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
881 |
\ $\dots$\\
|
|
882 |
\isacommand{moreover}\isamarkupfalse%
|
|
883 |
%
|
|
884 |
\\$\vdots$\\\hspace{-1.4ex}
|
|
885 |
\isacommand{moreover}\isamarkupfalse%
|
|
886 |
\ \isacommand{have}\isamarkupfalse%
|
|
887 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
888 |
\ $\dots$\\
|
|
889 |
\isacommand{ultimately}\isamarkupfalse%
|
|
890 |
\ \isacommand{have}\isamarkupfalse%
|
|
891 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}\ \ %
|
|
892 |
\ $\dots$\\
|
|
893 |
%
|
|
894 |
\endisatagproof
|
|
895 |
{\isafoldproof}%
|
|
896 |
%
|
|
897 |
\isadelimproof
|
|
898 |
%
|
|
899 |
\endisadelimproof
|
|
900 |
%
|
|
901 |
}
|
|
902 |
\end{minipage}
|
|
903 |
&
|
|
904 |
\qquad
|
|
905 |
\begin{minipage}[t]{.4\textwidth}
|
|
906 |
\isa{%
|
|
907 |
%
|
|
908 |
\isadelimproof
|
|
909 |
%
|
|
910 |
\endisadelimproof
|
|
911 |
%
|
|
912 |
\isatagproof
|
|
913 |
\isacommand{have}\isamarkupfalse%
|
|
914 |
\ lab\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
915 |
\ $\dots$\\
|
|
916 |
\isacommand{have}\isamarkupfalse%
|
|
917 |
\ lab\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
918 |
\ $\dots$
|
|
919 |
%
|
|
920 |
\\$\vdots$\\\hspace{-1.4ex}
|
|
921 |
\isacommand{have}\isamarkupfalse%
|
|
922 |
\ lab\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}P\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequoteclose}}\ %
|
|
923 |
\ $\dots$\\
|
|
924 |
\isacommand{from}\isamarkupfalse%
|
|
925 |
\ lab\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ lab\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}%
|
|
926 |
\ $\dots$\\
|
|
927 |
\isacommand{have}\isamarkupfalse%
|
|
928 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{22}{\isachardoublequoteclose}}\ \ %
|
|
929 |
\ $\dots$\\
|
|
930 |
%
|
|
931 |
\endisatagproof
|
|
932 |
{\isafoldproof}%
|
|
933 |
%
|
|
934 |
\isadelimproof
|
|
935 |
%
|
|
936 |
\endisadelimproof
|
|
937 |
%
|
|
938 |
}
|
|
939 |
\end{minipage}
|
|
940 |
\end{tabular}
|
|
941 |
\begin{isamarkuptext}%
|
|
942 |
The \isacom{moreover} version is no shorter but expresses the structure more
|
|
943 |
clearly and avoids new names.
|
|
944 |
|
|
945 |
\subsection{Raw proof blocks}
|
|
946 |
|
47306
|
947 |
Sometimes one would like to prove some lemma locally within a proof.
|
47269
|
948 |
A lemma that shares the current context of assumptions but that
|
47711
|
949 |
has its own assumptions and is generalized over its locally fixed
|
47269
|
950 |
variables at the end. This is what a \concept{raw proof block} does:
|
|
951 |
\begin{quote}
|
|
952 |
\isa{{\isaliteral{7B}{\isacharbraceleft}}} \isacom{fix} \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n}\\
|
|
953 |
\mbox{}\ \ \ \isacom{assume} \isa{A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub m}\\
|
|
954 |
\mbox{}\ \ \ $\vdots$\\
|
|
955 |
\mbox{}\ \ \ \isacom{have} \isa{B}\\
|
|
956 |
\isa{{\isaliteral{7D}{\isacharbraceright}}}
|
|
957 |
\end{quote}
|
|
958 |
proves \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{3B}{\isacharsemicolon}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub m\ {\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B}
|
|
959 |
where all \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub i} have been replaced by unknowns \isa{{\isaliteral{3F}{\isacharquery}}x\isaliteral{5C3C5E697375623E}{}\isactrlisub i}.
|
|
960 |
\begin{warn}
|
|
961 |
The conclusion of a raw proof block is \emph{not} indicated by \isacom{show}
|
|
962 |
but is simply the final \isacom{have}.
|
|
963 |
\end{warn}
|
|
964 |
|
|
965 |
As an example we prove a simple fact about divisibility on integers.
|
|
966 |
The definition of \isa{dvd} is \isa{{\isaliteral{28}{\isacharparenleft}}b\ dvd\ a{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}k{\isaliteral{2E}{\isachardot}}\ a\ {\isaliteral{3D}{\isacharequal}}\ b\ {\isaliteral{2A}{\isacharasterisk}}\ k{\isaliteral{29}{\isacharparenright}}}.
|
|
967 |
\end{isamarkuptext}%
|
|
968 |
\isacommand{lemma}\isamarkupfalse%
|
|
969 |
\ \isakeyword{fixes}\ a\ b\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ int\ \isakeyword{assumes}\ {\isaliteral{22}{\isachardoublequoteopen}}b\ dvd\ {\isaliteral{28}{\isacharparenleft}}a{\isaliteral{2B}{\isacharplus}}b{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{shows}\ {\isaliteral{22}{\isachardoublequoteopen}}b\ dvd\ a{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
970 |
%
|
|
971 |
\isadelimproof
|
|
972 |
%
|
|
973 |
\endisadelimproof
|
|
974 |
%
|
|
975 |
\isatagproof
|
|
976 |
\isacommand{proof}\isamarkupfalse%
|
|
977 |
\ {\isaliteral{2D}{\isacharminus}}\isanewline
|
|
978 |
\ \ \isacommand{{\isaliteral{7B}{\isacharbraceleft}}}\isamarkupfalse%
|
|
979 |
\ \isacommand{fix}\isamarkupfalse%
|
|
980 |
\ k\ \isacommand{assume}\isamarkupfalse%
|
|
981 |
\ k{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}a{\isaliteral{2B}{\isacharplus}}b\ {\isaliteral{3D}{\isacharequal}}\ b{\isaliteral{2A}{\isacharasterisk}}k{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
982 |
\ \ \ \ \isacommand{have}\isamarkupfalse%
|
|
983 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}k{\isaliteral{27}{\isacharprime}}{\isaliteral{2E}{\isachardot}}\ a\ {\isaliteral{3D}{\isacharequal}}\ b{\isaliteral{2A}{\isacharasterisk}}k{\isaliteral{27}{\isacharprime}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
984 |
\ \ \ \ \isacommand{proof}\isamarkupfalse%
|
|
985 |
\isanewline
|
|
986 |
\ \ \ \ \ \ \isacommand{show}\isamarkupfalse%
|
|
987 |
\ {\isaliteral{22}{\isachardoublequoteopen}}a\ {\isaliteral{3D}{\isacharequal}}\ b{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}k\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{1}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{using}\isamarkupfalse%
|
|
988 |
\ k\ \isacommand{by}\isamarkupfalse%
|
|
989 |
{\isaliteral{28}{\isacharparenleft}}simp\ add{\isaliteral{3A}{\isacharcolon}}\ algebra{\isaliteral{5F}{\isacharunderscore}}simps{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
990 |
\ \ \ \ \isacommand{qed}\isamarkupfalse%
|
|
991 |
\ \isacommand{{\isaliteral{7D}{\isacharbraceright}}}\isamarkupfalse%
|
|
992 |
\isanewline
|
|
993 |
\ \ \isacommand{then}\isamarkupfalse%
|
|
994 |
\ \isacommand{show}\isamarkupfalse%
|
|
995 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ \isacommand{using}\isamarkupfalse%
|
|
996 |
\ assms\ \isacommand{by}\isamarkupfalse%
|
|
997 |
{\isaliteral{28}{\isacharparenleft}}auto\ simp\ add{\isaliteral{3A}{\isacharcolon}}\ dvd{\isaliteral{5F}{\isacharunderscore}}def{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
998 |
\isacommand{qed}\isamarkupfalse%
|
|
999 |
%
|
|
1000 |
\endisatagproof
|
|
1001 |
{\isafoldproof}%
|
|
1002 |
%
|
|
1003 |
\isadelimproof
|
|
1004 |
%
|
|
1005 |
\endisadelimproof
|
|
1006 |
%
|
|
1007 |
\begin{isamarkuptext}%
|
|
1008 |
Note that the result of a raw proof block has no name. In this example
|
|
1009 |
it was directly piped (via \isacom{then}) into the final proof, but it can
|
|
1010 |
also be named for later reference: you simply follow the block directly by a
|
|
1011 |
\isacom{note} command:
|
|
1012 |
\begin{quote}
|
|
1013 |
\isacom{note} \ \isa{name\ {\isaliteral{3D}{\isacharequal}}\ this}
|
|
1014 |
\end{quote}
|
|
1015 |
This introduces a new name \isa{name} that refers to \isa{this},
|
|
1016 |
the fact just proved, in this case the preceding block. In general,
|
|
1017 |
\isacom{note} introduces a new name for one or more facts.
|
|
1018 |
|
47711
|
1019 |
\section{Case analysis and induction}
|
47269
|
1020 |
|
47711
|
1021 |
\subsection{Datatype case analysis}
|
47269
|
1022 |
|
47711
|
1023 |
We have seen case analysis on formulas. Now we want to distinguish
|
47269
|
1024 |
which form some term takes: is it \isa{{\isadigit{0}}} or of the form \isa{Suc\ n},
|
|
1025 |
is it \isa{{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}} or of the form \isa{x\ {\isaliteral{23}{\isacharhash}}\ xs}, etc. Here is a typical example
|
47711
|
1026 |
proof by case analysis on the form of \isa{xs}:%
|
47269
|
1027 |
\end{isamarkuptext}%
|
|
1028 |
\isamarkuptrue%
|
|
1029 |
\isacommand{lemma}\isamarkupfalse%
|
|
1030 |
\ {\isaliteral{22}{\isachardoublequoteopen}}length{\isaliteral{28}{\isacharparenleft}}tl\ xs{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ length\ xs\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1031 |
%
|
|
1032 |
\isadelimproof
|
|
1033 |
%
|
|
1034 |
\endisadelimproof
|
|
1035 |
%
|
|
1036 |
\isatagproof
|
|
1037 |
\isacommand{proof}\isamarkupfalse%
|
|
1038 |
\ {\isaliteral{28}{\isacharparenleft}}cases\ xs{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1039 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
1040 |
\ {\isaliteral{22}{\isachardoublequoteopen}}xs\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1041 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1042 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ \isacommand{by}\isamarkupfalse%
|
|
1043 |
\ simp\isanewline
|
|
1044 |
\isacommand{next}\isamarkupfalse%
|
|
1045 |
\isanewline
|
|
1046 |
\ \ \isacommand{fix}\isamarkupfalse%
|
|
1047 |
\ y\ ys\ \isacommand{assume}\isamarkupfalse%
|
|
1048 |
\ {\isaliteral{22}{\isachardoublequoteopen}}xs\ {\isaliteral{3D}{\isacharequal}}\ y{\isaliteral{23}{\isacharhash}}ys{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1049 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1050 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ \isacommand{by}\isamarkupfalse%
|
|
1051 |
\ simp\isanewline
|
|
1052 |
\isacommand{qed}\isamarkupfalse%
|
|
1053 |
%
|
|
1054 |
\endisatagproof
|
|
1055 |
{\isafoldproof}%
|
|
1056 |
%
|
|
1057 |
\isadelimproof
|
|
1058 |
%
|
|
1059 |
\endisadelimproof
|
|
1060 |
%
|
|
1061 |
\begin{isamarkuptext}%
|
|
1062 |
Function \isa{tl} (''tail'') is defined by \isa{tl\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}} and
|
|
1063 |
\isa{tl\ {\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{23}{\isacharhash}}\ xs{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ xs}. Note that the result type of \isa{length} is \isa{nat}
|
|
1064 |
and \isa{{\isadigit{0}}\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{1}}\ {\isaliteral{3D}{\isacharequal}}\ {\isadigit{0}}}.
|
|
1065 |
|
|
1066 |
This proof pattern works for any term \isa{t} whose type is a datatype.
|
|
1067 |
The goal has to be proved for each constructor \isa{C}:
|
|
1068 |
\begin{quote}
|
|
1069 |
\isacom{fix} \ \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n} \isacom{assume} \isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3D}{\isacharequal}}\ C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}}
|
|
1070 |
\end{quote}
|
|
1071 |
Each case can be written in a more compact form by means of the \isacom{case}
|
|
1072 |
command:
|
|
1073 |
\begin{quote}
|
|
1074 |
\isacom{case} \isa{{\isaliteral{28}{\isacharparenleft}}C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{29}{\isacharparenright}}}
|
|
1075 |
\end{quote}
|
47704
|
1076 |
This is equivalent to the explicit \isacom{fix}-\isacom{assume} line
|
47269
|
1077 |
but also gives the assumption \isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3D}{\isacharequal}}\ C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}} a name: \isa{C},
|
|
1078 |
like the constructor.
|
|
1079 |
Here is the \isacom{case} version of the proof above:%
|
|
1080 |
\end{isamarkuptext}%
|
|
1081 |
\isamarkuptrue%
|
|
1082 |
%
|
|
1083 |
\isadelimproof
|
|
1084 |
%
|
|
1085 |
\endisadelimproof
|
|
1086 |
%
|
|
1087 |
\isatagproof
|
|
1088 |
\isacommand{proof}\isamarkupfalse%
|
|
1089 |
\ {\isaliteral{28}{\isacharparenleft}}cases\ xs{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1090 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1091 |
\ Nil\isanewline
|
|
1092 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1093 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ \isacommand{by}\isamarkupfalse%
|
|
1094 |
\ simp\isanewline
|
|
1095 |
\isacommand{next}\isamarkupfalse%
|
|
1096 |
\isanewline
|
|
1097 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1098 |
\ {\isaliteral{28}{\isacharparenleft}}Cons\ y\ ys{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1099 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1100 |
\ {\isaliteral{3F}{\isacharquery}}thesis\ \isacommand{by}\isamarkupfalse%
|
|
1101 |
\ simp\isanewline
|
|
1102 |
\isacommand{qed}\isamarkupfalse%
|
|
1103 |
%
|
|
1104 |
\endisatagproof
|
|
1105 |
{\isafoldproof}%
|
|
1106 |
%
|
|
1107 |
\isadelimproof
|
|
1108 |
%
|
|
1109 |
\endisadelimproof
|
|
1110 |
%
|
|
1111 |
\begin{isamarkuptext}%
|
|
1112 |
Remember that \isa{Nil} and \isa{Cons} are the alphanumeric names
|
|
1113 |
for \isa{{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}} and \isa{{\isaliteral{23}{\isacharhash}}}. The names of the assumptions
|
|
1114 |
are not used because they are directly piped (via \isacom{thus})
|
|
1115 |
into the proof of the claim.
|
|
1116 |
|
|
1117 |
\subsection{Structural induction}
|
|
1118 |
|
|
1119 |
We illustrate structural induction with an example based on natural numbers:
|
|
1120 |
the sum (\isa{{\isaliteral{5C3C53756D3E}{\isasymSum}}}) of the first \isa{n} natural numbers
|
|
1121 |
(\isa{{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}n{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}nat{\isaliteral{7D}{\isacharbraceright}}}) is equal to \mbox{\isa{n\ {\isaliteral{2A}{\isacharasterisk}}\ {\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}}}.
|
|
1122 |
Never mind the details, just focus on the pattern:%
|
|
1123 |
\end{isamarkuptext}%
|
|
1124 |
\isamarkuptrue%
|
|
1125 |
\isacommand{lemma}\isamarkupfalse%
|
47711
|
1126 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}n{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}nat{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ n{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{2B}{\isacharplus}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
47269
|
1127 |
%
|
|
1128 |
\isadelimproof
|
|
1129 |
%
|
|
1130 |
\endisadelimproof
|
|
1131 |
%
|
|
1132 |
\isatagproof
|
|
1133 |
\isacommand{proof}\isamarkupfalse%
|
|
1134 |
\ {\isaliteral{28}{\isacharparenleft}}induction\ n{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1135 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1136 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}nat{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isadigit{0}}{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{2B}{\isacharplus}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1137 |
\ simp\isanewline
|
|
1138 |
\isacommand{next}\isamarkupfalse%
|
|
1139 |
\isanewline
|
|
1140 |
\ \ \isacommand{fix}\isamarkupfalse%
|
|
1141 |
\ n\ \isacommand{assume}\isamarkupfalse%
|
|
1142 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}n{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}nat{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ n{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{2B}{\isacharplus}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1143 |
\ \ \isacommand{thus}\isamarkupfalse%
|
47711
|
1144 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}Suc\ n{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ Suc\ n{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{2B}{\isacharplus}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
47269
|
1145 |
\ simp\isanewline
|
|
1146 |
\isacommand{qed}\isamarkupfalse%
|
|
1147 |
%
|
|
1148 |
\endisatagproof
|
|
1149 |
{\isafoldproof}%
|
|
1150 |
%
|
|
1151 |
\isadelimproof
|
|
1152 |
%
|
|
1153 |
\endisadelimproof
|
|
1154 |
%
|
|
1155 |
\begin{isamarkuptext}%
|
|
1156 |
Except for the rewrite steps, everything is explicitly given. This
|
|
1157 |
makes the proof easily readable, but the duplication means it is tedious to
|
|
1158 |
write and maintain. Here is how pattern
|
|
1159 |
matching can completely avoid any duplication:%
|
|
1160 |
\end{isamarkuptext}%
|
|
1161 |
\isamarkuptrue%
|
|
1162 |
\isacommand{lemma}\isamarkupfalse%
|
|
1163 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}n{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}nat{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ n{\isaliteral{2A}{\isacharasterisk}}{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{2B}{\isacharplus}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{is}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}P\ n{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1164 |
%
|
|
1165 |
\isadelimproof
|
|
1166 |
%
|
|
1167 |
\endisadelimproof
|
|
1168 |
%
|
|
1169 |
\isatagproof
|
|
1170 |
\isacommand{proof}\isamarkupfalse%
|
|
1171 |
\ {\isaliteral{28}{\isacharparenleft}}induction\ n{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1172 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1173 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}P\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1174 |
\ simp\isanewline
|
|
1175 |
\isacommand{next}\isamarkupfalse%
|
|
1176 |
\isanewline
|
|
1177 |
\ \ \isacommand{fix}\isamarkupfalse%
|
|
1178 |
\ n\ \isacommand{assume}\isamarkupfalse%
|
|
1179 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}P\ n{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1180 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1181 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{3F}{\isacharquery}}P{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1182 |
\ simp\isanewline
|
|
1183 |
\isacommand{qed}\isamarkupfalse%
|
|
1184 |
%
|
|
1185 |
\endisatagproof
|
|
1186 |
{\isafoldproof}%
|
|
1187 |
%
|
|
1188 |
\isadelimproof
|
|
1189 |
%
|
|
1190 |
\endisadelimproof
|
|
1191 |
%
|
|
1192 |
\begin{isamarkuptext}%
|
|
1193 |
The first line introduces an abbreviation \isa{{\isaliteral{3F}{\isacharquery}}P\ n} for the goal.
|
|
1194 |
Pattern matching \isa{{\isaliteral{3F}{\isacharquery}}P\ n} with the goal instantiates \isa{{\isaliteral{3F}{\isacharquery}}P} to the
|
|
1195 |
function \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}n{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{7B}{\isacharbraceleft}}{\isadigit{0}}{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}n{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{3D}{\isacharequal}}\ n\ {\isaliteral{2A}{\isacharasterisk}}\ {\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{29}{\isacharparenright}}\ div\ {\isadigit{2}}}. Now the proposition to
|
|
1196 |
be proved in the base case can be written as \isa{{\isaliteral{3F}{\isacharquery}}P\ {\isadigit{0}}}, the induction
|
|
1197 |
hypothesis as \isa{{\isaliteral{3F}{\isacharquery}}P\ n}, and the conclusion of the induction step as
|
|
1198 |
\isa{{\isaliteral{3F}{\isacharquery}}P{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}}.
|
|
1199 |
|
|
1200 |
Induction also provides the \isacom{case} idiom that abbreviates
|
|
1201 |
the \isacom{fix}-\isacom{assume} step. The above proof becomes%
|
|
1202 |
\end{isamarkuptext}%
|
|
1203 |
\isamarkuptrue%
|
|
1204 |
%
|
|
1205 |
\isadelimproof
|
|
1206 |
%
|
|
1207 |
\endisadelimproof
|
|
1208 |
%
|
|
1209 |
\isatagproof
|
|
1210 |
\isacommand{proof}\isamarkupfalse%
|
|
1211 |
\ {\isaliteral{28}{\isacharparenleft}}induction\ n{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1212 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1213 |
\ {\isadigit{0}}\isanewline
|
|
1214 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1215 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{by}\isamarkupfalse%
|
|
1216 |
\ simp\isanewline
|
|
1217 |
\isacommand{next}\isamarkupfalse%
|
|
1218 |
\isanewline
|
|
1219 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1220 |
\ {\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1221 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1222 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{by}\isamarkupfalse%
|
|
1223 |
\ simp\isanewline
|
|
1224 |
\isacommand{qed}\isamarkupfalse%
|
|
1225 |
%
|
|
1226 |
\endisatagproof
|
|
1227 |
{\isafoldproof}%
|
|
1228 |
%
|
|
1229 |
\isadelimproof
|
|
1230 |
%
|
|
1231 |
\endisadelimproof
|
|
1232 |
%
|
|
1233 |
\begin{isamarkuptext}%
|
|
1234 |
The unknown \isa{{\isaliteral{3F}{\isacharquery}}case} is set in each case to the required
|
|
1235 |
claim, i.e.\ \isa{{\isaliteral{3F}{\isacharquery}}P\ {\isadigit{0}}} and \mbox{\isa{{\isaliteral{3F}{\isacharquery}}P{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}}} in the above proof,
|
|
1236 |
without requiring the user to define a \isa{{\isaliteral{3F}{\isacharquery}}P}. The general
|
|
1237 |
pattern for induction over \isa{nat} is shown on the left-hand side:%
|
|
1238 |
\end{isamarkuptext}%
|
|
1239 |
\isamarkuptrue%
|
|
1240 |
%
|
|
1241 |
\begin{tabular}{@ {}ll@ {}}
|
|
1242 |
\begin{minipage}[t]{.4\textwidth}
|
|
1243 |
\isa{%
|
|
1244 |
%
|
|
1245 |
\isadelimproof
|
|
1246 |
%
|
|
1247 |
\endisadelimproof
|
|
1248 |
%
|
|
1249 |
\isatagproof
|
|
1250 |
\isacommand{show}\isamarkupfalse%
|
|
1251 |
\ {\isaliteral{22}{\isachardoublequoteopen}}P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1252 |
\isacommand{proof}\isamarkupfalse%
|
|
1253 |
\ {\isaliteral{28}{\isacharparenleft}}induction\ n{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1254 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1255 |
\ {\isadigit{0}}%
|
|
1256 |
\\\mbox{}\ \ $\vdots$\\\mbox{}\hspace{-1ex}
|
|
1257 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1258 |
\ {\isaliteral{3F}{\isacharquery}}case\ %
|
|
1259 |
\ $\dots$\\
|
|
1260 |
\isacommand{next}\isamarkupfalse%
|
|
1261 |
\isanewline
|
|
1262 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1263 |
\ {\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}%
|
|
1264 |
\\\mbox{}\ \ $\vdots$\\\mbox{}\hspace{-1ex}
|
|
1265 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1266 |
\ {\isaliteral{3F}{\isacharquery}}case\ %
|
|
1267 |
\ $\dots$\\
|
|
1268 |
\isacommand{qed}\isamarkupfalse%
|
|
1269 |
%
|
|
1270 |
\endisatagproof
|
|
1271 |
{\isafoldproof}%
|
|
1272 |
%
|
|
1273 |
\isadelimproof
|
|
1274 |
%
|
|
1275 |
\endisadelimproof
|
|
1276 |
%
|
|
1277 |
}
|
|
1278 |
\end{minipage}
|
|
1279 |
&
|
|
1280 |
\begin{minipage}[t]{.4\textwidth}
|
|
1281 |
~\\
|
|
1282 |
~\\
|
|
1283 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
1284 |
~\\
|
|
1285 |
~\\
|
|
1286 |
~\\[1ex]
|
|
1287 |
\isacom{fix} \isa{n} \isacom{assume} \isa{Suc{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
1288 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
1289 |
\end{minipage}
|
|
1290 |
\end{tabular}
|
|
1291 |
\medskip
|
|
1292 |
%
|
|
1293 |
\begin{isamarkuptext}%
|
|
1294 |
On the right side you can see what the \isacom{case} command
|
|
1295 |
on the left stands for.
|
|
1296 |
|
|
1297 |
In case the goal is an implication, induction does one more thing: the
|
|
1298 |
proposition to be proved in each case is not the whole implication but only
|
|
1299 |
its conclusion; the premises of the implication are immediately made
|
|
1300 |
assumptions of that case. That is, if in the above proof we replace
|
|
1301 |
\isacom{show}~\isa{P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}} by
|
|
1302 |
\mbox{\isacom{show}~\isa{A{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}}}
|
|
1303 |
then \isacom{case}~\isa{{\isadigit{0}}} stands for
|
|
1304 |
\begin{quote}
|
|
1305 |
\isacom{assume} \ \isa{{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}A{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
1306 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}
|
|
1307 |
\end{quote}
|
|
1308 |
and \isacom{case}~\isa{{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}} stands for
|
|
1309 |
\begin{quote}
|
|
1310 |
\isacom{fix} \isa{n}\\
|
|
1311 |
\isacom{assume} \isa{Suc{\isaliteral{3A}{\isacharcolon}}}
|
47306
|
1312 |
\begin{tabular}[t]{l}\isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\\isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\end{tabular}\\
|
47269
|
1313 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}
|
|
1314 |
\end{quote}
|
|
1315 |
The list of assumptions \isa{Suc} is actually subdivided
|
|
1316 |
into \isa{Suc{\isaliteral{2E}{\isachardot}}IH}, the induction hypotheses (here \isa{A{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P{\isaliteral{28}{\isacharparenleft}}n{\isaliteral{29}{\isacharparenright}}})
|
|
1317 |
and \isa{Suc{\isaliteral{2E}{\isachardot}}prems}, the premises of the goal being proved
|
|
1318 |
(here \isa{A{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}}).
|
|
1319 |
|
|
1320 |
Induction works for any datatype.
|
|
1321 |
Proving a goal \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{3B}{\isacharsemicolon}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub k{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}}
|
|
1322 |
by induction on \isa{x} generates a proof obligation for each constructor
|
|
1323 |
\isa{C} of the datatype. The command \isa{case\ {\isaliteral{28}{\isacharparenleft}}C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{29}{\isacharparenright}}}
|
|
1324 |
performs the following steps:
|
|
1325 |
\begin{enumerate}
|
|
1326 |
\item \isacom{fix} \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n}
|
|
1327 |
\item \isacom{assume} the induction hypotheses (calling them \isa{C{\isaliteral{2E}{\isachardot}}IH})
|
|
1328 |
and the premises \mbox{\isa{A\isaliteral{5C3C5E697375623E}{}\isactrlisub i{\isaliteral{28}{\isacharparenleft}}C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{29}{\isacharparenright}}}} (calling them \isa{C{\isaliteral{2E}{\isachardot}}prems})
|
|
1329 |
and calling the whole list \isa{C}
|
|
1330 |
\item \isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}P{\isaliteral{28}{\isacharparenleft}}C\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}
|
|
1331 |
\end{enumerate}
|
|
1332 |
|
|
1333 |
\subsection{Rule induction}
|
|
1334 |
|
|
1335 |
Recall the inductive and recursive definitions of even numbers in
|
|
1336 |
\autoref{sec:inductive-defs}:%
|
|
1337 |
\end{isamarkuptext}%
|
|
1338 |
\isamarkuptrue%
|
|
1339 |
\isacommand{inductive}\isamarkupfalse%
|
|
1340 |
\ ev\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}nat\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{where}\isanewline
|
|
1341 |
ev{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}ev\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isaliteral{7C}{\isacharbar}}\isanewline
|
|
1342 |
evSS{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ ev{\isaliteral{28}{\isacharparenleft}}Suc{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1343 |
\isanewline
|
|
1344 |
\isacommand{fun}\isamarkupfalse%
|
|
1345 |
\ even\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}nat\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{where}\isanewline
|
|
1346 |
{\isaliteral{22}{\isachardoublequoteopen}}even\ {\isadigit{0}}\ {\isaliteral{3D}{\isacharequal}}\ True{\isaliteral{22}{\isachardoublequoteclose}}\ {\isaliteral{7C}{\isacharbar}}\isanewline
|
|
1347 |
{\isaliteral{22}{\isachardoublequoteopen}}even\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ False{\isaliteral{22}{\isachardoublequoteclose}}\ {\isaliteral{7C}{\isacharbar}}\isanewline
|
|
1348 |
{\isaliteral{22}{\isachardoublequoteopen}}even\ {\isaliteral{28}{\isacharparenleft}}Suc{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ even\ n{\isaliteral{22}{\isachardoublequoteclose}}%
|
|
1349 |
\begin{isamarkuptext}%
|
|
1350 |
We recast the proof of \isa{ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ even\ n} in Isar. The
|
|
1351 |
left column shows the actual proof text, the right column shows
|
|
1352 |
the implicit effect of the two \isacom{case} commands:%
|
|
1353 |
\end{isamarkuptext}%
|
|
1354 |
\isamarkuptrue%
|
|
1355 |
%
|
|
1356 |
\begin{tabular}{@ {}l@ {\qquad}l@ {}}
|
|
1357 |
\begin{minipage}[t]{.5\textwidth}
|
|
1358 |
\isa{%
|
|
1359 |
\isacommand{lemma}\isamarkupfalse%
|
|
1360 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ even\ n{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1361 |
%
|
|
1362 |
\isadelimproof
|
|
1363 |
%
|
|
1364 |
\endisadelimproof
|
|
1365 |
%
|
|
1366 |
\isatagproof
|
|
1367 |
\isacommand{proof}\isamarkupfalse%
|
|
1368 |
{\isaliteral{28}{\isacharparenleft}}induction\ rule{\isaliteral{3A}{\isacharcolon}}\ ev{\isaliteral{2E}{\isachardot}}induct{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1369 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1370 |
\ ev{\isadigit{0}}\isanewline
|
|
1371 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1372 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{by}\isamarkupfalse%
|
|
1373 |
\ simp\isanewline
|
|
1374 |
\isacommand{next}\isamarkupfalse%
|
|
1375 |
\isanewline
|
|
1376 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1377 |
\ evSS\isanewline
|
|
1378 |
\isanewline
|
|
1379 |
\isanewline
|
|
1380 |
\isanewline
|
|
1381 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1382 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{by}\isamarkupfalse%
|
|
1383 |
\ simp\isanewline
|
|
1384 |
\isacommand{qed}\isamarkupfalse%
|
|
1385 |
%
|
|
1386 |
\endisatagproof
|
|
1387 |
{\isafoldproof}%
|
|
1388 |
%
|
|
1389 |
\isadelimproof
|
|
1390 |
%
|
|
1391 |
\endisadelimproof
|
|
1392 |
%
|
|
1393 |
}
|
|
1394 |
\end{minipage}
|
|
1395 |
&
|
|
1396 |
\begin{minipage}[t]{.5\textwidth}
|
|
1397 |
~\\
|
|
1398 |
~\\
|
|
1399 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}even\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}}\\
|
|
1400 |
~\\
|
|
1401 |
~\\
|
|
1402 |
\isacom{fix} \isa{n}\\
|
|
1403 |
\isacom{assume} \isa{evSS{\isaliteral{3A}{\isacharcolon}}}
|
47306
|
1404 |
\begin{tabular}[t]{l} \isa{{\isaliteral{22}{\isachardoublequote}}ev\ n{\isaliteral{22}{\isachardoublequote}}}\\\isa{{\isaliteral{22}{\isachardoublequote}}even\ n{\isaliteral{22}{\isachardoublequote}}}\end{tabular}\\
|
|
1405 |
\isacom{let} \isa{{\isaliteral{3F}{\isacharquery}}case\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}even{\isaliteral{28}{\isacharparenleft}}Suc{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}\\
|
47269
|
1406 |
\end{minipage}
|
|
1407 |
\end{tabular}
|
|
1408 |
\medskip
|
|
1409 |
%
|
|
1410 |
\begin{isamarkuptext}%
|
|
1411 |
The proof resembles structural induction, but the induction rule is given
|
|
1412 |
explicitly and the names of the cases are the names of the rules in the
|
|
1413 |
inductive definition.
|
|
1414 |
Let us examine the two assumptions named \isa{evSS}:
|
|
1415 |
\isa{ev\ n} is the premise of rule \isa{evSS}, which we may assume
|
|
1416 |
because we are in the case where that rule was used; \isa{even\ n}
|
|
1417 |
is the induction hypothesis.
|
|
1418 |
\begin{warn}
|
|
1419 |
Because each \isacom{case} command introduces a list of assumptions
|
|
1420 |
named like the case name, which is the name of a rule of the inductive
|
|
1421 |
definition, those rules now need to be accessed with a qualified name, here
|
|
1422 |
\isa{ev{\isaliteral{2E}{\isachardot}}ev{\isadigit{0}}} and \isa{ev{\isaliteral{2E}{\isachardot}}evSS}
|
|
1423 |
\end{warn}
|
|
1424 |
|
|
1425 |
In the case \isa{evSS} of the proof above we have pretended that the
|
|
1426 |
system fixes a variable \isa{n}. But unless the user provides the name
|
|
1427 |
\isa{n}, the system will just invent its own name that cannot be referred
|
|
1428 |
to. In the above proof, we do not need to refer to it, hence we do not give
|
|
1429 |
it a specific name. In case one needs to refer to it one writes
|
|
1430 |
\begin{quote}
|
|
1431 |
\isacom{case} \isa{{\isaliteral{28}{\isacharparenleft}}evSS\ m{\isaliteral{29}{\isacharparenright}}}
|
|
1432 |
\end{quote}
|
|
1433 |
just like \isacom{case}~\isa{{\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}} in earlier structural inductions.
|
|
1434 |
The name \isa{m} is an arbitrary choice. As a result,
|
|
1435 |
case \isa{evSS} is derived from a renamed version of
|
|
1436 |
rule \isa{evSS}: \isa{ev\ m\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ ev{\isaliteral{28}{\isacharparenleft}}Suc{\isaliteral{28}{\isacharparenleft}}Suc\ m{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}}.
|
|
1437 |
Here is an example with a (contrived) intermediate step that refers to \isa{m}:%
|
|
1438 |
\end{isamarkuptext}%
|
|
1439 |
\isamarkuptrue%
|
|
1440 |
\isacommand{lemma}\isamarkupfalse%
|
|
1441 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ even\ n{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1442 |
%
|
|
1443 |
\isadelimproof
|
|
1444 |
%
|
|
1445 |
\endisadelimproof
|
|
1446 |
%
|
|
1447 |
\isatagproof
|
|
1448 |
\isacommand{proof}\isamarkupfalse%
|
|
1449 |
{\isaliteral{28}{\isacharparenleft}}induction\ rule{\isaliteral{3A}{\isacharcolon}}\ ev{\isaliteral{2E}{\isachardot}}induct{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1450 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1451 |
\ ev{\isadigit{0}}\ \isacommand{show}\isamarkupfalse%
|
|
1452 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{by}\isamarkupfalse%
|
|
1453 |
\ simp\isanewline
|
|
1454 |
\isacommand{next}\isamarkupfalse%
|
|
1455 |
\isanewline
|
|
1456 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1457 |
\ {\isaliteral{28}{\isacharparenleft}}evSS\ m{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1458 |
\ \ \isacommand{have}\isamarkupfalse%
|
|
1459 |
\ {\isaliteral{22}{\isachardoublequoteopen}}even{\isaliteral{28}{\isacharparenleft}}Suc{\isaliteral{28}{\isacharparenleft}}Suc\ m{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ even\ m{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1460 |
\ simp\isanewline
|
|
1461 |
\ \ \isacommand{thus}\isamarkupfalse%
|
|
1462 |
\ {\isaliteral{3F}{\isacharquery}}case\ \isacommand{using}\isamarkupfalse%
|
|
1463 |
\ {\isaliteral{60}{\isacharbackquoteopen}}even\ m{\isaliteral{60}{\isacharbackquoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1464 |
\ blast\isanewline
|
|
1465 |
\isacommand{qed}\isamarkupfalse%
|
|
1466 |
%
|
|
1467 |
\endisatagproof
|
|
1468 |
{\isafoldproof}%
|
|
1469 |
%
|
|
1470 |
\isadelimproof
|
|
1471 |
%
|
|
1472 |
\endisadelimproof
|
|
1473 |
%
|
|
1474 |
\begin{isamarkuptext}%
|
|
1475 |
\indent
|
|
1476 |
In general, let \isa{I} be a (for simplicity unary) inductively defined
|
|
1477 |
predicate and let the rules in the definition of \isa{I}
|
|
1478 |
be called \isa{rule\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}}, \dots, \isa{rule\isaliteral{5C3C5E697375623E}{}\isactrlisub n}. A proof by rule
|
|
1479 |
induction follows this pattern:%
|
|
1480 |
\end{isamarkuptext}%
|
|
1481 |
\isamarkuptrue%
|
|
1482 |
%
|
|
1483 |
\isadelimproof
|
|
1484 |
%
|
|
1485 |
\endisadelimproof
|
|
1486 |
%
|
|
1487 |
\isatagproof
|
|
1488 |
\isacommand{show}\isamarkupfalse%
|
|
1489 |
\ {\isaliteral{22}{\isachardoublequoteopen}}I\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ x{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1490 |
\isacommand{proof}\isamarkupfalse%
|
|
1491 |
{\isaliteral{28}{\isacharparenleft}}induction\ rule{\isaliteral{3A}{\isacharcolon}}\ I{\isaliteral{2E}{\isachardot}}induct{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1492 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1493 |
\ rule\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}%
|
|
1494 |
\\[-.4ex]\mbox{}\ \ $\vdots$\\[-.4ex]\mbox{}\hspace{-1ex}
|
|
1495 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1496 |
\ {\isaliteral{3F}{\isacharquery}}case\ %
|
|
1497 |
\ $\dots$\\
|
|
1498 |
\isacommand{next}\isamarkupfalse%
|
|
1499 |
%
|
|
1500 |
\\[-.4ex]$\vdots$\\[-.4ex]\mbox{}\hspace{-1ex}
|
|
1501 |
\isacommand{next}\isamarkupfalse%
|
|
1502 |
\isanewline
|
|
1503 |
\ \ \isacommand{case}\isamarkupfalse%
|
|
1504 |
\ rule\isaliteral{5C3C5E697375623E}{}\isactrlisub n%
|
|
1505 |
\\[-.4ex]\mbox{}\ \ $\vdots$\\[-.4ex]\mbox{}\hspace{-1ex}
|
|
1506 |
\ \ \isacommand{show}\isamarkupfalse%
|
|
1507 |
\ {\isaliteral{3F}{\isacharquery}}case\ %
|
|
1508 |
\ $\dots$\\
|
|
1509 |
\isacommand{qed}\isamarkupfalse%
|
|
1510 |
%
|
|
1511 |
\endisatagproof
|
|
1512 |
{\isafoldproof}%
|
|
1513 |
%
|
|
1514 |
\isadelimproof
|
|
1515 |
%
|
|
1516 |
\endisadelimproof
|
|
1517 |
%
|
|
1518 |
\begin{isamarkuptext}%
|
|
1519 |
One can provide explicit variable names by writing
|
|
1520 |
\isacom{case}~\isa{{\isaliteral{28}{\isacharparenleft}}rule\isaliteral{5C3C5E697375623E}{}\isactrlisub i\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub k{\isaliteral{29}{\isacharparenright}}}, thus renaming the first \isa{k}
|
|
1521 |
free variables in rule \isa{i} to \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub k},
|
|
1522 |
going through rule \isa{i} from left to right.
|
|
1523 |
|
|
1524 |
\subsection{Assumption naming}
|
|
1525 |
|
|
1526 |
In any induction, \isacom{case}~\isa{name} sets up a list of assumptions
|
|
1527 |
also called \isa{name}, which is subdivided into three parts:
|
|
1528 |
\begin{description}
|
|
1529 |
\item[\isa{name{\isaliteral{2E}{\isachardot}}IH}] contains the induction hypotheses.
|
|
1530 |
\item[\isa{name{\isaliteral{2E}{\isachardot}}hyps}] contains all the other hypotheses of this case in the
|
|
1531 |
induction rule. For rule inductions these are the hypotheses of rule
|
|
1532 |
\isa{name}, for structural inductions these are empty.
|
|
1533 |
\item[\isa{name{\isaliteral{2E}{\isachardot}}prems}] contains the (suitably instantiated) premises
|
|
1534 |
of the statement being proved, i.e. the \isa{A\isaliteral{5C3C5E697375623E}{}\isactrlisub i} when
|
|
1535 |
proving \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{3B}{\isacharsemicolon}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub n\ {\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A}.
|
|
1536 |
\end{description}
|
|
1537 |
\begin{warn}
|
|
1538 |
Proof method \isa{induct} differs from \isa{induction}
|
|
1539 |
only in this naming policy: \isa{induct} does not distinguish
|
|
1540 |
\isa{IH} from \isa{hyps} but subsumes \isa{IH} under \isa{hyps}.
|
|
1541 |
\end{warn}
|
|
1542 |
|
|
1543 |
More complicated inductive proofs than the ones we have seen so far
|
|
1544 |
often need to refer to specific assumptions---just \isa{name} or even
|
|
1545 |
\isa{name{\isaliteral{2E}{\isachardot}}prems} and \isa{name{\isaliteral{2E}{\isachardot}}IH} can be too unspecific.
|
|
1546 |
This is where the indexing of fact lists comes in handy, e.g.\
|
|
1547 |
\isa{name{\isaliteral{2E}{\isachardot}}IH{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}} or \isa{name{\isaliteral{2E}{\isachardot}}prems{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{2D}{\isacharminus}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}}.
|
|
1548 |
|
|
1549 |
\subsection{Rule inversion}
|
|
1550 |
|
47711
|
1551 |
Rule inversion is case analysis of which rule could have been used to
|
47269
|
1552 |
derive some fact. The name \concept{rule inversion} emphasizes that we are
|
|
1553 |
reasoning backwards: by which rules could some given fact have been proved?
|
|
1554 |
For the inductive definition of \isa{ev}, rule inversion can be summarized
|
|
1555 |
like this:
|
|
1556 |
\begin{isabelle}%
|
|
1557 |
ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ n\ {\isaliteral{3D}{\isacharequal}}\ {\isadigit{0}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}k{\isaliteral{2E}{\isachardot}}\ n\ {\isaliteral{3D}{\isacharequal}}\ Suc\ {\isaliteral{28}{\isacharparenleft}}Suc\ k{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C616E643E}{\isasymand}}\ ev\ k{\isaliteral{29}{\isacharparenright}}%
|
|
1558 |
\end{isabelle}
|
47711
|
1559 |
The realisation in Isabelle is a case analysis.
|
47269
|
1560 |
A simple example is the proof that \isa{ev\ n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ ev\ {\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}}. We
|
|
1561 |
already went through the details informally in \autoref{sec:Logic:even}. This
|
|
1562 |
is the Isar proof:%
|
|
1563 |
\end{isamarkuptext}%
|
|
1564 |
\isamarkuptrue%
|
|
1565 |
%
|
|
1566 |
\isadelimproof
|
|
1567 |
%
|
|
1568 |
\endisadelimproof
|
|
1569 |
%
|
|
1570 |
\isatagproof
|
|
1571 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
1572 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev\ n{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1573 |
\ \ \isacommand{from}\isamarkupfalse%
|
|
1574 |
\ this\ \isacommand{have}\isamarkupfalse%
|
|
1575 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev{\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1576 |
\ \ \isacommand{proof}\isamarkupfalse%
|
|
1577 |
\ cases\isanewline
|
|
1578 |
\ \ \ \ \isacommand{case}\isamarkupfalse%
|
|
1579 |
\ ev{\isadigit{0}}\ \isacommand{thus}\isamarkupfalse%
|
|
1580 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev{\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1581 |
\ {\isaliteral{28}{\isacharparenleft}}simp\ add{\isaliteral{3A}{\isacharcolon}}\ ev{\isaliteral{2E}{\isachardot}}ev{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1582 |
\ \ \isacommand{next}\isamarkupfalse%
|
|
1583 |
\isanewline
|
|
1584 |
\ \ \ \ \isacommand{case}\isamarkupfalse%
|
|
1585 |
\ {\isaliteral{28}{\isacharparenleft}}evSS\ k{\isaliteral{29}{\isacharparenright}}\ \isacommand{thus}\isamarkupfalse%
|
|
1586 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev{\isaliteral{28}{\isacharparenleft}}n\ {\isaliteral{2D}{\isacharminus}}\ {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse%
|
|
1587 |
\ {\isaliteral{28}{\isacharparenleft}}simp\ add{\isaliteral{3A}{\isacharcolon}}\ ev{\isaliteral{2E}{\isachardot}}evSS{\isaliteral{29}{\isacharparenright}}\isanewline
|
|
1588 |
\ \ \isacommand{qed}\isamarkupfalse%
|
|
1589 |
%
|
|
1590 |
\endisatagproof
|
|
1591 |
{\isafoldproof}%
|
|
1592 |
%
|
|
1593 |
\isadelimproof
|
|
1594 |
%
|
|
1595 |
\endisadelimproof
|
|
1596 |
%
|
|
1597 |
\begin{isamarkuptext}%
|
47711
|
1598 |
The key point here is that a case analysis over some inductively
|
47269
|
1599 |
defined predicate is triggered by piping the given fact
|
|
1600 |
(here: \isacom{from}~\isa{this}) into a proof by \isa{cases}.
|
|
1601 |
Let us examine the assumptions available in each case. In case \isa{ev{\isadigit{0}}}
|
|
1602 |
we have \isa{n\ {\isaliteral{3D}{\isacharequal}}\ {\isadigit{0}}} and in case \isa{evSS} we have \isa{n\ {\isaliteral{3D}{\isacharequal}}\ Suc\ {\isaliteral{28}{\isacharparenleft}}Suc\ k{\isaliteral{29}{\isacharparenright}}}
|
|
1603 |
and \isa{ev\ k}. In each case the assumptions are available under the name
|
|
1604 |
of the case; there is no fine grained naming schema like for induction.
|
|
1605 |
|
47704
|
1606 |
Sometimes some rules could not have been used to derive the given fact
|
47269
|
1607 |
because constructors clash. As an extreme example consider
|
|
1608 |
rule inversion applied to \isa{ev\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}}: neither rule \isa{ev{\isadigit{0}}} nor
|
|
1609 |
rule \isa{evSS} can yield \isa{ev\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}} because \isa{Suc\ {\isadigit{0}}} unifies
|
|
1610 |
neither with \isa{{\isadigit{0}}} nor with \isa{Suc\ {\isaliteral{28}{\isacharparenleft}}Suc\ n{\isaliteral{29}{\isacharparenright}}}. Impossible cases do not
|
|
1611 |
have to be proved. Hence we can prove anything from \isa{ev\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}}:%
|
|
1612 |
\end{isamarkuptext}%
|
|
1613 |
\isamarkuptrue%
|
|
1614 |
%
|
|
1615 |
\isadelimproof
|
|
1616 |
%
|
|
1617 |
\endisadelimproof
|
|
1618 |
%
|
|
1619 |
\isatagproof
|
|
1620 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
1621 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev{\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{then}\isamarkupfalse%
|
|
1622 |
\ \isacommand{have}\isamarkupfalse%
|
|
1623 |
\ P\ \isacommand{by}\isamarkupfalse%
|
|
1624 |
\ cases%
|
|
1625 |
\endisatagproof
|
|
1626 |
{\isafoldproof}%
|
|
1627 |
%
|
|
1628 |
\isadelimproof
|
|
1629 |
%
|
|
1630 |
\endisadelimproof
|
|
1631 |
%
|
|
1632 |
\begin{isamarkuptext}%
|
|
1633 |
That is, \isa{ev\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}} is simply not provable:%
|
|
1634 |
\end{isamarkuptext}%
|
|
1635 |
\isamarkuptrue%
|
|
1636 |
\isacommand{lemma}\isamarkupfalse%
|
|
1637 |
\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ ev{\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
|
|
1638 |
%
|
|
1639 |
\isadelimproof
|
|
1640 |
%
|
|
1641 |
\endisadelimproof
|
|
1642 |
%
|
|
1643 |
\isatagproof
|
|
1644 |
\isacommand{proof}\isamarkupfalse%
|
|
1645 |
\isanewline
|
|
1646 |
\ \ \isacommand{assume}\isamarkupfalse%
|
|
1647 |
\ {\isaliteral{22}{\isachardoublequoteopen}}ev{\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{then}\isamarkupfalse%
|
|
1648 |
\ \isacommand{show}\isamarkupfalse%
|
|
1649 |
\ False\ \isacommand{by}\isamarkupfalse%
|
|
1650 |
\ cases\isanewline
|
|
1651 |
\isacommand{qed}\isamarkupfalse%
|
|
1652 |
%
|
|
1653 |
\endisatagproof
|
|
1654 |
{\isafoldproof}%
|
|
1655 |
%
|
|
1656 |
\isadelimproof
|
|
1657 |
%
|
|
1658 |
\endisadelimproof
|
|
1659 |
%
|
|
1660 |
\begin{isamarkuptext}%
|
|
1661 |
Normally not all cases will be impossible. As a simple exercise,
|
|
1662 |
prove that \mbox{\isa{{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ ev\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isaliteral{28}{\isacharparenleft}}Suc\ {\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}}.}%
|
|
1663 |
\end{isamarkuptext}%
|
|
1664 |
\isamarkuptrue%
|
|
1665 |
%
|
|
1666 |
\isadelimtheory
|
|
1667 |
%
|
|
1668 |
\endisadelimtheory
|
|
1669 |
%
|
|
1670 |
\isatagtheory
|
|
1671 |
%
|
|
1672 |
\endisatagtheory
|
|
1673 |
{\isafoldtheory}%
|
|
1674 |
%
|
|
1675 |
\isadelimtheory
|
|
1676 |
%
|
|
1677 |
\endisadelimtheory
|
|
1678 |
\end{isabellebody}%
|
|
1679 |
%%% Local Variables:
|
|
1680 |
%%% mode: latex
|
|
1681 |
%%% TeX-master: "root"
|
|
1682 |
%%% End:
|