1 % |
|
2 \begin{isabellebody}% |
|
3 \def\isabellecontext{Framework}% |
|
4 % |
|
5 \isadelimtheory |
|
6 % |
|
7 \endisadelimtheory |
|
8 % |
|
9 \isatagtheory |
|
10 \isacommand{theory}\isamarkupfalse% |
|
11 \ Framework\isanewline |
|
12 \isakeyword{imports}\ Base\ Main\isanewline |
|
13 \isakeyword{begin}% |
|
14 \endisatagtheory |
|
15 {\isafoldtheory}% |
|
16 % |
|
17 \isadelimtheory |
|
18 % |
|
19 \endisadelimtheory |
|
20 % |
|
21 \isamarkupchapter{The Isabelle/Isar Framework \label{ch:isar-framework}% |
|
22 } |
|
23 \isamarkuptrue% |
|
24 % |
|
25 \begin{isamarkuptext}% |
|
26 Isabelle/Isar |
|
27 \cite{Wenzel:1999:TPHOL,Wenzel-PhD,Nipkow-TYPES02,Wenzel-Paulson:2006,Wenzel:2006:Festschrift} |
|
28 is intended as a generic framework for developing formal |
|
29 mathematical documents with full proof checking. Definitions and |
|
30 proofs are organized as theories. An assembly of theory sources may |
|
31 be presented as a printed document; see also |
|
32 \chref{ch:document-prep}. |
|
33 |
|
34 The main objective of Isar is the design of a human-readable |
|
35 structured proof language, which is called the ``primary proof |
|
36 format'' in Isar terminology. Such a primary proof language is |
|
37 somewhere in the middle between the extremes of primitive proof |
|
38 objects and actual natural language. In this respect, Isar is a bit |
|
39 more formalistic than Mizar |
|
40 \cite{Trybulec:1993:MizarFeatures,Rudnicki:1992:MizarOverview,Wiedijk:1999:Mizar}, |
|
41 using logical symbols for certain reasoning schemes where Mizar |
|
42 would prefer English words; see \cite{Wenzel-Wiedijk:2002} for |
|
43 further comparisons of these systems. |
|
44 |
|
45 So Isar challenges the traditional way of recording informal proofs |
|
46 in mathematical prose, as well as the common tendency to see fully |
|
47 formal proofs directly as objects of some logical calculus (e.g.\ |
|
48 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms in a version of type theory). In fact, Isar is |
|
49 better understood as an interpreter of a simple block-structured |
|
50 language for describing the data flow of local facts and goals, |
|
51 interspersed with occasional invocations of proof methods. |
|
52 Everything is reduced to logical inferences internally, but these |
|
53 steps are somewhat marginal compared to the overall bookkeeping of |
|
54 the interpretation process. Thanks to careful design of the syntax |
|
55 and semantics of Isar language elements, a formal record of Isar |
|
56 instructions may later appear as an intelligible text to the |
|
57 attentive reader. |
|
58 |
|
59 The Isar proof language has emerged from careful analysis of some |
|
60 inherent virtues of the existing logical framework of Isabelle/Pure |
|
61 \cite{paulson-found,paulson700}, notably composition of higher-order |
|
62 natural deduction rules, which is a generalization of Gentzen's |
|
63 original calculus \cite{Gentzen:1935}. The approach of generic |
|
64 inference systems in Pure is continued by Isar towards actual proof |
|
65 texts. |
|
66 |
|
67 Concrete applications require another intermediate layer: an |
|
68 object-logic. Isabelle/HOL \cite{isa-tutorial} (simply-typed |
|
69 set-theory) is being used most of the time; Isabelle/ZF |
|
70 \cite{isabelle-ZF} is less extensively developed, although it would |
|
71 probably fit better for classical mathematics. |
|
72 |
|
73 \medskip In order to illustrate natural deduction in Isar, we shall |
|
74 refer to the background theory and library of Isabelle/HOL. This |
|
75 includes common notions of predicate logic, naive set-theory etc.\ |
|
76 using fairly standard mathematical notation. From the perspective |
|
77 of generic natural deduction there is nothing special about the |
|
78 logical connectives of HOL (\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616E643E}{\isasymand}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6F723E}{\isasymor}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}{\isaliteral{22}{\isachardoublequote}}}, |
|
79 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}{\isaliteral{22}{\isachardoublequote}}}, etc.), only the resulting reasoning principles are |
|
80 relevant to the user. There are similar rules available for |
|
81 set-theory operators (\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E7465723E}{\isasyminter}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C756E696F6E3E}{\isasymunion}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{22}{\isachardoublequote}}}, etc.), or any other theory developed in the library (lattice |
|
82 theory, topology etc.). |
|
83 |
|
84 Subsequently we briefly review fragments of Isar proof texts |
|
85 corresponding directly to such general deduction schemes. The |
|
86 examples shall refer to set-theory, to minimize the danger of |
|
87 understanding connectives of predicate logic as something special. |
|
88 |
|
89 \medskip The following deduction performs \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E7465723E}{\isasyminter}}{\isaliteral{22}{\isachardoublequote}}}-introduction, |
|
90 working forwards from assumptions towards the conclusion. We give |
|
91 both the Isar text, and depict the primitive rule involved, as |
|
92 determined by unification of the problem against rules that are |
|
93 declared in the library context.% |
|
94 \end{isamarkuptext}% |
|
95 \isamarkuptrue% |
|
96 % |
|
97 \medskip\begin{minipage}{0.6\textwidth} |
|
98 % |
|
99 \isadelimproof |
|
100 \ \ \ \ % |
|
101 \endisadelimproof |
|
102 % |
|
103 \isatagproof |
|
104 \isacommand{assume}\isamarkupfalse% |
|
105 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
106 \ \ \ \ \isacommand{then}\isamarkupfalse% |
|
107 \ \isacommand{have}\isamarkupfalse% |
|
108 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C696E7465723E}{\isasyminter}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}\isamarkupfalse% |
|
109 % |
|
110 \endisatagproof |
|
111 {\isafoldproof}% |
|
112 % |
|
113 \isadelimproof |
|
114 % |
|
115 \endisadelimproof |
|
116 % |
|
117 \end{minipage}\begin{minipage}{0.4\textwidth} |
|
118 % |
|
119 \begin{isamarkuptext}% |
|
120 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C696E7465723E}{\isasyminter}}\ B{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ B{\isaliteral{22}{\isachardoublequote}}}}% |
|
121 \end{isamarkuptext}% |
|
122 \isamarkuptrue% |
|
123 % |
|
124 \end{minipage} |
|
125 % |
|
126 \begin{isamarkuptext}% |
|
127 \medskip\noindent Note that \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} augments the proof |
|
128 context, \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} indicates that the current fact shall be |
|
129 used in the next step, and \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} states an intermediate |
|
130 goal. The two dots ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}'' refer to a complete proof of |
|
131 this claim, using the indicated facts and a canonical rule from the |
|
132 context. We could have been more explicit here by spelling out the |
|
133 final proof step via the \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}} command:% |
|
134 \end{isamarkuptext}% |
|
135 \isamarkuptrue% |
|
136 % |
|
137 \isadelimproof |
|
138 \ \ \ \ % |
|
139 \endisadelimproof |
|
140 % |
|
141 \isatagproof |
|
142 \isacommand{assume}\isamarkupfalse% |
|
143 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
144 \ \ \ \ \isacommand{then}\isamarkupfalse% |
|
145 \ \isacommand{have}\isamarkupfalse% |
|
146 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C696E7465723E}{\isasyminter}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{by}\isamarkupfalse% |
|
147 \ {\isaliteral{28}{\isacharparenleft}}rule\ IntI{\isaliteral{29}{\isacharparenright}}% |
|
148 \endisatagproof |
|
149 {\isafoldproof}% |
|
150 % |
|
151 \isadelimproof |
|
152 % |
|
153 \endisadelimproof |
|
154 % |
|
155 \begin{isamarkuptext}% |
|
156 \noindent The format of the \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E7465723E}{\isasyminter}}{\isaliteral{22}{\isachardoublequote}}}-introduction rule represents |
|
157 the most basic inference, which proceeds from given premises to a |
|
158 conclusion, without any nested proof context involved. |
|
159 |
|
160 The next example performs backwards introduction on \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}}, |
|
161 the intersection of all sets within a given set. This requires a |
|
162 nested proof of set membership within a local context, where \isa{A} is an arbitrary-but-fixed member of the collection:% |
|
163 \end{isamarkuptext}% |
|
164 \isamarkuptrue% |
|
165 % |
|
166 \medskip\begin{minipage}{0.6\textwidth} |
|
167 % |
|
168 \isadelimproof |
|
169 \ \ \ \ % |
|
170 \endisadelimproof |
|
171 % |
|
172 \isatagproof |
|
173 \isacommand{have}\isamarkupfalse% |
|
174 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
175 \ \ \ \ \isacommand{proof}\isamarkupfalse% |
|
176 \isanewline |
|
177 \ \ \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
178 \ A\isanewline |
|
179 \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
180 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
181 \ \ \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
182 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}% |
|
183 \endisatagproof |
|
184 {\isafoldproof}% |
|
185 % |
|
186 \isadelimproof |
|
187 % |
|
188 \endisadelimproof |
|
189 % |
|
190 \isadelimnoproof |
|
191 \ % |
|
192 \endisadelimnoproof |
|
193 % |
|
194 \isatagnoproof |
|
195 \isacommand{sorry}\isamarkupfalse% |
|
196 % |
|
197 \endisatagnoproof |
|
198 {\isafoldnoproof}% |
|
199 % |
|
200 \isadelimnoproof |
|
201 % |
|
202 \endisadelimnoproof |
|
203 \isanewline |
|
204 % |
|
205 \isadelimproof |
|
206 \ \ \ \ % |
|
207 \endisadelimproof |
|
208 % |
|
209 \isatagproof |
|
210 \isacommand{qed}\isamarkupfalse% |
|
211 % |
|
212 \endisatagproof |
|
213 {\isafoldproof}% |
|
214 % |
|
215 \isadelimproof |
|
216 % |
|
217 \endisadelimproof |
|
218 % |
|
219 \end{minipage}\begin{minipage}{0.4\textwidth} |
|
220 % |
|
221 \begin{isamarkuptext}% |
|
222 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}}}{\infer*{\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}A{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5B}{\isacharbrackleft}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}}}% |
|
223 \end{isamarkuptext}% |
|
224 \isamarkuptrue% |
|
225 % |
|
226 \end{minipage} |
|
227 % |
|
228 \begin{isamarkuptext}% |
|
229 \medskip\noindent This Isar reasoning pattern again refers to the |
|
230 primitive rule depicted above. The system determines it in the |
|
231 ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}'' step, which could have been spelt out more |
|
232 explicitly as ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}rule\ InterI{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}''. Note |
|
233 that the rule involves both a local parameter \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{22}{\isachardoublequote}}} and an |
|
234 assumption \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}} in the nested reasoning. This kind of |
|
235 compound rule typically demands a genuine sub-proof in Isar, working |
|
236 backwards rather than forwards as seen before. In the proof body we |
|
237 encounter the \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}-\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}-\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} |
|
238 outline of nested sub-proofs that is typical for Isar. The final |
|
239 \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} is like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} followed by an additional |
|
240 refinement of the enclosing claim, using the rule derived from the |
|
241 proof body. |
|
242 |
|
243 \medskip The next example involves \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}}, which can be |
|
244 characterized as the set of all \isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}} such that \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}A{\isaliteral{2E}{\isachardot}}\ x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}}. The elimination rule for \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}} does |
|
245 not mention \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616E643E}{\isasymand}}{\isaliteral{22}{\isachardoublequote}}} at all, but admits to obtain |
|
246 directly a local \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{22}{\isachardoublequote}}} such that \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}} hold. This corresponds to the following Isar proof and |
|
247 inference rule, respectively:% |
|
248 \end{isamarkuptext}% |
|
249 \isamarkuptrue% |
|
250 % |
|
251 \medskip\begin{minipage}{0.6\textwidth} |
|
252 % |
|
253 \isadelimproof |
|
254 \ \ \ \ % |
|
255 \endisadelimproof |
|
256 % |
|
257 \isatagproof |
|
258 \isacommand{assume}\isamarkupfalse% |
|
259 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
260 \ \ \ \ \isacommand{then}\isamarkupfalse% |
|
261 \ \isacommand{have}\isamarkupfalse% |
|
262 \ C\isanewline |
|
263 \ \ \ \ \isacommand{proof}\isamarkupfalse% |
|
264 \isanewline |
|
265 \ \ \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
266 \ A\isanewline |
|
267 \ \ \ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
268 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
269 \ \ \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
270 \ C% |
|
271 \endisatagproof |
|
272 {\isafoldproof}% |
|
273 % |
|
274 \isadelimproof |
|
275 % |
|
276 \endisadelimproof |
|
277 % |
|
278 \isadelimnoproof |
|
279 \ % |
|
280 \endisadelimnoproof |
|
281 % |
|
282 \isatagnoproof |
|
283 \isacommand{sorry}\isamarkupfalse% |
|
284 % |
|
285 \endisatagnoproof |
|
286 {\isafoldnoproof}% |
|
287 % |
|
288 \isadelimnoproof |
|
289 % |
|
290 \endisadelimnoproof |
|
291 \isanewline |
|
292 % |
|
293 \isadelimproof |
|
294 \ \ \ \ % |
|
295 \endisadelimproof |
|
296 % |
|
297 \isatagproof |
|
298 \isacommand{qed}\isamarkupfalse% |
|
299 % |
|
300 \endisatagproof |
|
301 {\isafoldproof}% |
|
302 % |
|
303 \isadelimproof |
|
304 % |
|
305 \endisadelimproof |
|
306 % |
|
307 \end{minipage}\begin{minipage}{0.4\textwidth} |
|
308 % |
|
309 \begin{isamarkuptext}% |
|
310 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}} & \infer*{\isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}}~}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}A{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5B}{\isacharbrackleft}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{2C}{\isacharcomma}}\ A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}}}% |
|
311 \end{isamarkuptext}% |
|
312 \isamarkuptrue% |
|
313 % |
|
314 \end{minipage} |
|
315 % |
|
316 \begin{isamarkuptext}% |
|
317 \medskip\noindent Although the Isar proof follows the natural |
|
318 deduction rule closely, the text reads not as natural as |
|
319 anticipated. There is a double occurrence of an arbitrary |
|
320 conclusion \isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}}, which represents the final result, but is |
|
321 irrelevant for now. This issue arises for any elimination rule |
|
322 involving local parameters. Isar provides the derived language |
|
323 element \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}, which is able to perform the same |
|
324 elimination proof more conveniently:% |
|
325 \end{isamarkuptext}% |
|
326 \isamarkuptrue% |
|
327 % |
|
328 \isadelimproof |
|
329 \ \ \ \ % |
|
330 \endisadelimproof |
|
331 % |
|
332 \isatagproof |
|
333 \isacommand{assume}\isamarkupfalse% |
|
334 \ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C556E696F6E3E}{\isasymUnion}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
335 \ \ \ \ \isacommand{then}\isamarkupfalse% |
|
336 \ \isacommand{obtain}\isamarkupfalse% |
|
337 \ A\ \isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}\isamarkupfalse% |
|
338 % |
|
339 \endisatagproof |
|
340 {\isafoldproof}% |
|
341 % |
|
342 \isadelimproof |
|
343 % |
|
344 \endisadelimproof |
|
345 % |
|
346 \begin{isamarkuptext}% |
|
347 \noindent Here we avoid to mention the final conclusion \isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}} |
|
348 and return to plain forward reasoning. The rule involved in the |
|
349 ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}'' proof is the same as before.% |
|
350 \end{isamarkuptext}% |
|
351 \isamarkuptrue% |
|
352 % |
|
353 \isamarkupsection{The Pure framework \label{sec:framework-pure}% |
|
354 } |
|
355 \isamarkuptrue% |
|
356 % |
|
357 \begin{isamarkuptext}% |
|
358 The Pure logic \cite{paulson-found,paulson700} is an intuitionistic |
|
359 fragment of higher-order logic \cite{church40}. In type-theoretic |
|
360 parlance, there are three levels of \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-calculus with |
|
361 corresponding arrows \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}{\isaliteral{22}{\isachardoublequote}}}/\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}}/\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}}: |
|
362 |
|
363 \medskip |
|
364 \begin{tabular}{ll} |
|
365 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{22}{\isachardoublequote}}} & syntactic function space (terms depending on terms) \\ |
|
366 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & universal quantification (proofs depending on terms) \\ |
|
367 \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}} & implication (proofs depending on proofs) \\ |
|
368 \end{tabular} |
|
369 \medskip |
|
370 |
|
371 \noindent Here only the types of syntactic terms, and the |
|
372 propositions of proof terms have been shown. The \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-structure of proofs can be recorded as an optional feature of |
|
373 the Pure inference kernel \cite{Berghofer-Nipkow:2000:TPHOL}, but |
|
374 the formal system can never depend on them due to \emph{proof |
|
375 irrelevance}. |
|
376 |
|
377 On top of this most primitive layer of proofs, Pure implements a |
|
378 generic calculus for nested natural deduction rules, similar to |
|
379 \cite{Schroeder-Heister:1984}. Here object-logic inferences are |
|
380 internalized as formulae over \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}}. |
|
381 Combining such rule statements may involve higher-order unification |
|
382 \cite{paulson-natural}.% |
|
383 \end{isamarkuptext}% |
|
384 \isamarkuptrue% |
|
385 % |
|
386 \isamarkupsubsection{Primitive inferences% |
|
387 } |
|
388 \isamarkuptrue% |
|
389 % |
|
390 \begin{isamarkuptext}% |
|
391 Term syntax provides explicit notation for abstraction \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} and application \isa{{\isaliteral{22}{\isachardoublequote}}b\ a{\isaliteral{22}{\isachardoublequote}}}, while types are usually |
|
392 implicit thanks to type-inference; terms of type \isa{{\isaliteral{22}{\isachardoublequote}}prop{\isaliteral{22}{\isachardoublequote}}} are |
|
393 called propositions. Logical statements are composed via \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{2E}{\isachardot}}\ B{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}}. Primitive reasoning operates on |
|
394 judgments of the form \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}{\isaliteral{22}{\isachardoublequote}}}, with standard introduction |
|
395 and elimination rules for \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} that refer to |
|
396 fixed parameters \isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub m{\isaliteral{22}{\isachardoublequote}}} and hypotheses |
|
397 \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}} from the context \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}{\isaliteral{22}{\isachardoublequote}}}; |
|
398 the corresponding proof terms are left implicit. The subsequent |
|
399 inference rules define \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}{\isaliteral{22}{\isachardoublequote}}} inductively, relative to a |
|
400 collection of axioms: |
|
401 |
|
402 \[ |
|
403 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A{\isaliteral{22}{\isachardoublequote}}}}{(\isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{22}{\isachardoublequote}}} \text{~axiom})} |
|
404 \qquad |
|
405 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A{\isaliteral{22}{\isachardoublequote}}}}{} |
|
406 \] |
|
407 |
|
408 \[ |
|
409 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C6E6F74696E3E}{\isasymnotin}}\ {\isaliteral{5C3C47616D6D613E}{\isasymGamma}}{\isaliteral{22}{\isachardoublequote}}}} |
|
410 \qquad |
|
411 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{28}{\isacharparenleft}}a{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}} |
|
412 \] |
|
413 |
|
414 \[ |
|
415 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{2D}{\isacharminus}}\ A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}}} |
|
416 \qquad |
|
417 \infer{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C756E696F6E3E}{\isasymunion}}\ {\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A{\isaliteral{22}{\isachardoublequote}}}} |
|
418 \] |
|
419 |
|
420 Furthermore, Pure provides a built-in equality \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ prop{\isaliteral{22}{\isachardoublequote}}} with axioms for reflexivity, substitution, extensionality, |
|
421 and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-conversion on \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms. |
|
422 |
|
423 \medskip An object-logic introduces another layer on top of Pure, |
|
424 e.g.\ with types \isa{{\isaliteral{22}{\isachardoublequote}}i{\isaliteral{22}{\isachardoublequote}}} for individuals and \isa{{\isaliteral{22}{\isachardoublequote}}o{\isaliteral{22}{\isachardoublequote}}} for |
|
425 propositions, term constants \isa{{\isaliteral{22}{\isachardoublequote}}Trueprop\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ o\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ prop{\isaliteral{22}{\isachardoublequote}}} as |
|
426 (implicit) derivability judgment and connectives like \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ o\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ o\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ o{\isaliteral{22}{\isachardoublequote}}} or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}i\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ o{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ o{\isaliteral{22}{\isachardoublequote}}}, and axioms for object-level |
|
427 rules such as \isa{{\isaliteral{22}{\isachardoublequote}}conjI{\isaliteral{3A}{\isacharcolon}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{22}{\isachardoublequote}}} or \isa{{\isaliteral{22}{\isachardoublequote}}allI{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B\ x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ B\ x{\isaliteral{22}{\isachardoublequote}}}. Derived object rules are represented as theorems of |
|
428 Pure. After the initial object-logic setup, further axiomatizations |
|
429 are usually avoided; plain definitions and derived principles are |
|
430 used exclusively.% |
|
431 \end{isamarkuptext}% |
|
432 \isamarkuptrue% |
|
433 % |
|
434 \isamarkupsubsection{Reasoning with rules \label{sec:framework-resolution}% |
|
435 } |
|
436 \isamarkuptrue% |
|
437 % |
|
438 \begin{isamarkuptext}% |
|
439 Primitive inferences mostly serve foundational purposes. The main |
|
440 reasoning mechanisms of Pure operate on nested natural deduction |
|
441 rules expressed as formulae, using \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}} to bind local |
|
442 parameters and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} to express entailment. Multiple |
|
443 parameters and premises are represented by repeating these |
|
444 connectives in a right-associative manner. |
|
445 |
|
446 Since \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} commute thanks to the theorem |
|
447 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, we may assume w.l.o.g.\ |
|
448 that rule statements always observe the normal form where |
|
449 quantifiers are pulled in front of implications at each level of |
|
450 nesting. This means that any Pure proposition may be presented as a |
|
451 \emph{Hereditary Harrop Formula} \cite{Miller:1991} which is of the |
|
452 form \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub m{\isaliteral{2E}{\isachardot}}\ H\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ H\isaliteral{5C3C5E697375623E}{}\isactrlisub n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{22}{\isachardoublequote}}} for \isa{{\isaliteral{22}{\isachardoublequote}}m{\isaliteral{2C}{\isacharcomma}}\ n\ {\isaliteral{5C3C67653E}{\isasymge}}\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}}, and \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{22}{\isachardoublequote}}} atomic, and \isa{{\isaliteral{22}{\isachardoublequote}}H\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ H\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}} being recursively of the same format. |
|
453 Following the convention that outermost quantifiers are implicit, |
|
454 Horn clauses \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{22}{\isachardoublequote}}} are a special |
|
455 case of this. |
|
456 |
|
457 For example, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E7465723E}{\isasyminter}}{\isaliteral{22}{\isachardoublequote}}}-introduction rule encountered before is |
|
458 represented as a Pure theorem as follows: |
|
459 \[ |
|
460 \isa{{\isaliteral{22}{\isachardoublequote}}IntI{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A\ {\isaliteral{5C3C696E7465723E}{\isasyminter}}\ B{\isaliteral{22}{\isachardoublequote}}} |
|
461 \] |
|
462 |
|
463 \noindent This is a plain Horn clause, since no further nesting on |
|
464 the left is involved. The general \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{22}{\isachardoublequote}}}-introduction |
|
465 corresponds to a Hereditary Harrop Formula with one additional level |
|
466 of nesting: |
|
467 \[ |
|
468 \isa{{\isaliteral{22}{\isachardoublequote}}InterI{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}A{\isaliteral{2E}{\isachardot}}\ A\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C413E}{\isasymA}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ A{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ {\isaliteral{5C3C496E7465723E}{\isasymInter}}{\isaliteral{5C3C413E}{\isasymA}}{\isaliteral{22}{\isachardoublequote}}} |
|
469 \] |
|
470 |
|
471 \medskip Goals are also represented as rules: \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub n\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{22}{\isachardoublequote}}} states that the sub-goals \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ A\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}} entail the result \isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}}; for \isa{{\isaliteral{22}{\isachardoublequote}}n\ {\isaliteral{3D}{\isacharequal}}\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}} the |
|
472 goal is finished. To allow \isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{22}{\isachardoublequote}}} being a rule statement |
|
473 itself, we introduce the protective marker \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ prop\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ prop{\isaliteral{22}{\isachardoublequote}}}, which is defined as identity and hidden from the user. We |
|
474 initialize and finish goal states as follows: |
|
475 |
|
476 \[ |
|
477 \begin{array}{c@ {\qquad}c} |
|
478 \infer[(\indexdef{}{inference}{init}\hypertarget{inference.init}{\hyperlink{inference.init}{\mbox{\isa{init}}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}C\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}C{\isaliteral{22}{\isachardoublequote}}}}{} & |
|
479 \infer[(\indexdef{}{inference}{finish}\hypertarget{inference.finish}{\hyperlink{inference.finish}{\mbox{\isa{finish}}}})]{\isa{C}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}C{\isaliteral{22}{\isachardoublequote}}}} |
|
480 \end{array} |
|
481 \] |
|
482 |
|
483 \noindent Goal states are refined in intermediate proof steps until |
|
484 a finished form is achieved. Here the two main reasoning principles |
|
485 are \hyperlink{inference.resolution}{\mbox{\isa{resolution}}}, for back-chaining a rule against a |
|
486 sub-goal (replacing it by zero or more sub-goals), and \hyperlink{inference.assumption}{\mbox{\isa{assumption}}}, for solving a sub-goal (finding a short-circuit with |
|
487 local assumptions). Below \isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{22}{\isachardoublequote}}} stands for \isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E697375623E}{}\isactrlisub n{\isaliteral{22}{\isachardoublequote}}} (\isa{{\isaliteral{22}{\isachardoublequote}}n\ {\isaliteral{5C3C67653E}{\isasymge}}\ {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}}). |
|
488 |
|
489 \[ |
|
490 \infer[(\indexdef{}{inference}{resolution}\hypertarget{inference.resolution}{\hyperlink{inference.resolution}{\mbox{\isa{resolution}}}})] |
|
491 {\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec H\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec a\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}}} |
|
492 {\begin{tabular}{rl} |
|
493 \isa{{\isaliteral{22}{\isachardoublequote}}rule{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
494 \isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec a\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ \isaliteral{5C3C5E7665633E}{}\isactrlvec a{\isaliteral{22}{\isachardoublequote}}} \\ |
|
495 \isa{{\isaliteral{22}{\isachardoublequote}}goal{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
496 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec H\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{27}{\isacharprime}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{22}{\isachardoublequote}}} \\ |
|
497 \isa{{\isaliteral{22}{\isachardoublequote}}goal\ unifier{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
498 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ B\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec a\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{3D}{\isacharequal}}\ B{\isaliteral{27}{\isacharprime}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
499 \end{tabular}} |
|
500 \] |
|
501 |
|
502 \medskip |
|
503 |
|
504 \[ |
|
505 \infer[(\indexdef{}{inference}{assumption}\hypertarget{inference.assumption}{\hyperlink{inference.assumption}{\mbox{\isa{assumption}}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}C{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}}} |
|
506 {\begin{tabular}{rl} |
|
507 \isa{{\isaliteral{22}{\isachardoublequote}}goal{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
508 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec H\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{22}{\isachardoublequote}}} \\ |
|
509 \isa{{\isaliteral{22}{\isachardoublequote}}assm\ unifier{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{3D}{\isacharequal}}\ H\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}}~~\text{(for some~\isa{{\isaliteral{22}{\isachardoublequote}}H\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}})} \\ |
|
510 \end{tabular}} |
|
511 \] |
|
512 |
|
513 The following trace illustrates goal-oriented reasoning in |
|
514 Isabelle/Pure: |
|
515 |
|
516 {\footnotesize |
|
517 \medskip |
|
518 \begin{tabular}{r@ {\quad}l} |
|
519 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ {\isaliteral{5C3C616E643E}{\isasymand}}\ A{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ {\isaliteral{5C3C616E643E}{\isasymand}}\ A{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}init{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
520 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}resolution\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ {\isaliteral{5C3C616E643E}{\isasymand}}\ A{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
521 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}resolution\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
522 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}assumption{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
523 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}resolution\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ A{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
524 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}assumption{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
525 \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ {\isaliteral{5C3C616E643E}{\isasymand}}\ A{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}finish{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
526 \end{tabular} |
|
527 \medskip |
|
528 } |
|
529 |
|
530 Compositions of \hyperlink{inference.assumption}{\mbox{\isa{assumption}}} after \hyperlink{inference.resolution}{\mbox{\isa{resolution}}} occurs quite often, typically in elimination steps. |
|
531 Traditional Isabelle tactics accommodate this by a combined |
|
532 \indexdef{}{inference}{elim\_resolution}\hypertarget{inference.elim-resolution}{\hyperlink{inference.elim-resolution}{\mbox{\isa{elim{\isaliteral{5F}{\isacharunderscore}}resolution}}}} principle. In contrast, Isar uses |
|
533 a slightly more refined combination, where the assumptions to be |
|
534 closed are marked explicitly, using again the protective marker |
|
535 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}{\isaliteral{22}{\isachardoublequote}}}: |
|
536 |
|
537 \[ |
|
538 \infer[(\hyperlink{inference.refinement}{\mbox{\isa{refinement}}})] |
|
539 {\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec H\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec G{\isaliteral{27}{\isacharprime}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec a\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}}} |
|
540 {\begin{tabular}{rl} |
|
541 \isa{{\isaliteral{22}{\isachardoublequote}}sub{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}proof{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
542 \isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec G\ \isaliteral{5C3C5E7665633E}{}\isactrlvec a\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ \isaliteral{5C3C5E7665633E}{}\isactrlvec a{\isaliteral{22}{\isachardoublequote}}} \\ |
|
543 \isa{{\isaliteral{22}{\isachardoublequote}}goal{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
544 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec H\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{27}{\isacharprime}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C{\isaliteral{22}{\isachardoublequote}}} \\ |
|
545 \isa{{\isaliteral{22}{\isachardoublequote}}goal\ unifier{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
546 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ B\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec a\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{3D}{\isacharequal}}\ B{\isaliteral{27}{\isacharprime}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
547 \isa{{\isaliteral{22}{\isachardoublequote}}assm\ unifiers{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
548 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ G\isaliteral{5C3C5E7375623E}{}\isactrlsub j\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec a\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{23}{\isacharhash}}H\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{5C3C76617274686574613E}{\isasymvartheta}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
549 & \quad (for each marked \isa{{\isaliteral{22}{\isachardoublequote}}G\isaliteral{5C3C5E7375623E}{}\isactrlsub j{\isaliteral{22}{\isachardoublequote}}} some \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}H\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}}) \\ |
|
550 \end{tabular}} |
|
551 \] |
|
552 |
|
553 \noindent Here the \isa{{\isaliteral{22}{\isachardoublequote}}sub{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}proof{\isaliteral{22}{\isachardoublequote}}} rule stems from the |
|
554 main \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}-\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}-\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} outline of |
|
555 Isar (cf.\ \secref{sec:framework-subproof}): each assumption |
|
556 indicated in the text results in a marked premise \isa{{\isaliteral{22}{\isachardoublequote}}G{\isaliteral{22}{\isachardoublequote}}} above. |
|
557 The marking enforces resolution against one of the sub-goal's |
|
558 premises. Consequently, \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}-\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}-\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} enables to fit the result of a sub-proof quite robustly into a |
|
559 pending sub-goal, while maintaining a good measure of flexibility.% |
|
560 \end{isamarkuptext}% |
|
561 \isamarkuptrue% |
|
562 % |
|
563 \isamarkupsection{The Isar proof language \label{sec:framework-isar}% |
|
564 } |
|
565 \isamarkuptrue% |
|
566 % |
|
567 \begin{isamarkuptext}% |
|
568 Structured proofs are presented as high-level expressions for |
|
569 composing entities of Pure (propositions, facts, and goals). The |
|
570 Isar proof language allows to organize reasoning within the |
|
571 underlying rule calculus of Pure, but Isar is not another logical |
|
572 calculus! |
|
573 |
|
574 Isar is an exercise in sound minimalism. Approximately half of the |
|
575 language is introduced as primitive, the rest defined as derived |
|
576 concepts. The following grammar describes the core language |
|
577 (category \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{22}{\isachardoublequote}}}), which is embedded into theory |
|
578 specification elements such as \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}; see also |
|
579 \secref{sec:framework-stmt} for the separate category \isa{{\isaliteral{22}{\isachardoublequote}}statement{\isaliteral{22}{\isachardoublequote}}}. |
|
580 |
|
581 \medskip |
|
582 \begin{tabular}{rcl} |
|
583 \isa{{\isaliteral{22}{\isachardoublequote}}theory{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}stmt{\isaliteral{22}{\isachardoublequote}}} & = & \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}statement\ proof\ \ {\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}}~~\hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\[1ex] |
|
584 |
|
585 \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{22}{\isachardoublequote}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}prfx\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}method\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{3F}{\isacharquery}}\ stmt\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}method\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{3F}{\isacharquery}}{\isaliteral{22}{\isachardoublequote}}} \\[1ex] |
|
586 |
|
587 \isa{prfx} & = & \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}facts{\isaliteral{22}{\isachardoublequote}}} \\ |
|
588 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}facts{\isaliteral{22}{\isachardoublequote}}} \\ |
|
589 |
|
590 \isa{stmt} & = & \hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isaliteral{7B}{\isacharbraceleft}}}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}stmt\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isaliteral{7D}{\isacharbraceright}}}}}} \\ |
|
591 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}} \\ |
|
592 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{3D}{\isacharequal}}\ facts{\isaliteral{22}{\isachardoublequote}}} \\ |
|
593 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}term\ {\isaliteral{3D}{\isacharequal}}\ term{\isaliteral{22}{\isachardoublequote}}} \\ |
|
594 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}var\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2B}{\isacharplus}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
595 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}inference{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}\ name{\isaliteral{3A}{\isacharcolon}}\ props{\isaliteral{22}{\isachardoublequote}}} \\ |
|
596 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{3F}{\isacharquery}}{\isaliteral{22}{\isachardoublequote}}}~\isa{goal} \\ |
|
597 \isa{goal} & = & \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name{\isaliteral{3A}{\isacharcolon}}\ props\ proof{\isaliteral{22}{\isachardoublequote}}} \\ |
|
598 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name{\isaliteral{3A}{\isacharcolon}}\ props\ proof{\isaliteral{22}{\isachardoublequote}}} \\ |
|
599 \end{tabular} |
|
600 |
|
601 \medskip Simultaneous propositions or facts may be separated by the |
|
602 \hyperlink{keyword.and}{\mbox{\isa{\isakeyword{and}}}} keyword. |
|
603 |
|
604 \medskip The syntax for terms and propositions is inherited from |
|
605 Pure (and the object-logic). A \isa{{\isaliteral{22}{\isachardoublequote}}pattern{\isaliteral{22}{\isachardoublequote}}} is a \isa{{\isaliteral{22}{\isachardoublequote}}term{\isaliteral{22}{\isachardoublequote}}} with schematic variables, to be bound by higher-order |
|
606 matching. |
|
607 |
|
608 \medskip Facts may be referenced by name or proposition. For |
|
609 example, the result of ``\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{3A}{\isacharcolon}}\ A\ {\isaliteral{5C3C6C616E676C653E}{\isasymlangle}}proof{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}{\isaliteral{22}{\isachardoublequote}}}'' |
|
610 becomes available both as \isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{22}{\isachardoublequote}}} and |
|
611 \isacharbackquoteopen\isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{22}{\isachardoublequote}}}\isacharbackquoteclose. Moreover, |
|
612 fact expressions may involve attributes that modify either the |
|
613 theorem or the background context. For example, the expression |
|
614 ``\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{5B}{\isacharbrackleft}}OF\ b{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}'' refers to the composition of two facts |
|
615 according to the \hyperlink{inference.resolution}{\mbox{\isa{resolution}}} inference of |
|
616 \secref{sec:framework-resolution}, while ``\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{5B}{\isacharbrackleft}}intro{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}'' |
|
617 declares a fact as introduction rule in the context. |
|
618 |
|
619 The special fact called ``\hyperlink{fact.this}{\mbox{\isa{this}}}'' always refers to the last |
|
620 result, as produced by \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}, \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, or \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}. Since \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}} occurs |
|
621 frequently together with \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} we provide some |
|
622 abbreviations: |
|
623 |
|
624 \medskip |
|
625 \begin{tabular}{rcl} |
|
626 \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{a} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{a}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} \\ |
|
627 \hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}}~\isa{a} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ this{\isaliteral{22}{\isachardoublequote}}} \\ |
|
628 \end{tabular} |
|
629 \medskip |
|
630 |
|
631 The \isa{{\isaliteral{22}{\isachardoublequote}}method{\isaliteral{22}{\isachardoublequote}}} category is essentially a parameter and may be |
|
632 populated later. Methods use the facts indicated by \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} or \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}, and then operate on the goal state. |
|
633 Some basic methods are predefined: ``\hyperlink{method.-}{\mbox{\isa{{\isaliteral{2D}{\isacharminus}}}}}'' leaves the goal |
|
634 unchanged, ``\hyperlink{method.this}{\mbox{\isa{this}}}'' applies the facts as rules to the |
|
635 goal, ``\hyperlink{method.Pure.rule}{\mbox{\isa{rule}}}'' applies the facts to another rule and the |
|
636 result to the goal (both ``\hyperlink{method.this}{\mbox{\isa{this}}}'' and ``\hyperlink{method.Pure.rule}{\mbox{\isa{rule}}}'' |
|
637 refer to \hyperlink{inference.resolution}{\mbox{\isa{resolution}}} of |
|
638 \secref{sec:framework-resolution}). The secondary arguments to |
|
639 ``\hyperlink{method.Pure.rule}{\mbox{\isa{rule}}}'' may be specified explicitly as in ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}rule\ a{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}'', or picked from the context. In the latter case, the system |
|
640 first tries rules declared as \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}} or |
|
641 \hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}, followed by those declared as \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}. |
|
642 |
|
643 The default method for \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} is ``\hyperlink{method.Pure.rule}{\mbox{\isa{rule}}}'' |
|
644 (arguments picked from the context), for \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} it is |
|
645 ``\hyperlink{method.-}{\mbox{\isa{{\isaliteral{2D}{\isacharminus}}}}}''. Further abbreviations for terminal proof steps |
|
646 are ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}method\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ method\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}}'' for |
|
647 ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}method\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}method\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}}'', and ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}'' for ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\hyperlink{method.Pure.rule}{\mbox{\isa{rule}}}, and ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}}}}}'' for ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\hyperlink{method.this}{\mbox{\isa{this}}}''. The \hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}} element operates |
|
648 directly on the current facts and goal by applying equalities. |
|
649 |
|
650 \medskip Block structure can be indicated explicitly by ``\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isaliteral{7B}{\isacharbraceleft}}}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isaliteral{7D}{\isacharbraceright}}}}}}'', although the body of a sub-proof |
|
651 already involves implicit nesting. In any case, \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}} |
|
652 jumps into the next section of a block, i.e.\ it acts like closing |
|
653 an implicit block scope and opening another one; there is no direct |
|
654 correspondence to subgoals here. |
|
655 |
|
656 The remaining elements \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}} and \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} build up |
|
657 a local context (see \secref{sec:framework-context}), while |
|
658 \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} refines a pending sub-goal by the rule resulting |
|
659 from a nested sub-proof (see \secref{sec:framework-subproof}). |
|
660 Further derived concepts will support calculational reasoning (see |
|
661 \secref{sec:framework-calc}).% |
|
662 \end{isamarkuptext}% |
|
663 \isamarkuptrue% |
|
664 % |
|
665 \isamarkupsubsection{Context elements \label{sec:framework-context}% |
|
666 } |
|
667 \isamarkuptrue% |
|
668 % |
|
669 \begin{isamarkuptext}% |
|
670 In judgments \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}{\isaliteral{22}{\isachardoublequote}}} of the primitive framework, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}{\isaliteral{22}{\isachardoublequote}}} |
|
671 essentially acts like a proof context. Isar elaborates this idea |
|
672 towards a higher-level notion, with additional information for |
|
673 type-inference, term abbreviations, local facts, hypotheses etc. |
|
674 |
|
675 The element \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{22}{\isachardoublequote}}} declares a local |
|
676 parameter, i.e.\ an arbitrary-but-fixed entity of a given type; in |
|
677 results exported from the context, \isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}} may become anything. |
|
678 The \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}inference{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}{\isaliteral{22}{\isachardoublequote}}} element provides a |
|
679 general interface to hypotheses: ``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}inference{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}\ A{\isaliteral{22}{\isachardoublequote}}}'' produces \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A{\isaliteral{22}{\isachardoublequote}}} locally, while the |
|
680 included inference tells how to discharge \isa{A} from results |
|
681 \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}} later on. There is no user-syntax for \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}inference{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}{\isaliteral{22}{\isachardoublequote}}}, i.e.\ it may only occur internally when derived |
|
682 commands are defined in ML. |
|
683 |
|
684 At the user-level, the default inference for \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} is |
|
685 \hyperlink{inference.discharge}{\mbox{\isa{discharge}}} as given below. The additional variants |
|
686 \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} and \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} are defined as follows: |
|
687 |
|
688 \medskip |
|
689 \begin{tabular}{rcl} |
|
690 \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}~\isa{A} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}weak{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}discharge{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}\ A{\isaliteral{22}{\isachardoublequote}}} \\ |
|
691 \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ a{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}expansion{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}\ x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ a{\isaliteral{22}{\isachardoublequote}}} \\ |
|
692 \end{tabular} |
|
693 \medskip |
|
694 |
|
695 \[ |
|
696 \infer[(\indexdef{}{inference}{discharge}\hypertarget{inference.discharge}{\hyperlink{inference.discharge}{\mbox{\isa{discharge}}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{2D}{\isacharminus}}\ A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{23}{\isacharhash}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}}} |
|
697 \] |
|
698 \[ |
|
699 \infer[(\indexdef{}{inference}{weak-discharge}\hypertarget{inference.weak-discharge}{\hyperlink{inference.weak-discharge}{\mbox{\isa{weak{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}discharge}}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{2D}{\isacharminus}}\ A\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}}} |
|
700 \] |
|
701 \[ |
|
702 \infer[(\indexdef{}{inference}{expansion}\hypertarget{inference.expansion}{\hyperlink{inference.expansion}{\mbox{\isa{expansion}}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{2D}{\isacharminus}}\ {\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ a{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B\ a{\isaliteral{22}{\isachardoublequote}}}}{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73747275743E}{\isasymstrut}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B\ x{\isaliteral{22}{\isachardoublequote}}}} |
|
703 \] |
|
704 |
|
705 \medskip Note that \hyperlink{inference.discharge}{\mbox{\isa{discharge}}} and \hyperlink{inference.weak-discharge}{\mbox{\isa{weak{\isaliteral{5C3C68797068656E3E}{\isasymhyphen}}discharge}}} differ in the marker for \isa{A}, which is |
|
706 relevant when the result of a \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}-\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}-\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} outline is composed with a pending goal, |
|
707 cf.\ \secref{sec:framework-subproof}. |
|
708 |
|
709 The most interesting derived context element in Isar is \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} \cite[\S5.3]{Wenzel-PhD}, which supports generalized |
|
710 elimination steps in a purely forward manner. The \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} |
|
711 command takes a specification of parameters \isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{22}{\isachardoublequote}}} and |
|
712 assumptions \isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec A{\isaliteral{22}{\isachardoublequote}}} to be added to the context, together |
|
713 with a proof of a case rule stating that this extension is |
|
714 conservative (i.e.\ may be removed from closed results later on): |
|
715 |
|
716 \medskip |
|
717 \begin{tabular}{l} |
|
718 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616E676C653E}{\isasymlangle}}facts{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}{\isaliteral{22}{\isachardoublequote}}}~~\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ \ {\isaliteral{5C3C6C616E676C653E}{\isasymlangle}}proof{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} \\[0.5ex] |
|
719 \quad \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}case{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}thesis{\isaliteral{2E}{\isachardot}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
720 \quad \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\hyperlink{method.-}{\mbox{\isa{{\isaliteral{2D}{\isacharminus}}}}} \\ |
|
721 \qquad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{thesis} \\ |
|
722 \qquad \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}intro{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{22}{\isachardoublequote}}} \\ |
|
723 \qquad \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{thesis}~\hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616E676C653E}{\isasymlangle}}facts{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}\ {\isaliteral{5C3C6C616E676C653E}{\isasymlangle}}proof{\isaliteral{5C3C72616E676C653E}{\isasymrangle}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
724 \quad \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} \\ |
|
725 \quad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6775696C6C656D6F746C6566743E}{\isasymguillemotleft}}elimination\ case{\isaliteral{5C3C6775696C6C656D6F7472696768743E}{\isasymguillemotright}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{22}{\isachardoublequote}}} \\ |
|
726 \end{tabular} |
|
727 \medskip |
|
728 |
|
729 \[ |
|
730 \infer[(\hyperlink{inference.elimination}{\mbox{\isa{elimination}}})]{\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}}}{ |
|
731 \begin{tabular}{rl} |
|
732 \isa{{\isaliteral{22}{\isachardoublequote}}case{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
733 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}thesis{\isaliteral{2E}{\isachardot}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{22}{\isachardoublequote}}} \\[0.2ex] |
|
734 \isa{{\isaliteral{22}{\isachardoublequote}}result{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}} & |
|
735 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C47616D6D613E}{\isasymGamma}}\ {\isaliteral{5C3C756E696F6E3E}{\isasymunion}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec y\ {\isaliteral{5C3C7475726E7374696C653E}{\isasymturnstile}}\ B{\isaliteral{22}{\isachardoublequote}}} \\[0.2ex] |
|
736 \end{tabular}} |
|
737 \] |
|
738 |
|
739 \noindent Here the name ``\isa{thesis}'' is a specific convention |
|
740 for an arbitrary-but-fixed proposition; in the primitive natural |
|
741 deduction rules shown before we have occasionally used \isa{C}. |
|
742 The whole statement of ``\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}~\isa{x}~\hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}A\ x{\isaliteral{22}{\isachardoublequote}}}'' may be read as a claim that \isa{{\isaliteral{22}{\isachardoublequote}}A\ x{\isaliteral{22}{\isachardoublequote}}} |
|
743 may be assumed for some arbitrary-but-fixed \isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}}. Also note |
|
744 that ``\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ B{\isaliteral{22}{\isachardoublequote}}}'' without parameters |
|
745 is similar to ``\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ B{\isaliteral{22}{\isachardoublequote}}}'', but the |
|
746 latter involves multiple sub-goals. |
|
747 |
|
748 \medskip The subsequent Isar proof texts explain all context |
|
749 elements introduced above using the formal proof language itself. |
|
750 After finishing a local proof within a block, we indicate the |
|
751 exported result via \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}.% |
|
752 \end{isamarkuptext}% |
|
753 \isamarkuptrue% |
|
754 % |
|
755 \isadelimproof |
|
756 % |
|
757 \endisadelimproof |
|
758 % |
|
759 \isatagproof |
|
760 % |
|
761 \begin{minipage}[t]{0.45\textwidth} |
|
762 \ \ \isacommand{{\isaliteral{7B}{\isacharbraceleft}}}\isamarkupfalse% |
|
763 \isanewline |
|
764 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
765 \ x\isanewline |
|
766 \ \ \ \ \isacommand{have}\isamarkupfalse% |
|
767 \ {\isaliteral{22}{\isachardoublequoteopen}}B\ x{\isaliteral{22}{\isachardoublequoteclose}}% |
|
768 \endisatagproof |
|
769 {\isafoldproof}% |
|
770 % |
|
771 \isadelimproof |
|
772 % |
|
773 \endisadelimproof |
|
774 % |
|
775 \isadelimnoproof |
|
776 \ % |
|
777 \endisadelimnoproof |
|
778 % |
|
779 \isatagnoproof |
|
780 \isacommand{sorry}\isamarkupfalse% |
|
781 % |
|
782 \endisatagnoproof |
|
783 {\isafoldnoproof}% |
|
784 % |
|
785 \isadelimnoproof |
|
786 \isanewline |
|
787 % |
|
788 \endisadelimnoproof |
|
789 % |
|
790 \isadelimproof |
|
791 \ \ % |
|
792 \endisadelimproof |
|
793 % |
|
794 \isatagproof |
|
795 \isacommand{{\isaliteral{7D}{\isacharbraceright}}}\isamarkupfalse% |
|
796 \isanewline |
|
797 \ \ \isacommand{note}\isamarkupfalse% |
|
798 \ {\isaliteral{60}{\isacharbackquoteopen}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ B\ x{\isaliteral{60}{\isacharbackquoteclose}}% |
|
799 \end{minipage}\quad\begin{minipage}[t]{0.45\textwidth} |
|
800 \ \ \isacommand{{\isaliteral{7B}{\isacharbraceleft}}}\isamarkupfalse% |
|
801 \isanewline |
|
802 \ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
803 \ A\isanewline |
|
804 \ \ \ \ \isacommand{have}\isamarkupfalse% |
|
805 \ B% |
|
806 \endisatagproof |
|
807 {\isafoldproof}% |
|
808 % |
|
809 \isadelimproof |
|
810 % |
|
811 \endisadelimproof |
|
812 % |
|
813 \isadelimnoproof |
|
814 \ % |
|
815 \endisadelimnoproof |
|
816 % |
|
817 \isatagnoproof |
|
818 \isacommand{sorry}\isamarkupfalse% |
|
819 % |
|
820 \endisatagnoproof |
|
821 {\isafoldnoproof}% |
|
822 % |
|
823 \isadelimnoproof |
|
824 \isanewline |
|
825 % |
|
826 \endisadelimnoproof |
|
827 % |
|
828 \isadelimproof |
|
829 \ \ % |
|
830 \endisadelimproof |
|
831 % |
|
832 \isatagproof |
|
833 \isacommand{{\isaliteral{7D}{\isacharbraceright}}}\isamarkupfalse% |
|
834 \isanewline |
|
835 \ \ \isacommand{note}\isamarkupfalse% |
|
836 \ {\isaliteral{60}{\isacharbackquoteopen}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{60}{\isacharbackquoteclose}}% |
|
837 \end{minipage}\\[3ex]\begin{minipage}[t]{0.45\textwidth} |
|
838 \ \ \isacommand{{\isaliteral{7B}{\isacharbraceleft}}}\isamarkupfalse% |
|
839 \isanewline |
|
840 \ \ \ \ \isacommand{def}\isamarkupfalse% |
|
841 \ x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ a\isanewline |
|
842 \ \ \ \ \isacommand{have}\isamarkupfalse% |
|
843 \ {\isaliteral{22}{\isachardoublequoteopen}}B\ x{\isaliteral{22}{\isachardoublequoteclose}}% |
|
844 \endisatagproof |
|
845 {\isafoldproof}% |
|
846 % |
|
847 \isadelimproof |
|
848 % |
|
849 \endisadelimproof |
|
850 % |
|
851 \isadelimnoproof |
|
852 \ % |
|
853 \endisadelimnoproof |
|
854 % |
|
855 \isatagnoproof |
|
856 \isacommand{sorry}\isamarkupfalse% |
|
857 % |
|
858 \endisatagnoproof |
|
859 {\isafoldnoproof}% |
|
860 % |
|
861 \isadelimnoproof |
|
862 \isanewline |
|
863 % |
|
864 \endisadelimnoproof |
|
865 % |
|
866 \isadelimproof |
|
867 \ \ % |
|
868 \endisadelimproof |
|
869 % |
|
870 \isatagproof |
|
871 \isacommand{{\isaliteral{7D}{\isacharbraceright}}}\isamarkupfalse% |
|
872 \isanewline |
|
873 \ \ \isacommand{note}\isamarkupfalse% |
|
874 \ {\isaliteral{60}{\isacharbackquoteopen}}B\ a{\isaliteral{60}{\isacharbackquoteclose}}% |
|
875 \end{minipage}\quad\begin{minipage}[t]{0.45\textwidth} |
|
876 \ \ \isacommand{{\isaliteral{7B}{\isacharbraceleft}}}\isamarkupfalse% |
|
877 \isanewline |
|
878 \ \ \ \ \isacommand{obtain}\isamarkupfalse% |
|
879 \ x\ \isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}% |
|
880 \endisatagproof |
|
881 {\isafoldproof}% |
|
882 % |
|
883 \isadelimproof |
|
884 % |
|
885 \endisadelimproof |
|
886 % |
|
887 \isadelimnoproof |
|
888 \ % |
|
889 \endisadelimnoproof |
|
890 % |
|
891 \isatagnoproof |
|
892 \isacommand{sorry}\isamarkupfalse% |
|
893 % |
|
894 \endisatagnoproof |
|
895 {\isafoldnoproof}% |
|
896 % |
|
897 \isadelimnoproof |
|
898 \isanewline |
|
899 % |
|
900 \endisadelimnoproof |
|
901 % |
|
902 \isadelimproof |
|
903 \ \ \ \ % |
|
904 \endisadelimproof |
|
905 % |
|
906 \isatagproof |
|
907 \isacommand{have}\isamarkupfalse% |
|
908 \ B% |
|
909 \endisatagproof |
|
910 {\isafoldproof}% |
|
911 % |
|
912 \isadelimproof |
|
913 % |
|
914 \endisadelimproof |
|
915 % |
|
916 \isadelimnoproof |
|
917 \ % |
|
918 \endisadelimnoproof |
|
919 % |
|
920 \isatagnoproof |
|
921 \isacommand{sorry}\isamarkupfalse% |
|
922 % |
|
923 \endisatagnoproof |
|
924 {\isafoldnoproof}% |
|
925 % |
|
926 \isadelimnoproof |
|
927 \isanewline |
|
928 % |
|
929 \endisadelimnoproof |
|
930 % |
|
931 \isadelimproof |
|
932 \ \ % |
|
933 \endisadelimproof |
|
934 % |
|
935 \isatagproof |
|
936 \isacommand{{\isaliteral{7D}{\isacharbraceright}}}\isamarkupfalse% |
|
937 \isanewline |
|
938 \ \ \isacommand{note}\isamarkupfalse% |
|
939 \ {\isaliteral{60}{\isacharbackquoteopen}}B{\isaliteral{60}{\isacharbackquoteclose}}% |
|
940 \end{minipage} |
|
941 % |
|
942 \endisatagproof |
|
943 {\isafoldproof}% |
|
944 % |
|
945 \isadelimproof |
|
946 % |
|
947 \endisadelimproof |
|
948 % |
|
949 \begin{isamarkuptext}% |
|
950 \bigskip\noindent This illustrates the meaning of Isar context |
|
951 elements without goals getting in between.% |
|
952 \end{isamarkuptext}% |
|
953 \isamarkuptrue% |
|
954 % |
|
955 \isamarkupsubsection{Structured statements \label{sec:framework-stmt}% |
|
956 } |
|
957 \isamarkuptrue% |
|
958 % |
|
959 \begin{isamarkuptext}% |
|
960 The category \isa{{\isaliteral{22}{\isachardoublequote}}statement{\isaliteral{22}{\isachardoublequote}}} of top-level theorem specifications |
|
961 is defined as follows: |
|
962 |
|
963 \medskip |
|
964 \begin{tabular}{rcl} |
|
965 \isa{{\isaliteral{22}{\isachardoublequote}}statement{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}name{\isaliteral{3A}{\isacharcolon}}\ props\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
966 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}context\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}\ conclusion{\isaliteral{22}{\isachardoublequote}}} \\[0.5ex] |
|
967 |
|
968 \isa{{\isaliteral{22}{\isachardoublequote}}context{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C46495845533E}{\isasymFIXES}}\ vars\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
969 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C415353554D45533E}{\isasymASSUMES}}\ name{\isaliteral{3A}{\isacharcolon}}\ props\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
970 |
|
971 \isa{{\isaliteral{22}{\isachardoublequote}}conclusion{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C53484F57533E}{\isasymSHOWS}}\ name{\isaliteral{3A}{\isacharcolon}}\ props\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
972 & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4F425441494E533E}{\isasymOBTAINS}}\ vars\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ name{\isaliteral{3A}{\isacharcolon}}\ props\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
973 & & \quad \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C424241523E}{\isasymBBAR}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
974 \end{tabular} |
|
975 |
|
976 \medskip\noindent A simple \isa{{\isaliteral{22}{\isachardoublequote}}statement{\isaliteral{22}{\isachardoublequote}}} consists of named |
|
977 propositions. The full form admits local context elements followed |
|
978 by the actual conclusions, such as ``\hyperlink{keyword.fixes}{\mbox{\isa{\isakeyword{fixes}}}}~\isa{x}~\hyperlink{keyword.assumes}{\mbox{\isa{\isakeyword{assumes}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}A\ x{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{keyword.shows}{\mbox{\isa{\isakeyword{shows}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}B\ x{\isaliteral{22}{\isachardoublequote}}}''. The final result emerges as a Pure rule after discharging |
|
979 the context: \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ x{\isaliteral{22}{\isachardoublequote}}}. |
|
980 |
|
981 The \hyperlink{keyword.obtains}{\mbox{\isa{\isakeyword{obtains}}}} variant is another abbreviation defined |
|
982 below; unlike \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} (cf.\ |
|
983 \secref{sec:framework-context}) there may be several ``cases'' |
|
984 separated by ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C424241523E}{\isasymBBAR}}{\isaliteral{22}{\isachardoublequote}}}'', each consisting of several |
|
985 parameters (\isa{{\isaliteral{22}{\isachardoublequote}}vars{\isaliteral{22}{\isachardoublequote}}}) and several premises (\isa{{\isaliteral{22}{\isachardoublequote}}props{\isaliteral{22}{\isachardoublequote}}}). |
|
986 This specifies multi-branch elimination rules. |
|
987 |
|
988 \medskip |
|
989 \begin{tabular}{l} |
|
990 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4F425441494E533E}{\isasymOBTAINS}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ \ \ {\isaliteral{5C3C424241523E}{\isasymBBAR}}\ \ \ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ \ \ {\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} \\[0.5ex] |
|
991 \quad \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C46495845533E}{\isasymFIXES}}\ thesis{\isaliteral{22}{\isachardoublequote}}} \\ |
|
992 \quad \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C415353554D45533E}{\isasymASSUMES}}\ {\isaliteral{5B}{\isacharbrackleft}}intro{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C416E643E}{\isasymAnd}}\isaliteral{5C3C5E7665633E}{}\isactrlvec x{\isaliteral{2E}{\isachardot}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec A\ \isaliteral{5C3C5E7665633E}{}\isactrlvec x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis\ \ {\isaliteral{5C3C414E443E}{\isasymAND}}\ \ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
993 \quad \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C53484F57533E}{\isasymSHOWS}}\ thesis{\isaliteral{22}{\isachardoublequote}}} \\ |
|
994 \end{tabular} |
|
995 \medskip |
|
996 |
|
997 Presenting structured statements in such an ``open'' format usually |
|
998 simplifies the subsequent proof, because the outer structure of the |
|
999 problem is already laid out directly. E.g.\ consider the following |
|
1000 canonical patterns for \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C53484F57533E}{\isasymSHOWS}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4F425441494E533E}{\isasymOBTAINS}}{\isaliteral{22}{\isachardoublequote}}}, |
|
1001 respectively:% |
|
1002 \end{isamarkuptext}% |
|
1003 \isamarkuptrue% |
|
1004 % |
|
1005 \begin{minipage}{0.5\textwidth} |
|
1006 \isacommand{theorem}\isamarkupfalse% |
|
1007 \isanewline |
|
1008 \ \ \isakeyword{fixes}\ x\ \isakeyword{and}\ y\isanewline |
|
1009 \ \ \isakeyword{assumes}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1010 \ \ \isakeyword{shows}\ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1011 % |
|
1012 \isadelimproof |
|
1013 % |
|
1014 \endisadelimproof |
|
1015 % |
|
1016 \isatagproof |
|
1017 \isacommand{proof}\isamarkupfalse% |
|
1018 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1019 \ \ \isacommand{from}\isamarkupfalse% |
|
1020 \ {\isaliteral{60}{\isacharbackquoteopen}}A\ x{\isaliteral{60}{\isacharbackquoteclose}}\ \isakeyword{and}\ {\isaliteral{60}{\isacharbackquoteopen}}B\ y{\isaliteral{60}{\isacharbackquoteclose}}\isanewline |
|
1021 \ \ \isacommand{show}\isamarkupfalse% |
|
1022 \ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}% |
|
1023 \endisatagproof |
|
1024 {\isafoldproof}% |
|
1025 % |
|
1026 \isadelimproof |
|
1027 % |
|
1028 \endisadelimproof |
|
1029 % |
|
1030 \isadelimnoproof |
|
1031 \ % |
|
1032 \endisadelimnoproof |
|
1033 % |
|
1034 \isatagnoproof |
|
1035 \isacommand{sorry}\isamarkupfalse% |
|
1036 % |
|
1037 \endisatagnoproof |
|
1038 {\isafoldnoproof}% |
|
1039 % |
|
1040 \isadelimnoproof |
|
1041 \isanewline |
|
1042 % |
|
1043 \endisadelimnoproof |
|
1044 % |
|
1045 \isadelimproof |
|
1046 % |
|
1047 \endisadelimproof |
|
1048 % |
|
1049 \isatagproof |
|
1050 \isacommand{qed}\isamarkupfalse% |
|
1051 % |
|
1052 \endisatagproof |
|
1053 {\isafoldproof}% |
|
1054 % |
|
1055 \isadelimproof |
|
1056 % |
|
1057 \endisadelimproof |
|
1058 % |
|
1059 \end{minipage}\begin{minipage}{0.5\textwidth} |
|
1060 \isacommand{theorem}\isamarkupfalse% |
|
1061 \isanewline |
|
1062 \ \ \isakeyword{obtains}\ x\ \isakeyword{and}\ y\isanewline |
|
1063 \ \ \isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1064 % |
|
1065 \isadelimproof |
|
1066 % |
|
1067 \endisadelimproof |
|
1068 % |
|
1069 \isatagproof |
|
1070 \isacommand{proof}\isamarkupfalse% |
|
1071 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1072 \ \ \isacommand{have}\isamarkupfalse% |
|
1073 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ a{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}B\ b{\isaliteral{22}{\isachardoublequoteclose}}% |
|
1074 \endisatagproof |
|
1075 {\isafoldproof}% |
|
1076 % |
|
1077 \isadelimproof |
|
1078 % |
|
1079 \endisadelimproof |
|
1080 % |
|
1081 \isadelimnoproof |
|
1082 \ % |
|
1083 \endisadelimnoproof |
|
1084 % |
|
1085 \isatagnoproof |
|
1086 \isacommand{sorry}\isamarkupfalse% |
|
1087 % |
|
1088 \endisatagnoproof |
|
1089 {\isafoldnoproof}% |
|
1090 % |
|
1091 \isadelimnoproof |
|
1092 \isanewline |
|
1093 % |
|
1094 \endisadelimnoproof |
|
1095 % |
|
1096 \isadelimproof |
|
1097 \ \ % |
|
1098 \endisadelimproof |
|
1099 % |
|
1100 \isatagproof |
|
1101 \isacommand{then}\isamarkupfalse% |
|
1102 \ \isacommand{show}\isamarkupfalse% |
|
1103 \ thesis\ \isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}\isamarkupfalse% |
|
1104 \isanewline |
|
1105 \isacommand{qed}\isamarkupfalse% |
|
1106 % |
|
1107 \endisatagproof |
|
1108 {\isafoldproof}% |
|
1109 % |
|
1110 \isadelimproof |
|
1111 % |
|
1112 \endisadelimproof |
|
1113 % |
|
1114 \end{minipage} |
|
1115 % |
|
1116 \begin{isamarkuptext}% |
|
1117 \medskip\noindent Here local facts \isacharbackquoteopen\isa{{\isaliteral{22}{\isachardoublequote}}A\ x{\isaliteral{22}{\isachardoublequote}}}\isacharbackquoteclose\ and \isacharbackquoteopen\isa{{\isaliteral{22}{\isachardoublequote}}B\ y{\isaliteral{22}{\isachardoublequote}}}\isacharbackquoteclose\ are referenced immediately; there is no |
|
1118 need to decompose the logical rule structure again. In the second |
|
1119 proof the final ``\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{thesis}~\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}'' involves the local rule case \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ y{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ thesis{\isaliteral{22}{\isachardoublequote}}} for the particular instance of terms \isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}b{\isaliteral{22}{\isachardoublequote}}} produced in the body.% |
|
1120 \end{isamarkuptext}% |
|
1121 \isamarkuptrue% |
|
1122 % |
|
1123 \isamarkupsubsection{Structured proof refinement \label{sec:framework-subproof}% |
|
1124 } |
|
1125 \isamarkuptrue% |
|
1126 % |
|
1127 \begin{isamarkuptext}% |
|
1128 By breaking up the grammar for the Isar proof language, we may |
|
1129 understand a proof text as a linear sequence of individual proof |
|
1130 commands. These are interpreted as transitions of the Isar virtual |
|
1131 machine (Isar/VM), which operates on a block-structured |
|
1132 configuration in single steps. This allows users to write proof |
|
1133 texts in an incremental manner, and inspect intermediate |
|
1134 configurations for debugging. |
|
1135 |
|
1136 The basic idea is analogous to evaluating algebraic expressions on a |
|
1137 stack machine: \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}a\ {\isaliteral{2B}{\isacharplus}}\ b{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C63646F743E}{\isasymcdot}}\ c{\isaliteral{22}{\isachardoublequote}}} then corresponds to a sequence |
|
1138 of single transitions for each symbol \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{2C}{\isacharcomma}}\ a{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{2B}{\isacharplus}}{\isaliteral{2C}{\isacharcomma}}\ b{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{29}{\isacharparenright}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C63646F743E}{\isasymcdot}}{\isaliteral{2C}{\isacharcomma}}\ c{\isaliteral{22}{\isachardoublequote}}}. |
|
1139 In Isar the algebraic values are facts or goals, and the operations |
|
1140 are inferences. |
|
1141 |
|
1142 \medskip The Isar/VM state maintains a stack of nodes, each node |
|
1143 contains the local proof context, the linguistic mode, and a pending |
|
1144 goal (optional). The mode determines the type of transition that |
|
1145 may be performed next, it essentially alternates between forward and |
|
1146 backward reasoning, with an intermediate stage for chained facts |
|
1147 (see \figref{fig:isar-vm}). |
|
1148 |
|
1149 \begin{figure}[htb] |
|
1150 \begin{center} |
|
1151 \includegraphics[width=0.8\textwidth]{Thy/document/isar-vm} |
|
1152 \end{center} |
|
1153 \caption{Isar/VM modes}\label{fig:isar-vm} |
|
1154 \end{figure} |
|
1155 |
|
1156 For example, in \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} mode Isar acts like a mathematical |
|
1157 scratch-pad, accepting declarations like \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}, \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, and claims like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}. A goal |
|
1158 statement changes the mode to \isa{{\isaliteral{22}{\isachardoublequote}}prove{\isaliteral{22}{\isachardoublequote}}}, which means that we |
|
1159 may now refine the problem via \hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}} or \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}. Then we are again in \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} mode of a proof body, |
|
1160 which may issue \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} statements to solve pending |
|
1161 sub-goals. A concluding \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} will return to the original |
|
1162 \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} mode one level upwards. The subsequent Isar/VM |
|
1163 trace indicates block structure, linguistic mode, goal state, and |
|
1164 inferences:% |
|
1165 \end{isamarkuptext}% |
|
1166 \isamarkuptrue% |
|
1167 % |
|
1168 \begingroup\footnotesize |
|
1169 % |
|
1170 \isadelimproof |
|
1171 % |
|
1172 \endisadelimproof |
|
1173 % |
|
1174 \isatagproof |
|
1175 % |
|
1176 \begin{minipage}[t]{0.18\textwidth} |
|
1177 \ \ \isacommand{have}\isamarkupfalse% |
|
1178 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1179 \ \ \isacommand{proof}\isamarkupfalse% |
|
1180 \isanewline |
|
1181 \ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
1182 \ A\isanewline |
|
1183 \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
1184 \ B% |
|
1185 \endisatagproof |
|
1186 {\isafoldproof}% |
|
1187 % |
|
1188 \isadelimproof |
|
1189 % |
|
1190 \endisadelimproof |
|
1191 \isanewline |
|
1192 % |
|
1193 \isadelimnoproof |
|
1194 \ \ \ \ \ \ % |
|
1195 \endisadelimnoproof |
|
1196 % |
|
1197 \isatagnoproof |
|
1198 \isacommand{sorry}\isamarkupfalse% |
|
1199 % |
|
1200 \endisatagnoproof |
|
1201 {\isafoldnoproof}% |
|
1202 % |
|
1203 \isadelimnoproof |
|
1204 % |
|
1205 \endisadelimnoproof |
|
1206 \isanewline |
|
1207 % |
|
1208 \isadelimproof |
|
1209 \ \ % |
|
1210 \endisadelimproof |
|
1211 % |
|
1212 \isatagproof |
|
1213 \isacommand{qed}\isamarkupfalse% |
|
1214 % |
|
1215 \end{minipage}\quad |
|
1216 \begin{minipage}[t]{0.06\textwidth} |
|
1217 \isa{{\isaliteral{22}{\isachardoublequote}}begin{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1218 \\ |
|
1219 \\ |
|
1220 \isa{{\isaliteral{22}{\isachardoublequote}}begin{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1221 \isa{{\isaliteral{22}{\isachardoublequote}}end{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1222 \isa{{\isaliteral{22}{\isachardoublequote}}end{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1223 \end{minipage} |
|
1224 \begin{minipage}[t]{0.08\textwidth} |
|
1225 \isa{{\isaliteral{22}{\isachardoublequote}}prove{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1226 \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1227 \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1228 \isa{{\isaliteral{22}{\isachardoublequote}}prove{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1229 \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1230 \isa{{\isaliteral{22}{\isachardoublequote}}state{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1231 \end{minipage}\begin{minipage}[t]{0.35\textwidth} |
|
1232 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1233 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{23}{\isacharhash}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1234 \\ |
|
1235 \\ |
|
1236 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{23}{\isacharhash}}{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1237 \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1238 \end{minipage}\begin{minipage}[t]{0.4\textwidth} |
|
1239 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}init{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1240 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}resolution\ impI{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1241 \\ |
|
1242 \\ |
|
1243 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}refinement\ {\isaliteral{23}{\isacharhash}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1244 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}finish{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1245 \end{minipage} |
|
1246 % |
|
1247 \endisatagproof |
|
1248 {\isafoldproof}% |
|
1249 % |
|
1250 \isadelimproof |
|
1251 % |
|
1252 \endisadelimproof |
|
1253 % |
|
1254 \endgroup |
|
1255 % |
|
1256 \begin{isamarkuptext}% |
|
1257 \noindent Here the \hyperlink{inference.refinement}{\mbox{\isa{refinement}}} inference from |
|
1258 \secref{sec:framework-resolution} mediates composition of Isar |
|
1259 sub-proofs nicely. Observe that this principle incorporates some |
|
1260 degree of freedom in proof composition. In particular, the proof |
|
1261 body allows parameters and assumptions to be re-ordered, or commuted |
|
1262 according to Hereditary Harrop Form. Moreover, context elements |
|
1263 that are not used in a sub-proof may be omitted altogether. For |
|
1264 example:% |
|
1265 \end{isamarkuptext}% |
|
1266 \isamarkuptrue% |
|
1267 % |
|
1268 \begin{minipage}{0.5\textwidth} |
|
1269 % |
|
1270 \isadelimproof |
|
1271 \ \ % |
|
1272 \endisadelimproof |
|
1273 % |
|
1274 \isatagproof |
|
1275 \isacommand{have}\isamarkupfalse% |
|
1276 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ y{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1277 \ \ \isacommand{proof}\isamarkupfalse% |
|
1278 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1279 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1280 \ x\ \isakeyword{and}\ y\isanewline |
|
1281 \ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
1282 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}\ \isakeyword{and}\ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1283 \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
1284 \ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}% |
|
1285 \endisatagproof |
|
1286 {\isafoldproof}% |
|
1287 % |
|
1288 \isadelimproof |
|
1289 % |
|
1290 \endisadelimproof |
|
1291 % |
|
1292 \isadelimnoproof |
|
1293 \ % |
|
1294 \endisadelimnoproof |
|
1295 % |
|
1296 \isatagnoproof |
|
1297 \isacommand{sorry}\isamarkupfalse% |
|
1298 % |
|
1299 \endisatagnoproof |
|
1300 {\isafoldnoproof}% |
|
1301 % |
|
1302 \isadelimnoproof |
|
1303 % |
|
1304 \endisadelimnoproof |
|
1305 \isanewline |
|
1306 % |
|
1307 \isadelimproof |
|
1308 \ \ % |
|
1309 \endisadelimproof |
|
1310 % |
|
1311 \isatagproof |
|
1312 \isacommand{qed}\isamarkupfalse% |
|
1313 % |
|
1314 \end{minipage}\begin{minipage}{0.5\textwidth} |
|
1315 \ \ \isacommand{have}\isamarkupfalse% |
|
1316 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ y{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1317 \ \ \isacommand{proof}\isamarkupfalse% |
|
1318 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1319 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1320 \ x\ \isacommand{assume}\isamarkupfalse% |
|
1321 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1322 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1323 \ y\ \isacommand{assume}\isamarkupfalse% |
|
1324 \ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1325 \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
1326 \ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}% |
|
1327 \endisatagproof |
|
1328 {\isafoldproof}% |
|
1329 % |
|
1330 \isadelimproof |
|
1331 % |
|
1332 \endisadelimproof |
|
1333 % |
|
1334 \isadelimnoproof |
|
1335 \ % |
|
1336 \endisadelimnoproof |
|
1337 % |
|
1338 \isatagnoproof |
|
1339 \isacommand{sorry}\isamarkupfalse% |
|
1340 % |
|
1341 \endisatagnoproof |
|
1342 {\isafoldnoproof}% |
|
1343 % |
|
1344 \isadelimnoproof |
|
1345 % |
|
1346 \endisadelimnoproof |
|
1347 \isanewline |
|
1348 % |
|
1349 \isadelimproof |
|
1350 \ \ % |
|
1351 \endisadelimproof |
|
1352 % |
|
1353 \isatagproof |
|
1354 \isacommand{qed}\isamarkupfalse% |
|
1355 % |
|
1356 \end{minipage}\\[3ex]\begin{minipage}{0.5\textwidth} |
|
1357 \ \ \isacommand{have}\isamarkupfalse% |
|
1358 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ y{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1359 \ \ \isacommand{proof}\isamarkupfalse% |
|
1360 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1361 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1362 \ y\ \isacommand{assume}\isamarkupfalse% |
|
1363 \ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1364 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1365 \ x\ \isacommand{assume}\isamarkupfalse% |
|
1366 \ {\isaliteral{22}{\isachardoublequoteopen}}A\ x{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1367 \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
1368 \ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{sorry}\isamarkupfalse% |
|
1369 \isanewline |
|
1370 \ \ \isacommand{qed}\isamarkupfalse% |
|
1371 % |
|
1372 \end{minipage}\begin{minipage}{0.5\textwidth} |
|
1373 \ \ \isacommand{have}\isamarkupfalse% |
|
1374 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C416E643E}{\isasymAnd}}x\ y{\isaliteral{2E}{\isachardot}}\ A\ x\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1375 \ \ \isacommand{proof}\isamarkupfalse% |
|
1376 \ {\isaliteral{2D}{\isacharminus}}\isanewline |
|
1377 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1378 \ y\ \isacommand{assume}\isamarkupfalse% |
|
1379 \ {\isaliteral{22}{\isachardoublequoteopen}}B\ y{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
1380 \ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
1381 \ x\isanewline |
|
1382 \ \ \ \ \isacommand{show}\isamarkupfalse% |
|
1383 \ {\isaliteral{22}{\isachardoublequoteopen}}C\ x\ y{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{sorry}\isamarkupfalse% |
|
1384 \isanewline |
|
1385 \ \ \isacommand{qed}\isamarkupfalse% |
|
1386 % |
|
1387 \endisatagproof |
|
1388 {\isafoldproof}% |
|
1389 % |
|
1390 \isadelimproof |
|
1391 % |
|
1392 \endisadelimproof |
|
1393 % |
|
1394 \end{minipage} |
|
1395 % |
|
1396 \begin{isamarkuptext}% |
|
1397 \medskip\noindent Such ``peephole optimizations'' of Isar texts are |
|
1398 practically important to improve readability, by rearranging |
|
1399 contexts elements according to the natural flow of reasoning in the |
|
1400 body, while still observing the overall scoping rules. |
|
1401 |
|
1402 \medskip This illustrates the basic idea of structured proof |
|
1403 processing in Isar. The main mechanisms are based on natural |
|
1404 deduction rule composition within the Pure framework. In |
|
1405 particular, there are no direct operations on goal states within the |
|
1406 proof body. Moreover, there is no hidden automated reasoning |
|
1407 involved, just plain unification.% |
|
1408 \end{isamarkuptext}% |
|
1409 \isamarkuptrue% |
|
1410 % |
|
1411 \isamarkupsubsection{Calculational reasoning \label{sec:framework-calc}% |
|
1412 } |
|
1413 \isamarkuptrue% |
|
1414 % |
|
1415 \begin{isamarkuptext}% |
|
1416 The existing Isar infrastructure is sufficiently flexible to support |
|
1417 calculational reasoning (chains of transitivity steps) as derived |
|
1418 concept. The generic proof elements introduced below depend on |
|
1419 rules declared as \hyperlink{attribute.trans}{\mbox{\isa{trans}}} in the context. It is left to |
|
1420 the object-logic to provide a suitable rule collection for mixed |
|
1421 relations of \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3C}{\isacharless}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C653E}{\isasymle}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7375627365743E}{\isasymsubset}}{\isaliteral{22}{\isachardoublequote}}}, |
|
1422 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}{\isaliteral{22}{\isachardoublequote}}} etc. Due to the flexibility of rule composition |
|
1423 (\secref{sec:framework-resolution}), substitution of equals by |
|
1424 equals is covered as well, even substitution of inequalities |
|
1425 involving monotonicity conditions; see also \cite[\S6]{Wenzel-PhD} |
|
1426 and \cite{Bauer-Wenzel:2001}. |
|
1427 |
|
1428 The generic calculational mechanism is based on the observation that |
|
1429 rules such as \isa{{\isaliteral{22}{\isachardoublequote}}trans{\isaliteral{3A}{\isacharcolon}}{\isaliteral{22}{\isachardoublequote}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3D}{\isacharequal}}\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ y\ {\isaliteral{3D}{\isacharequal}}\ z\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ x\ {\isaliteral{3D}{\isacharequal}}\ z{\isaliteral{22}{\isachardoublequote}}} |
|
1430 proceed from the premises towards the conclusion in a deterministic |
|
1431 fashion. Thus we may reason in forward mode, feeding intermediate |
|
1432 results into rules selected from the context. The course of |
|
1433 reasoning is organized by maintaining a secondary fact called |
|
1434 ``\hyperlink{fact.calculation}{\mbox{\isa{calculation}}}'', apart from the primary ``\hyperlink{fact.this}{\mbox{\isa{this}}}'' |
|
1435 already provided by the Isar primitives. In the definitions below, |
|
1436 \hyperlink{attribute.OF}{\mbox{\isa{OF}}} refers to \hyperlink{inference.resolution}{\mbox{\isa{resolution}}} |
|
1437 (\secref{sec:framework-resolution}) with multiple rule arguments, |
|
1438 and \isa{{\isaliteral{22}{\isachardoublequote}}trans{\isaliteral{22}{\isachardoublequote}}} represents to a suitable rule from the context: |
|
1439 |
|
1440 \begin{matharray}{rcl} |
|
1441 \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{0}}{\isaliteral{22}{\isachardoublequote}}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}calculation\ {\isaliteral{3D}{\isacharequal}}\ this{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1442 \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isaliteral{2B}{\isacharplus}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}calculation\ {\isaliteral{3D}{\isacharequal}}\ trans\ {\isaliteral{5B}{\isacharbrackleft}}OF\ calculation\ this{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} \\[0.5ex] |
|
1443 \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} & \equiv & \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{calculation} \\ |
|
1444 \end{matharray} |
|
1445 |
|
1446 \noindent The start of a calculation is determined implicitly in the |
|
1447 text: here \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} sets \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} to the current |
|
1448 result; any subsequent occurrence will update \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by |
|
1449 combination with the next result and a transitivity rule. The |
|
1450 calculational sequence is concluded via \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}, where |
|
1451 the final result is exposed for use in a concluding claim. |
|
1452 |
|
1453 Here is a canonical proof pattern, using \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} to |
|
1454 establish the intermediate results:% |
|
1455 \end{isamarkuptext}% |
|
1456 \isamarkuptrue% |
|
1457 % |
|
1458 \isadelimproof |
|
1459 \ \ % |
|
1460 \endisadelimproof |
|
1461 % |
|
1462 \isatagproof |
|
1463 \isacommand{have}\isamarkupfalse% |
|
1464 \ {\isaliteral{22}{\isachardoublequoteopen}}a\ {\isaliteral{3D}{\isacharequal}}\ b{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{sorry}\isamarkupfalse% |
|
1465 \isanewline |
|
1466 \ \ \isacommand{also}\isamarkupfalse% |
|
1467 \ \isacommand{have}\isamarkupfalse% |
|
1468 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{3D}{\isacharequal}}\ c{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{sorry}\isamarkupfalse% |
|
1469 \isanewline |
|
1470 \ \ \isacommand{also}\isamarkupfalse% |
|
1471 \ \isacommand{have}\isamarkupfalse% |
|
1472 \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{3D}{\isacharequal}}\ d{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{sorry}\isamarkupfalse% |
|
1473 \isanewline |
|
1474 \ \ \isacommand{finally}\isamarkupfalse% |
|
1475 \ \isacommand{have}\isamarkupfalse% |
|
1476 \ {\isaliteral{22}{\isachardoublequoteopen}}a\ {\isaliteral{3D}{\isacharequal}}\ d{\isaliteral{22}{\isachardoublequoteclose}}\ \isacommand{{\isaliteral{2E}{\isachardot}}}\isamarkupfalse% |
|
1477 % |
|
1478 \endisatagproof |
|
1479 {\isafoldproof}% |
|
1480 % |
|
1481 \isadelimproof |
|
1482 % |
|
1483 \endisadelimproof |
|
1484 % |
|
1485 \begin{isamarkuptext}% |
|
1486 \noindent The term ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}}'' above is a special abbreviation |
|
1487 provided by the Isabelle/Isar syntax layer: it statically refers to |
|
1488 the right-hand side argument of the previous statement given in the |
|
1489 text. Thus it happens to coincide with relevant sub-expressions in |
|
1490 the calculational chain, but the exact correspondence is dependent |
|
1491 on the transitivity rules being involved. |
|
1492 |
|
1493 \medskip Symmetry rules such as \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3D}{\isacharequal}}\ y\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ y\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequote}}} are like |
|
1494 transitivities with only one premise. Isar maintains a separate |
|
1495 rule collection declared via the \hyperlink{attribute.sym}{\mbox{\isa{sym}}} attribute, to be |
|
1496 used in fact expressions ``\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{5B}{\isacharbrackleft}}symmetric{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}'', or single-step |
|
1497 proofs ``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3D}{\isacharequal}}\ y{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}y\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequote}}}~\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}''.% |
|
1498 \end{isamarkuptext}% |
|
1499 \isamarkuptrue% |
|
1500 % |
|
1501 \isadelimtheory |
|
1502 % |
|
1503 \endisadelimtheory |
|
1504 % |
|
1505 \isatagtheory |
|
1506 \isacommand{end}\isamarkupfalse% |
|
1507 % |
|
1508 \endisatagtheory |
|
1509 {\isafoldtheory}% |
|
1510 % |
|
1511 \isadelimtheory |
|
1512 % |
|
1513 \endisadelimtheory |
|
1514 \end{isabellebody}% |
|
1515 %%% Local Variables: |
|
1516 %%% mode: latex |
|
1517 %%% TeX-master: "root" |
|
1518 %%% End: |
|