author | wenzelm |
Wed, 10 Dec 2008 22:05:58 +0100 | |
changeset 29055 | edaef19665e6 |
parent 28857 | 87d638a4ee67 |
child 29731 | efcbbd7baa02 |
child 30240 | 5b25fee0362c |
permissions | -rw-r--r-- |
26869 | 1 |
% |
2 |
\begin{isabellebody}% |
|
3 |
\def\isabellecontext{Proof}% |
|
4 |
% |
|
5 |
\isadelimtheory |
|
6 |
\isanewline |
|
7 |
\isanewline |
|
8 |
% |
|
9 |
\endisadelimtheory |
|
10 |
% |
|
11 |
\isatagtheory |
|
12 |
\isacommand{theory}\isamarkupfalse% |
|
13 |
\ Proof\isanewline |
|
14 |
\isakeyword{imports}\ Main\isanewline |
|
15 |
\isakeyword{begin}% |
|
16 |
\endisatagtheory |
|
17 |
{\isafoldtheory}% |
|
18 |
% |
|
19 |
\isadelimtheory |
|
20 |
% |
|
21 |
\endisadelimtheory |
|
22 |
% |
|
23 |
\isamarkupchapter{Proofs% |
|
24 |
} |
|
25 |
\isamarkuptrue% |
|
26 |
% |
|
26870 | 27 |
\begin{isamarkuptext}% |
28 |
Proof commands perform transitions of Isar/VM machine |
|
29 |
configurations, which are block-structured, consisting of a stack of |
|
30 |
nodes with three main components: logical proof context, current |
|
31 |
facts, and open goals. Isar/VM transitions are \emph{typed} |
|
32 |
according to the following three different modes of operation: |
|
33 |
||
28788 | 34 |
\begin{description} |
26870 | 35 |
|
28788 | 36 |
\item \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} means that a new goal has just been |
26870 | 37 |
stated that is now to be \emph{proven}; the next command may refine |
38 |
it by some proof method, and enter a sub-proof to establish the |
|
39 |
actual result. |
|
40 |
||
28788 | 41 |
\item \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} is like a nested theory mode: the |
26870 | 42 |
context may be augmented by \emph{stating} additional assumptions, |
43 |
intermediate results etc. |
|
44 |
||
28788 | 45 |
\item \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} is intermediate between \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} and \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}: existing facts (i.e.\ |
26902 | 46 |
the contents of the special ``\indexref{}{fact}{this}\hyperlink{fact.this}{\mbox{\isa{this}}}'' register) have been |
26870 | 47 |
just picked up in order to be used when refining the goal claimed |
48 |
next. |
|
49 |
||
28788 | 50 |
\end{description} |
26870 | 51 |
|
52 |
The proof mode indicator may be read as a verb telling the writer |
|
53 |
what kind of operation may be performed next. The corresponding |
|
54 |
typings of proof commands restricts the shape of well-formed proof |
|
55 |
texts to particular command sequences. So dynamic arrangements of |
|
56 |
commands eventually turn out as static texts of a certain structure. |
|
57 |
\Appref{ap:refcard} gives a simplified grammar of the overall |
|
58 |
(extensible) language emerging that way.% |
|
59 |
\end{isamarkuptext}% |
|
60 |
\isamarkuptrue% |
|
61 |
% |
|
28788 | 62 |
\isamarkupsection{Proof structure% |
63 |
} |
|
64 |
\isamarkuptrue% |
|
65 |
% |
|
66 |
\isamarkupsubsection{Blocks% |
|
26870 | 67 |
} |
68 |
\isamarkuptrue% |
|
69 |
% |
|
70 |
\begin{isamarkuptext}% |
|
71 |
\begin{matharray}{rcl} |
|
28788 | 72 |
\indexdef{}{command}{next}\hypertarget{command.next}{\hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
73 |
\indexdef{}{command}{\{}\hypertarget{command.braceleft}{\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
74 |
\indexdef{}{command}{\}}\hypertarget{command.braceright}{\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
75 |
\end{matharray} |
|
76 |
||
77 |
While Isar is inherently block-structured, opening and closing |
|
78 |
blocks is mostly handled rather casually, with little explicit |
|
79 |
user-intervention. Any local goal statement automatically opens |
|
80 |
\emph{two} internal blocks, which are closed again when concluding |
|
81 |
the sub-proof (by \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} etc.). Sections of different |
|
82 |
context within a sub-proof may be switched via \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}}, |
|
83 |
which is just a single block-close followed by block-open again. |
|
84 |
The effect of \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}} is to reset the local proof context; |
|
85 |
there is no goal focus involved here! |
|
86 |
||
87 |
For slightly more advanced applications, there are explicit block |
|
88 |
parentheses as well. These typically achieve a stronger forward |
|
89 |
style of reasoning. |
|
90 |
||
91 |
\begin{description} |
|
92 |
||
93 |
\item \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}} switches to a fresh block within a |
|
94 |
sub-proof, resetting the local context to the initial one. |
|
95 |
||
96 |
\item \hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}} and \hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}} explicitly open and close |
|
97 |
blocks. Any current facts pass through ``\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}}'' |
|
98 |
unchanged, while ``\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}}'' causes any result to be |
|
99 |
\emph{exported} into the enclosing context. Thus fixed variables |
|
100 |
are generalized, assumptions discharged, and local definitions |
|
101 |
unfolded (cf.\ \secref{sec:proof-context}). There is no difference |
|
102 |
of \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} and \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} in this mode of |
|
103 |
forward reasoning --- in contrast to plain backward reasoning with |
|
104 |
the result exported at \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} time. |
|
105 |
||
106 |
\end{description}% |
|
107 |
\end{isamarkuptext}% |
|
108 |
\isamarkuptrue% |
|
109 |
% |
|
110 |
\isamarkupsubsection{Omitting proofs% |
|
111 |
} |
|
112 |
\isamarkuptrue% |
|
113 |
% |
|
114 |
\begin{isamarkuptext}% |
|
115 |
\begin{matharray}{rcl} |
|
116 |
\indexdef{}{command}{oops}\hypertarget{command.oops}{\hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}}} & : & \isa{{\isachardoublequote}proof\ {\isasymrightarrow}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
117 |
\end{matharray} |
|
118 |
||
119 |
The \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} command discontinues the current proof |
|
120 |
attempt, while considering the partial proof text as properly |
|
121 |
processed. This is conceptually quite different from ``faking'' |
|
122 |
actual proofs via \indexref{}{command}{sorry}\hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}} (see |
|
123 |
\secref{sec:proof-steps}): \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} does not observe the |
|
124 |
proof structure at all, but goes back right to the theory level. |
|
125 |
Furthermore, \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} does not produce any result theorem |
|
126 |
--- there is no intended claim to be able to complete the proof |
|
127 |
anyhow. |
|
128 |
||
129 |
A typical application of \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} is to explain Isar proofs |
|
130 |
\emph{within} the system itself, in conjunction with the document |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
28788
diff
changeset
|
131 |
preparation tools of Isabelle described in \chref{ch:document-prep}. |
28788 | 132 |
Thus partial or even wrong proof attempts can be discussed in a |
133 |
logically sound manner. Note that the Isabelle {\LaTeX} macros can |
|
134 |
be easily adapted to print something like ``\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}'' instead of |
|
135 |
the keyword ``\hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}}''. |
|
136 |
||
137 |
\medskip The \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} command is undo-able, unlike |
|
138 |
\indexref{}{command}{kill}\hyperlink{command.kill}{\mbox{\isa{\isacommand{kill}}}} (see \secref{sec:history}). The effect is to |
|
139 |
get back to the theory just before the opening of the proof.% |
|
140 |
\end{isamarkuptext}% |
|
141 |
\isamarkuptrue% |
|
142 |
% |
|
143 |
\isamarkupsection{Statements% |
|
144 |
} |
|
145 |
\isamarkuptrue% |
|
146 |
% |
|
147 |
\isamarkupsubsection{Context elements \label{sec:proof-context}% |
|
148 |
} |
|
149 |
\isamarkuptrue% |
|
150 |
% |
|
151 |
\begin{isamarkuptext}% |
|
152 |
\begin{matharray}{rcl} |
|
153 |
\indexdef{}{command}{fix}\hypertarget{command.fix}{\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
154 |
\indexdef{}{command}{assume}\hypertarget{command.assume}{\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
155 |
\indexdef{}{command}{presume}\hypertarget{command.presume}{\hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
156 |
\indexdef{}{command}{def}\hypertarget{command.def}{\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
26870 | 157 |
\end{matharray} |
158 |
||
159 |
The logical proof context consists of fixed variables and |
|
160 |
assumptions. The former closely correspond to Skolem constants, or |
|
161 |
meta-level universal quantification as provided by the Isabelle/Pure |
|
162 |
logical framework. Introducing some \emph{arbitrary, but fixed} |
|
26902 | 163 |
variable via ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}'' results in a local value |
26870 | 164 |
that may be used in the subsequent proof as any other variable or |
165 |
constant. Furthermore, any result \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} exported from |
|
166 |
the context will be universally closed wrt.\ \isa{x} at the |
|
167 |
outermost level: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymAnd}x{\isachardot}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} (this is expressed in normal |
|
168 |
form using Isabelle's meta-variables). |
|
169 |
||
170 |
Similarly, introducing some assumption \isa{{\isasymchi}} has two effects. |
|
171 |
On the one hand, a local theorem is created that may be used as a |
|
172 |
fact in subsequent proof steps. On the other hand, any result |
|
173 |
\isa{{\isachardoublequote}{\isasymchi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} exported from the context becomes conditional wrt.\ |
|
174 |
the assumption: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymchi}\ {\isasymLongrightarrow}\ {\isasymphi}{\isachardoublequote}}. Thus, solving an enclosing goal |
|
175 |
using such a result would basically introduce a new subgoal stemming |
|
176 |
from the assumption. How this situation is handled depends on the |
|
26902 | 177 |
version of assumption command used: while \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} |
26870 | 178 |
insists on solving the subgoal by unification with some premise of |
26902 | 179 |
the goal, \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} leaves the subgoal unchanged in order |
26870 | 180 |
to be proved later by the user. |
181 |
||
26902 | 182 |
Local definitions, introduced by ``\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', are achieved by combining ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}'' with |
26870 | 183 |
another version of assumption that causes any hypothetical equation |
184 |
\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}} to be eliminated by the reflexivity rule. Thus, |
|
185 |
exporting some result \isa{{\isachardoublequote}x\ {\isasymequiv}\ t\ {\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} yields \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}t{\isacharbrackright}{\isachardoublequote}}. |
|
186 |
||
187 |
\begin{rail} |
|
188 |
'fix' (vars + 'and') |
|
189 |
; |
|
190 |
('assume' | 'presume') (props + 'and') |
|
191 |
; |
|
192 |
'def' (def + 'and') |
|
193 |
; |
|
194 |
def: thmdecl? \\ name ('==' | equiv) term termpat? |
|
195 |
; |
|
196 |
\end{rail} |
|
197 |
||
28788 | 198 |
\begin{description} |
26870 | 199 |
|
28788 | 200 |
\item \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x} introduces a local variable \isa{x} that is \emph{arbitrary, but fixed.} |
26870 | 201 |
|
28788 | 202 |
\item \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} introduce a local fact \isa{{\isachardoublequote}{\isasymphi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} by |
26870 | 203 |
assumption. Subsequent results applied to an enclosing goal (e.g.\ |
26902 | 204 |
by \indexref{}{command}{show}\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}) are handled as follows: \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} expects to be able to unify with existing premises in the |
205 |
goal, while \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} leaves \isa{{\isasymphi}} as new subgoals. |
|
26870 | 206 |
|
207 |
Several lists of assumptions may be given (separated by |
|
26902 | 208 |
\indexref{}{keyword}{and}\hyperlink{keyword.and}{\mbox{\isa{\isakeyword{and}}}}; the resulting list of current facts consists |
26870 | 209 |
of all of these concatenated. |
210 |
||
28788 | 211 |
\item \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}} introduces a local |
26870 | 212 |
(non-polymorphic) definition. In results exported from the context, |
26902 | 213 |
\isa{x} is replaced by \isa{t}. Basically, ``\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'' abbreviates ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', with the resulting |
26870 | 214 |
hypothetical equation solved by reflexivity. |
215 |
||
216 |
The default name for the definitional equation is \isa{x{\isacharunderscore}def}. |
|
217 |
Several simultaneous definitions may be given at the same time. |
|
218 |
||
28788 | 219 |
\end{description} |
26870 | 220 |
|
26902 | 221 |
The special name \indexref{}{fact}{prems}\hyperlink{fact.prems}{\mbox{\isa{prems}}} refers to all assumptions of the |
26870 | 222 |
current context as a list of theorems. This feature should be used |
223 |
with great care! It is better avoided in final proof texts.% |
|
224 |
\end{isamarkuptext}% |
|
225 |
\isamarkuptrue% |
|
226 |
% |
|
28788 | 227 |
\isamarkupsubsection{Term abbreviations \label{sec:term-abbrev}% |
26870 | 228 |
} |
229 |
\isamarkuptrue% |
|
230 |
% |
|
231 |
\begin{isamarkuptext}% |
|
232 |
\begin{matharray}{rcl} |
|
28788 | 233 |
\indexdef{}{command}{let}\hypertarget{command.let}{\hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
234 |
\indexdef{}{keyword}{is}\hypertarget{keyword.is}{\hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}}} & : & syntax \\ |
|
235 |
\end{matharray} |
|
236 |
||
237 |
Abbreviations may be either bound by explicit \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}~\isa{{\isachardoublequote}p\ {\isasymequiv}\ t{\isachardoublequote}} statements, or by annotating assumptions or |
|
238 |
goal statements with a list of patterns ``\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}''. In both cases, higher-order matching is invoked to |
|
239 |
bind extra-logical term variables, which may be either named |
|
240 |
schematic variables of the form \isa{{\isacharquery}x}, or nameless dummies |
|
241 |
``\hyperlink{variable.underscore}{\mbox{\isa{{\isacharunderscore}}}}'' (underscore). Note that in the \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}} |
|
242 |
form the patterns occur on the left-hand side, while the \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} patterns are in postfix position. |
|
243 |
||
244 |
Polymorphism of term bindings is handled in Hindley-Milner style, |
|
245 |
similar to ML. Type variables referring to local assumptions or |
|
246 |
open goal statements are \emph{fixed}, while those of finished |
|
247 |
results or bound by \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}} may occur in \emph{arbitrary} |
|
248 |
instances later. Even though actual polymorphism should be rarely |
|
249 |
used in practice, this mechanism is essential to achieve proper |
|
250 |
incremental type-inference, as the user proceeds to build up the |
|
251 |
Isar proof text from left to right. |
|
252 |
||
253 |
\medskip Term abbreviations are quite different from local |
|
254 |
definitions as introduced via \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} (see |
|
255 |
\secref{sec:proof-context}). The latter are visible within the |
|
256 |
logic as actual equations, while abbreviations disappear during the |
|
257 |
input process just after type checking. Also note that \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} does not support polymorphism. |
|
258 |
||
259 |
\begin{rail} |
|
260 |
'let' ((term + 'and') '=' term + 'and') |
|
261 |
; |
|
262 |
\end{rail} |
|
263 |
||
264 |
The syntax of \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} patterns follows \railnonterm{termpat} |
|
265 |
or \railnonterm{proppat} (see \secref{sec:term-decls}). |
|
266 |
||
267 |
\begin{description} |
|
268 |
||
269 |
\item \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}~\isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ p\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}} binds any |
|
270 |
text variables in patterns \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} by simultaneous |
|
271 |
higher-order matching against terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}}. |
|
272 |
||
273 |
\item \isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}} resembles \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}, but |
|
274 |
matches \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} against the preceding statement. Also |
|
275 |
note that \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} is not a separate command, but part of |
|
276 |
others (such as \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} etc.). |
|
277 |
||
278 |
\end{description} |
|
279 |
||
280 |
Some \emph{implicit} term abbreviations\index{term abbreviations} |
|
281 |
for goals and facts are available as well. For any open goal, |
|
282 |
\indexref{}{variable}{thesis}\hyperlink{variable.thesis}{\mbox{\isa{thesis}}} refers to its object-level statement, |
|
283 |
abstracted over any meta-level parameters (if present). Likewise, |
|
284 |
\indexref{}{variable}{this}\hyperlink{variable.this}{\mbox{\isa{this}}} is bound for fact statements resulting from |
|
285 |
assumptions or finished goals. In case \hyperlink{variable.this}{\mbox{\isa{this}}} refers to |
|
286 |
an object-logic statement that is an application \isa{{\isachardoublequote}f\ t{\isachardoublequote}}, then |
|
287 |
\isa{t} is bound to the special text variable ``\hyperlink{variable.dots}{\mbox{\isa{{\isasymdots}}}}'' |
|
288 |
(three dots). The canonical application of this convenience are |
|
289 |
calculational proofs (see \secref{sec:calculation}).% |
|
290 |
\end{isamarkuptext}% |
|
291 |
\isamarkuptrue% |
|
292 |
% |
|
293 |
\isamarkupsubsection{Facts and forward chaining% |
|
294 |
} |
|
295 |
\isamarkuptrue% |
|
296 |
% |
|
297 |
\begin{isamarkuptext}% |
|
298 |
\begin{matharray}{rcl} |
|
299 |
\indexdef{}{command}{note}\hypertarget{command.note}{\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
300 |
\indexdef{}{command}{then}\hypertarget{command.then}{\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} \\ |
|
301 |
\indexdef{}{command}{from}\hypertarget{command.from}{\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} \\ |
|
302 |
\indexdef{}{command}{with}\hypertarget{command.with}{\hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} \\ |
|
303 |
\indexdef{}{command}{using}\hypertarget{command.using}{\hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
304 |
\indexdef{}{command}{unfolding}\hypertarget{command.unfolding}{\hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
26870 | 305 |
\end{matharray} |
306 |
||
307 |
New facts are established either by assumption or proof of local |
|
308 |
statements. Any fact will usually be involved in further proofs, |
|
309 |
either as explicit arguments of proof methods, or when forward |
|
26902 | 310 |
chaining towards the next goal via \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} (and variants); |
311 |
\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}} and \hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}} are composite forms |
|
312 |
involving \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}. The \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}} elements |
|
26870 | 313 |
augments the collection of used facts \emph{after} a goal has been |
26902 | 314 |
stated. Note that the special theorem name \indexref{}{fact}{this}\hyperlink{fact.this}{\mbox{\isa{this}}} refers |
26870 | 315 |
to the most recently established facts, but only \emph{before} |
316 |
issuing a follow-up claim. |
|
317 |
||
318 |
\begin{rail} |
|
319 |
'note' (thmdef? thmrefs + 'and') |
|
320 |
; |
|
321 |
('from' | 'with' | 'using' | 'unfolding') (thmrefs + 'and') |
|
322 |
; |
|
323 |
\end{rail} |
|
324 |
||
28788 | 325 |
\begin{description} |
26870 | 326 |
|
28788 | 327 |
\item \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}a\ {\isacharequal}\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} recalls existing facts |
328 |
\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ b\isactrlsub n{\isachardoublequote}}, binding the result as \isa{a}. Note that |
|
329 |
attributes may be involved as well, both on the left and right hand |
|
330 |
sides. |
|
26870 | 331 |
|
28788 | 332 |
\item \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} indicates forward chaining by the current |
26870 | 333 |
facts in order to establish the goal to be claimed next. The |
334 |
initial proof method invoked to refine that will be offered the |
|
335 |
facts to do ``anything appropriate'' (see also |
|
26902 | 336 |
\secref{sec:proof-steps}). For example, method \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}} |
26870 | 337 |
(see \secref{sec:pure-meth-att}) would typically do an elimination |
338 |
rather than an introduction. Automatic methods usually insert the |
|
339 |
facts into the goal state before operation. This provides a simple |
|
340 |
scheme to control relevance of facts in automated proof search. |
|
341 |
||
28788 | 342 |
\item \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{b} abbreviates ``\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{b}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}''; thus \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} is |
26902 | 343 |
equivalent to ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}''. |
26870 | 344 |
|
28788 | 345 |
\item \hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} abbreviates ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n\ {\isasymAND}\ this{\isachardoublequote}}''; thus the forward chaining |
346 |
is from earlier facts together with the current ones. |
|
26870 | 347 |
|
28788 | 348 |
\item \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} augments the facts being |
349 |
currently indicated for use by a subsequent refinement step (such as |
|
350 |
\indexref{}{command}{apply}\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}} or \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}). |
|
26870 | 351 |
|
28788 | 352 |
\item \hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} is structurally |
353 |
similar to \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}, but unfolds definitional equations |
|
354 |
\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} throughout the goal state and facts. |
|
26870 | 355 |
|
28788 | 356 |
\end{description} |
26870 | 357 |
|
358 |
Forward chaining with an empty list of theorems is the same as not |
|
26902 | 359 |
chaining at all. Thus ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{nothing}'' has no |
26870 | 360 |
effect apart from entering \isa{{\isachardoublequote}prove{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode, since |
26902 | 361 |
\indexref{}{fact}{nothing}\hyperlink{fact.nothing}{\mbox{\isa{nothing}}} is bound to the empty list of theorems. |
26870 | 362 |
|
26902 | 363 |
Basic proof methods (such as \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}}) expect multiple |
26870 | 364 |
facts to be given in their proper order, corresponding to a prefix |
365 |
of the premises of the rule involved. Note that positions may be |
|
26902 | 366 |
easily skipped using something like \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{{\isachardoublequote}{\isacharunderscore}\ {\isasymAND}\ a\ {\isasymAND}\ b{\isachardoublequote}}, for example. This involves the trivial rule |
26870 | 367 |
\isa{{\isachardoublequote}PROP\ {\isasympsi}\ {\isasymLongrightarrow}\ PROP\ {\isasympsi}{\isachardoublequote}}, which is bound in Isabelle/Pure as |
26912 | 368 |
``\indexref{}{fact}{\_}\hyperlink{fact.underscore}{\mbox{\isa{{\isacharunderscore}}}}'' (underscore). |
26870 | 369 |
|
26902 | 370 |
Automated methods (such as \hyperlink{method.simp}{\mbox{\isa{simp}}} or \hyperlink{method.auto}{\mbox{\isa{auto}}}) just |
26870 | 371 |
insert any given facts before their usual operation. Depending on |
372 |
the kind of procedure involved, the order of facts is less |
|
373 |
significant here.% |
|
374 |
\end{isamarkuptext}% |
|
375 |
\isamarkuptrue% |
|
376 |
% |
|
28788 | 377 |
\isamarkupsubsection{Goals \label{sec:goals}% |
26870 | 378 |
} |
379 |
\isamarkuptrue% |
|
380 |
% |
|
381 |
\begin{isamarkuptext}% |
|
382 |
\begin{matharray}{rcl} |
|
28788 | 383 |
\indexdef{}{command}{lemma}\hypertarget{command.lemma}{\hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}} & : & \isa{{\isachardoublequote}local{\isacharunderscore}theory\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
384 |
\indexdef{}{command}{theorem}\hypertarget{command.theorem}{\hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}} & : & \isa{{\isachardoublequote}local{\isacharunderscore}theory\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
385 |
\indexdef{}{command}{corollary}\hypertarget{command.corollary}{\hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}} & : & \isa{{\isachardoublequote}local{\isacharunderscore}theory\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
386 |
\indexdef{}{command}{have}\hypertarget{command.have}{\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ proof{\isacharparenleft}chain{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
387 |
\indexdef{}{command}{show}\hypertarget{command.show}{\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ proof{\isacharparenleft}chain{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
388 |
\indexdef{}{command}{hence}\hypertarget{command.hence}{\hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
389 |
\indexdef{}{command}{thus}\hypertarget{command.thus}{\hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
390 |
\indexdef{}{command}{print\_statement}\hypertarget{command.print-statement}{\hyperlink{command.print-statement}{\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\ |
|
26870 | 391 |
\end{matharray} |
392 |
||
393 |
From a theory context, proof mode is entered by an initial goal |
|
26902 | 394 |
command such as \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}, \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}, or |
395 |
\hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}. Within a proof, new claims may be |
|
26870 | 396 |
introduced locally as well; four variants are available here to |
397 |
indicate whether forward chaining of facts should be performed |
|
26902 | 398 |
initially (via \indexref{}{command}{then}\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}), and whether the final result |
26870 | 399 |
is meant to solve some pending goal. |
400 |
||
401 |
Goals may consist of multiple statements, resulting in a list of |
|
402 |
facts eventually. A pending multi-goal is internally represented as |
|
28857 | 403 |
a meta-level conjunction (\isa{{\isachardoublequote}{\isacharampersand}{\isacharampersand}{\isacharampersand}{\isachardoublequote}}), which is usually |
26870 | 404 |
split into the corresponding number of sub-goals prior to an initial |
26902 | 405 |
method application, via \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} |
406 |
(\secref{sec:proof-steps}) or \indexref{}{command}{apply}\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}} |
|
407 |
(\secref{sec:tactic-commands}). The \indexref{}{method}{induct}\hyperlink{method.induct}{\mbox{\isa{induct}}} method |
|
26870 | 408 |
covered in \secref{sec:cases-induct} acts on multiple claims |
409 |
simultaneously. |
|
410 |
||
411 |
Claims at the theory level may be either in short or long form. A |
|
412 |
short goal merely consists of several simultaneous propositions |
|
413 |
(often just one). A long goal includes an explicit context |
|
414 |
specification for the subsequent conclusion, involving local |
|
415 |
parameters and assumptions. Here the role of each part of the |
|
416 |
statement is explicitly marked by separate keywords (see also |
|
417 |
\secref{sec:locale}); the local assumptions being introduced here |
|
26902 | 418 |
are available as \indexref{}{fact}{assms}\hyperlink{fact.assms}{\mbox{\isa{assms}}} in the proof. Moreover, there |
419 |
are two kinds of conclusions: \indexdef{}{element}{shows}\hypertarget{element.shows}{\hyperlink{element.shows}{\mbox{\isa{\isakeyword{shows}}}}} states several |
|
26870 | 420 |
simultaneous propositions (essentially a big conjunction), while |
26902 | 421 |
\indexdef{}{element}{obtains}\hypertarget{element.obtains}{\hyperlink{element.obtains}{\mbox{\isa{\isakeyword{obtains}}}}} claims several simultaneous simultaneous |
26870 | 422 |
contexts of (essentially a big disjunction of eliminated parameters |
423 |
and assumptions, cf.\ \secref{sec:obtain}). |
|
424 |
||
425 |
\begin{rail} |
|
426 |
('lemma' | 'theorem' | 'corollary') target? (goal | longgoal) |
|
427 |
; |
|
428 |
('have' | 'show' | 'hence' | 'thus') goal |
|
429 |
; |
|
430 |
'print\_statement' modes? thmrefs |
|
431 |
; |
|
432 |
||
433 |
goal: (props + 'and') |
|
434 |
; |
|
435 |
longgoal: thmdecl? (contextelem *) conclusion |
|
436 |
; |
|
437 |
conclusion: 'shows' goal | 'obtains' (parname? case + '|') |
|
438 |
; |
|
439 |
case: (vars + 'and') 'where' (props + 'and') |
|
440 |
; |
|
441 |
\end{rail} |
|
442 |
||
28788 | 443 |
\begin{description} |
26870 | 444 |
|
28788 | 445 |
\item \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} enters proof mode with |
26870 | 446 |
\isa{{\isasymphi}} as main goal, eventually resulting in some fact \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} to be put back into the target context. An additional |
447 |
\railnonterm{context} specification may build up an initial proof |
|
448 |
context for the subsequent claim; this includes local definitions |
|
26902 | 449 |
and syntax as well, see the definition of \hyperlink{syntax.contextelem}{\mbox{\isa{contextelem}}} in |
26870 | 450 |
\secref{sec:locale}. |
451 |
||
28788 | 452 |
\item \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} are essentially the same as \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}, but the facts are internally marked as |
26870 | 453 |
being of a different kind. This discrimination acts like a formal |
454 |
comment. |
|
455 |
||
28788 | 456 |
\item \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} claims a local goal, |
26870 | 457 |
eventually resulting in a fact within the current logical context. |
458 |
This operation is completely independent of any pending sub-goals of |
|
26902 | 459 |
an enclosing goal statements, so \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} may be freely |
26870 | 460 |
used for experimental exploration of potential results within a |
461 |
proof body. |
|
462 |
||
28788 | 463 |
\item \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} is like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} plus a second stage to refine some pending |
26870 | 464 |
sub-goal for each one of the finished result, after having been |
465 |
exported into the corresponding context (at the head of the |
|
26902 | 466 |
sub-proof of this \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} command). |
26870 | 467 |
|
468 |
To accommodate interactive debugging, resulting rules are printed |
|
469 |
before being applied internally. Even more, interactive execution |
|
26902 | 470 |
of \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} predicts potential failure and displays the |
26870 | 471 |
resulting error as a warning beforehand. Watch out for the |
472 |
following message: |
|
473 |
||
474 |
%FIXME proper antiquitation |
|
475 |
\begin{ttbox} |
|
476 |
Problem! Local statement will fail to solve any pending goal |
|
477 |
\end{ttbox} |
|
478 |
||
28788 | 479 |
\item \hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}} abbreviates ``\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}'', i.e.\ claims a local goal to be proven by forward |
26902 | 480 |
chaining the current facts. Note that \hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}} is also |
481 |
equivalent to ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}''. |
|
26870 | 482 |
|
28788 | 483 |
\item \hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}} abbreviates ``\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}''. Note that \hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}} is also equivalent to |
26902 | 484 |
``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}''. |
26870 | 485 |
|
28788 | 486 |
\item \hyperlink{command.print-statement}{\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}}~\isa{a} prints facts from the |
26870 | 487 |
current theory or proof context in long statement form, according to |
26902 | 488 |
the syntax for \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}} given above. |
26870 | 489 |
|
28788 | 490 |
\end{description} |
26870 | 491 |
|
492 |
Any goal statement causes some term abbreviations (such as |
|
26902 | 493 |
\indexref{}{variable}{?thesis}\hyperlink{variable.?thesis}{\mbox{\isa{{\isacharquery}thesis}}}) to be bound automatically, see also |
26961 | 494 |
\secref{sec:term-abbrev}. |
26870 | 495 |
|
26902 | 496 |
The optional case names of \indexref{}{element}{obtains}\hyperlink{element.obtains}{\mbox{\isa{\isakeyword{obtains}}}} have a twofold |
26870 | 497 |
meaning: (1) during the of this claim they refer to the the local |
498 |
context introductions, (2) the resulting rule is annotated |
|
499 |
accordingly to support symbolic case splits when used with the |
|
27124 | 500 |
\indexref{}{method}{cases}\hyperlink{method.cases}{\mbox{\isa{cases}}} method (cf.\ \secref{sec:cases-induct}). |
26870 | 501 |
|
502 |
\medskip |
|
503 |
||
504 |
\begin{warn} |
|
505 |
Isabelle/Isar suffers theory-level goal statements to contain |
|
506 |
\emph{unbound schematic variables}, although this does not conform |
|
507 |
to the aim of human-readable proof documents! The main problem |
|
508 |
with schematic goals is that the actual outcome is usually hard to |
|
509 |
predict, depending on the behavior of the proof methods applied |
|
510 |
during the course of reasoning. Note that most semi-automated |
|
511 |
methods heavily depend on several kinds of implicit rule |
|
512 |
declarations within the current theory context. As this would |
|
513 |
also result in non-compositional checking of sub-proofs, |
|
514 |
\emph{local goals} are not allowed to be schematic at all. |
|
515 |
Nevertheless, schematic goals do have their use in Prolog-style |
|
516 |
interactive synthesis of proven results, usually by stepwise |
|
517 |
refinement via emulation of traditional Isabelle tactic scripts |
|
518 |
(see also \secref{sec:tactic-commands}). In any case, users |
|
519 |
should know what they are doing. |
|
520 |
\end{warn}% |
|
521 |
\end{isamarkuptext}% |
|
522 |
\isamarkuptrue% |
|
523 |
% |
|
28788 | 524 |
\isamarkupsection{Refinement steps% |
525 |
} |
|
526 |
\isamarkuptrue% |
|
527 |
% |
|
528 |
\isamarkupsubsection{Proof method expressions \label{sec:proof-meth}% |
|
529 |
} |
|
530 |
\isamarkuptrue% |
|
531 |
% |
|
532 |
\begin{isamarkuptext}% |
|
533 |
Proof methods are either basic ones, or expressions composed of |
|
534 |
methods via ``\verb|,|'' (sequential composition), |
|
535 |
``\verb||\verb,|,\verb||'' (alternative choices), ``\verb|?|'' |
|
536 |
(try), ``\verb|+|'' (repeat at least once), ``\verb|[|\isa{n}\verb|]|'' (restriction to first \isa{n} |
|
537 |
sub-goals, with default \isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}}). In practice, proof |
|
538 |
methods are usually just a comma separated list of |
|
539 |
\railqtok{nameref}~\railnonterm{args} specifications. Note that |
|
540 |
parentheses may be dropped for single method specifications (with no |
|
541 |
arguments). |
|
542 |
||
543 |
\indexouternonterm{method} |
|
544 |
\begin{rail} |
|
545 |
method: (nameref | '(' methods ')') (() | '?' | '+' | '[' nat? ']') |
|
546 |
; |
|
547 |
methods: (nameref args | method) + (',' | '|') |
|
548 |
; |
|
549 |
\end{rail} |
|
550 |
||
551 |
Proper Isar proof methods do \emph{not} admit arbitrary goal |
|
552 |
addressing, but refer either to the first sub-goal or all sub-goals |
|
553 |
uniformly. The goal restriction operator ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharbrackright}{\isachardoublequote}}'' |
|
554 |
evaluates a method expression within a sandbox consisting of the |
|
555 |
first \isa{n} sub-goals (which need to exist). For example, the |
|
556 |
method ``\isa{{\isachardoublequote}simp{\isacharunderscore}all{\isacharbrackleft}{\isadigit{3}}{\isacharbrackright}{\isachardoublequote}}'' simplifies the first three |
|
557 |
sub-goals, while ``\isa{{\isachardoublequote}{\isacharparenleft}rule\ foo{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequote}}'' simplifies all |
|
558 |
new goals that emerge from applying rule \isa{{\isachardoublequote}foo{\isachardoublequote}} to the |
|
559 |
originally first one. |
|
560 |
||
561 |
Improper methods, notably tactic emulations, offer a separate |
|
562 |
low-level goal addressing scheme as explicit argument to the |
|
563 |
individual tactic being involved. Here ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' refers to |
|
564 |
all goals, and ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharminus}{\isacharbrackright}{\isachardoublequote}}'' to all goals starting from \isa{{\isachardoublequote}n{\isachardoublequote}}. |
|
565 |
||
566 |
\indexouternonterm{goalspec} |
|
567 |
\begin{rail} |
|
568 |
goalspec: '[' (nat '-' nat | nat '-' | nat | '!' ) ']' |
|
569 |
; |
|
570 |
\end{rail}% |
|
571 |
\end{isamarkuptext}% |
|
572 |
\isamarkuptrue% |
|
573 |
% |
|
574 |
\isamarkupsubsection{Initial and terminal proof steps \label{sec:proof-steps}% |
|
26870 | 575 |
} |
576 |
\isamarkuptrue% |
|
577 |
% |
|
578 |
\begin{isamarkuptext}% |
|
579 |
\begin{matharray}{rcl} |
|
28788 | 580 |
\indexdef{}{command}{proof}\hypertarget{command.proof}{\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
581 |
\indexdef{}{command}{qed}\hypertarget{command.qed}{\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
582 |
\indexdef{}{command}{by}\hypertarget{command.by}{\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
583 |
\indexdef{}{command}{..}\hypertarget{command.ddot}{\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
584 |
\indexdef{}{command}{.}\hypertarget{command.dot}{\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
585 |
\indexdef{}{command}{sorry}\hypertarget{command.sorry}{\hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
26870 | 586 |
\end{matharray} |
587 |
||
588 |
Arbitrary goal refinement via tactics is considered harmful. |
|
589 |
Structured proof composition in Isar admits proof methods to be |
|
590 |
invoked in two places only. |
|
591 |
||
592 |
\begin{enumerate} |
|
593 |
||
26902 | 594 |
\item An \emph{initial} refinement step \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} reduces a newly stated goal to a number |
26870 | 595 |
of sub-goals that are to be solved later. Facts are passed to |
596 |
\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} for forward chaining, if so indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode. |
|
597 |
||
26902 | 598 |
\item A \emph{terminal} conclusion step \indexref{}{command}{qed}\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} is intended to solve remaining goals. No facts are |
26870 | 599 |
passed to \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}. |
600 |
||
601 |
\end{enumerate} |
|
602 |
||
603 |
The only other (proper) way to affect pending goals in a proof body |
|
26902 | 604 |
is by \indexref{}{command}{show}\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}, which involves an explicit statement of |
26870 | 605 |
what is to be solved eventually. Thus we avoid the fundamental |
606 |
problem of unstructured tactic scripts that consist of numerous |
|
607 |
consecutive goal transformations, with invisible effects. |
|
608 |
||
609 |
\medskip As a general rule of thumb for good proof style, initial |
|
610 |
proof methods should either solve the goal completely, or constitute |
|
611 |
some well-understood reduction to new sub-goals. Arbitrary |
|
612 |
automatic proof tools that are prone leave a large number of badly |
|
613 |
structured sub-goals are no help in continuing the proof document in |
|
614 |
an intelligible manner. |
|
615 |
||
616 |
Unless given explicitly by the user, the default initial method is |
|
26902 | 617 |
``\indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}}'', which applies a single standard elimination |
26870 | 618 |
or introduction rule according to the topmost symbol involved. |
619 |
There is no separate default terminal method. Any remaining goals |
|
620 |
are always solved by assumption in the very last step. |
|
621 |
||
622 |
\begin{rail} |
|
623 |
'proof' method? |
|
624 |
; |
|
625 |
'qed' method? |
|
626 |
; |
|
627 |
'by' method method? |
|
628 |
; |
|
629 |
('.' | '..' | 'sorry') |
|
630 |
; |
|
631 |
\end{rail} |
|
632 |
||
28788 | 633 |
\begin{description} |
26870 | 634 |
|
28788 | 635 |
\item \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} refines the goal by proof |
636 |
method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}; facts for forward chaining are passed if so |
|
637 |
indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode. |
|
26870 | 638 |
|
28788 | 639 |
\item \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} refines any remaining goals by |
640 |
proof method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} and concludes the sub-proof by assumption. |
|
641 |
If the goal had been \isa{{\isachardoublequote}show{\isachardoublequote}} (or \isa{{\isachardoublequote}thus{\isachardoublequote}}), some |
|
642 |
pending sub-goal is solved as well by the rule resulting from the |
|
643 |
result \emph{exported} into the enclosing goal context. Thus \isa{{\isachardoublequote}qed{\isachardoublequote}} may fail for two reasons: either \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} fails, or the |
|
644 |
resulting rule does not fit to any pending goal\footnote{This |
|
645 |
includes any additional ``strong'' assumptions as introduced by |
|
646 |
\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}.} of the enclosing context. Debugging such a |
|
647 |
situation might involve temporarily changing \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} into |
|
648 |
\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, or weakening the local context by replacing |
|
649 |
occurrences of \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} by \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}. |
|
26870 | 650 |
|
28788 | 651 |
\item \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}} is a \emph{terminal |
652 |
proof}\index{proof!terminal}; it abbreviates \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}~\isa{{\isachardoublequote}qed{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}, but with |
|
653 |
backtracking across both methods. Debugging an unsuccessful |
|
654 |
\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}} command can be done by expanding its |
|
655 |
definition; in many cases \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} (or even |
|
656 |
\isa{{\isachardoublequote}apply{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}) is already sufficient to see the |
|
26870 | 657 |
problem. |
658 |
||
28788 | 659 |
\item ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}'' is a \emph{default |
26902 | 660 |
proof}\index{proof!default}; it abbreviates \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}rule{\isachardoublequote}}. |
26870 | 661 |
|
28788 | 662 |
\item ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' is a \emph{trivial |
26902 | 663 |
proof}\index{proof!trivial}; it abbreviates \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}this{\isachardoublequote}}. |
26870 | 664 |
|
28788 | 665 |
\item \hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}} is a \emph{fake proof}\index{proof!fake} |
26870 | 666 |
pretending to solve the pending claim without further ado. This |
667 |
only works in interactive development, or if the \verb|quick_and_dirty| flag is enabled (in ML). Facts emerging from fake |
|
668 |
proofs are not the real thing. Internally, each theorem container |
|
669 |
is tainted by an oracle invocation, which is indicated as ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' in the printed result. |
|
670 |
||
26902 | 671 |
The most important application of \hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}} is to support |
26870 | 672 |
experimentation and top-down proof development. |
673 |
||
28788 | 674 |
\end{description}% |
26870 | 675 |
\end{isamarkuptext}% |
676 |
\isamarkuptrue% |
|
677 |
% |
|
28788 | 678 |
\isamarkupsubsection{Fundamental methods and attributes \label{sec:pure-meth-att}% |
26870 | 679 |
} |
680 |
\isamarkuptrue% |
|
681 |
% |
|
682 |
\begin{isamarkuptext}% |
|
683 |
The following proof methods and attributes refer to basic logical |
|
684 |
operations of Isar. Further methods and attributes are provided by |
|
685 |
several generic and object-logic specific tools and packages (see |
|
686 |
\chref{ch:gen-tools} and \chref{ch:hol}). |
|
687 |
||
688 |
\begin{matharray}{rcl} |
|
28788 | 689 |
\indexdef{}{method}{-}\hypertarget{method.-}{\hyperlink{method.-}{\mbox{\isa{{\isacharminus}}}}} & : & \isa{method} \\ |
690 |
\indexdef{}{method}{fact}\hypertarget{method.fact}{\hyperlink{method.fact}{\mbox{\isa{fact}}}} & : & \isa{method} \\ |
|
691 |
\indexdef{}{method}{assumption}\hypertarget{method.assumption}{\hyperlink{method.assumption}{\mbox{\isa{assumption}}}} & : & \isa{method} \\ |
|
692 |
\indexdef{}{method}{this}\hypertarget{method.this}{\hyperlink{method.this}{\mbox{\isa{this}}}} & : & \isa{method} \\ |
|
693 |
\indexdef{}{method}{rule}\hypertarget{method.rule}{\hyperlink{method.rule}{\mbox{\isa{rule}}}} & : & \isa{method} \\ |
|
694 |
\indexdef{}{method}{iprover}\hypertarget{method.iprover}{\hyperlink{method.iprover}{\mbox{\isa{iprover}}}} & : & \isa{method} \\[0.5ex] |
|
695 |
\indexdef{Pure}{attribute}{intro}\hypertarget{attribute.Pure.intro}{\hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}} & : & \isa{attribute} \\ |
|
696 |
\indexdef{Pure}{attribute}{elim}\hypertarget{attribute.Pure.elim}{\hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}} & : & \isa{attribute} \\ |
|
697 |
\indexdef{Pure}{attribute}{dest}\hypertarget{attribute.Pure.dest}{\hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}} & : & \isa{attribute} \\ |
|
698 |
\indexdef{}{attribute}{rule}\hypertarget{attribute.rule}{\hyperlink{attribute.rule}{\mbox{\isa{rule}}}} & : & \isa{attribute} \\[0.5ex] |
|
699 |
\indexdef{}{attribute}{OF}\hypertarget{attribute.OF}{\hyperlink{attribute.OF}{\mbox{\isa{OF}}}} & : & \isa{attribute} \\ |
|
700 |
\indexdef{}{attribute}{of}\hypertarget{attribute.of}{\hyperlink{attribute.of}{\mbox{\isa{of}}}} & : & \isa{attribute} \\ |
|
701 |
\indexdef{}{attribute}{where}\hypertarget{attribute.where}{\hyperlink{attribute.where}{\mbox{\isa{where}}}} & : & \isa{attribute} \\ |
|
26870 | 702 |
\end{matharray} |
703 |
||
704 |
\begin{rail} |
|
705 |
'fact' thmrefs? |
|
706 |
; |
|
707 |
'rule' thmrefs? |
|
708 |
; |
|
709 |
'iprover' ('!' ?) (rulemod *) |
|
710 |
; |
|
711 |
rulemod: ('intro' | 'elim' | 'dest') ((('!' | () | '?') nat?) | 'del') ':' thmrefs |
|
712 |
; |
|
713 |
('intro' | 'elim' | 'dest') ('!' | () | '?') nat? |
|
714 |
; |
|
715 |
'rule' 'del' |
|
716 |
; |
|
717 |
'OF' thmrefs |
|
718 |
; |
|
719 |
'of' insts ('concl' ':' insts)? |
|
720 |
; |
|
721 |
'where' ((name | var | typefree | typevar) '=' (type | term) * 'and') |
|
722 |
; |
|
723 |
\end{rail} |
|
724 |
||
28788 | 725 |
\begin{description} |
26870 | 726 |
|
28788 | 727 |
\item ``\hyperlink{method.-}{\mbox{\isa{{\isacharminus}}}}'' (minus) does nothing but insert the forward |
728 |
chaining facts as premises into the goal. Note that command |
|
26902 | 729 |
\indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} without any method actually performs a single |
730 |
reduction step using the \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}} method; thus a plain |
|
731 |
\emph{do-nothing} proof step would be ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}{\isacharminus}{\isachardoublequote}}'' rather than \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} alone. |
|
26870 | 732 |
|
28788 | 733 |
\item \hyperlink{method.fact}{\mbox{\isa{fact}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} composes some fact from |
734 |
\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} (or implicitly from the current proof context) |
|
735 |
modulo unification of schematic type and term variables. The rule |
|
736 |
structure is not taken into account, i.e.\ meta-level implication is |
|
737 |
considered atomic. This is the same principle underlying literal |
|
738 |
facts (cf.\ \secref{sec:syn-att}): ``\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}~\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{fact}'' is equivalent to ``\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\verb|`|\isa{{\isasymphi}}\verb|`|'' provided that |
|
739 |
\isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} is an instance of some known \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} in the |
|
740 |
proof context. |
|
26870 | 741 |
|
28788 | 742 |
\item \hyperlink{method.assumption}{\mbox{\isa{assumption}}} solves some goal by a single assumption |
26870 | 743 |
step. All given facts are guaranteed to participate in the |
744 |
refinement; this means there may be only 0 or 1 in the first place. |
|
26902 | 745 |
Recall that \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} (\secref{sec:proof-steps}) already |
26870 | 746 |
concludes any remaining sub-goals by assumption, so structured |
26902 | 747 |
proofs usually need not quote the \hyperlink{method.assumption}{\mbox{\isa{assumption}}} method at |
26870 | 748 |
all. |
749 |
||
28788 | 750 |
\item \hyperlink{method.this}{\mbox{\isa{this}}} applies all of the current facts directly as |
26902 | 751 |
rules. Recall that ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' (dot) abbreviates ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{this}''. |
26870 | 752 |
|
28788 | 753 |
\item \hyperlink{method.rule}{\mbox{\isa{rule}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} applies some rule given as |
754 |
argument in backward manner; facts are used to reduce the rule |
|
755 |
before applying it to the goal. Thus \hyperlink{method.rule}{\mbox{\isa{rule}}} without facts |
|
756 |
is plain introduction, while with facts it becomes elimination. |
|
26870 | 757 |
|
26902 | 758 |
When no arguments are given, the \hyperlink{method.rule}{\mbox{\isa{rule}}} method tries to pick |
26870 | 759 |
appropriate rules automatically, as declared in the current context |
26902 | 760 |
using the \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}, \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}, |
761 |
\hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}} attributes (see below). This is the |
|
762 |
default behavior of \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} and ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}'' |
|
763 |
(double-dot) steps (see \secref{sec:proof-steps}). |
|
26870 | 764 |
|
28788 | 765 |
\item \hyperlink{method.iprover}{\mbox{\isa{iprover}}} performs intuitionistic proof search, |
26870 | 766 |
depending on specifically declared rules from the context, or given |
767 |
as explicit arguments. Chained facts are inserted into the goal |
|
28788 | 768 |
before commencing proof search; ``\hyperlink{method.iprover}{\mbox{\isa{iprover}}}\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' |
26902 | 769 |
means to include the current \hyperlink{fact.prems}{\mbox{\isa{prems}}} as well. |
26870 | 770 |
|
26902 | 771 |
Rules need to be classified as \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}, |
772 |
\hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}, or \hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}; here the |
|
773 |
``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' indicator refers to ``safe'' rules, which may be |
|
774 |
applied aggressively (without considering back-tracking later). |
|
775 |
Rules declared with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'' are ignored in proof search (the |
|
776 |
single-step \hyperlink{method.rule}{\mbox{\isa{rule}}} method still observes these). An |
|
777 |
explicit weight annotation may be given as well; otherwise the |
|
778 |
number of rule premises will be taken into account here. |
|
26870 | 779 |
|
28788 | 780 |
\item \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}, \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}, and |
781 |
\hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}} declare introduction, elimination, and |
|
26902 | 782 |
destruct rules, to be used with the \hyperlink{method.rule}{\mbox{\isa{rule}}} and \hyperlink{method.iprover}{\mbox{\isa{iprover}}} methods. Note that the latter will ignore rules declared |
783 |
with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'', while ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' are used most |
|
784 |
aggressively. |
|
26870 | 785 |
|
786 |
The classical reasoner (see \secref{sec:classical}) introduces its |
|
787 |
own variants of these attributes; use qualified names to access the |
|
26902 | 788 |
present versions of Isabelle/Pure, i.e.\ \hyperlink{attribute.Pure.Pure.intro}{\mbox{\isa{Pure{\isachardot}intro}}}. |
26870 | 789 |
|
28788 | 790 |
\item \hyperlink{attribute.rule}{\mbox{\isa{rule}}}~\isa{del} undeclares introduction, |
26870 | 791 |
elimination, or destruct rules. |
792 |
||
28788 | 793 |
\item \hyperlink{attribute.OF}{\mbox{\isa{OF}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} applies some theorem to all |
794 |
of the given rules \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} (in parallel). This |
|
795 |
corresponds to the \verb|op MRS| operation in ML, |
|
796 |
but note the reversed order. Positions may be effectively skipped |
|
797 |
by including ``\isa{{\isacharunderscore}}'' (underscore) as argument. |
|
26870 | 798 |
|
28788 | 799 |
\item \hyperlink{attribute.of}{\mbox{\isa{of}}}~\isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}\ {\isasymdots}\ t\isactrlsub n{\isachardoublequote}} performs positional |
800 |
instantiation of term variables. The terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}} are |
|
801 |
substituted for any schematic variables occurring in a theorem from |
|
802 |
left to right; ``\isa{{\isacharunderscore}}'' (underscore) indicates to skip a |
|
803 |
position. Arguments following a ``\isa{{\isachardoublequote}concl{\isacharcolon}{\isachardoublequote}}'' specification |
|
804 |
refer to positions of the conclusion of a rule. |
|
26870 | 805 |
|
28788 | 806 |
\item \hyperlink{attribute.where}{\mbox{\isa{where}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ x\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}} |
807 |
performs named instantiation of schematic type and term variables |
|
808 |
occurring in a theorem. Schematic variables have to be specified on |
|
809 |
the left-hand side (e.g.\ \isa{{\isachardoublequote}{\isacharquery}x{\isadigit{1}}{\isachardot}{\isadigit{3}}{\isachardoublequote}}). The question mark may |
|
810 |
be omitted if the variable name is a plain identifier without index. |
|
811 |
As type instantiations are inferred from term instantiations, |
|
812 |
explicit type instantiations are seldom necessary. |
|
26870 | 813 |
|
28788 | 814 |
\end{description}% |
26870 | 815 |
\end{isamarkuptext}% |
816 |
\isamarkuptrue% |
|
817 |
% |
|
28788 | 818 |
\isamarkupsubsection{Emulating tactic scripts \label{sec:tactic-commands}% |
26870 | 819 |
} |
820 |
\isamarkuptrue% |
|
821 |
% |
|
822 |
\begin{isamarkuptext}% |
|
823 |
The Isar provides separate commands to accommodate tactic-style |
|
824 |
proof scripts within the same system. While being outside the |
|
825 |
orthodox Isar proof language, these might come in handy for |
|
826 |
interactive exploration and debugging, or even actual tactical proof |
|
827 |
within new-style theories (to benefit from document preparation, for |
|
828 |
example). See also \secref{sec:tactics} for actual tactics, that |
|
829 |
have been encapsulated as proof methods. Proper proof methods may |
|
830 |
be used in scripts, too. |
|
831 |
||
832 |
\begin{matharray}{rcl} |
|
28788 | 833 |
\indexdef{}{command}{apply}\hypertarget{command.apply}{\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
834 |
\indexdef{}{command}{apply\_end}\hypertarget{command.apply-end}{\hyperlink{command.apply-end}{\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
835 |
\indexdef{}{command}{done}\hypertarget{command.done}{\hyperlink{command.done}{\mbox{\isa{\isacommand{done}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ local{\isacharunderscore}theory\ {\isacharbar}\ theory{\isachardoublequote}} \\ |
|
836 |
\indexdef{}{command}{defer}\hypertarget{command.defer}{\hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof\ {\isasymrightarrow}\ proof{\isachardoublequote}} \\ |
|
837 |
\indexdef{}{command}{prefer}\hypertarget{command.prefer}{\hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof\ {\isasymrightarrow}\ proof{\isachardoublequote}} \\ |
|
838 |
\indexdef{}{command}{back}\hypertarget{command.back}{\hyperlink{command.back}{\mbox{\isa{\isacommand{back}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof\ {\isasymrightarrow}\ proof{\isachardoublequote}} \\ |
|
26870 | 839 |
\end{matharray} |
840 |
||
841 |
\begin{rail} |
|
842 |
( 'apply' | 'apply\_end' ) method |
|
843 |
; |
|
844 |
'defer' nat? |
|
845 |
; |
|
846 |
'prefer' nat |
|
847 |
; |
|
848 |
\end{rail} |
|
849 |
||
28788 | 850 |
\begin{description} |
26870 | 851 |
|
28788 | 852 |
\item \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}~\isa{m} applies proof method \isa{m} in |
853 |
initial position, but unlike \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} it retains ``\isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}'' mode. Thus consecutive method applications may be |
|
854 |
given just as in tactic scripts. |
|
26870 | 855 |
|
856 |
Facts are passed to \isa{m} as indicated by the goal's |
|
857 |
forward-chain mode, and are \emph{consumed} afterwards. Thus any |
|
26902 | 858 |
further \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}} command would always work in a purely |
26870 | 859 |
backward manner. |
860 |
||
28788 | 861 |
\item \hyperlink{command.apply-end}{\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}}~\isa{{\isachardoublequote}m{\isachardoublequote}} applies proof method \isa{m} as if in terminal position. Basically, this simulates a |
26902 | 862 |
multi-step tactic script for \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}, but may be given |
26870 | 863 |
anywhere within the proof body. |
864 |
||
26895 | 865 |
No facts are passed to \isa{m} here. Furthermore, the static |
26902 | 866 |
context is that of the enclosing goal (as for actual \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}). Thus the proof method may not refer to any assumptions |
26870 | 867 |
introduced in the current body, for example. |
868 |
||
28788 | 869 |
\item \hyperlink{command.done}{\mbox{\isa{\isacommand{done}}}} completes a proof script, provided that the |
870 |
current goal state is solved completely. Note that actual |
|
26902 | 871 |
structured proof commands (e.g.\ ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' or \hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}}) may be used to conclude proof scripts as well. |
26870 | 872 |
|
28788 | 873 |
\item \hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}}~\isa{n} and \hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}}~\isa{n} |
874 |
shuffle the list of pending goals: \hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}} puts off |
|
26870 | 875 |
sub-goal \isa{n} to the end of the list (\isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}} by |
26902 | 876 |
default), while \hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}} brings sub-goal \isa{n} to the |
26870 | 877 |
front. |
878 |
||
28788 | 879 |
\item \hyperlink{command.back}{\mbox{\isa{\isacommand{back}}}} does back-tracking over the result sequence |
880 |
of the latest proof command. Basically, any proof command may |
|
881 |
return multiple results. |
|
26870 | 882 |
|
28788 | 883 |
\end{description} |
26870 | 884 |
|
885 |
Any proper Isar proof method may be used with tactic script commands |
|
26902 | 886 |
such as \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}. A few additional emulations of actual |
26870 | 887 |
tactics are provided as well; these would be never used in actual |
888 |
structured proofs, of course.% |
|
889 |
\end{isamarkuptext}% |
|
890 |
\isamarkuptrue% |
|
891 |
% |
|
28788 | 892 |
\isamarkupsubsection{Defining proof methods% |
26870 | 893 |
} |
894 |
\isamarkuptrue% |
|
895 |
% |
|
896 |
\begin{isamarkuptext}% |
|
897 |
\begin{matharray}{rcl} |
|
28788 | 898 |
\indexdef{}{command}{method\_setup}\hypertarget{command.method-setup}{\hyperlink{command.method-setup}{\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\ |
26870 | 899 |
\end{matharray} |
900 |
||
28788 | 901 |
\begin{rail} |
902 |
'method\_setup' name '=' text text |
|
903 |
; |
|
904 |
\end{rail} |
|
905 |
||
906 |
\begin{description} |
|
907 |
||
908 |
\item \hyperlink{command.method-setup}{\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}}}~\isa{{\isachardoublequote}name\ {\isacharequal}\ text\ description{\isachardoublequote}} |
|
909 |
defines a proof method in the current theory. The given \isa{{\isachardoublequote}text{\isachardoublequote}} has to be an ML expression of type \verb|Args.src -> Proof.context -> Proof.method|. Parsing concrete |
|
910 |
method syntax from \verb|Args.src| input can be quite tedious in |
|
911 |
general. The following simple examples are for methods without any |
|
912 |
explicit arguments, or a list of theorems, respectively. |
|
26870 | 913 |
|
28788 | 914 |
%FIXME proper antiquotations |
915 |
{\footnotesize |
|
916 |
\begin{verbatim} |
|
917 |
Method.no_args (Method.METHOD (fn facts => foobar_tac)) |
|
918 |
Method.thms_args (fn thms => Method.METHOD (fn facts => foobar_tac)) |
|
919 |
Method.ctxt_args (fn ctxt => Method.METHOD (fn facts => foobar_tac)) |
|
920 |
Method.thms_ctxt_args (fn thms => fn ctxt => |
|
921 |
Method.METHOD (fn facts => foobar_tac)) |
|
922 |
\end{verbatim} |
|
923 |
} |
|
26870 | 924 |
|
28788 | 925 |
Note that mere tactic emulations may ignore the \isa{facts} |
926 |
parameter above. Proper proof methods would do something |
|
927 |
appropriate with the list of current facts, though. Single-rule |
|
928 |
methods usually do strict forward-chaining (e.g.\ by using \verb|Drule.multi_resolves|), while automatic ones just insert the facts |
|
929 |
using \verb|Method.insert_tac| before applying the main tactic. |
|
930 |
||
931 |
\end{description}% |
|
26870 | 932 |
\end{isamarkuptext}% |
933 |
\isamarkuptrue% |
|
934 |
% |
|
935 |
\isamarkupsection{Generalized elimination \label{sec:obtain}% |
|
936 |
} |
|
937 |
\isamarkuptrue% |
|
938 |
% |
|
939 |
\begin{isamarkuptext}% |
|
940 |
\begin{matharray}{rcl} |
|
28788 | 941 |
\indexdef{}{command}{obtain}\hypertarget{command.obtain}{\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ proof{\isacharparenleft}chain{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
942 |
\indexdef{}{command}{guess}\hypertarget{command.guess}{\hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isacharbar}\ proof{\isacharparenleft}chain{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}} \\ |
|
26870 | 943 |
\end{matharray} |
944 |
||
945 |
Generalized elimination means that additional elements with certain |
|
946 |
properties may be introduced in the current context, by virtue of a |
|
947 |
locally proven ``soundness statement''. Technically speaking, the |
|
26902 | 948 |
\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} language element is like a declaration of |
949 |
\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}} and \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} (see also see |
|
26870 | 950 |
\secref{sec:proof-context}), together with a soundness proof of its |
951 |
additional claim. According to the nature of existential reasoning, |
|
952 |
assumptions get eliminated from any result exported from the context |
|
953 |
later, provided that the corresponding parameters do \emph{not} |
|
954 |
occur in the conclusion. |
|
955 |
||
956 |
\begin{rail} |
|
957 |
'obtain' parname? (vars + 'and') 'where' (props + 'and') |
|
958 |
; |
|
959 |
'guess' (vars + 'and') |
|
960 |
; |
|
961 |
\end{rail} |
|
962 |
||
26902 | 963 |
The derived Isar command \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} is defined as follows |
26870 | 964 |
(where \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ b\isactrlsub k{\isachardoublequote}} shall refer to (optional) |
965 |
facts indicated for forward chaining). |
|
966 |
\begin{matharray}{l} |
|
26902 | 967 |
\isa{{\isachardoublequote}{\isasymlangle}using\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub k{\isasymrangle}{\isachardoublequote}}~~\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m\ {\isasymWHERE}\ a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ \ {\isasymlangle}proof{\isasymrangle}\ {\isasymequiv}{\isachardoublequote}} \\[1ex] |
968 |
\quad \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}{\isasymAnd}thesis{\isachardot}\ {\isacharparenleft}{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isacharparenright}\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}} \\ |
|
969 |
\quad \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{succeed} \\ |
|
970 |
\qquad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{thesis} \\ |
|
971 |
\qquad \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}that\ {\isacharbrackleft}Pure{\isachardot}intro{\isacharquery}{\isacharbrackright}{\isacharcolon}\ {\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}} \\ |
|
972 |
\qquad \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{thesis} \\ |
|
973 |
\quad\qquad \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}~\isa{{\isacharminus}} \\ |
|
974 |
\quad\qquad \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub k\ \ {\isasymlangle}proof{\isasymrangle}{\isachardoublequote}} \\ |
|
975 |
\quad \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} \\ |
|
976 |
\quad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardoublequote}}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}\ a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}} \\ |
|
26870 | 977 |
\end{matharray} |
978 |
||
979 |
Typically, the soundness proof is relatively straight-forward, often |
|
26902 | 980 |
just by canonical automated tools such as ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{simp}'' or ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{blast}''. Accordingly, the |
26870 | 981 |
``\isa{that}'' reduction above is declared as simplification and |
982 |
introduction rule. |
|
983 |
||
26902 | 984 |
In a sense, \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} represents at the level of Isar |
26870 | 985 |
proofs what would be meta-logical existential quantifiers and |
986 |
conjunctions. This concept has a broad range of useful |
|
987 |
applications, ranging from plain elimination (or introduction) of |
|
988 |
object-level existential and conjunctions, to elimination over |
|
989 |
results of symbolic evaluation of recursive definitions, for |
|
26902 | 990 |
example. Also note that \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} without parameters acts |
991 |
much like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, where the result is treated as a |
|
26870 | 992 |
genuine assumption. |
993 |
||
994 |
An alternative name to be used instead of ``\isa{that}'' above may |
|
995 |
be given in parentheses. |
|
996 |
||
26902 | 997 |
\medskip The improper variant \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}} is similar to |
998 |
\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}, but derives the obtained statement from the |
|
26870 | 999 |
course of reasoning! The proof starts with a fixed goal \isa{thesis}. The subsequent proof may refine this to anything of the |
1000 |
form like \isa{{\isachardoublequote}{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}}, but must not introduce new subgoals. The |
|
1001 |
final goal state is then used as reduction rule for the obtain |
|
1002 |
scheme described above. Obtained parameters \isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isachardoublequote}} are marked as internal by default, which prevents the |
|
1003 |
proof context from being polluted by ad-hoc variables. The variable |
|
26902 | 1004 |
names and type constraints given as arguments for \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}} |
26870 | 1005 |
specify a prefix of obtained parameters explicitly in the text. |
1006 |
||
26902 | 1007 |
It is important to note that the facts introduced by \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} and \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}} may not be polymorphic: any |
26870 | 1008 |
type-variables occurring here are fixed in the present context!% |
1009 |
\end{isamarkuptext}% |
|
1010 |
\isamarkuptrue% |
|
1011 |
% |
|
1012 |
\isamarkupsection{Calculational reasoning \label{sec:calculation}% |
|
1013 |
} |
|
1014 |
\isamarkuptrue% |
|
1015 |
% |
|
1016 |
\begin{isamarkuptext}% |
|
1017 |
\begin{matharray}{rcl} |
|
28788 | 1018 |
\indexdef{}{command}{also}\hypertarget{command.also}{\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
1019 |
\indexdef{}{command}{finally}\hypertarget{command.finally}{\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} \\ |
|
1020 |
\indexdef{}{command}{moreover}\hypertarget{command.moreover}{\hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
|
1021 |
\indexdef{}{command}{ultimately}\hypertarget{command.ultimately}{\hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} \\ |
|
1022 |
\indexdef{}{command}{print\_trans\_rules}\hypertarget{command.print-trans-rules}{\hyperlink{command.print-trans-rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}trans{\isacharunderscore}rules}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\ |
|
1023 |
\hyperlink{attribute.trans}{\mbox{\isa{trans}}} & : & \isa{attribute} \\ |
|
1024 |
\hyperlink{attribute.sym}{\mbox{\isa{sym}}} & : & \isa{attribute} \\ |
|
1025 |
\hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}} & : & \isa{attribute} \\ |
|
26870 | 1026 |
\end{matharray} |
1027 |
||
1028 |
Calculational proof is forward reasoning with implicit application |
|
1029 |
of transitivity rules (such those of \isa{{\isachardoublequote}{\isacharequal}{\isachardoublequote}}, \isa{{\isachardoublequote}{\isasymle}{\isachardoublequote}}, |
|
1030 |
\isa{{\isachardoublequote}{\isacharless}{\isachardoublequote}}). Isabelle/Isar maintains an auxiliary fact register |
|
26902 | 1031 |
\indexref{}{fact}{calculation}\hyperlink{fact.calculation}{\mbox{\isa{calculation}}} for accumulating results obtained by |
1032 |
transitivity composed with the current result. Command \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} updates \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} involving \hyperlink{fact.this}{\mbox{\isa{this}}}, while |
|
1033 |
\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} exhibits the final \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by |
|
26870 | 1034 |
forward chaining towards the next goal statement. Both commands |
1035 |
require valid current facts, i.e.\ may occur only after commands |
|
26902 | 1036 |
that produce theorems such as \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}, or some finished proof of \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} etc. The \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} and \hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}} |
1037 |
commands are similar to \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}, |
|
1038 |
but only collect further results in \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} without |
|
26870 | 1039 |
applying any rules yet. |
1040 |
||
1041 |
Also note that the implicit term abbreviation ``\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}'' has |
|
1042 |
its canonical application with calculational proofs. It refers to |
|
1043 |
the argument of the preceding statement. (The argument of a curried |
|
1044 |
infix expression happens to be its right-hand side.) |
|
1045 |
||
1046 |
Isabelle/Isar calculations are implicitly subject to block structure |
|
1047 |
in the sense that new threads of calculational reasoning are |
|
1048 |
commenced for any new block (as opened by a local goal, for |
|
1049 |
example). This means that, apart from being able to nest |
|
1050 |
calculations, there is no separate \emph{begin-calculation} command |
|
1051 |
required. |
|
1052 |
||
1053 |
\medskip The Isar calculation proof commands may be defined as |
|
1054 |
follows:\footnote{We suppress internal bookkeeping such as proper |
|
1055 |
handling of block-structure.} |
|
1056 |
||
1057 |
\begin{matharray}{rcl} |
|
26902 | 1058 |
\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isachardoublequote}\isactrlsub {\isadigit{0}}{\isachardoublequote}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ this{\isachardoublequote}} \\ |
1059 |
\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isachardoublequote}\isactrlsub n\isactrlsub {\isacharplus}\isactrlsub {\isadigit{1}}{\isachardoublequote}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ trans\ {\isacharbrackleft}OF\ calculation\ this{\isacharbrackright}{\isachardoublequote}} \\[0.5ex] |
|
1060 |
\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} & \equiv & \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{calculation} \\[0.5ex] |
|
1061 |
\hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ calculation\ this{\isachardoublequote}} \\ |
|
1062 |
\hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}} & \equiv & \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{calculation} \\ |
|
26870 | 1063 |
\end{matharray} |
1064 |
||
1065 |
\begin{rail} |
|
1066 |
('also' | 'finally') ('(' thmrefs ')')? |
|
1067 |
; |
|
1068 |
'trans' (() | 'add' | 'del') |
|
1069 |
; |
|
1070 |
\end{rail} |
|
1071 |
||
28788 | 1072 |
\begin{description} |
26870 | 1073 |
|
28788 | 1074 |
\item \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\isa{{\isachardoublequote}{\isacharparenleft}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharparenright}{\isachardoublequote}} maintains the auxiliary |
1075 |
\hyperlink{fact.calculation}{\mbox{\isa{calculation}}} register as follows. The first occurrence of |
|
1076 |
\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} in some calculational thread initializes \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by \hyperlink{fact.this}{\mbox{\isa{this}}}. Any subsequent \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} on |
|
1077 |
the same level of block-structure updates \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by |
|
1078 |
some transitivity rule applied to \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} and \hyperlink{fact.this}{\mbox{\isa{this}}} (in that order). Transitivity rules are picked from the |
|
1079 |
current context, unless alternative rules are given as explicit |
|
1080 |
arguments. |
|
26870 | 1081 |
|
28788 | 1082 |
\item \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\isa{{\isachardoublequote}{\isacharparenleft}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharparenright}{\isachardoublequote}} maintaining \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} in the same way as \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}, and concludes the |
1083 |
current calculational thread. The final result is exhibited as fact |
|
1084 |
for forward chaining towards the next goal. Basically, \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} just abbreviates \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\hyperlink{fact.calculation}{\mbox{\isa{calculation}}}. Typical idioms for concluding |
|
1085 |
calculational proofs are ``\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{{\isacharquery}thesis}~\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' and ``\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isasymphi}}~\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}''. |
|
26870 | 1086 |
|
28788 | 1087 |
\item \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} and \hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}} are |
26902 | 1088 |
analogous to \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}, but collect |
26870 | 1089 |
results only, without applying rules. |
1090 |
||
28788 | 1091 |
\item \hyperlink{command.print-trans-rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}trans{\isacharunderscore}rules}}}} prints the list of transitivity |
1092 |
rules (for calculational commands \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}) and symmetry rules (for the \hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}} |
|
1093 |
operation and single step elimination patters) of the current |
|
1094 |
context. |
|
26870 | 1095 |
|
28788 | 1096 |
\item \hyperlink{attribute.trans}{\mbox{\isa{trans}}} declares theorems as transitivity rules. |
26870 | 1097 |
|
28788 | 1098 |
\item \hyperlink{attribute.sym}{\mbox{\isa{sym}}} declares symmetry rules, as well as |
26902 | 1099 |
\hyperlink{attribute.Pure.elim}{\mbox{\isa{Pure{\isachardot}elim}}}\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}} rules. |
26870 | 1100 |
|
28788 | 1101 |
\item \hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}} resolves a theorem with some rule |
26902 | 1102 |
declared as \hyperlink{attribute.sym}{\mbox{\isa{sym}}} in the current context. For example, |
1103 |
``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}{\isacharbrackleft}symmetric{\isacharbrackright}{\isacharcolon}\ x\ {\isacharequal}\ y{\isachardoublequote}}'' produces a |
|
26870 | 1104 |
swapped fact derived from that assumption. |
1105 |
||
1106 |
In structured proof texts it is often more appropriate to use an |
|
26902 | 1107 |
explicit single-step elimination proof, such as ``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}x\ {\isacharequal}\ y{\isachardoublequote}}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}y\ {\isacharequal}\ x{\isachardoublequote}}~\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}''. |
26870 | 1108 |
|
28788 | 1109 |
\end{description}% |
26870 | 1110 |
\end{isamarkuptext}% |
1111 |
\isamarkuptrue% |
|
1112 |
% |
|
27042 | 1113 |
\isamarkupsection{Proof by cases and induction \label{sec:cases-induct}% |
1114 |
} |
|
1115 |
\isamarkuptrue% |
|
1116 |
% |
|
1117 |
\isamarkupsubsection{Rule contexts% |
|
1118 |
} |
|
1119 |
\isamarkuptrue% |
|
1120 |
% |
|
1121 |
\begin{isamarkuptext}% |
|
1122 |
\begin{matharray}{rcl} |
|
28788 | 1123 |
\indexdef{}{command}{case}\hypertarget{command.case}{\hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}} & : & \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}\ {\isasymrightarrow}\ proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} \\ |
1124 |
\indexdef{}{command}{print\_cases}\hypertarget{command.print-cases}{\hyperlink{command.print-cases}{\mbox{\isa{\isacommand{print{\isacharunderscore}cases}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\ |
|
1125 |
\indexdef{}{attribute}{case\_names}\hypertarget{attribute.case-names}{\hyperlink{attribute.case-names}{\mbox{\isa{case{\isacharunderscore}names}}}} & : & \isa{attribute} \\ |
|
1126 |
\indexdef{}{attribute}{case\_conclusion}\hypertarget{attribute.case-conclusion}{\hyperlink{attribute.case-conclusion}{\mbox{\isa{case{\isacharunderscore}conclusion}}}} & : & \isa{attribute} \\ |
|
1127 |
\indexdef{}{attribute}{params}\hypertarget{attribute.params}{\hyperlink{attribute.params}{\mbox{\isa{params}}}} & : & \isa{attribute} \\ |
|
1128 |
\indexdef{}{attribute}{consumes}\hypertarget{attribute.consumes}{\hyperlink{attribute.consumes}{\mbox{\isa{consumes}}}} & : & \isa{attribute} \\ |
|
27042 | 1129 |
\end{matharray} |
1130 |
||
1131 |
The puristic way to build up Isar proof contexts is by explicit |
|
1132 |
language elements like \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}, \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, |
|
1133 |
\hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}} (see \secref{sec:proof-context}). This is adequate |
|
1134 |
for plain natural deduction, but easily becomes unwieldy in concrete |
|
1135 |
verification tasks, which typically involve big induction rules with |
|
1136 |
several cases. |
|
1137 |
||
1138 |
The \hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}} command provides a shorthand to refer to a |
|
1139 |
local context symbolically: certain proof methods provide an |
|
1140 |
environment of named ``cases'' of the form \isa{{\isachardoublequote}c{\isacharcolon}\ x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isacharcomma}\ {\isasymphi}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymphi}\isactrlsub n{\isachardoublequote}}; the effect of ``\hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}~\isa{c}'' is then equivalent to ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardoublequote}}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}c{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}}''. Term bindings may be covered as well, notably |
|
1141 |
\hyperlink{variable.?case}{\mbox{\isa{{\isacharquery}case}}} for the main conclusion. |
|
1142 |
||
1143 |
By default, the ``terminology'' \isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isachardoublequote}} of |
|
1144 |
a case value is marked as hidden, i.e.\ there is no way to refer to |
|
1145 |
such parameters in the subsequent proof text. After all, original |
|
1146 |
rule parameters stem from somewhere outside of the current proof |
|
1147 |
text. By using the explicit form ``\hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}~\isa{{\isachardoublequote}{\isacharparenleft}c\ y\isactrlsub {\isadigit{1}}\ {\isasymdots}\ y\isactrlsub m{\isacharparenright}{\isachardoublequote}}'' instead, the proof author is able to |
|
1148 |
chose local names that fit nicely into the current context. |
|
1149 |
||
1150 |
\medskip It is important to note that proper use of \hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}} does not provide means to peek at the current goal state, |
|
1151 |
which is not directly observable in Isar! Nonetheless, goal |
|
1152 |
refinement commands do provide named cases \isa{{\isachardoublequote}goal\isactrlsub i{\isachardoublequote}} |
|
1153 |
for each subgoal \isa{{\isachardoublequote}i\ {\isacharequal}\ {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ n{\isachardoublequote}} of the resulting goal state. |
|
1154 |
Using this extra feature requires great care, because some bits of |
|
1155 |
the internal tactical machinery intrude the proof text. In |
|
1156 |
particular, parameter names stemming from the left-over of automated |
|
1157 |
reasoning tools are usually quite unpredictable. |
|
1158 |
||
1159 |
Under normal circumstances, the text of cases emerge from standard |
|
1160 |
elimination or induction rules, which in turn are derived from |
|
1161 |
previous theory specifications in a canonical way (say from |
|
1162 |
\hyperlink{command.inductive}{\mbox{\isa{\isacommand{inductive}}}} definitions). |
|
1163 |
||
1164 |
\medskip Proper cases are only available if both the proof method |
|
1165 |
and the rules involved support this. By using appropriate |
|
1166 |
attributes, case names, conclusions, and parameters may be also |
|
1167 |
declared by hand. Thus variant versions of rules that have been |
|
1168 |
derived manually become ready to use in advanced case analysis |
|
1169 |
later. |
|
1170 |
||
1171 |
\begin{rail} |
|
1172 |
'case' (caseref | '(' caseref ((name | underscore) +) ')') |
|
1173 |
; |
|
1174 |
caseref: nameref attributes? |
|
1175 |
; |
|
1176 |
||
1177 |
'case\_names' (name +) |
|
1178 |
; |
|
1179 |
'case\_conclusion' name (name *) |
|
1180 |
; |
|
1181 |
'params' ((name *) + 'and') |
|
1182 |
; |
|
1183 |
'consumes' nat? |
|
1184 |
; |
|
1185 |
\end{rail} |
|
1186 |
||
28788 | 1187 |
\begin{description} |
27042 | 1188 |
|
28788 | 1189 |
\item \hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}~\isa{{\isachardoublequote}{\isacharparenleft}c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isacharparenright}{\isachardoublequote}} invokes a named local |
1190 |
context \isa{{\isachardoublequote}c{\isacharcolon}\ x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isacharcomma}\ {\isasymphi}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymphi}\isactrlsub m{\isachardoublequote}}, as provided by an |
|
1191 |
appropriate proof method (such as \indexref{}{method}{cases}\hyperlink{method.cases}{\mbox{\isa{cases}}} and |
|
1192 |
\indexref{}{method}{induct}\hyperlink{method.induct}{\mbox{\isa{induct}}}). The command ``\hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}~\isa{{\isachardoublequote}{\isacharparenleft}c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isacharparenright}{\isachardoublequote}}'' abbreviates ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardoublequote}}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}c{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}}''. |
|
27042 | 1193 |
|
28788 | 1194 |
\item \hyperlink{command.print-cases}{\mbox{\isa{\isacommand{print{\isacharunderscore}cases}}}} prints all local contexts of the |
27042 | 1195 |
current state, using Isar proof language notation. |
1196 |
||
28788 | 1197 |
\item \hyperlink{attribute.case-names}{\mbox{\isa{case{\isacharunderscore}names}}}~\isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}\ {\isasymdots}\ c\isactrlsub k{\isachardoublequote}} declares names for |
1198 |
the local contexts of premises of a theorem; \isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub k{\isachardoublequote}} |
|
1199 |
refers to the \emph{suffix} of the list of premises. |
|
27042 | 1200 |
|
28788 | 1201 |
\item \hyperlink{attribute.case-conclusion}{\mbox{\isa{case{\isacharunderscore}conclusion}}}~\isa{{\isachardoublequote}c\ d\isactrlsub {\isadigit{1}}\ {\isasymdots}\ d\isactrlsub k{\isachardoublequote}} declares |
1202 |
names for the conclusions of a named premise \isa{c}; here \isa{{\isachardoublequote}d\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ d\isactrlsub k{\isachardoublequote}} refers to the prefix of arguments of a logical formula |
|
1203 |
built by nesting a binary connective (e.g.\ \isa{{\isachardoublequote}{\isasymor}{\isachardoublequote}}). |
|
27042 | 1204 |
|
1205 |
Note that proof methods such as \hyperlink{method.induct}{\mbox{\isa{induct}}} and \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} already provide a default name for the conclusion as a |
|
1206 |
whole. The need to name subformulas only arises with cases that |
|
1207 |
split into several sub-cases, as in common co-induction rules. |
|
1208 |
||
28788 | 1209 |
\item \hyperlink{attribute.params}{\mbox{\isa{params}}}~\isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub m\ {\isasymAND}\ {\isasymdots}\ q\isactrlsub {\isadigit{1}}\ {\isasymdots}\ q\isactrlsub n{\isachardoublequote}} renames |
1210 |
the innermost parameters of premises \isa{{\isachardoublequote}{\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ n{\isachardoublequote}} of some |
|
1211 |
theorem. An empty list of names may be given to skip positions, |
|
1212 |
leaving the present parameters unchanged. |
|
27042 | 1213 |
|
1214 |
Note that the default usage of case rules does \emph{not} directly |
|
1215 |
expose parameters to the proof context. |
|
1216 |
||
28788 | 1217 |
\item \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}}~\isa{n} declares the number of ``major |
1218 |
premises'' of a rule, i.e.\ the number of facts to be consumed when |
|
1219 |
it is applied by an appropriate proof method. The default value of |
|
1220 |
\hyperlink{attribute.consumes}{\mbox{\isa{consumes}}} is \isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}}, which is appropriate for |
|
1221 |
the usual kind of cases and induction rules for inductive sets (cf.\ |
|
1222 |
\secref{sec:hol-inductive}). Rules without any \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}} declaration given are treated as if \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}}~\isa{{\isadigit{0}}} had been specified. |
|
27042 | 1223 |
|
1224 |
Note that explicit \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}} declarations are only |
|
1225 |
rarely needed; this is already taken care of automatically by the |
|
1226 |
higher-level \hyperlink{attribute.cases}{\mbox{\isa{cases}}}, \hyperlink{attribute.induct}{\mbox{\isa{induct}}}, and |
|
1227 |
\hyperlink{attribute.coinduct}{\mbox{\isa{coinduct}}} declarations. |
|
1228 |
||
28788 | 1229 |
\end{description}% |
27042 | 1230 |
\end{isamarkuptext}% |
1231 |
\isamarkuptrue% |
|
1232 |
% |
|
1233 |
\isamarkupsubsection{Proof methods% |
|
1234 |
} |
|
1235 |
\isamarkuptrue% |
|
1236 |
% |
|
1237 |
\begin{isamarkuptext}% |
|
1238 |
\begin{matharray}{rcl} |
|
28788 | 1239 |
\indexdef{}{method}{cases}\hypertarget{method.cases}{\hyperlink{method.cases}{\mbox{\isa{cases}}}} & : & \isa{method} \\ |
1240 |
\indexdef{}{method}{induct}\hypertarget{method.induct}{\hyperlink{method.induct}{\mbox{\isa{induct}}}} & : & \isa{method} \\ |
|
1241 |
\indexdef{}{method}{coinduct}\hypertarget{method.coinduct}{\hyperlink{method.coinduct}{\mbox{\isa{coinduct}}}} & : & \isa{method} \\ |
|
27042 | 1242 |
\end{matharray} |
1243 |
||
1244 |
The \hyperlink{method.cases}{\mbox{\isa{cases}}}, \hyperlink{method.induct}{\mbox{\isa{induct}}}, and \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} |
|
1245 |
methods provide a uniform interface to common proof techniques over |
|
1246 |
datatypes, inductive predicates (or sets), recursive functions etc. |
|
1247 |
The corresponding rules may be specified and instantiated in a |
|
1248 |
casual manner. Furthermore, these methods provide named local |
|
1249 |
contexts that may be invoked via the \hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}} proof command |
|
1250 |
within the subsequent proof text. This accommodates compact proof |
|
1251 |
texts even when reasoning about large specifications. |
|
1252 |
||
1253 |
The \hyperlink{method.induct}{\mbox{\isa{induct}}} method also provides some additional |
|
1254 |
infrastructure in order to be applicable to structure statements |
|
1255 |
(either using explicit meta-level connectives, or including facts |
|
1256 |
and parameters separately). This avoids cumbersome encoding of |
|
1257 |
``strengthened'' inductive statements within the object-logic. |
|
1258 |
||
1259 |
\begin{rail} |
|
1260 |
'cases' (insts * 'and') rule? |
|
1261 |
; |
|
1262 |
'induct' (definsts * 'and') \\ arbitrary? taking? rule? |
|
1263 |
; |
|
1264 |
'coinduct' insts taking rule? |
|
1265 |
; |
|
1266 |
||
1267 |
rule: ('type' | 'pred' | 'set') ':' (nameref +) | 'rule' ':' (thmref +) |
|
1268 |
; |
|
1269 |
definst: name ('==' | equiv) term | inst |
|
1270 |
; |
|
1271 |
definsts: ( definst *) |
|
1272 |
; |
|
1273 |
arbitrary: 'arbitrary' ':' ((term *) 'and' +) |
|
1274 |
; |
|
1275 |
taking: 'taking' ':' insts |
|
1276 |
; |
|
1277 |
\end{rail} |
|
1278 |
||
28788 | 1279 |
\begin{description} |
27042 | 1280 |
|
28788 | 1281 |
\item \hyperlink{method.cases}{\mbox{\isa{cases}}}~\isa{{\isachardoublequote}insts\ R{\isachardoublequote}} applies method \hyperlink{method.rule}{\mbox{\isa{rule}}} with an appropriate case distinction theorem, instantiated to |
27042 | 1282 |
the subjects \isa{insts}. Symbolic case names are bound according |
1283 |
to the rule's local contexts. |
|
1284 |
||
1285 |
The rule is determined as follows, according to the facts and |
|
1286 |
arguments passed to the \hyperlink{method.cases}{\mbox{\isa{cases}}} method: |
|
1287 |
||
1288 |
\medskip |
|
1289 |
\begin{tabular}{llll} |
|
1290 |
facts & & arguments & rule \\\hline |
|
1291 |
& \hyperlink{method.cases}{\mbox{\isa{cases}}} & & classical case split \\ |
|
1292 |
& \hyperlink{method.cases}{\mbox{\isa{cases}}} & \isa{t} & datatype exhaustion (type of \isa{t}) \\ |
|
1293 |
\isa{{\isachardoublequote}{\isasymturnstile}\ A\ t{\isachardoublequote}} & \hyperlink{method.cases}{\mbox{\isa{cases}}} & \isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & inductive predicate/set elimination (of \isa{A}) \\ |
|
1294 |
\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & \hyperlink{method.cases}{\mbox{\isa{cases}}} & \isa{{\isachardoublequote}{\isasymdots}\ rule{\isacharcolon}\ R{\isachardoublequote}} & explicit rule \isa{R} \\ |
|
1295 |
\end{tabular} |
|
1296 |
\medskip |
|
1297 |
||
1298 |
Several instantiations may be given, referring to the \emph{suffix} |
|
1299 |
of premises of the case rule; within each premise, the \emph{prefix} |
|
1300 |
of variables is instantiated. In most situations, only a single |
|
1301 |
term needs to be specified; this refers to the first variable of the |
|
1302 |
last premise (it is usually the same for all cases). |
|
1303 |
||
28788 | 1304 |
\item \hyperlink{method.induct}{\mbox{\isa{induct}}}~\isa{{\isachardoublequote}insts\ R{\isachardoublequote}} is analogous to the |
27042 | 1305 |
\hyperlink{method.cases}{\mbox{\isa{cases}}} method, but refers to induction rules, which are |
1306 |
determined as follows: |
|
1307 |
||
1308 |
\medskip |
|
1309 |
\begin{tabular}{llll} |
|
1310 |
facts & & arguments & rule \\\hline |
|
1311 |
& \hyperlink{method.induct}{\mbox{\isa{induct}}} & \isa{{\isachardoublequote}P\ x{\isachardoublequote}} & datatype induction (type of \isa{x}) \\ |
|
1312 |
\isa{{\isachardoublequote}{\isasymturnstile}\ A\ x{\isachardoublequote}} & \hyperlink{method.induct}{\mbox{\isa{induct}}} & \isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & predicate/set induction (of \isa{A}) \\ |
|
1313 |
\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & \hyperlink{method.induct}{\mbox{\isa{induct}}} & \isa{{\isachardoublequote}{\isasymdots}\ rule{\isacharcolon}\ R{\isachardoublequote}} & explicit rule \isa{R} \\ |
|
1314 |
\end{tabular} |
|
1315 |
\medskip |
|
1316 |
||
1317 |
Several instantiations may be given, each referring to some part of |
|
1318 |
a mutual inductive definition or datatype --- only related partial |
|
1319 |
induction rules may be used together, though. Any of the lists of |
|
1320 |
terms \isa{{\isachardoublequote}P{\isacharcomma}\ x{\isacharcomma}\ {\isasymdots}{\isachardoublequote}} refers to the \emph{suffix} of variables |
|
1321 |
present in the induction rule. This enables the writer to specify |
|
1322 |
only induction variables, or both predicates and variables, for |
|
1323 |
example. |
|
1324 |
||
1325 |
Instantiations may be definitional: equations \isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}} |
|
1326 |
introduce local definitions, which are inserted into the claim and |
|
1327 |
discharged after applying the induction rule. Equalities reappear |
|
1328 |
in the inductive cases, but have been transformed according to the |
|
1329 |
induction principle being involved here. In order to achieve |
|
1330 |
practically useful induction hypotheses, some variables occurring in |
|
1331 |
\isa{t} need to be fixed (see below). |
|
1332 |
||
1333 |
The optional ``\isa{{\isachardoublequote}arbitrary{\isacharcolon}\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardoublequote}}'' |
|
1334 |
specification generalizes variables \isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isachardoublequote}} of the original goal before applying induction. Thus |
|
1335 |
induction hypotheses may become sufficiently general to get the |
|
1336 |
proof through. Together with definitional instantiations, one may |
|
1337 |
effectively perform induction over expressions of a certain |
|
1338 |
structure. |
|
1339 |
||
1340 |
The optional ``\isa{{\isachardoublequote}taking{\isacharcolon}\ t\isactrlsub {\isadigit{1}}\ {\isasymdots}\ t\isactrlsub n{\isachardoublequote}}'' |
|
1341 |
specification provides additional instantiations of a prefix of |
|
1342 |
pending variables in the rule. Such schematic induction rules |
|
1343 |
rarely occur in practice, though. |
|
1344 |
||
28788 | 1345 |
\item \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}}~\isa{{\isachardoublequote}inst\ R{\isachardoublequote}} is analogous to the |
27042 | 1346 |
\hyperlink{method.induct}{\mbox{\isa{induct}}} method, but refers to coinduction rules, which are |
1347 |
determined as follows: |
|
1348 |
||
1349 |
\medskip |
|
1350 |
\begin{tabular}{llll} |
|
1351 |
goal & & arguments & rule \\\hline |
|
1352 |
& \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} & \isa{x} & type coinduction (type of \isa{x}) \\ |
|
1353 |
\isa{{\isachardoublequote}A\ x{\isachardoublequote}} & \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} & \isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & predicate/set coinduction (of \isa{A}) \\ |
|
1354 |
\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} & \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} & \isa{{\isachardoublequote}{\isasymdots}\ rule{\isacharcolon}\ R{\isachardoublequote}} & explicit rule \isa{R} \\ |
|
1355 |
\end{tabular} |
|
1356 |
||
1357 |
Coinduction is the dual of induction. Induction essentially |
|
1358 |
eliminates \isa{{\isachardoublequote}A\ x{\isachardoublequote}} towards a generic result \isa{{\isachardoublequote}P\ x{\isachardoublequote}}, |
|
1359 |
while coinduction introduces \isa{{\isachardoublequote}A\ x{\isachardoublequote}} starting with \isa{{\isachardoublequote}B\ x{\isachardoublequote}}, for a suitable ``bisimulation'' \isa{B}. The cases of a |
|
1360 |
coinduct rule are typically named after the predicates or sets being |
|
1361 |
covered, while the conclusions consist of several alternatives being |
|
1362 |
named after the individual destructor patterns. |
|
1363 |
||
1364 |
The given instantiation refers to the \emph{suffix} of variables |
|
1365 |
occurring in the rule's major premise, or conclusion if unavailable. |
|
1366 |
An additional ``\isa{{\isachardoublequote}taking{\isacharcolon}\ t\isactrlsub {\isadigit{1}}\ {\isasymdots}\ t\isactrlsub n{\isachardoublequote}}'' |
|
1367 |
specification may be required in order to specify the bisimulation |
|
1368 |
to be used in the coinduction step. |
|
1369 |
||
28788 | 1370 |
\end{description} |
27042 | 1371 |
|
1372 |
Above methods produce named local contexts, as determined by the |
|
1373 |
instantiated rule as given in the text. Beyond that, the \hyperlink{method.induct}{\mbox{\isa{induct}}} and \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} methods guess further instantiations |
|
1374 |
from the goal specification itself. Any persisting unresolved |
|
1375 |
schematic variables of the resulting rule will render the the |
|
1376 |
corresponding case invalid. The term binding \hyperlink{variable.?case}{\mbox{\isa{{\isacharquery}case}}} for |
|
1377 |
the conclusion will be provided with each case, provided that term |
|
1378 |
is fully specified. |
|
1379 |
||
1380 |
The \hyperlink{command.print-cases}{\mbox{\isa{\isacommand{print{\isacharunderscore}cases}}}} command prints all named cases present |
|
1381 |
in the current proof state. |
|
1382 |
||
1383 |
\medskip Despite the additional infrastructure, both \hyperlink{method.cases}{\mbox{\isa{cases}}} |
|
1384 |
and \hyperlink{method.coinduct}{\mbox{\isa{coinduct}}} merely apply a certain rule, after |
|
1385 |
instantiation, while conforming due to the usual way of monotonic |
|
1386 |
natural deduction: the context of a structured statement \isa{{\isachardoublequote}{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ {\isasymdots}{\isachardoublequote}} |
|
1387 |
reappears unchanged after the case split. |
|
1388 |
||
1389 |
The \hyperlink{method.induct}{\mbox{\isa{induct}}} method is fundamentally different in this |
|
1390 |
respect: the meta-level structure is passed through the |
|
1391 |
``recursive'' course involved in the induction. Thus the original |
|
1392 |
statement is basically replaced by separate copies, corresponding to |
|
1393 |
the induction hypotheses and conclusion; the original goal context |
|
1394 |
is no longer available. Thus local assumptions, fixed parameters |
|
1395 |
and definitions effectively participate in the inductive rephrasing |
|
1396 |
of the original statement. |
|
1397 |
||
1398 |
In induction proofs, local assumptions introduced by cases are split |
|
1399 |
into two different kinds: \isa{hyps} stemming from the rule and |
|
1400 |
\isa{prems} from the goal statement. This is reflected in the |
|
1401 |
extracted cases accordingly, so invoking ``\hyperlink{command.case}{\mbox{\isa{\isacommand{case}}}}~\isa{c}'' will provide separate facts \isa{c{\isachardot}hyps} and \isa{c{\isachardot}prems}, |
|
1402 |
as well as fact \isa{c} to hold the all-inclusive list. |
|
1403 |
||
1404 |
\medskip Facts presented to either method are consumed according to |
|
1405 |
the number of ``major premises'' of the rule involved, which is |
|
1406 |
usually 0 for plain cases and induction rules of datatypes etc.\ and |
|
1407 |
1 for rules of inductive predicates or sets and the like. The |
|
1408 |
remaining facts are inserted into the goal verbatim before the |
|
1409 |
actual \isa{cases}, \isa{induct}, or \isa{coinduct} rule is |
|
1410 |
applied.% |
|
1411 |
\end{isamarkuptext}% |
|
1412 |
\isamarkuptrue% |
|
1413 |
% |
|
1414 |
\isamarkupsubsection{Declaring rules% |
|
1415 |
} |
|
1416 |
\isamarkuptrue% |
|
1417 |
% |
|
1418 |
\begin{isamarkuptext}% |
|
1419 |
\begin{matharray}{rcl} |
|
28788 | 1420 |
\indexdef{}{command}{print\_induct\_rules}\hypertarget{command.print-induct-rules}{\hyperlink{command.print-induct-rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}induct{\isacharunderscore}rules}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\ |
1421 |
\indexdef{}{attribute}{cases}\hypertarget{attribute.cases}{\hyperlink{attribute.cases}{\mbox{\isa{cases}}}} & : & \isa{attribute} \\ |
|
1422 |
\indexdef{}{attribute}{induct}\hypertarget{attribute.induct}{\hyperlink{attribute.induct}{\mbox{\isa{induct}}}} & : & \isa{attribute} \\ |
|
1423 |
\indexdef{}{attribute}{coinduct}\hypertarget{attribute.coinduct}{\hyperlink{attribute.coinduct}{\mbox{\isa{coinduct}}}} & : & \isa{attribute} \\ |
|
27042 | 1424 |
\end{matharray} |
1425 |
||
1426 |
\begin{rail} |
|
1427 |
'cases' spec |
|
1428 |
; |
|
1429 |
'induct' spec |
|
1430 |
; |
|
1431 |
'coinduct' spec |
|
1432 |
; |
|
1433 |
||
27142 | 1434 |
spec: (('type' | 'pred' | 'set') ':' nameref) | 'del' |
27042 | 1435 |
; |
1436 |
\end{rail} |
|
1437 |
||
28788 | 1438 |
\begin{description} |
27042 | 1439 |
|
28788 | 1440 |
\item \hyperlink{command.print-induct-rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}induct{\isacharunderscore}rules}}}} prints cases and induct rules |
1441 |
for predicates (or sets) and types of the current context. |
|
27042 | 1442 |
|
28788 | 1443 |
\item \hyperlink{attribute.cases}{\mbox{\isa{cases}}}, \hyperlink{attribute.induct}{\mbox{\isa{induct}}}, and \hyperlink{attribute.coinduct}{\mbox{\isa{coinduct}}} (as attributes) declare rules for reasoning about |
27142 | 1444 |
(co)inductive predicates (or sets) and types, using the |
1445 |
corresponding methods of the same name. Certain definitional |
|
1446 |
packages of object-logics usually declare emerging cases and |
|
1447 |
induction rules as expected, so users rarely need to intervene. |
|
1448 |
||
1449 |
Rules may be deleted via the \isa{{\isachardoublequote}del{\isachardoublequote}} specification, which |
|
1450 |
covers all of the \isa{{\isachardoublequote}type{\isachardoublequote}}/\isa{{\isachardoublequote}pred{\isachardoublequote}}/\isa{{\isachardoublequote}set{\isachardoublequote}} |
|
1451 |
sub-categories simultaneously. For example, \hyperlink{attribute.cases}{\mbox{\isa{cases}}}~\isa{del} removes any \hyperlink{attribute.cases}{\mbox{\isa{cases}}} rules declared for |
|
1452 |
some type, predicate, or set. |
|
27042 | 1453 |
|
1454 |
Manual rule declarations usually refer to the \hyperlink{attribute.case-names}{\mbox{\isa{case{\isacharunderscore}names}}} and \hyperlink{attribute.params}{\mbox{\isa{params}}} attributes to adjust names of |
|
1455 |
cases and parameters of a rule; the \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}} |
|
1456 |
declaration is taken care of automatically: \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}}~\isa{{\isadigit{0}}} is specified for ``type'' rules and \hyperlink{attribute.consumes}{\mbox{\isa{consumes}}}~\isa{{\isadigit{1}}} for ``predicate'' / ``set'' rules. |
|
1457 |
||
28788 | 1458 |
\end{description}% |
27042 | 1459 |
\end{isamarkuptext}% |
1460 |
\isamarkuptrue% |
|
1461 |
% |
|
26869 | 1462 |
\isadelimtheory |
1463 |
% |
|
1464 |
\endisadelimtheory |
|
1465 |
% |
|
1466 |
\isatagtheory |
|
1467 |
\isacommand{end}\isamarkupfalse% |
|
1468 |
% |
|
1469 |
\endisatagtheory |
|
1470 |
{\isafoldtheory}% |
|
1471 |
% |
|
1472 |
\isadelimtheory |
|
1473 |
% |
|
1474 |
\endisadelimtheory |
|
1475 |
\isanewline |
|
1476 |
\end{isabellebody}% |
|
1477 |
%%% Local Variables: |
|
1478 |
%%% mode: latex |
|
1479 |
%%% TeX-master: "root" |
|
1480 |
%%% End: |