author | wenzelm |
Wed, 11 Feb 2009 21:41:05 +0100 | |
changeset 29729 | c2e926455fcc |
parent 29721 | df4e53d18ebc |
child 29732 | 0a643dd9e0f5 |
permissions | -rw-r--r-- |
29716 | 1 |
theory Framework |
2 |
imports Main |
|
3 |
begin |
|
4 |
||
5 |
chapter {* The Isabelle/Isar Framework \label{ch:isar-framework} *} |
|
6 |
||
7 |
text {* |
|
8 |
Isabelle/Isar |
|
9 |
\cite{Wenzel:1999:TPHOL,Wenzel-PhD,Nipkow-TYPES02,Wenzel-Paulson:2006,Wenzel:2006:Festschrift} |
|
10 |
is intended as a generic framework for developing formal |
|
11 |
mathematical documents with full proof checking. Definitions and |
|
12 |
proofs are organized as theories; an assembly of theory sources may |
|
13 |
be presented as a printed document; see also |
|
14 |
\chref{ch:document-prep}. |
|
15 |
||
16 |
The main objective of Isar is the design of a human-readable |
|
17 |
structured proof language, which is called the ``primary proof |
|
18 |
format'' in Isar terminology. Such a primary proof language is |
|
19 |
somewhere in the middle between the extremes of primitive proof |
|
20 |
objects and actual natural language. In this respect, Isar is a bit |
|
21 |
more formalistic than Mizar |
|
22 |
\cite{Trybulec:1993:MizarFeatures,Rudnicki:1992:MizarOverview,Wiedijk:1999:Mizar}, |
|
23 |
using logical symbols for certain reasoning schemes where Mizar |
|
24 |
would prefer English words; see \cite{Wenzel-Wiedijk:2002} for |
|
25 |
further comparisons of these systems. |
|
26 |
||
27 |
So Isar challenges the traditional way of recording informal proofs |
|
28 |
in mathematical prose, as well as the common tendency to see fully |
|
29 |
formal proofs directly as objects of some logical calculus (e.g.\ |
|
30 |
@{text "\<lambda>"}-terms in a version of type theory). In fact, Isar is |
|
31 |
better understood as an interpreter of a simple block-structured |
|
32 |
language for describing data flow of local facts and goals, |
|
33 |
interspersed with occasional invocations of proof methods. |
|
34 |
Everything is reduced to logical inferences internally, but these |
|
35 |
steps are somewhat marginal compared to the overall bookkeeping of |
|
36 |
the interpretation process. Thanks to careful design of the syntax |
|
37 |
and semantics of Isar language elements, a formal record of Isar |
|
38 |
instructions may later appear as an intelligible text to the |
|
39 |
attentive reader. |
|
40 |
||
41 |
The Isar proof language has emerged from careful analysis of some |
|
42 |
inherent virtues of the existing logical framework of Isabelle/Pure |
|
43 |
\cite{paulson-found,paulson700}, notably composition of higher-order |
|
44 |
natural deduction rules, which is a generalization of Gentzen's |
|
45 |
original calculus \cite{Gentzen:1935}. The approach of generic |
|
46 |
inference systems in Pure is continued by Isar towards actual proof |
|
47 |
texts. |
|
48 |
||
49 |
Concrete applications require another intermediate layer: an |
|
50 |
object-logic. Isabelle/HOL \cite{isa-tutorial} (simply-typed |
|
51 |
set-theory) is being used most of the time; Isabelle/ZF |
|
52 |
\cite{isabelle-ZF} is less extensively developed, although it would |
|
53 |
probably fit better for classical mathematics. |
|
29721 | 54 |
|
55 |
\medskip In order to illustrate typical natural deduction reasoning |
|
56 |
in Isar, we shall refer to the background theory and library of |
|
57 |
Isabelle/HOL. This includes common notions of predicate logic, |
|
58 |
naive set-theory etc.\ using fairly standard mathematical notation. |
|
59 |
From the perspective of generic natural deduction there is nothing |
|
60 |
special about the logical connectives of HOL (@{text "\<and>"}, @{text |
|
61 |
"\<or>"}, @{text "\<forall>"}, @{text "\<exists>"}, etc.), only the resulting reasoning |
|
62 |
principles are relevant to the user. There are similar rules |
|
63 |
available for set-theory operators (@{text "\<inter>"}, @{text "\<union>"}, @{text |
|
64 |
"\<Inter>"}, @{text "\<Union>"}, etc.), or any other theory developed in the |
|
65 |
library (lattice theory, topology etc.). |
|
66 |
||
67 |
Subsequently we briefly review fragments of Isar proof texts |
|
68 |
corresponding directly to such general natural deduction schemes. |
|
69 |
The examples shall refer to set-theory, to minimize the danger of |
|
70 |
understanding connectives of predicate logic as something special. |
|
71 |
||
72 |
\medskip The following deduction performs @{text "\<inter>"}-introduction, |
|
73 |
working forwards from assumptions towards the conclusion. We give |
|
74 |
both the Isar text, and depict the primitive rule involved, as |
|
75 |
determined by unification of the problem against rules from the |
|
76 |
context. |
|
77 |
*} |
|
78 |
||
79 |
text_raw {*\medskip\begin{minipage}{0.6\textwidth}*} |
|
80 |
||
81 |
(*<*) |
|
82 |
lemma True |
|
83 |
proof |
|
84 |
(*>*) |
|
85 |
assume "x \<in> A" and "x \<in> B" |
|
86 |
then have "x \<in> A \<inter> B" .. |
|
87 |
(*<*) |
|
88 |
qed |
|
89 |
(*>*) |
|
90 |
||
91 |
text_raw {*\end{minipage}\begin{minipage}{0.4\textwidth}*} |
|
92 |
||
93 |
text {* |
|
94 |
\infer{@{prop "x \<in> A \<inter> B"}}{@{prop "x \<in> A"} & @{prop "x \<in> B"}} |
|
95 |
*} |
|
96 |
||
97 |
text_raw {*\end{minipage}*} |
|
98 |
||
99 |
text {* |
|
100 |
\medskip\noindent Note that @{command "assume"} augments the |
|
101 |
context, @{command "then"} indicates that the current facts shall be |
|
102 |
used in the next step, and @{command "have"} states a local claim. |
|
103 |
The two dots ``@{command ".."}'' above refer to a complete proof of |
|
104 |
the claim, using the indicated facts and a canonical rule from the |
|
105 |
context. We could have been more explicit here by spelling out the |
|
106 |
final proof step via the @{command "by"} command: |
|
107 |
*} |
|
108 |
||
109 |
(*<*) |
|
110 |
lemma True |
|
111 |
proof |
|
112 |
(*>*) |
|
113 |
assume "x \<in> A" and "x \<in> B" |
|
114 |
then have "x \<in> A \<inter> B" by (rule IntI) |
|
115 |
(*<*) |
|
116 |
qed |
|
117 |
(*>*) |
|
118 |
||
119 |
text {* |
|
120 |
\noindent The format of the @{text "\<inter>"}-introduction rule represents |
|
121 |
the most basic inference, which proceeds from given premises to a |
|
122 |
conclusion, without any additional context involved. |
|
123 |
||
124 |
\medskip The next example performs backwards introduction on @{term |
|
125 |
"\<Inter>\<A>"}, the intersection of all sets within a given set. This |
|
126 |
requires a nested proof of set membership within a local context of |
|
127 |
an arbitrary-but-fixed member of the collection: |
|
128 |
*} |
|
129 |
||
130 |
text_raw {*\medskip\begin{minipage}{0.6\textwidth}*} |
|
131 |
||
132 |
(*<*) |
|
133 |
lemma True |
|
134 |
proof |
|
135 |
(*>*) |
|
136 |
have "x \<in> \<Inter>\<A>" |
|
137 |
proof |
|
138 |
fix A |
|
139 |
assume "A \<in> \<A>" |
|
140 |
show "x \<in> A" sorry |
|
141 |
qed |
|
142 |
(*<*) |
|
143 |
qed |
|
144 |
(*>*) |
|
145 |
||
146 |
text_raw {*\end{minipage}\begin{minipage}{0.4\textwidth}*} |
|
147 |
||
148 |
text {* |
|
149 |
\infer{@{prop "x \<in> \<Inter>\<A>"}}{\infer*{@{prop "x \<in> A"}}{@{text "[A][A \<in> \<A>]"}}} |
|
150 |
*} |
|
151 |
||
152 |
text_raw {*\end{minipage}*} |
|
153 |
||
154 |
text {* |
|
155 |
\medskip\noindent This Isar reasoning pattern again refers to the |
|
156 |
primitive rule depicted above. The system determines it in the |
|
157 |
``@{command "proof"}'' step, which could have been spelt out more |
|
29729
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
158 |
explicitly as ``@{command "proof"}~@{text "(rule InterI)"}''. Note |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
159 |
that this rule involves both a local parameter @{term "A"} and an |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
160 |
assumption @{prop "A \<in> \<A>"} in the nested reasoning. This kind of |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
161 |
compound rule typically demands a genuine sub-proof in Isar, working |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
162 |
backwards rather than forwards as seen before. In the proof body we |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
163 |
encounter the @{command "fix"}-@{command "assume"}-@{command "show"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
164 |
skeleton of nested sub-proofs that is typical for Isar. The final |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
165 |
@{command "show"} is like @{command "have"} followed by an |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
166 |
additional refinement of the enclosing claim, using the rule derived |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
167 |
from the proof body. The @{command "sorry"} command stands for a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
168 |
hole in the proof --- it may be understood as an excuse for not |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
169 |
providing a proper proof yet. |
29721 | 170 |
|
171 |
\medskip The next example involves @{term "\<Union>\<A>"}, which can be |
|
172 |
characterized as the set of all @{term "x"} such that @{prop "\<exists>A. x |
|
173 |
\<in> A \<and> A \<in> \<A>"}. The elimination rule for @{prop "x \<in> \<Union>\<A>"} does |
|
174 |
not mention @{text "\<exists>"} and @{text "\<and>"} at all, but admits to obtain |
|
175 |
directly a local @{term "A"} such that @{prop "x \<in> A"} and @{prop "A |
|
176 |
\<in> \<A>"} hold. This corresponds to the following Isar proof and |
|
177 |
inference rule, respectively: |
|
178 |
*} |
|
179 |
||
180 |
text_raw {*\medskip\begin{minipage}{0.6\textwidth}*} |
|
181 |
||
182 |
(*<*) |
|
183 |
lemma True |
|
184 |
proof |
|
185 |
(*>*) |
|
186 |
assume "x \<in> \<Union>\<A>" |
|
187 |
then have C |
|
188 |
proof |
|
189 |
fix A |
|
190 |
assume "x \<in> A" and "A \<in> \<A>" |
|
191 |
show C sorry |
|
192 |
qed |
|
193 |
(*<*) |
|
194 |
qed |
|
195 |
(*>*) |
|
196 |
||
197 |
text_raw {*\end{minipage}\begin{minipage}{0.4\textwidth}*} |
|
198 |
||
199 |
text {* |
|
200 |
\infer{@{prop "C"}}{@{prop "x \<in> \<Union>\<A>"} & \infer*{@{prop "C"}~}{@{text "[A][x \<in> A, A \<in> \<A>]"}}} |
|
201 |
*} |
|
202 |
||
203 |
text_raw {*\end{minipage}*} |
|
204 |
||
205 |
text {* |
|
206 |
\medskip\noindent Although the Isar proof follows the natural |
|
207 |
deduction rule closely, the text reads not as natural as |
|
208 |
anticipated. There is a double occurrence of an arbitrary |
|
209 |
conclusion @{prop "C"}, which represents the final result, but is |
|
210 |
irrelevant for now. This issue arises for any elimination rule |
|
211 |
involving local parameters. Isar provides the derived language |
|
212 |
element @{command "obtain"}, which is able to perform the same |
|
213 |
elimination proof more conveniently: |
|
214 |
*} |
|
215 |
||
216 |
(*<*) |
|
217 |
lemma True |
|
218 |
proof |
|
219 |
(*>*) |
|
220 |
assume "x \<in> \<Union>\<A>" |
|
221 |
then obtain A where "x \<in> A" and "A \<in> \<A>" .. |
|
222 |
(*<*) |
|
223 |
qed |
|
224 |
(*>*) |
|
225 |
||
226 |
text {* |
|
227 |
\noindent Here we avoid to mention the final conclusion @{prop "C"} |
|
228 |
and return to plain forward reasoning. The rule involved in the |
|
229 |
``@{command ".."}'' proof is the same as before. |
|
29716 | 230 |
*} |
231 |
||
29729
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
232 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
233 |
section {* The Pure framework \label{sec:framework-pure} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
234 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
235 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
236 |
The Pure logic \cite{paulson-found,paulson700} is an intuitionistic |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
237 |
fragment of higher-order logic \cite{church40}. In type-theoretic |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
238 |
parlance, there are three levels of @{text "\<lambda>"}-calculus with |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
239 |
corresponding arrows: @{text "\<Rightarrow>"} for syntactic function space |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
240 |
(terms depending on terms), @{text "\<And>"} for universal quantification |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
241 |
(proofs depending on terms), and @{text "\<Longrightarrow>"} for implication (proofs |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
242 |
depending on proofs). |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
243 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
244 |
On top of this, Pure implements a generic calculus for nested |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
245 |
natural deduction rules, similar to \cite{Schroeder-Heister:1984}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
246 |
Here object-logic inferences are internalized as formulae over |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
247 |
@{text "\<And>"} and @{text "\<Longrightarrow>"}. Combining such rule statements may |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
248 |
involve higher-order unification \cite{paulson-natural}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
249 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
250 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
251 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
252 |
subsection {* Primitive inferences *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
253 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
254 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
255 |
Term syntax provides explicit notation for abstraction @{text "\<lambda>x :: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
256 |
\<alpha>. b(x)"} and application @{text "b a"}, while types are usually |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
257 |
implicit thanks to type-inference; terms of type @{text "prop"} are |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
258 |
called propositions. Logical statements are composed via @{text "\<And>x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
259 |
:: \<alpha>. B(x)"} and @{text "A \<Longrightarrow> B"}. Primitive reasoning operates on |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
260 |
judgments of the form @{text "\<Gamma> \<turnstile> \<phi>"}, with standard introduction |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
261 |
and elimination rules for @{text "\<And>"} and @{text "\<Longrightarrow>"} that refer to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
262 |
fixed parameters @{text "x\<^isub>1, \<dots>, x\<^isub>m"} and hypotheses |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
263 |
@{text "A\<^isub>1, \<dots>, A\<^isub>n"} from the context @{text "\<Gamma>"}; |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
264 |
the corresponding proof terms are left implicit. The subsequent |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
265 |
inference rules define @{text "\<Gamma> \<turnstile> \<phi>"} inductively, relative to a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
266 |
collection of axioms: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
267 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
268 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
269 |
\infer{@{text "\<turnstile> A"}}{(@{text "A"} \text{~axiom})} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
270 |
\qquad |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
271 |
\infer{@{text "A \<turnstile> A"}}{} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
272 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
273 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
274 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
275 |
\infer{@{text "\<Gamma> \<turnstile> \<And>x. B(x)"}}{@{text "\<Gamma> \<turnstile> B(x)"} & @{text "x \<notin> \<Gamma>"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
276 |
\qquad |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
277 |
\infer{@{text "\<Gamma> \<turnstile> B(a)"}}{@{text "\<Gamma> \<turnstile> \<And>x. B(x)"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
278 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
279 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
280 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
281 |
\infer{@{text "\<Gamma> - A \<turnstile> A \<Longrightarrow> B"}}{@{text "\<Gamma> \<turnstile> B"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
282 |
\qquad |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
283 |
\infer{@{text "\<Gamma>\<^sub>1 \<union> \<Gamma>\<^sub>2 \<turnstile> B"}}{@{text "\<Gamma>\<^sub>1 \<turnstile> A \<Longrightarrow> B"} & @{text "\<Gamma>\<^sub>2 \<turnstile> A"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
284 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
285 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
286 |
Furthermore, Pure provides a built-in equality @{text "\<equiv> :: \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
287 |
prop"} with axioms for reflexivity, substitution, extensionality, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
288 |
and @{text "\<alpha>\<beta>\<eta>"}-conversion on @{text "\<lambda>"}-terms. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
289 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
290 |
\medskip An object-logic introduces another layer on top of Pure, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
291 |
e.g.\ with types @{text "i"} for individuals and @{text "o"} for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
292 |
propositions, term constants @{text "Trueprop :: o \<Rightarrow> prop"} as |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
293 |
(implicit) derivability judgment and connectives like @{text "\<and> :: o |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
294 |
\<Rightarrow> o \<Rightarrow> o"} or @{text "\<forall> :: (i \<Rightarrow> o) \<Rightarrow> o"}, and axioms for object-level |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
295 |
rules such as @{text "conjI: A \<Longrightarrow> B \<Longrightarrow> A \<and> B"} or @{text "allI: (\<And>x. B |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
296 |
x) \<Longrightarrow> \<forall>x. B x"}. Derived object rules are represented as theorems of |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
297 |
Pure. After the initial object-logic setup, further axiomatizations |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
298 |
are usually avoided; plain definitions and derived principles are |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
299 |
used exclusively. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
300 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
301 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
302 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
303 |
subsection {* Reasoning with rules \label{sec:framework-resolution} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
304 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
305 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
306 |
Primitive inferences mostly serve foundational purposes. The main |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
307 |
reasoning mechanisms of Pure operate on nested natural deduction |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
308 |
rules expressed as formulae, using @{text "\<And>"} to bind local |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
309 |
parameters and @{text "\<Longrightarrow>"} to express entailment. Multiple |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
310 |
parameters and premises are represented by repeating these |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
311 |
connectives in a right-associative fashion. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
312 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
313 |
Since @{text "\<And>"} and @{text "\<Longrightarrow>"} commute thanks to the theorem |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
314 |
@{prop "(A \<Longrightarrow> (\<And>x. B x)) \<equiv> (\<And>x. A \<Longrightarrow> B x)"}, we may assume w.l.o.g.\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
315 |
that rule statements always observe the normal form where |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
316 |
quantifiers are pulled in front of implications at each level of |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
317 |
nesting. This means that any Pure proposition may be presented as a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
318 |
\emph{Hereditary Harrop Formula} \cite{Miller:1991} which is of the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
319 |
form @{text "\<And>x\<^isub>1 \<dots> x\<^isub>m. H\<^isub>1 \<Longrightarrow> \<dots> H\<^isub>n \<Longrightarrow> |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
320 |
A"} for @{text "m, n \<ge> 0"}, and @{text "H\<^isub>1, \<dots>, H\<^isub>n"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
321 |
being recursively of the same format, and @{text "A"} atomic. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
322 |
Following the convention that outermost quantifiers are implicit, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
323 |
Horn clauses @{text "A\<^isub>1 \<Longrightarrow> \<dots> A\<^isub>n \<Longrightarrow> A"} are a special |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
324 |
case of this. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
325 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
326 |
\medskip Goals are also represented as rules: @{text "A\<^isub>1 \<Longrightarrow> |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
327 |
\<dots> A\<^isub>n \<Longrightarrow> C"} states that the sub-goals @{text "A\<^isub>1, \<dots>, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
328 |
A\<^isub>n"} entail the result @{text "C"}; for @{text "n = 0"} the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
329 |
goal is finished. To allow @{text "C"} being a rule statement |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
330 |
itself, we introduce the protective marker @{text "# :: prop \<Rightarrow> |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
331 |
prop"}, which is defined as identity and hidden from the user. We |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
332 |
initialize and finish goal states as follows: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
333 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
334 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
335 |
\begin{array}{c@ {\qquad}c} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
336 |
\infer[(@{inference_def init})]{@{text "C \<Longrightarrow> #C"}}{} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
337 |
\infer[(@{inference_def finish})]{@{text C}}{@{text "#C"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
338 |
\end{array} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
339 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
340 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
341 |
Goal states are refined in intermediate proof steps until a finished |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
342 |
form is achieved. Here the two main reasoning principles are |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
343 |
@{inference resolution}, for back-chaining a rule against a sub-goal |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
344 |
(replacing it by zero or more sub-goals), and @{inference |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
345 |
assumption}, for solving a sub-goal (finding a short-circuit with |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
346 |
local assumptions). Below @{text "\<^vec>x"} stands for @{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
347 |
"x\<^isub>1, \<dots>, x\<^isub>n"} (@{text "n \<ge> 0"}). |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
348 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
349 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
350 |
\infer[(@{inference_def resolution})] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
351 |
{@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> \<^vec>A (\<^vec>a \<^vec>x))\<vartheta> \<Longrightarrow> C\<vartheta>"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
352 |
{\begin{tabular}{rl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
353 |
@{text "rule:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
354 |
@{text "\<^vec>A \<^vec>a \<Longrightarrow> B \<^vec>a"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
355 |
@{text "goal:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
356 |
@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> B' \<^vec>x) \<Longrightarrow> C"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
357 |
@{text "goal unifier:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
358 |
@{text "(\<lambda>\<^vec>x. B (\<^vec>a \<^vec>x))\<vartheta> = B'\<vartheta>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
359 |
\end{tabular}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
360 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
361 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
362 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
363 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
364 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
365 |
\infer[(@{inference_def assumption})]{@{text "C\<vartheta>"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
366 |
{\begin{tabular}{rl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
367 |
@{text "goal:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
368 |
@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> A \<^vec>x) \<Longrightarrow> C"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
369 |
@{text "assm unifier:"} & @{text "A\<vartheta> = H\<^sub>i\<vartheta>"}~~\text{(for some~@{text "H\<^sub>i"})} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
370 |
\end{tabular}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
371 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
372 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
373 |
The following trace illustrates goal-oriented reasoning in |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
374 |
Isabelle/Pure: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
375 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
376 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
377 |
\begin{tabular}{r@ {\qquad}l} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
378 |
@{text "(A \<and> B \<Longrightarrow> B \<and> A) \<Longrightarrow> #(A \<and> B \<Longrightarrow> B \<and> A)"} & @{text "(init)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
379 |
@{text "(A \<and> B \<Longrightarrow> B) \<Longrightarrow> (A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(resolution B \<Longrightarrow> A \<Longrightarrow> B \<and> A)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
380 |
@{text "(A \<and> B \<Longrightarrow> A \<and> B) \<Longrightarrow> (A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(resolution A \<and> B \<Longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
381 |
@{text "(A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(assumption)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
382 |
@{text "(A \<and> B \<Longrightarrow> B \<and> A) \<Longrightarrow> #\<dots>"} & @{text "(resolution A \<and> B \<Longrightarrow> A)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
383 |
@{text "#\<dots>"} & @{text "(assumption)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
384 |
@{text "A \<and> B \<Longrightarrow> B \<and> A"} & @{text "(finish)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
385 |
\end{tabular} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
386 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
387 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
388 |
Compositions of @{inference assumption} after @{inference |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
389 |
resolution} occurs quite often, typically in elimination steps. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
390 |
Traditional Isabelle tactics accommodate this by a combined |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
391 |
@{inference_def elim_resolution} principle. In contrast, Isar uses |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
392 |
a slightly more refined combination, where the assumptions to be |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
393 |
closed are marked explicitly, using again the protective marker |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
394 |
@{text "#"}: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
395 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
396 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
397 |
\infer[(@{inference refinement})] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
398 |
{@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> \<^vec>G' (\<^vec>a \<^vec>x))\<vartheta> \<Longrightarrow> C\<vartheta>"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
399 |
{\begin{tabular}{rl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
400 |
@{text "sub\<dash>proof:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
401 |
@{text "\<^vec>G \<^vec>a \<Longrightarrow> B \<^vec>a"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
402 |
@{text "goal:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
403 |
@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> B' \<^vec>x) \<Longrightarrow> C"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
404 |
@{text "goal unifier:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
405 |
@{text "(\<lambda>\<^vec>x. B (\<^vec>a \<^vec>x))\<vartheta> = B'\<vartheta>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
406 |
@{text "assm unifiers:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
407 |
@{text "(\<lambda>\<^vec>x. G\<^sub>j (\<^vec>a \<^vec>x))\<vartheta> = #H\<^sub>i\<vartheta>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
408 |
& \quad (for each marked @{text "G\<^sub>j"} some @{text "#H\<^sub>i"}) \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
409 |
\end{tabular}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
410 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
411 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
412 |
\noindent Here the @{text "sub\<dash>proof"} rule stems from the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
413 |
main @{command "fix"}-@{command "assume"}-@{command "show"} skeleton |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
414 |
of Isar (cf.\ \secref{sec:framework-subproof}): each assumption |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
415 |
indicated in the text results in a marked premise @{text "G"} above. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
416 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
417 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
418 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
419 |
section {* The Isar proof language \label{sec:framework-isar} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
420 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
421 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
422 |
Structured proofs are presented as high-level expressions for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
423 |
composing entities of Pure (propositions, facts, and goals). The |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
424 |
Isar proof language allows to organize reasoning within the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
425 |
underlying rule calculus of Pure, but Isar is not another logical |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
426 |
calculus! |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
427 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
428 |
Isar is an exercise in sound minimalism. Approximately half of the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
429 |
language is introduced as primitive, the rest defined as derived |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
430 |
concepts. The following grammar describes the core language |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
431 |
(category @{text "proof"}), which is embedded into theory |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
432 |
specification elements such as @{command theorem}; see also |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
433 |
\secref{sec:framework-stmt} for the separate category @{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
434 |
"statement"}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
435 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
436 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
437 |
\begin{tabular}{rcl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
438 |
@{text "theory\<dash>stmt"} & = & @{command "theorem"}~@{text "statement proof |"}~~@{command "definition"}~@{text "\<dots> | \<dots>"} \\[1ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
439 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
440 |
@{text "proof"} & = & @{text "prfx\<^sup>*"}~@{command "proof"}~@{text "method\<^sup>? stmt\<^sup>*"}~@{command "qed"}~@{text "method\<^sup>?"} \\[1ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
441 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
442 |
@{text prfx} & = & @{command "using"}~@{text "facts"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
443 |
& @{text "|"} & @{command "unfolding"}~@{text "facts"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
444 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
445 |
@{text stmt} & = & @{command "{"}~@{text "stmt\<^sup>*"}~@{command "}"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
446 |
& @{text "|"} & @{command "next"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
447 |
& @{text "|"} & @{command "note"}~@{text "name = facts"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
448 |
& @{text "|"} & @{command "let"}~@{text "term = term"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
449 |
& @{text "|"} & @{command "fix"}~@{text "var\<^sup>+"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
450 |
& @{text "|"} & @{text "\<ASSM> \<guillemotleft>inference\<guillemotright> name: props"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
451 |
& @{text "|"} & @{command "then"}@{text "\<^sup>?"}~@{text goal} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
452 |
@{text goal} & = & @{command "have"}~@{text "name: props proof"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
453 |
& @{text "|"} & @{command "show"}~@{text "name: props proof"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
454 |
\end{tabular} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
455 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
456 |
\medskip Simultaneous propositions or facts may be separated by the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
457 |
@{keyword "and"} keyword. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
458 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
459 |
\medskip The syntax for terms and propositions is inherited from |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
460 |
Pure (and the object-logic). A @{text "pattern"} is a @{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
461 |
"term"} with schematic variables, to be bound by higher-order |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
462 |
matching. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
463 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
464 |
\medskip Facts may be referenced by name or proposition. E.g.\ the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
465 |
result of ``@{command "have"}~@{text "a: A \<langle>proof\<rangle>"}'' becomes |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
466 |
available both as @{text "a"} and \isacharbackquoteopen@{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
467 |
"A"}\isacharbackquoteclose. Moreover, fact expressions may involve |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
468 |
attributes that modify either the theorem or the background context. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
469 |
For example, the expression ``@{text "a [OF b]"}'' refers to the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
470 |
composition of two facts according to the @{inference resolution} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
471 |
inference of \secref{sec:framework-resolution}, while ``@{text "a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
472 |
[intro]"}'' declares a fact as introduction rule in the context. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
473 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
474 |
The special fact name ``@{fact this}'' always refers to the last |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
475 |
result, as produced by @{command note}, @{text "\<ASSM>"}, @{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
476 |
"have"}, or @{command "show"}. Since @{command "note"} occurs |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
477 |
frequently together with @{command "then"} we provide some |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
478 |
abbreviations: ``@{command "from"}~@{text a}'' for ``@{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
479 |
"note"}~@{text a}~@{command "then"}'', and ``@{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
480 |
"with"}~@{text a}'' for ``@{command "from"}~@{text a}~@{keyword |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
481 |
"and"}~@{fact this}''. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
482 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
483 |
\medskip The @{text "method"} category is essentially a parameter |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
484 |
and may be populated later. Methods use the facts indicated by |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
485 |
@{command "then"} or @{command "using"}, and then operate on the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
486 |
goal state. Some basic methods are predefined: ``@{method "-"}'' |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
487 |
leaves the goal unchanged, ``@{method this}'' applies the facts as |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
488 |
rules to the goal, ``@{method "rule"}'' applies the facts to another |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
489 |
rule and the result to the goal (both ``@{method this}'' and |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
490 |
``@{method rule}'' refer to @{inference resolution} of |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
491 |
\secref{sec:framework-resolution}). The secondary arguments to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
492 |
``@{method rule}'' may be specified explicitly as in ``@{text "(rule |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
493 |
a)"}'', or picked from the context. In the latter case, the system |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
494 |
first tries rules declared as @{attribute (Pure) elim} or |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
495 |
@{attribute (Pure) dest}, followed by those declared as @{attribute |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
496 |
(Pure) intro}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
497 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
498 |
The default method for @{command "proof"} is ``@{method default}'' |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
499 |
(arguments picked from the context), for @{command "qed"} it is |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
500 |
``@{method "-"}''. Further abbreviations for terminal proof steps |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
501 |
are ``@{command "by"}~@{text "method\<^sub>1 method\<^sub>2"}'' for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
502 |
``@{command "proof"}~@{text "method\<^sub>1"}~@{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
503 |
"qed"}~@{text "method\<^sub>2"}'', and ``@{command ".."}'' for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
504 |
``@{command "by"}~@{method default}, and ``@{command "."}'' for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
505 |
``@{command "by"}~@{method this}''. The @{command "unfolding"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
506 |
element operates directly on the current facts and goal by applying |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
507 |
equalities. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
508 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
509 |
\medskip Block structure can be indicated explicitly by |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
510 |
``@{command "{"}~@{text "\<dots>"}~@{command "}"}'', although the body of |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
511 |
a sub-proof already involves implicit nesting. In any case, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
512 |
@{command "next"} jumps into the next section of a block, i.e.\ it |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
513 |
acts like closing an implicit block scope and opening another one; |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
514 |
there is no direct correspondence to subgoals here. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
515 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
516 |
The remaining elements @{command "fix"} and @{text "\<ASSM>"} build |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
517 |
up a local context (see \secref{sec:framework-context}), while |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
518 |
@{command "show"} refines a pending sub-goal by the rule resulting |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
519 |
from a nested sub-proof (see \secref{sec:framework-subproof}). |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
520 |
Further derived concepts will support calculational reasoning (see |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
521 |
\secref{sec:framework-calc}). |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
522 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
523 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
524 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
525 |
subsection {* Context elements \label{sec:framework-context} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
526 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
527 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
528 |
In judgments @{text "\<Gamma> \<turnstile> \<phi>"} of the primitive framework, @{text "\<Gamma>"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
529 |
essentially acts like a proof context. Isar elaborates this idea |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
530 |
towards a higher-level notion, with separate information for |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
531 |
type-inference, term abbreviations, local facts, hypotheses etc. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
532 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
533 |
The element @{command "fix"}~@{text "x :: \<alpha>"} declares a local |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
534 |
parameter, i.e.\ an arbitrary-but-fixed entity of a given type; in |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
535 |
results exported from the context, @{text "x"} may become anything. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
536 |
The @{text "\<ASSM>"} element provides a general interface to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
537 |
hypotheses: ``@{text "\<ASSM> \<guillemotleft>rule\<guillemotright> A"}'' produces @{text "A \<turnstile> A"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
538 |
locally, while the included inference rule tells how to discharge |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
539 |
@{text "A"} from results @{text "A \<turnstile> B"} later on. There is no |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
540 |
user-syntax for @{text "\<guillemotleft>rule\<guillemotright>"}, i.e.\ @{text "\<ASSM>"} may only |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
541 |
occur in derived elements that provide a suitable inference |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
542 |
internally. In particular, ``@{command "assume"}~@{text A}'' |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
543 |
abbreviates ``@{text "\<ASSM> \<guillemotleft>discharge\<guillemotright> A"}'', and ``@{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
544 |
"def"}~@{text "x \<equiv> a"}'' abbreviates ``@{command "fix"}~@{text "x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
545 |
\<ASSM> \<guillemotleft>expansion\<guillemotright> x \<equiv> a"}'', involving the following inferences: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
546 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
547 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
548 |
\infer[(@{inference_def "discharge"})]{@{text "\<strut>\<Gamma> - A \<turnstile> #A \<Longrightarrow> B"}}{@{text "\<strut>\<Gamma> \<turnstile> B"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
549 |
\qquad |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
550 |
\infer[(@{inference_def expansion})]{@{text "\<strut>\<Gamma> - (x \<equiv> a) \<turnstile> B a"}}{@{text "\<strut>\<Gamma> \<turnstile> B x"}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
551 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
552 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
553 |
\medskip The most interesting derived element in Isar is @{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
554 |
"obtain"} \cite[\S5.3]{Wenzel-PhD}, which supports generalized |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
555 |
elimination steps in a purely forward manner. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
556 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
557 |
The @{command "obtain"} element takes a specification of parameters |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
558 |
@{text "\<^vec>x"} and assumptions @{text "\<^vec>A"} to be added to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
559 |
the context, together with a proof of a case rule stating that this |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
560 |
extension is conservative (i.e.\ may be removed from closed results |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
561 |
later on): |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
562 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
563 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
564 |
\begin{tabular}{l} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
565 |
@{text "\<langle>facts\<rangle>"}~~@{command obtain}~@{text "\<^vec>x \<WHERE> \<^vec>A \<^vec>x \<langle>proof\<rangle> \<equiv>"} \\[0.5ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
566 |
\quad @{command have}~@{text "case: \<And>thesis. (\<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis) \<Longrightarrow> thesis\<rangle>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
567 |
\quad @{command proof}~@{method "-"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
568 |
\qquad @{command fix}~@{text thesis} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
569 |
\qquad @{command assume}~@{text "[intro]: \<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
570 |
\qquad @{command show}~@{text thesis}~@{command using}@{text "\<langle>facts\<rangle> \<langle>proof\<rangle>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
571 |
\quad @{command qed} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
572 |
\quad @{command fix}~@{text "\<^vec>x \<ASSM> \<guillemotleft>elimination case\<guillemotright> \<^vec>A \<^vec>x"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
573 |
\end{tabular} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
574 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
575 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
576 |
\[ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
577 |
\infer[(@{inference elimination})]{@{text "\<Gamma> \<turnstile> B"}}{ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
578 |
\begin{tabular}{rl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
579 |
@{text "case:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
580 |
@{text "\<Gamma> \<turnstile> \<And>thesis. (\<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis) \<Longrightarrow> thesis"} \\[0.2ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
581 |
@{text "result:"} & |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
582 |
@{text "\<Gamma> \<union> \<^vec>A \<^vec>y \<turnstile> B"} \\[0.2ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
583 |
\end{tabular}} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
584 |
\] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
585 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
586 |
\noindent Here the name ``@{text thesis}'' is a specific convention |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
587 |
for an arbitrary-but-fixed proposition; in the primitive natural |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
588 |
deduction rules shown before we have occasionally used @{text C}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
589 |
The whole statement of ``@{command "obtain"}~@{text x}~@{keyword |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
590 |
"where"}~@{text "A x"}'' may be read as a claim that @{text "A x"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
591 |
may be assumed for some arbitrary-but-fixed @{text "x"}. Also note |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
592 |
that ``@{command "obtain"}~@{text A}~@{keyword "and"}~@{text B}'' |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
593 |
without parameters is similar to ``@{command "have"}~@{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
594 |
A}~@{keyword "and"}~@{text B}'', but the latter involves multiple |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
595 |
sub-goals. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
596 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
597 |
\medskip The subsequent Isar proof texts explain all context |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
598 |
elements introduced above using the formal proof language itself. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
599 |
After finishing a local proof within a block, we indicate the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
600 |
exported result via @{command "note"}. This illustrates the meaning |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
601 |
of Isar context elements without goals getting in between. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
602 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
603 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
604 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
605 |
theorem True |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
606 |
proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
607 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
608 |
txt_raw {* \begin{minipage}{0.22\textwidth} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
609 |
{ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
610 |
fix x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
611 |
have "B x" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
612 |
sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
613 |
} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
614 |
note `\<And>x. B x` |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
615 |
txt_raw {* \end{minipage}\quad\begin{minipage}{0.22\textwidth} *}(*<*)next(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
616 |
{ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
617 |
def x \<equiv> a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
618 |
have "B x" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
619 |
sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
620 |
} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
621 |
note `B a` |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
622 |
txt_raw {* \end{minipage}\quad\begin{minipage}{0.22\textwidth} *}(*<*)next(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
623 |
{ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
624 |
assume A |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
625 |
have B |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
626 |
sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
627 |
} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
628 |
note `A \<Longrightarrow> B` |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
629 |
txt_raw {* \end{minipage}\quad\begin{minipage}{0.34\textwidth} *}(*<*)next(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
630 |
{ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
631 |
obtain x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
632 |
where "A x" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
633 |
have B sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
634 |
} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
635 |
note `B` |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
636 |
txt_raw {* \end{minipage} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
637 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
638 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
639 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
640 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
641 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
642 |
subsection {* Structured statements \label{sec:framework-stmt} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
643 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
644 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
645 |
The category @{text "statement"} of top-level theorem specifications |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
646 |
is defined as follows: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
647 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
648 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
649 |
\begin{tabular}{rcl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
650 |
@{text "statement"} & @{text "\<equiv>"} & @{text "name: props \<AND> \<dots>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
651 |
& @{text "|"} & @{text "context\<^sup>* conclusion"} \\[0.5ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
652 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
653 |
@{text "context"} & @{text "\<equiv>"} & @{text "\<FIXES> vars \<AND> \<dots>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
654 |
& @{text "|"} & @{text "\<ASSUMES> name: props \<AND> \<dots>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
655 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
656 |
@{text "conclusion"} & @{text "\<equiv>"} & @{text "\<SHOWS> name: props \<AND> \<dots>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
657 |
& @{text "|"} & @{text "\<OBTAINS> vars \<AND> \<dots> \<WHERE> name: props \<AND> \<dots> \<BBAR> \<dots>"} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
658 |
\end{tabular} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
659 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
660 |
\medskip\noindent A simple @{text "statement"} consists of named |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
661 |
propositions. The full form admits local context elements followed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
662 |
by the actual conclusions, such as ``@{keyword "fixes"}~@{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
663 |
x}~@{keyword "assumes"}~@{text "A x"}~@{keyword "shows"}~@{text "B |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
664 |
x"}''. The final result emerges as a Pure rule after discharging |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
665 |
the context: @{prop "\<And>x. A x \<Longrightarrow> B x"}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
666 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
667 |
The @{keyword "obtains"} variant is another abbreviation defined |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
668 |
below; unlike @{command obtain} (cf.\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
669 |
\secref{sec:framework-context}) there may be several ``cases'' |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
670 |
separated by ``@{text "\<BBAR>"}'', each consisting of several |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
671 |
parameters (@{text "vars"}) and several premises (@{text "props"}). |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
672 |
This specifies multi-branch elimination rules. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
673 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
674 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
675 |
\begin{tabular}{l} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
676 |
@{text "\<OBTAINS> \<^vec>x \<WHERE> \<^vec>A \<^vec>x \<BBAR> \<dots> \<equiv>"} \\[0.5ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
677 |
\quad @{text "\<FIXES> thesis"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
678 |
\quad @{text "\<ASSUMES> [intro]: \<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis \<AND> \<dots>"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
679 |
\quad @{text "\<SHOWS> thesis"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
680 |
\end{tabular} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
681 |
\medskip |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
682 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
683 |
Presenting structured statements in such an ``open'' format usually |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
684 |
simplifies the subsequent proof, because the outer structure of the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
685 |
problem is already laid out directly. E.g.\ consider the following |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
686 |
canonical patterns for @{text "\<SHOWS>"} and @{text "\<OBTAINS>"}, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
687 |
respectively: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
688 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
689 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
690 |
text_raw {*\begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
691 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
692 |
theorem |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
693 |
fixes x and y |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
694 |
assumes "A x" and "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
695 |
shows "C x y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
696 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
697 |
from `A x` and `B y` |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
698 |
show "C x y" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
699 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
700 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
701 |
text_raw {*\end{minipage}\begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
702 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
703 |
theorem |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
704 |
obtains x and y |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
705 |
where "A x" and "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
706 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
707 |
have "A a" and "B b" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
708 |
then show thesis .. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
709 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
710 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
711 |
text_raw {*\end{minipage}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
712 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
713 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
714 |
\medskip\noindent Here local facts \isacharbackquoteopen@{text "A |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
715 |
x"}\isacharbackquoteclose\ and \isacharbackquoteopen@{text "B |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
716 |
y"}\isacharbackquoteclose\ are referenced immediately; there is no |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
717 |
need to decompose the logical rule structure again. In the second |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
718 |
proof the final ``@{command then}~@{command show}~@{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
719 |
thesis}~@{command ".."}'' involves the local rule case @{text "\<And>x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
720 |
y. A x \<Longrightarrow> B y \<Longrightarrow> thesis"} for the particular instance of terms @{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
721 |
"a"} and @{text "b"} produced in the body. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
722 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
723 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
724 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
725 |
subsection {* Structured proof refinement \label{sec:framework-subproof} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
726 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
727 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
728 |
By breaking up the grammar for the Isar proof language, we may |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
729 |
understand a proof text as a linear sequence of individual proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
730 |
commands. These are interpreted as transitions of the Isar virtual |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
731 |
machine (Isar/VM), which operates on a block-structured |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
732 |
configuration in single steps. This allows users to write proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
733 |
texts in an incremental manner, and inspect intermediate |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
734 |
configurations for debugging. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
735 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
736 |
The basic idea is analogous to evaluating algebraic expressions on a |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
737 |
stack machine: @{text "(a + b) \<cdot> c"} then corresponds to a sequence |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
738 |
of single transitions for each symbol @{text "(, a, +, b, ), \<cdot>, c"}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
739 |
In Isar the algebraic values are facts or goals, and the operations |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
740 |
are inferences. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
741 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
742 |
\medskip The Isar/VM state maintains a stack of nodes, each node |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
743 |
contains the local proof context, the linguistic mode, and a pending |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
744 |
goal (optional). The mode determines the type of transition that |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
745 |
may be performed next, it essentially alternates between forward and |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
746 |
backward reasoning. For example, in @{text "state"} mode Isar acts |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
747 |
like a mathematical scratch-pad, accepting declarations like |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
748 |
@{command fix}, @{command assume}, and claims like @{command have}, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
749 |
@{command show}. A goal statement changes the mode to @{text |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
750 |
"prove"}, which means that we may now refine the problem via |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
751 |
@{command unfolding} or @{command proof}. Then we are again in |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
752 |
@{text "state"} mode of a proof body, which may issue @{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
753 |
show} statements to solve pending sub-goals. A concluding @{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
754 |
qed} will return to the original @{text "state"} mode one level |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
755 |
upwards. The subsequent Isar/VM trace indicates block structure, |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
756 |
linguistic mode, goal state, and inferences: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
757 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
758 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
759 |
(*<*)lemma True |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
760 |
proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
761 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
762 |
txt_raw {* \begin{minipage}[t]{0.15\textwidth} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
763 |
have "A \<longrightarrow> B" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
764 |
proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
765 |
assume A |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
766 |
show B |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
767 |
sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
768 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
769 |
txt_raw {* \end{minipage}\quad |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
770 |
\begin{minipage}[t]{0.07\textwidth} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
771 |
@{text "begin"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
772 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
773 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
774 |
@{text "begin"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
775 |
@{text "end"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
776 |
@{text "end"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
777 |
\end{minipage} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
778 |
\begin{minipage}[t]{0.08\textwidth} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
779 |
@{text "prove"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
780 |
@{text "state"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
781 |
@{text "state"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
782 |
@{text "prove"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
783 |
@{text "state"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
784 |
@{text "state"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
785 |
\end{minipage}\begin{minipage}[t]{0.3\textwidth} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
786 |
@{text "(A \<longrightarrow> B) \<Longrightarrow> #(A \<longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
787 |
@{text "(A \<Longrightarrow> B) \<Longrightarrow> #(A \<longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
788 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
789 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
790 |
@{text "#(A \<longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
791 |
@{text "A \<longrightarrow> B"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
792 |
\end{minipage}\begin{minipage}[t]{0.35\textwidth} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
793 |
@{text "(init)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
794 |
@{text "(resolution (A \<Longrightarrow> B) \<Longrightarrow> A \<longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
795 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
796 |
\\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
797 |
@{text "(refinement #A \<Longrightarrow> B)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
798 |
@{text "(finish)"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
799 |
\end{minipage} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
800 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
801 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
802 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
803 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
804 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
805 |
Here the @{inference refinement} inference from |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
806 |
\secref{sec:framework-resolution} mediates composition of Isar |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
807 |
sub-proofs nicely. Observe that this principle incorporates some |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
808 |
degree of freedom in proof composition. In particular, the proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
809 |
body allows parameters and assumptions to be re-ordered, or commuted |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
810 |
according to Hereditary Harrop Form. Moreover, context elements |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
811 |
that are not used in a sub-proof may be omitted altogether. For |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
812 |
example: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
813 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
814 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
815 |
text_raw {*\begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
816 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
817 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
818 |
lemma True |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
819 |
proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
820 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
821 |
have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
822 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
823 |
fix x and y |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
824 |
assume "A x" and "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
825 |
show "C x y" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
826 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
827 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
828 |
txt_raw {*\end{minipage}\begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
829 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
830 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
831 |
next |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
832 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
833 |
have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
834 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
835 |
fix x assume "A x" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
836 |
fix y assume "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
837 |
show "C x y" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
838 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
839 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
840 |
txt_raw {*\end{minipage} \\[\medskipamount] \begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
841 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
842 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
843 |
next |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
844 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
845 |
have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
846 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
847 |
fix y assume "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
848 |
fix x assume "A x" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
849 |
show "C x y" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
850 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
851 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
852 |
txt_raw {*\end{minipage}\begin{minipage}{0.5\textwidth}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
853 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
854 |
next |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
855 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
856 |
have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
857 |
proof - |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
858 |
fix y assume "B y" |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
859 |
fix x |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
860 |
show "C x y" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
861 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
862 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
863 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
864 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
865 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
866 |
text_raw {*\end{minipage}*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
867 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
868 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
869 |
\medskip Such ``peephole optimizations'' of Isar texts are |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
870 |
practically important to improve readability, by rearranging |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
871 |
contexts elements according to the natural flow of reasoning in the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
872 |
body, while still observing the overall scoping rules. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
873 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
874 |
\medskip This illustrates the basic idea of structured proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
875 |
processing in Isar. The main mechanisms are based on natural |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
876 |
deduction rule composition within the Pure framework. In |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
877 |
particular, there are no direct operations on goal states within the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
878 |
proof body. Moreover, there is no hidden automated reasoning |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
879 |
involved, just plain unification. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
880 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
881 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
882 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
883 |
subsection {* Calculational reasoning \label{sec:framework-calc} *} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
884 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
885 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
886 |
The present Isar infrastructure is sufficiently flexible to support |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
887 |
calculational reasoning (chains of transitivity steps) as derived |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
888 |
concept. The generic proof elements introduced below depend on |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
889 |
rules declared as @{text "[trans]"} in the context. It is left to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
890 |
the object-logic to provide a suitable rule collection for mixed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
891 |
@{text "="}, @{text "<"}, @{text "\<le>"}, @{text "\<subset>"}, @{text "\<subseteq>"} etc. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
892 |
Due to the flexibility of rule composition |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
893 |
(\secref{sec:framework-resolution}), substitution of equals by |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
894 |
equals is covered as well, even substitution of inequalities |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
895 |
involving monotonicity conditions; see also \cite[\S6]{Wenzel-PhD} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
896 |
and \cite{Bauer-Wenzel:2001}. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
897 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
898 |
The generic calculational mechanism is based on the observation that |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
899 |
rules such as @{text "x = y \<Longrightarrow> y = z \<Longrightarrow> x = z"} proceed from the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
900 |
premises towards the conclusion in a deterministic fashion. Thus we |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
901 |
may reason in forward mode, feeding intermediate results into rules |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
902 |
selected from the context. The course of reasoning is organized by |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
903 |
maintaining a secondary fact called ``@{fact calculation}'', apart |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
904 |
from the primary ``@{fact this}'' already provided by the Isar |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
905 |
primitives. In the definitions below, @{attribute OF} is |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
906 |
@{inference resolution} (\secref{sec:framework-resolution}) with |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
907 |
multiple rule arguments, and @{text "trans"} refers to a suitable |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
908 |
rule from the context: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
909 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
910 |
\begin{matharray}{rcl} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
911 |
@{command "also"}@{text "\<^sub>0"} & \equiv & @{command "note"}~@{text "calculation = this"} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
912 |
@{command "also"}@{text "\<^sub>n\<^sub>+\<^sub>1"} & \equiv & @{command "note"}~@{text "calculation = trans [OF calculation this]"} \\[0.5ex] |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
913 |
@{command "finally"} & \equiv & @{command "also"}~@{command "from"}~@{text calculation} \\ |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
914 |
\end{matharray} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
915 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
916 |
\noindent The start of a calculation is determined implicitly in the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
917 |
text: here @{command also} sets @{fact calculation} to the current |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
918 |
result; any subsequent occurrence will update @{fact calculation} by |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
919 |
combination with the next result and a transitivity rule. The |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
920 |
calculational sequence is concluded via @{command finally}, where |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
921 |
the final result is exposed for use in a concluding claim. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
922 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
923 |
Here is a canonical proof pattern, using @{command have} to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
924 |
establish the intermediate results: |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
925 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
926 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
927 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
928 |
lemma True |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
929 |
proof |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
930 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
931 |
have "a = b" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
932 |
also have "\<dots> = c" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
933 |
also have "\<dots> = d" sorry |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
934 |
finally have "a = d" . |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
935 |
(*<*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
936 |
qed |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
937 |
(*>*) |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
938 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
939 |
text {* |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
940 |
\noindent The term ``@{text "\<dots>"}'' above is a special abbreviation |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
941 |
provided by the Isabelle/Isar syntax layer: it statically refers to |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
942 |
the right-hand side argument of the previous statement given in the |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
943 |
text. Thus it happens to coincide with relevant sub-expressions in |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
944 |
the calculational chain, but the exact correspondence is dependent |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
945 |
on the transitivity rules being involved. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
946 |
|
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
947 |
\medskip Symmetry rules such as @{prop "x = y \<Longrightarrow> y = x"} are like |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
948 |
transitivities with only one premise. Isar maintains a separate |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
949 |
rule collection declared via the @{attribute sym} attribute, to be |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
950 |
used in fact expressions ``@{text "a [symmetric]"}'', or single-step |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
951 |
proofs ``@{command assume}~@{text "x = y"}~@{command then}~@{command |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
952 |
have}~@{text "y = x"}~@{command ".."}''. |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
953 |
*} |
c2e926455fcc
more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents:
29721
diff
changeset
|
954 |
|
29716 | 955 |
end |