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