author | ballarin |
Sat, 28 Mar 2009 00:11:02 +0100 | |
changeset 30751 | 36a255c2e428 |
parent 30750 | 3779e2158dad |
child 30780 | c3f1e8a9e0b5 |
permissions | -rw-r--r-- |
27063 | 1 |
% |
2 |
\begin{isabellebody}% |
|
3 |
\def\isabellecontext{Examples{\isadigit{3}}}% |
|
4 |
% |
|
5 |
\isadelimtheory |
|
6 |
% |
|
7 |
\endisadelimtheory |
|
8 |
% |
|
9 |
\isatagtheory |
|
27080 | 10 |
\isacommand{theory}\isamarkupfalse% |
11 |
\ Examples{\isadigit{3}}\isanewline |
|
12 |
\isakeyword{imports}\ Examples\isanewline |
|
13 |
\isakeyword{begin}% |
|
27063 | 14 |
\endisatagtheory |
15 |
{\isafoldtheory}% |
|
16 |
% |
|
17 |
\isadelimtheory |
|
18 |
% |
|
19 |
\endisadelimtheory |
|
20 |
% |
|
21 |
\isamarkupsubsection{Third Version: Local Interpretation% |
|
22 |
} |
|
23 |
\isamarkuptrue% |
|
24 |
% |
|
25 |
\begin{isamarkuptext}% |
|
26 |
In the above example, the fact that \isa{{\isasymle}} is a partial |
|
27 |
order for the natural numbers was used in the proof of the |
|
28 |
second goal. In general, proofs of the equations may involve |
|
29 |
theorems implied by the fact the assumptions of the instantiated |
|
30 |
locale hold for the instantiating structure. If these theorems have |
|
31 |
been shown abstractly in the locale they can be made available |
|
32 |
conveniently in the context through an auxiliary local interpretation (keyword |
|
33 |
\isakeyword{interpret}). This interpretation is inside the proof of the global |
|
34 |
interpretation. The third revision of the example illustrates this.% |
|
35 |
\end{isamarkuptext}% |
|
36 |
\isamarkuptrue% |
|
37 |
% |
|
38 |
\isadelimvisible |
|
39 |
% |
|
40 |
\endisadelimvisible |
|
41 |
% |
|
42 |
\isatagvisible |
|
43 |
\isacommand{interpretation}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
44 |
\ nat{\isacharbang}{\isacharcolon}\ partial{\isacharunderscore}order\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
45 |
\ \ \isakeyword{where}\ {\isachardoublequoteopen}partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharless}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
27063 | 46 |
\isacommand{proof}\isamarkupfalse% |
47 |
\ {\isacharminus}\isanewline |
|
48 |
\ \ \isacommand{show}\isamarkupfalse% |
|
49 |
\ {\isachardoublequoteopen}partial{\isacharunderscore}order\ {\isacharparenleft}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isacharparenright}{\isachardoublequoteclose}\isanewline |
|
50 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
51 |
\ unfold{\isacharunderscore}locales\ auto\isanewline |
|
52 |
\ \ \isacommand{then}\isamarkupfalse% |
|
53 |
\ \isacommand{interpret}\isamarkupfalse% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
54 |
\ nat{\isacharcolon}\ partial{\isacharunderscore}order\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ {\isacharbrackleft}nat{\isacharcomma}\ nat{\isacharbrackright}\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse% |
27063 | 55 |
\isanewline |
56 |
\ \ \isacommand{show}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
57 |
\ {\isachardoublequoteopen}partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharless}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
27063 | 58 |
\ \ \ \ \isacommand{unfolding}\isamarkupfalse% |
59 |
\ nat{\isachardot}less{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse% |
|
60 |
\ auto\isanewline |
|
61 |
\isacommand{qed}\isamarkupfalse% |
|
62 |
% |
|
63 |
\endisatagvisible |
|
64 |
{\isafoldvisible}% |
|
65 |
% |
|
66 |
\isadelimvisible |
|
67 |
% |
|
68 |
\endisadelimvisible |
|
69 |
% |
|
70 |
\begin{isamarkuptext}% |
|
71 |
The inner interpretation does not require an |
|
72 |
elaborate new proof, it is immediate from the preceeding fact and |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
73 |
proved with ``.''. Strict qualifiers are normally not necessary for |
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
74 |
interpretations inside proofs, since these have only limited scope. |
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
75 |
|
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
76 |
The above interpretation enriches the local proof context by |
27063 | 77 |
the very theorems also obtained in the interpretation from |
78 |
Section~\ref{sec:po-first}, and \isa{nat{\isachardot}less{\isacharunderscore}def} may directly be |
|
79 |
used to unfold the definition. Theorems from the local |
|
80 |
interpretation disappear after leaving the proof context --- that |
|
81 |
is, after the closing \isakeyword{qed} --- and are |
|
82 |
then replaced by those with the desired substitutions of the strict |
|
83 |
order.% |
|
84 |
\end{isamarkuptext}% |
|
85 |
\isamarkuptrue% |
|
86 |
% |
|
87 |
\isamarkupsubsection{Further Interpretations% |
|
88 |
} |
|
89 |
\isamarkuptrue% |
|
90 |
% |
|
91 |
\begin{isamarkuptext}% |
|
92 |
Further interpretations are necessary to reuse theorems from |
|
93 |
the other locales. In \isa{lattice} the operations \isa{{\isasymsqinter}} and |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
94 |
\isa{{\isasymsqunion}} are substituted by \isa{min} and |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
95 |
\isa{max}. The entire proof for the |
27063 | 96 |
interpretation is reproduced in order to give an example of a more |
97 |
elaborate interpretation proof.% |
|
98 |
\end{isamarkuptext}% |
|
99 |
\isamarkuptrue% |
|
100 |
% |
|
101 |
\isadelimvisible |
|
102 |
% |
|
103 |
\endisadelimvisible |
|
104 |
% |
|
105 |
\isatagvisible |
|
106 |
\isacommand{interpretation}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
107 |
\ nat{\isacharbang}{\isacharcolon}\ lattice\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
27063 | 108 |
\ \ \isakeyword{where}\ {\isachardoublequoteopen}lattice{\isachardot}meet\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ min\ x\ y{\isachardoublequoteclose}\isanewline |
109 |
\ \ \ \ \isakeyword{and}\ {\isachardoublequoteopen}lattice{\isachardot}join\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ max\ x\ y{\isachardoublequoteclose}\isanewline |
|
110 |
\isacommand{proof}\isamarkupfalse% |
|
111 |
\ {\isacharminus}\isanewline |
|
112 |
\ \ \isacommand{show}\isamarkupfalse% |
|
113 |
\ {\isachardoublequoteopen}lattice\ {\isacharparenleft}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isacharparenright}{\isachardoublequoteclose}% |
|
114 |
\begin{isamarkuptxt}% |
|
115 |
We have already shown that this is a partial order,% |
|
116 |
\end{isamarkuptxt}% |
|
117 |
\isamarkuptrue% |
|
118 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
119 |
\ unfold{\isacharunderscore}locales% |
|
120 |
\begin{isamarkuptxt}% |
|
121 |
hence only the lattice axioms remain to be shown: \begin{isabelle}% |
|
122 |
\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ y{\isachardot}\ {\isasymexists}inf{\isachardot}\ partial{\isacharunderscore}order{\isachardot}is{\isacharunderscore}inf\ op\ {\isasymle}\ x\ y\ inf\isanewline |
|
123 |
\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}x\ y{\isachardot}\ {\isasymexists}sup{\isachardot}\ partial{\isacharunderscore}order{\isachardot}is{\isacharunderscore}sup\ op\ {\isasymle}\ x\ y\ sup% |
|
124 |
\end{isabelle} After unfolding \isa{is{\isacharunderscore}inf} and \isa{is{\isacharunderscore}sup},% |
|
125 |
\end{isamarkuptxt}% |
|
126 |
\isamarkuptrue% |
|
127 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
128 |
\ {\isacharparenleft}unfold\ nat{\isachardot}is{\isacharunderscore}inf{\isacharunderscore}def\ nat{\isachardot}is{\isacharunderscore}sup{\isacharunderscore}def{\isacharparenright}% |
|
129 |
\begin{isamarkuptxt}% |
|
130 |
the goals become \begin{isabelle}% |
|
131 |
\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ y{\isachardot}\ {\isasymexists}inf{\isasymle}x{\isachardot}\ inf\ {\isasymle}\ y\ {\isasymand}\ {\isacharparenleft}{\isasymforall}z{\isachardot}\ z\ {\isasymle}\ x\ {\isasymand}\ z\ {\isasymle}\ y\ {\isasymlongrightarrow}\ z\ {\isasymle}\ inf{\isacharparenright}\isanewline |
|
132 |
\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}x\ y{\isachardot}\ {\isasymexists}sup{\isasymge}x{\isachardot}\ y\ {\isasymle}\ sup\ {\isasymand}\ {\isacharparenleft}{\isasymforall}z{\isachardot}\ x\ {\isasymle}\ z\ {\isasymand}\ y\ {\isasymle}\ z\ {\isasymlongrightarrow}\ sup\ {\isasymle}\ z{\isacharparenright}% |
|
133 |
\end{isabelle} which can be solved |
|
134 |
by Presburger arithmetic.% |
|
135 |
\end{isamarkuptxt}% |
|
136 |
\isamarkuptrue% |
|
137 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
138 |
\ arith{\isacharplus}% |
|
139 |
\begin{isamarkuptxt}% |
|
140 |
In order to show the equations, we put ourselves in a |
|
141 |
situation where the lattice theorems can be used in a convenient way.% |
|
142 |
\end{isamarkuptxt}% |
|
143 |
\isamarkuptrue% |
|
144 |
\ \ \isacommand{then}\isamarkupfalse% |
|
145 |
\ \isacommand{interpret}\isamarkupfalse% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
146 |
\ nat{\isacharcolon}\ lattice\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse% |
27063 | 147 |
\isanewline |
148 |
\ \ \isacommand{show}\isamarkupfalse% |
|
149 |
\ {\isachardoublequoteopen}lattice{\isachardot}meet\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ min\ x\ y{\isachardoublequoteclose}\isanewline |
|
150 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
151 |
\ {\isacharparenleft}bestsimp\ simp{\isacharcolon}\ nat{\isachardot}meet{\isacharunderscore}def\ nat{\isachardot}is{\isacharunderscore}inf{\isacharunderscore}def{\isacharparenright}\isanewline |
|
152 |
\ \ \isacommand{show}\isamarkupfalse% |
|
153 |
\ {\isachardoublequoteopen}lattice{\isachardot}join\ op\ {\isasymle}\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ max\ x\ y{\isachardoublequoteclose}\isanewline |
|
154 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
155 |
\ {\isacharparenleft}bestsimp\ simp{\isacharcolon}\ nat{\isachardot}join{\isacharunderscore}def\ nat{\isachardot}is{\isacharunderscore}sup{\isacharunderscore}def{\isacharparenright}\isanewline |
|
156 |
\isacommand{qed}\isamarkupfalse% |
|
157 |
% |
|
158 |
\endisatagvisible |
|
159 |
{\isafoldvisible}% |
|
160 |
% |
|
161 |
\isadelimvisible |
|
162 |
% |
|
163 |
\endisadelimvisible |
|
164 |
% |
|
165 |
\begin{isamarkuptext}% |
|
166 |
That the relation \isa{{\isasymle}} is a total order completes this |
|
167 |
sequence of interpretations.% |
|
168 |
\end{isamarkuptext}% |
|
169 |
\isamarkuptrue% |
|
170 |
% |
|
171 |
\isadelimvisible |
|
172 |
% |
|
173 |
\endisadelimvisible |
|
174 |
% |
|
175 |
\isatagvisible |
|
176 |
\isacommand{interpretation}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
177 |
\ nat{\isacharbang}{\isacharcolon}\ total{\isacharunderscore}order\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
27063 | 178 |
\ \ \isacommand{by}\isamarkupfalse% |
179 |
\ unfold{\isacharunderscore}locales\ arith% |
|
180 |
\endisatagvisible |
|
181 |
{\isafoldvisible}% |
|
182 |
% |
|
183 |
\isadelimvisible |
|
184 |
% |
|
185 |
\endisadelimvisible |
|
186 |
% |
|
187 |
\begin{isamarkuptext}% |
|
188 |
Theorems that are available in the theory at this point are shown in |
|
189 |
Table~\ref{tab:nat-lattice}. |
|
190 |
||
191 |
\begin{table} |
|
192 |
\hrule |
|
193 |
\vspace{2ex} |
|
194 |
\begin{center} |
|
195 |
\begin{tabular}{l} |
|
196 |
\isa{nat{\isachardot}less{\isacharunderscore}def} from locale \isa{partial{\isacharunderscore}order}: \\ |
|
197 |
\quad \isa{{\isacharparenleft}{\isacharquery}x\ {\isacharless}\ {\isacharquery}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isacharquery}x\ {\isasymle}\ {\isacharquery}y\ {\isasymand}\ {\isacharquery}x\ {\isasymnoteq}\ {\isacharquery}y{\isacharparenright}} \\ |
|
198 |
\isa{nat{\isachardot}meet{\isacharunderscore}left} from locale \isa{lattice}: \\ |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
199 |
\quad \isa{min\ {\isacharquery}x\ {\isacharquery}y\ {\isasymle}\ {\isacharquery}x} \\ |
27063 | 200 |
\isa{nat{\isachardot}join{\isacharunderscore}distr} from locale \isa{distrib{\isacharunderscore}lattice}: \\ |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
201 |
\quad \isa{lattice{\isachardot}join\ op\ {\isasymle}\ {\isacharquery}x\ {\isacharparenleft}lattice{\isachardot}meet\ op\ {\isasymle}\ {\isacharquery}y\ {\isacharquery}z{\isacharparenright}\ {\isacharequal}\ lattice{\isachardot}meet\ op\ {\isasymle}\ {\isacharparenleft}lattice{\isachardot}join\ op\ {\isasymle}\ {\isacharquery}x\ {\isacharquery}y{\isacharparenright}\ {\isacharparenleft}lattice{\isachardot}join\ op\ {\isasymle}\ {\isacharquery}x\ {\isacharquery}z{\isacharparenright}} \\ |
27063 | 202 |
\isa{nat{\isachardot}less{\isacharunderscore}total} from locale \isa{total{\isacharunderscore}order}: \\ |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
203 |
\quad \isa{partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasymle}\ {\isacharquery}x\ {\isacharquery}y\ {\isasymor}\ {\isacharquery}x\ {\isacharequal}\ {\isacharquery}y\ {\isasymor}\ partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasymle}\ {\isacharquery}y\ {\isacharquery}x} |
27063 | 204 |
\end{tabular} |
205 |
\end{center} |
|
206 |
\hrule |
|
207 |
\caption{Interpreted theorems for \isa{{\isasymle}} on the natural numbers.} |
|
208 |
\label{tab:nat-lattice} |
|
209 |
\end{table} |
|
210 |
||
211 |
Note that since the locale hierarchy reflects that total orders are |
|
212 |
distributive lattices, an explicit interpretation of distributive |
|
213 |
lattices for the order relation on natural numbers is not neccessary. |
|
214 |
||
215 |
Why not push this idea further and just give the last interpretation |
|
216 |
as a single interpretation instead of the sequence of three? The |
|
217 |
reasons for this are twofold: |
|
218 |
\begin{itemize} |
|
219 |
\item |
|
220 |
Often it is easier to work in an incremental fashion, because later |
|
221 |
interpretations require theorems provided by earlier |
|
222 |
interpretations. |
|
223 |
\item |
|
224 |
Assume that a definition is made in some locale $l_1$, and that $l_2$ |
|
225 |
imports $l_1$. Let an equation for the definition be |
|
226 |
proved in an interpretation of $l_2$. The equation will be unfolded |
|
227 |
in interpretations of theorems added to $l_2$ or below in the import |
|
228 |
hierarchy, but not for theorems added above $l_2$. |
|
229 |
Hence, an equation interpreting a definition should always be given in |
|
230 |
an interpretation of the locale where the definition is made, not in |
|
231 |
an interpretation of a locale further down the hierarchy. |
|
232 |
\end{itemize}% |
|
233 |
\end{isamarkuptext}% |
|
234 |
\isamarkuptrue% |
|
235 |
% |
|
236 |
\isamarkupsubsection{Lattice \isa{dvd} on \isa{nat}% |
|
237 |
} |
|
238 |
\isamarkuptrue% |
|
239 |
% |
|
240 |
\begin{isamarkuptext}% |
|
241 |
Divisibility on the natural numbers is a distributive lattice |
|
242 |
but not a total order. Interpretation again proceeds |
|
243 |
incrementally.% |
|
244 |
\end{isamarkuptext}% |
|
245 |
\isamarkuptrue% |
|
246 |
\isacommand{interpretation}\isamarkupfalse% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
247 |
\ nat{\isacharunderscore}dvd{\isacharcolon}\ partial{\isacharunderscore}order\ {\isachardoublequoteopen}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
27063 | 248 |
\ \ \isakeyword{where}\ {\isachardoublequoteopen}partial{\isacharunderscore}order{\isachardot}less\ op\ dvd\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ {\isacharparenleft}x\ dvd\ y\ {\isasymand}\ x\ {\isasymnoteq}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
249 |
% |
|
250 |
\isadelimproof |
|
251 |
% |
|
252 |
\endisadelimproof |
|
253 |
% |
|
254 |
\isatagproof |
|
255 |
\isacommand{proof}\isamarkupfalse% |
|
256 |
\ {\isacharminus}\isanewline |
|
257 |
\ \ \isacommand{show}\isamarkupfalse% |
|
258 |
\ {\isachardoublequoteopen}partial{\isacharunderscore}order\ {\isacharparenleft}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isacharparenright}{\isachardoublequoteclose}\isanewline |
|
259 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
260 |
\ unfold{\isacharunderscore}locales\ {\isacharparenleft}auto\ simp{\isacharcolon}\ dvd{\isacharunderscore}def{\isacharparenright}\isanewline |
|
261 |
\ \ \isacommand{then}\isamarkupfalse% |
|
262 |
\ \isacommand{interpret}\isamarkupfalse% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
263 |
\ nat{\isacharunderscore}dvd{\isacharcolon}\ partial{\isacharunderscore}order\ {\isachardoublequoteopen}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse% |
27063 | 264 |
\isanewline |
265 |
\ \ \isacommand{show}\isamarkupfalse% |
|
266 |
\ {\isachardoublequoteopen}partial{\isacharunderscore}order{\isachardot}less\ op\ dvd\ {\isacharparenleft}x{\isacharcolon}{\isacharcolon}nat{\isacharparenright}\ y\ {\isacharequal}\ {\isacharparenleft}x\ dvd\ y\ {\isasymand}\ x\ {\isasymnoteq}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
|
267 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
268 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}less{\isacharunderscore}def{\isacharparenright}\isanewline |
|
269 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
270 |
\ auto\isanewline |
|
271 |
\ \ \ \ \isacommand{done}\isamarkupfalse% |
|
272 |
\isanewline |
|
273 |
\isacommand{qed}\isamarkupfalse% |
|
274 |
% |
|
275 |
\endisatagproof |
|
276 |
{\isafoldproof}% |
|
277 |
% |
|
278 |
\isadelimproof |
|
279 |
% |
|
280 |
\endisadelimproof |
|
281 |
% |
|
282 |
\begin{isamarkuptext}% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
283 |
Note that in Isabelle/HOL there is no symbol for strict |
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
284 |
divisibility. Instead, interpretation substitutes \isa{x\ dvd\ y\ {\isasymand}\ x\ {\isasymnoteq}\ y}.% |
27063 | 285 |
\end{isamarkuptext}% |
286 |
\isamarkuptrue% |
|
287 |
\isacommand{interpretation}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
288 |
\ nat{\isacharunderscore}dvd{\isacharbang}{\isacharcolon}\ lattice\ {\isachardoublequoteopen}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
27063 | 289 |
\ \ \isakeyword{where}\ nat{\isacharunderscore}dvd{\isacharunderscore}meet{\isacharunderscore}eq{\isacharcolon}\isanewline |
27595 | 290 |
\ \ \ \ \ \ {\isachardoublequoteopen}lattice{\isachardot}meet\ op\ dvd\ {\isacharequal}\ gcd{\isachardoublequoteclose}\isanewline |
27063 | 291 |
\ \ \ \ \isakeyword{and}\ nat{\isacharunderscore}dvd{\isacharunderscore}join{\isacharunderscore}eq{\isacharcolon}\isanewline |
27595 | 292 |
\ \ \ \ \ \ {\isachardoublequoteopen}lattice{\isachardot}join\ op\ dvd\ {\isacharequal}\ lcm{\isachardoublequoteclose}\isanewline |
27063 | 293 |
% |
294 |
\isadelimproof |
|
295 |
% |
|
296 |
\endisadelimproof |
|
297 |
% |
|
298 |
\isatagproof |
|
299 |
\isacommand{proof}\isamarkupfalse% |
|
300 |
\ {\isacharminus}\isanewline |
|
301 |
\ \ \isacommand{show}\isamarkupfalse% |
|
302 |
\ {\isachardoublequoteopen}lattice\ {\isacharparenleft}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isacharparenright}{\isachardoublequoteclose}\isanewline |
|
303 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
304 |
\ unfold{\isacharunderscore}locales\isanewline |
|
305 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
306 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}is{\isacharunderscore}inf{\isacharunderscore}def\ nat{\isacharunderscore}dvd{\isachardot}is{\isacharunderscore}sup{\isacharunderscore}def{\isacharparenright}\isanewline |
|
307 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
27595 | 308 |
\ {\isacharparenleft}rule{\isacharunderscore}tac\ x\ {\isacharequal}\ {\isachardoublequoteopen}gcd\ x\ y{\isachardoublequoteclose}\ \isakeyword{in}\ exI{\isacharparenright}\isanewline |
27063 | 309 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
310 |
\ auto\ {\isacharbrackleft}{\isadigit{1}}{\isacharbrackright}\isanewline |
|
311 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
27595 | 312 |
\ {\isacharparenleft}rule{\isacharunderscore}tac\ x\ {\isacharequal}\ {\isachardoublequoteopen}lcm\ x\ y{\isachardoublequoteclose}\ \isakeyword{in}\ exI{\isacharparenright}\isanewline |
27063 | 313 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
314 |
\ {\isacharparenleft}auto\ intro{\isacharcolon}\ lcm{\isacharunderscore}dvd{\isadigit{1}}\ lcm{\isacharunderscore}dvd{\isadigit{2}}\ lcm{\isacharunderscore}least{\isacharparenright}\isanewline |
|
315 |
\ \ \ \ \isacommand{done}\isamarkupfalse% |
|
316 |
\isanewline |
|
317 |
\ \ \isacommand{then}\isamarkupfalse% |
|
318 |
\ \isacommand{interpret}\isamarkupfalse% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
319 |
\ nat{\isacharunderscore}dvd{\isacharcolon}\ lattice\ {\isachardoublequoteopen}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse% |
27063 | 320 |
\isanewline |
321 |
\ \ \isacommand{show}\isamarkupfalse% |
|
27595 | 322 |
\ {\isachardoublequoteopen}lattice{\isachardot}meet\ op\ dvd\ {\isacharequal}\ gcd{\isachardoublequoteclose}\isanewline |
323 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
324 |
\ {\isacharparenleft}auto\ simp\ add{\isacharcolon}\ expand{\isacharunderscore}fun{\isacharunderscore}eq{\isacharparenright}\isanewline |
|
27063 | 325 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
326 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}meet{\isacharunderscore}def{\isacharparenright}\isanewline |
|
327 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
328 |
\ {\isacharparenleft}rule\ the{\isacharunderscore}equality{\isacharparenright}\isanewline |
|
329 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
330 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}is{\isacharunderscore}inf{\isacharunderscore}def{\isacharparenright}\isanewline |
|
331 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
332 |
\ auto\isanewline |
|
333 |
\ \ \isacommand{show}\isamarkupfalse% |
|
27595 | 334 |
\ {\isachardoublequoteopen}lattice{\isachardot}join\ op\ dvd\ {\isacharequal}\ lcm{\isachardoublequoteclose}\isanewline |
335 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
336 |
\ {\isacharparenleft}auto\ simp\ add{\isacharcolon}\ expand{\isacharunderscore}fun{\isacharunderscore}eq{\isacharparenright}\isanewline |
|
27063 | 337 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
338 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}join{\isacharunderscore}def{\isacharparenright}\isanewline |
|
339 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
340 |
\ {\isacharparenleft}rule\ the{\isacharunderscore}equality{\isacharparenright}\isanewline |
|
341 |
\ \ \ \ \isacommand{apply}\isamarkupfalse% |
|
342 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isachardot}is{\isacharunderscore}sup{\isacharunderscore}def{\isacharparenright}\isanewline |
|
343 |
\ \ \ \ \isacommand{by}\isamarkupfalse% |
|
344 |
\ {\isacharparenleft}auto\ intro{\isacharcolon}\ lcm{\isacharunderscore}dvd{\isadigit{1}}\ lcm{\isacharunderscore}dvd{\isadigit{2}}\ lcm{\isacharunderscore}least{\isacharparenright}\isanewline |
|
345 |
\isacommand{qed}\isamarkupfalse% |
|
346 |
% |
|
347 |
\endisatagproof |
|
348 |
{\isafoldproof}% |
|
349 |
% |
|
350 |
\isadelimproof |
|
351 |
% |
|
352 |
\endisadelimproof |
|
353 |
% |
|
354 |
\begin{isamarkuptext}% |
|
355 |
Equations \isa{nat{\isacharunderscore}dvd{\isacharunderscore}meet{\isacharunderscore}eq} and \isa{nat{\isacharunderscore}dvd{\isacharunderscore}join{\isacharunderscore}eq} are named since they are handy in the proof of |
|
356 |
the subsequent interpretation.% |
|
357 |
\end{isamarkuptext}% |
|
358 |
\isamarkuptrue% |
|
359 |
% |
|
360 |
\isadeliminvisible |
|
361 |
% |
|
362 |
\endisadeliminvisible |
|
363 |
% |
|
364 |
\isataginvisible |
|
365 |
\isacommand{lemma}\isamarkupfalse% |
|
366 |
\ gcd{\isacharunderscore}lcm{\isacharunderscore}distr{\isacharcolon}\isanewline |
|
27595 | 367 |
\ \ {\isachardoublequoteopen}gcd\ x\ {\isacharparenleft}lcm\ y\ z{\isacharparenright}\ {\isacharequal}\ lcm\ {\isacharparenleft}gcd\ x\ y{\isacharparenright}\ {\isacharparenleft}gcd\ x\ z{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{sorry}\isamarkupfalse% |
29568 | 368 |
% |
27063 | 369 |
\endisataginvisible |
370 |
{\isafoldinvisible}% |
|
371 |
% |
|
372 |
\isadeliminvisible |
|
373 |
% |
|
374 |
\endisadeliminvisible |
|
375 |
\isanewline |
|
376 |
% |
|
377 |
\isadelimvisible |
|
29568 | 378 |
\isanewline |
27063 | 379 |
% |
380 |
\endisadelimvisible |
|
381 |
% |
|
382 |
\isatagvisible |
|
383 |
\isacommand{interpretation}\isamarkupfalse% |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
384 |
\ nat{\isacharunderscore}dvd{\isacharbang}{\isacharcolon}\isanewline |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
385 |
\ \ distrib{\isacharunderscore}lattice\ {\isachardoublequoteopen}op\ dvd\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline |
27063 | 386 |
\ \ \isacommand{apply}\isamarkupfalse% |
387 |
\ unfold{\isacharunderscore}locales% |
|
388 |
\begin{isamarkuptxt}% |
|
389 |
\begin{isabelle}% |
|
390 |
\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ y\ z{\isachardot}\isanewline |
|
391 |
\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }lattice{\isachardot}meet\ op\ dvd\ x\ {\isacharparenleft}lattice{\isachardot}join\ op\ dvd\ y\ z{\isacharparenright}\ {\isacharequal}\isanewline |
|
392 |
\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }lattice{\isachardot}join\ op\ dvd\ {\isacharparenleft}lattice{\isachardot}meet\ op\ dvd\ x\ y{\isacharparenright}\isanewline |
|
393 |
\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ \ }{\isacharparenleft}lattice{\isachardot}meet\ op\ dvd\ x\ z{\isacharparenright}% |
|
394 |
\end{isabelle}% |
|
395 |
\end{isamarkuptxt}% |
|
396 |
\isamarkuptrue% |
|
397 |
\ \ \isacommand{apply}\isamarkupfalse% |
|
398 |
\ {\isacharparenleft}unfold\ nat{\isacharunderscore}dvd{\isacharunderscore}meet{\isacharunderscore}eq\ nat{\isacharunderscore}dvd{\isacharunderscore}join{\isacharunderscore}eq{\isacharparenright}% |
|
399 |
\begin{isamarkuptxt}% |
|
400 |
\begin{isabelle}% |
|
27595 | 401 |
\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ y\ z{\isachardot}\ gcd\ x\ {\isacharparenleft}lcm\ y\ z{\isacharparenright}\ {\isacharequal}\ lcm\ {\isacharparenleft}gcd\ x\ y{\isacharparenright}\ {\isacharparenleft}gcd\ x\ z{\isacharparenright}% |
27063 | 402 |
\end{isabelle}% |
403 |
\end{isamarkuptxt}% |
|
404 |
\isamarkuptrue% |
|
405 |
\ \ \isacommand{apply}\isamarkupfalse% |
|
406 |
\ {\isacharparenleft}rule\ gcd{\isacharunderscore}lcm{\isacharunderscore}distr{\isacharparenright}\ \isacommand{done}\isamarkupfalse% |
|
407 |
% |
|
408 |
\endisatagvisible |
|
409 |
{\isafoldvisible}% |
|
410 |
% |
|
411 |
\isadelimvisible |
|
412 |
% |
|
413 |
\endisadelimvisible |
|
414 |
% |
|
415 |
\begin{isamarkuptext}% |
|
416 |
Theorems that are available in the theory after these |
|
417 |
interpretations are shown in Table~\ref{tab:nat-dvd-lattice}. |
|
418 |
||
419 |
\begin{table} |
|
420 |
\hrule |
|
421 |
\vspace{2ex} |
|
422 |
\begin{center} |
|
423 |
\begin{tabular}{l} |
|
424 |
\isa{nat{\isacharunderscore}dvd{\isachardot}less{\isacharunderscore}def} from locale \isa{partial{\isacharunderscore}order}: \\ |
|
425 |
\quad \isa{{\isacharparenleft}{\isacharquery}x\ dvd\ {\isacharquery}y\ {\isasymand}\ {\isacharquery}x\ {\isasymnoteq}\ {\isacharquery}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isacharquery}x\ dvd\ {\isacharquery}y\ {\isasymand}\ {\isacharquery}x\ {\isasymnoteq}\ {\isacharquery}y{\isacharparenright}} \\ |
|
426 |
\isa{nat{\isacharunderscore}dvd{\isachardot}meet{\isacharunderscore}left} from locale \isa{lattice}: \\ |
|
27595 | 427 |
\quad \isa{gcd\ {\isacharquery}x\ {\isacharquery}y\ dvd\ {\isacharquery}x} \\ |
27063 | 428 |
\isa{nat{\isacharunderscore}dvd{\isachardot}join{\isacharunderscore}distr} from locale \isa{distrib{\isacharunderscore}lattice}: \\ |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
429 |
\quad \isa{lattice{\isachardot}join\ op\ dvd\ {\isacharquery}x\ {\isacharparenleft}lattice{\isachardot}meet\ op\ dvd\ {\isacharquery}y\ {\isacharquery}z{\isacharparenright}\ {\isacharequal}\ lattice{\isachardot}meet\ op\ dvd\ {\isacharparenleft}lattice{\isachardot}join\ op\ dvd\ {\isacharquery}x\ {\isacharquery}y{\isacharparenright}\ {\isacharparenleft}lattice{\isachardot}join\ op\ dvd\ {\isacharquery}x\ {\isacharquery}z{\isacharparenright}} \\ |
27063 | 430 |
\end{tabular} |
431 |
\end{center} |
|
432 |
\hrule |
|
433 |
\caption{Interpreted theorems for \isa{dvd} on the natural numbers.} |
|
434 |
\label{tab:nat-dvd-lattice} |
|
435 |
\end{table}% |
|
436 |
\end{isamarkuptext}% |
|
437 |
\isamarkuptrue% |
|
438 |
% |
|
439 |
\begin{isamarkuptext}% |
|
440 |
The full syntax of the interpretation commands is shown in |
|
441 |
Table~\ref{tab:commands}. The grammar refers to |
|
30580
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
442 |
\textit{expression}, which stands for a \emph{locale} expression. |
cc5a55d7a5be
Updated chapters 1-5 to locale reimplementation.
ballarin
parents:
30393
diff
changeset
|
443 |
Locale expressions are discussed in the following section.% |
27063 | 444 |
\end{isamarkuptext}% |
445 |
\isamarkuptrue% |
|
446 |
% |
|
27079 | 447 |
\isamarkupsection{Locale Expressions \label{sec:expressions}% |
27063 | 448 |
} |
449 |
\isamarkuptrue% |
|
450 |
% |
|
451 |
\begin{isamarkuptext}% |
|
27079 | 452 |
A map \isa{{\isasymphi}} between partial orders \isa{{\isasymsqsubseteq}} and \isa{{\isasympreceq}} |
27063 | 453 |
is called order preserving if \isa{x\ {\isasymsqsubseteq}\ y} implies \isa{{\isasymphi}\ x\ {\isasympreceq}\ {\isasymphi}\ y}. This situation is more complex than those encountered so |
454 |
far: it involves two partial orders, and it is desirable to use the |
|
455 |
existing locale for both. |
|
456 |
||
457 |
Inspecting the grammar of locale commands in |
|
458 |
Table~\ref{tab:commands} reveals that the import of a locale can be |
|
459 |
more than just a single locale. In general, the import is a |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
460 |
\emph{locale expression}. These enable to combine locales |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
461 |
and instantiate parameters. A locale expression is a sequence of |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
462 |
locale \emph{instances} followed by an optional \isakeyword{for} |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
463 |
clause. Each instance consists of a locale reference, which may be |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
464 |
preceded by a qualifer and succeeded by instantiations of the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
465 |
parameters of that locale. Instantiations may be either positional |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
466 |
or through explicit parameter argument pairs. |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
467 |
|
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
468 |
Using a locale expression, a locale for order |
27063 | 469 |
preserving maps can be declared in the following way.% |
470 |
\end{isamarkuptext}% |
|
471 |
\isamarkuptrue% |
|
472 |
\ \ \isacommand{locale}\isamarkupfalse% |
|
473 |
\ order{\isacharunderscore}preserving\ {\isacharequal}\isanewline |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
474 |
\ \ \ \ le{\isacharcolon}\ partial{\isacharunderscore}order\ le\ {\isacharplus}\ le{\isacharprime}{\isacharcolon}\ partial{\isacharunderscore}order\ le{\isacharprime}\isanewline |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
475 |
\ \ \ \ \ \ \isakeyword{for}\ le\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymsqsubseteq}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ \isakeyword{and}\ le{\isacharprime}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasympreceq}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ {\isacharplus}\isanewline |
27063 | 476 |
\ \ \ \ \isakeyword{fixes}\ {\isasymphi}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}b{\isachardoublequoteclose}\isanewline |
477 |
\ \ \ \ \isakeyword{assumes}\ hom{\isacharunderscore}le{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymsqsubseteq}\ y\ {\isasymLongrightarrow}\ {\isasymphi}\ x\ {\isasympreceq}\ {\isasymphi}\ y{\isachardoublequoteclose}% |
|
478 |
\begin{isamarkuptext}% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
479 |
The second and third line contain the expression --- two |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
480 |
instances of the partial order locale with instantiations \isa{le} |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
481 |
and \isa{le{\isacharprime}}, respectively. The \isakeyword{for} clause consists |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
482 |
of parameter declarations and is similar to the context element |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
483 |
\isakeyword{fixes}. The notable difference is that the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
484 |
\isakeyword{for} clause is part of the expression, and only |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
485 |
parameters defined in the expression may occur in its instances. |
27063 | 486 |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
487 |
Instances are \emph{morphisms} on locales. Their effect on the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
488 |
parameters is naturally lifted to terms, propositions and theorems, |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
489 |
and thus to the assumptions and conclusions of a locale. The |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
490 |
assumption of a locale expression is the conjunction of the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
491 |
assumptions of the instances. The conclusions of a sequence of |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
492 |
instances are obtained by appending the conclusions of the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
493 |
instances in the order of the sequence. |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
494 |
|
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
495 |
The qualifiers in the expression are already a familiar concept from |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
496 |
the \isakeyword{interpretation} command. They serve to distinguish |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
497 |
names (in particular theorem names) for the two partial orders |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
498 |
within the locale. Qualifiers in the \isakeyword{locale} command |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
499 |
default to optional. Here are examples of theorems in locale \isa{order{\isacharunderscore}preserving}:% |
27063 | 500 |
\end{isamarkuptext}% |
501 |
\isamarkuptrue% |
|
502 |
% |
|
503 |
\isadeliminvisible |
|
504 |
% |
|
505 |
\endisadeliminvisible |
|
506 |
% |
|
507 |
\isataginvisible |
|
508 |
\isacommand{context}\isamarkupfalse% |
|
509 |
\ order{\isacharunderscore}preserving\ \isakeyword{begin}% |
|
510 |
\endisataginvisible |
|
511 |
{\isafoldinvisible}% |
|
512 |
% |
|
513 |
\isadeliminvisible |
|
514 |
% |
|
515 |
\endisadeliminvisible |
|
516 |
% |
|
517 |
\begin{isamarkuptext}% |
|
518 |
\isa{le{\isachardot}less{\isacharunderscore}le{\isacharunderscore}trans}: \isa{{\isasymlbrakk}{\isacharquery}x\ {\isasymsqsubset}\ {\isacharquery}y{\isacharsemicolon}\ {\isacharquery}y\ {\isasymsqsubseteq}\ {\isacharquery}z{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}x\ {\isasymsqsubset}\ {\isacharquery}z} |
|
519 |
||
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
520 |
\isa{hom{\isacharunderscore}le}: \isa{{\isacharquery}x\ {\isasymsqsubseteq}\ {\isacharquery}y\ {\isasymLongrightarrow}\ {\isasymphi}\ {\isacharquery}x\ {\isasympreceq}\ {\isasymphi}\ {\isacharquery}y}% |
27063 | 521 |
\end{isamarkuptext}% |
522 |
\isamarkuptrue% |
|
523 |
% |
|
524 |
\begin{isamarkuptext}% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
525 |
The theorems for the partial order \isa{{\isasympreceq}} |
27063 | 526 |
are qualified by \isa{le{\isacharprime}}. For example, \isa{le{\isacharprime}{\isachardot}less{\isacharunderscore}le{\isacharunderscore}trans}: \begin{isabelle}% |
527 |
\ \ {\isasymlbrakk}partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasympreceq}\ {\isacharquery}x\ {\isacharquery}y{\isacharsemicolon}\ {\isacharquery}y\ {\isasympreceq}\ {\isacharquery}z{\isasymrbrakk}\isanewline |
|
528 |
\isaindent{\ \ }{\isasymLongrightarrow}\ partial{\isacharunderscore}order{\isachardot}less\ op\ {\isasympreceq}\ {\isacharquery}x\ {\isacharquery}z% |
|
529 |
\end{isabelle}% |
|
530 |
\end{isamarkuptext}% |
|
531 |
\isamarkuptrue% |
|
532 |
% |
|
533 |
\isadeliminvisible |
|
534 |
% |
|
535 |
\endisadeliminvisible |
|
536 |
% |
|
537 |
\isataginvisible |
|
538 |
\isacommand{end}\isamarkupfalse% |
|
539 |
% |
|
540 |
\endisataginvisible |
|
541 |
{\isafoldinvisible}% |
|
542 |
% |
|
543 |
\isadeliminvisible |
|
544 |
% |
|
545 |
\endisadeliminvisible |
|
546 |
% |
|
547 |
\begin{isamarkuptext}% |
|
548 |
This example reveals that there is no infix syntax for the strict |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
549 |
version of \isa{{\isasympreceq}}! This can be declared through an abbreviation.% |
27063 | 550 |
\end{isamarkuptext}% |
551 |
\isamarkuptrue% |
|
552 |
\ \ \isacommand{abbreviation}\isamarkupfalse% |
|
553 |
\ {\isacharparenleft}\isakeyword{in}\ order{\isacharunderscore}preserving{\isacharparenright}\isanewline |
|
554 |
\ \ \ \ less{\isacharprime}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymprec}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ \isakeyword{where}\ {\isachardoublequoteopen}less{\isacharprime}\ {\isasymequiv}\ partial{\isacharunderscore}order{\isachardot}less\ le{\isacharprime}{\isachardoublequoteclose}% |
|
555 |
\begin{isamarkuptext}% |
|
556 |
Now the theorem is displayed nicely as |
|
557 |
\isa{{\isasymlbrakk}{\isacharquery}x\ {\isasymprec}\ {\isacharquery}y{\isacharsemicolon}\ {\isacharquery}y\ {\isasympreceq}\ {\isacharquery}z{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}x\ {\isasymprec}\ {\isacharquery}z}.% |
|
558 |
\end{isamarkuptext}% |
|
559 |
\isamarkuptrue% |
|
560 |
% |
|
561 |
\begin{isamarkuptext}% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
562 |
Qualifiers not only apply to theorem names, but also to names |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
563 |
introduced by definitions and abbreviations. In locale |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
564 |
\isa{partial{\isacharunderscore}order} the full name of the strict order of \isa{{\isasymsqsubseteq}} is |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
565 |
\isa{le{\isachardot}less} and therefore \isa{le{\isacharprime}{\isachardot}less} is the full name of |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
566 |
the strict order of \isa{{\isasympreceq}}. Hence, the equation in the |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
567 |
abbreviation above could have been also written as \isa{less{\isacharprime}\ {\isasymequiv}\ le{\isacharprime}{\isachardot}less}.% |
27063 | 568 |
\end{isamarkuptext}% |
569 |
\isamarkuptrue% |
|
570 |
% |
|
571 |
\begin{isamarkuptext}% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
572 |
Readers may find the declaration of locale \isa{order{\isacharunderscore}preserving} a little awkward, because the declaration and |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
573 |
concrete syntax for \isa{le} from \isa{partial{\isacharunderscore}order} are |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
574 |
repeated in the declaration of \isa{order{\isacharunderscore}preserving}. Locale |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
575 |
expressions provide a convenient short hand for this. A parameter |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
576 |
in an instance is \emph{untouched} if no instantiation term is |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
577 |
provided for it. In positional instantiations, a parameter position |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
578 |
may be skipped with an underscore, and it is allowed to give fewer |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
579 |
instantiation terms than the instantiated locale's number of |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
580 |
parameters. In named instantiations, instantiation pairs for |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
581 |
certain parameters may simply be omitted. Untouched parameters are |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
582 |
declared by the locale expression and with their concrete syntax by |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
583 |
implicitly adding them to the beginning of the \isakeyword{for} |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
584 |
clause. |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
585 |
|
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
586 |
The following locales illustrate this. A map \isa{{\isasymphi}} is a |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
587 |
lattice homomorphism if it preserves meet and join.% |
27063 | 588 |
\end{isamarkuptext}% |
589 |
\isamarkuptrue% |
|
590 |
\ \ \isacommand{locale}\isamarkupfalse% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
591 |
\ lattice{\isacharunderscore}hom\ {\isacharequal}\isanewline |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
592 |
\ \ \ \ le{\isacharcolon}\ lattice\ {\isacharplus}\ le{\isacharprime}{\isacharcolon}\ lattice\ le{\isacharprime}\ \isakeyword{for}\ le{\isacharprime}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasympreceq}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ {\isacharplus}\isanewline |
27063 | 593 |
\ \ \ \ \isakeyword{fixes}\ {\isasymphi}\isanewline |
594 |
\ \ \ \ \isakeyword{assumes}\ hom{\isacharunderscore}meet{\isacharcolon}\isanewline |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
595 |
\ \ \ \ \ \ \ \ {\isachardoublequoteopen}{\isasymphi}\ {\isacharparenleft}x\ {\isasymsqinter}\ y{\isacharparenright}\ {\isacharequal}\ le{\isacharprime}{\isachardot}meet\ {\isacharparenleft}{\isasymphi}\ x{\isacharparenright}\ {\isacharparenleft}{\isasymphi}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
27063 | 596 |
\ \ \ \ \ \ \isakeyword{and}\ hom{\isacharunderscore}join{\isacharcolon}\isanewline |
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
597 |
\ \ \ \ \ \ \ \ {\isachardoublequoteopen}{\isasymphi}\ {\isacharparenleft}x\ {\isasymsqunion}\ y{\isacharparenright}\ {\isacharequal}\ le{\isacharprime}{\isachardot}join\ {\isacharparenleft}{\isasymphi}\ x{\isacharparenright}\ {\isacharparenleft}{\isasymphi}\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline |
27063 | 598 |
\isanewline |
599 |
\ \ \isacommand{abbreviation}\isamarkupfalse% |
|
600 |
\ {\isacharparenleft}\isakeyword{in}\ lattice{\isacharunderscore}hom{\isacharparenright}\isanewline |
|
601 |
\ \ \ \ meet{\isacharprime}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymsqinter}{\isacharprime}{\isacharprime}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ \isakeyword{where}\ {\isachardoublequoteopen}meet{\isacharprime}\ {\isasymequiv}\ le{\isacharprime}{\isachardot}meet{\isachardoublequoteclose}\isanewline |
|
602 |
\ \ \isacommand{abbreviation}\isamarkupfalse% |
|
603 |
\ {\isacharparenleft}\isakeyword{in}\ lattice{\isacharunderscore}hom{\isacharparenright}\isanewline |
|
604 |
\ \ \ \ join{\isacharprime}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymsqunion}{\isacharprime}{\isacharprime}{\isachardoublequoteclose}\ {\isadigit{5}}{\isadigit{0}}{\isacharparenright}\ \isakeyword{where}\ {\isachardoublequoteopen}join{\isacharprime}\ {\isasymequiv}\ le{\isacharprime}{\isachardot}join{\isachardoublequoteclose}% |
|
605 |
\begin{isamarkuptext}% |
|
606 |
A homomorphism is an endomorphism if both orders coincide.% |
|
607 |
\end{isamarkuptext}% |
|
608 |
\isamarkuptrue% |
|
609 |
\ \ \isacommand{locale}\isamarkupfalse% |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
610 |
\ lattice{\isacharunderscore}end\ {\isacharequal}\ lattice{\isacharunderscore}hom\ {\isacharunderscore}\ le% |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
611 |
\begin{isamarkuptext}% |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
612 |
In this declaration, the first parameter of \isa{lattice{\isacharunderscore}hom}, \isa{le}, is untouched and then used to instantiate |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
613 |
the second parameter. Its concrete syntax is preseverd.% |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
614 |
\end{isamarkuptext}% |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
615 |
\isamarkuptrue% |
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
616 |
% |
27063 | 617 |
\begin{isamarkuptext}% |
618 |
The inheritance diagram of the situation we have now is shown |
|
619 |
in Figure~\ref{fig:hom}, where the dashed line depicts an |
|
620 |
interpretation which is introduced below. Renamings are |
|
621 |
indicated by $\sqsubseteq \mapsto \preceq$ etc. The expression |
|
622 |
imported by \isa{lattice{\isacharunderscore}end} identifies the first and second |
|
623 |
parameter of \isa{lattice{\isacharunderscore}hom}. By looking at the inheritance diagram it would seem |
|
624 |
that two identical copies of each of the locales \isa{partial{\isacharunderscore}order} and \isa{lattice} are imported. This is not the |
|
625 |
case! Inheritance paths with identical morphisms are detected and |
|
27506 | 626 |
the conclusions of the respective locales appear only once. |
27063 | 627 |
|
628 |
\begin{figure} |
|
629 |
\hrule \vspace{2ex} |
|
630 |
\begin{center} |
|
631 |
\begin{tikzpicture} |
|
632 |
\node (o) at (0,0) {\isa{partial{\isacharunderscore}order}}; |
|
633 |
\node (oh) at (1.5,-2) {\isa{order{\isacharunderscore}preserving}}; |
|
634 |
\node (oh1) at (1.5,-0.7) {$\scriptscriptstyle \sqsubseteq \mapsto \sqsubseteq$}; |
|
635 |
\node (oh2) at (0,-1.3) {$\scriptscriptstyle \sqsubseteq \mapsto \preceq$}; |
|
636 |
\node (l) at (-1.5,-2) {\isa{lattice}}; |
|
637 |
\node (lh) at (0,-4) {\isa{lattice{\isacharunderscore}hom}}; |
|
638 |
\node (lh1) at (0,-2.7) {$\scriptscriptstyle \sqsubseteq \mapsto \sqsubseteq$}; |
|
639 |
\node (lh2) at (-1.5,-3.3) {$\scriptscriptstyle \sqsubseteq \mapsto \preceq$}; |
|
640 |
\node (le) at (0,-6) {\isa{lattice{\isacharunderscore}end}}; |
|
641 |
\node (le1) at (0,-4.8) |
|
642 |
[anchor=west]{$\scriptscriptstyle \sqsubseteq \mapsto \sqsubseteq$}; |
|
643 |
\node (le2) at (0,-5.2) |
|
644 |
[anchor=west]{$\scriptscriptstyle \preceq \mapsto \sqsubseteq$}; |
|
645 |
\draw (o) -- (l); |
|
646 |
\draw[dashed] (oh) -- (lh); |
|
647 |
\draw (lh) -- (le); |
|
648 |
\draw (o) .. controls (oh1.south west) .. (oh); |
|
649 |
\draw (o) .. controls (oh2.north east) .. (oh); |
|
650 |
\draw (l) .. controls (lh1.south west) .. (lh); |
|
651 |
\draw (l) .. controls (lh2.north east) .. (lh); |
|
652 |
\end{tikzpicture} |
|
653 |
\end{center} |
|
654 |
\hrule |
|
655 |
\caption{Hierarchy of Homomorphism Locales.} |
|
656 |
\label{fig:hom} |
|
657 |
\end{figure}% |
|
658 |
\end{isamarkuptext}% |
|
659 |
\isamarkuptrue% |
|
660 |
% |
|
661 |
\begin{isamarkuptext}% |
|
662 |
It can be shown easily that a lattice homomorphism is order |
|
663 |
preserving. As the final example of this section, a locale |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
664 |
interpretation is used to assert this:% |
27063 | 665 |
\end{isamarkuptext}% |
666 |
\isamarkuptrue% |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
667 |
\ \ \isacommand{sublocale}\isamarkupfalse% |
27063 | 668 |
\ lattice{\isacharunderscore}hom\ {\isasymsubseteq}\ order{\isacharunderscore}preserving% |
669 |
\isadelimproof |
|
670 |
\ % |
|
671 |
\endisadelimproof |
|
672 |
% |
|
673 |
\isatagproof |
|
674 |
\isacommand{proof}\isamarkupfalse% |
|
675 |
\ unfold{\isacharunderscore}locales\isanewline |
|
676 |
\ \ \ \ \isacommand{fix}\isamarkupfalse% |
|
677 |
\ x\ y\isanewline |
|
678 |
\ \ \ \ \isacommand{assume}\isamarkupfalse% |
|
679 |
\ {\isachardoublequoteopen}x\ {\isasymsqsubseteq}\ y{\isachardoublequoteclose}\isanewline |
|
680 |
\ \ \ \ \isacommand{then}\isamarkupfalse% |
|
681 |
\ \isacommand{have}\isamarkupfalse% |
|
682 |
\ {\isachardoublequoteopen}y\ {\isacharequal}\ {\isacharparenleft}x\ {\isasymsqunion}\ y{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse% |
|
683 |
\ {\isacharparenleft}simp\ add{\isacharcolon}\ le{\isachardot}join{\isacharunderscore}connection{\isacharparenright}\isanewline |
|
684 |
\ \ \ \ \isacommand{then}\isamarkupfalse% |
|
685 |
\ \isacommand{have}\isamarkupfalse% |
|
686 |
\ {\isachardoublequoteopen}{\isasymphi}\ y\ {\isacharequal}\ {\isacharparenleft}{\isasymphi}\ x\ {\isasymsqunion}{\isacharprime}\ {\isasymphi}\ y{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse% |
|
687 |
\ {\isacharparenleft}simp\ add{\isacharcolon}\ hom{\isacharunderscore}join\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharparenright}\isanewline |
|
688 |
\ \ \ \ \isacommand{then}\isamarkupfalse% |
|
689 |
\ \isacommand{show}\isamarkupfalse% |
|
690 |
\ {\isachardoublequoteopen}{\isasymphi}\ x\ {\isasympreceq}\ {\isasymphi}\ y{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse% |
|
691 |
\ {\isacharparenleft}simp\ add{\isacharcolon}\ le{\isacharprime}{\isachardot}join{\isacharunderscore}connection{\isacharparenright}\isanewline |
|
692 |
\ \ \isacommand{qed}\isamarkupfalse% |
|
693 |
% |
|
694 |
\endisatagproof |
|
695 |
{\isafoldproof}% |
|
696 |
% |
|
697 |
\isadelimproof |
|
698 |
% |
|
699 |
\endisadelimproof |
|
700 |
% |
|
701 |
\begin{isamarkuptext}% |
|
30393
aa6f42252bf6
replaced old locale option by proper "text (in locale)";
wenzelm
parents:
29568
diff
changeset
|
702 |
Theorems and other declarations --- syntax, in particular --- from |
aa6f42252bf6
replaced old locale option by proper "text (in locale)";
wenzelm
parents:
29568
diff
changeset
|
703 |
the locale \isa{order{\isacharunderscore}preserving} are now active in \isa{lattice{\isacharunderscore}hom}, for example |
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
704 |
|
27063 | 705 |
\isa{le{\isacharprime}{\isachardot}less{\isacharunderscore}le{\isacharunderscore}trans}: |
706 |
\isa{{\isasymlbrakk}{\isacharquery}x\ {\isasymprec}\ {\isacharquery}y{\isacharsemicolon}\ {\isacharquery}y\ {\isasympreceq}\ {\isacharquery}z{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}x\ {\isasymprec}\ {\isacharquery}z}% |
|
707 |
\end{isamarkuptext}% |
|
708 |
\isamarkuptrue% |
|
709 |
% |
|
710 |
\isamarkupsection{Further Reading% |
|
711 |
} |
|
712 |
\isamarkuptrue% |
|
713 |
% |
|
714 |
\begin{isamarkuptext}% |
|
715 |
More information on locales and their interpretation is |
|
716 |
available. For the locale hierarchy of import and interpretation |
|
717 |
dependencies see \cite{Ballarin2006a}; interpretations in theories |
|
718 |
and proofs are covered in \cite{Ballarin2006b}. In the latter, we |
|
719 |
show how interpretation in proofs enables to reason about families |
|
720 |
of algebraic structures, which cannot be expressed with locales |
|
721 |
directly. |
|
722 |
||
723 |
Haftmann and Wenzel \cite{HaftmannWenzel2007} overcome a restriction |
|
724 |
of axiomatic type classes through a combination with locale |
|
725 |
interpretation. The result is a Haskell-style class system with a |
|
30750
3779e2158dad
Update explanation of locale expressions to locale reimplementation.
ballarin
parents:
30580
diff
changeset
|
726 |
facility to generate ML and Haskell code. Classes are sufficient for |
27063 | 727 |
simple specifications with a single type parameter. The locales for |
728 |
orders and lattices presented in this tutorial fall into this |
|
729 |
category. Order preserving maps, homomorphisms and vector spaces, |
|
730 |
on the other hand, do not. |
|
731 |
||
732 |
The original work of Kamm\"uller on locales \cite{KammullerEtAl1999} |
|
733 |
may be of interest from a historical perspective. The mathematical |
|
734 |
background on orders and lattices is taken from Jacobson's textbook |
|
735 |
on algebra \cite[Chapter~8]{Jacobson1985}.% |
|
736 |
\end{isamarkuptext}% |
|
737 |
\isamarkuptrue% |
|
738 |
% |
|
739 |
\begin{isamarkuptext}% |
|
740 |
\begin{table} |
|
741 |
\hrule |
|
742 |
\vspace{2ex} |
|
743 |
\begin{center} |
|
744 |
\begin{tabular}{l>$c<$l} |
|
745 |
\multicolumn{3}{l}{Miscellaneous} \\ |
|
746 |
||
747 |
\textit{attr-name} & ::= |
|
748 |
& \textit{name} $|$ \textit{attribute} $|$ |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
749 |
\textit{name} \textit{attribute} \\ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
750 |
\textit{qualifier} & ::= |
30751 | 751 |
& \textit{name} [``\textbf{?}'' $|$ ``\textbf{!}''] \\[2ex] |
27063 | 752 |
|
753 |
\multicolumn{3}{l}{Context Elements} \\ |
|
754 |
||
755 |
\textit{fixes} & ::= |
|
756 |
& \textit{name} [ ``\textbf{::}'' \textit{type} ] |
|
757 |
[ ``\textbf{(}'' \textbf{structure} ``\textbf{)}'' $|$ |
|
758 |
\textit{mixfix} ] \\ |
|
759 |
\begin{comment} |
|
760 |
\textit{constrains} & ::= |
|
761 |
& \textit{name} ``\textbf{::}'' \textit{type} \\ |
|
762 |
\end{comment} |
|
763 |
\textit{assumes} & ::= |
|
764 |
& [ \textit{attr-name} ``\textbf{:}'' ] \textit{proposition} \\ |
|
765 |
\begin{comment} |
|
766 |
\textit{defines} & ::= |
|
767 |
& [ \textit{attr-name} ``\textbf{:}'' ] \textit{proposition} \\ |
|
768 |
\textit{notes} & ::= |
|
769 |
& [ \textit{attr-name} ``\textbf{=}'' ] |
|
770 |
( \textit{qualified-name} [ \textit{attribute} ] )$^+$ \\ |
|
771 |
\end{comment} |
|
772 |
||
773 |
\textit{element} & ::= |
|
774 |
& \textbf{fixes} \textit{fixes} ( \textbf{and} \textit{fixes} )$^*$ \\ |
|
775 |
\begin{comment} |
|
776 |
& | |
|
777 |
& \textbf{constrains} \textit{constrains} |
|
778 |
( \textbf{and} \textit{constrains} )$^*$ \\ |
|
779 |
\end{comment} |
|
780 |
& | |
|
781 |
& \textbf{assumes} \textit{assumes} ( \textbf{and} \textit{assumes} )$^*$ \\[2ex] |
|
782 |
%\begin{comment} |
|
783 |
% & | |
|
784 |
% & \textbf{defines} \textit{defines} ( \textbf{and} \textit{defines} )$^*$ \\ |
|
785 |
% & | |
|
786 |
% & \textbf{notes} \textit{notes} ( \textbf{and} \textit{notes} )$^*$ \\ |
|
787 |
%\end{comment} |
|
788 |
||
789 |
\multicolumn{3}{l}{Locale Expressions} \\ |
|
790 |
||
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
791 |
\textit{pos-insts} & ::= |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
792 |
& ( \textit{term} $|$ ``\textbf{\_}'' )$^*$ \\ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
793 |
\textit{named-insts} & ::= |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
794 |
& \textbf{where} \textit{name} ``\textbf{=}'' \textit{term} |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
795 |
( \textbf{and} \textit{name} ``\textbf{=}'' \textit{term} )$^*$ \\ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
796 |
\textit{instance} & ::= |
30751 | 797 |
& [ \textit{qualifier} ``\textbf{:}'' ] |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
798 |
\textit{qualified-name} ( \textit{pos-insts} $|$ \textit{named-inst} ) \\ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
799 |
\textit{expression} & ::= |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
800 |
& \textit{instance} ( ``\textbf{+}'' \textit{instance} )$^*$ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
801 |
[ \textbf{for} \textit{fixes} ( \textbf{and} \textit{fixes} )$^*$ ] \\[2ex] |
27063 | 802 |
|
803 |
\multicolumn{3}{l}{Declaration of Locales} \\ |
|
804 |
||
805 |
\textit{locale} & ::= |
|
806 |
& \textit{element}$^+$ \\ |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
807 |
& | & \textit{expression} [ ``\textbf{+}'' \textit{element}$^+$ ] \\ |
27063 | 808 |
\textit{toplevel} & ::= |
809 |
& \textbf{locale} \textit{name} [ ``\textbf{=}'' |
|
810 |
\textit{locale} ] \\[2ex] |
|
811 |
||
812 |
\multicolumn{3}{l}{Interpretation} \\ |
|
813 |
||
814 |
\textit{equation} & ::= & [ \textit{attr-name} ``\textbf{:}'' ] |
|
815 |
\textit{prop} \\ |
|
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
816 |
\textit{equations} & ::= & \textbf{where} \textit{equation} ( \textbf{and} |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
817 |
\textit{equation} )$^*$ \\ |
27063 | 818 |
\textit{toplevel} & ::= |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
819 |
& \textbf{sublocale} \textit{name} ( ``$<$'' $|$ |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
820 |
``$\subseteq$'' ) \textit{expression} \textit{proof} \\ |
27063 | 821 |
& | |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
822 |
& \textbf{interpretation} |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
823 |
\textit{expression} [ \textit{equations} ] \textit{proof} \\ |
27063 | 824 |
& | |
29566
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
825 |
& \textbf{interpret} |
937baa077df2
Fixed tutorial to compile with new locales; grammar of new locale commands.
ballarin
parents:
28259
diff
changeset
|
826 |
\textit{expression} \textit{proof} \\[2ex] |
27063 | 827 |
|
828 |
\multicolumn{3}{l}{Diagnostics} \\ |
|
829 |
||
830 |
\textit{toplevel} & ::= |
|
831 |
& \textbf{print\_locale} [ ``\textbf{!}'' ] \textit{locale} \\ |
|
832 |
& | & \textbf{print\_locales} |
|
833 |
\end{tabular} |
|
834 |
\end{center} |
|
835 |
\hrule |
|
29567 | 836 |
\caption{Syntax of Locale Commands (abridged).} |
27063 | 837 |
\label{tab:commands} |
838 |
\end{table}% |
|
839 |
\end{isamarkuptext}% |
|
840 |
\isamarkuptrue% |
|
841 |
% |
|
842 |
\begin{isamarkuptext}% |
|
843 |
\textbf{Acknowledgements.} Alexander Krauss, Tobias Nipkow, |
|
844 |
Christian Sternagel and Makarius Wenzel have made useful comments on |
|
845 |
a draft of this document.% |
|
846 |
\end{isamarkuptext}% |
|
847 |
\isamarkuptrue% |
|
848 |
% |
|
849 |
\isadelimtheory |
|
850 |
% |
|
851 |
\endisadelimtheory |
|
852 |
% |
|
853 |
\isatagtheory |
|
27080 | 854 |
\isacommand{end}\isamarkupfalse% |
27063 | 855 |
% |
856 |
\endisatagtheory |
|
857 |
{\isafoldtheory}% |
|
858 |
% |
|
859 |
\isadelimtheory |
|
860 |
% |
|
861 |
\endisadelimtheory |
|
27080 | 862 |
\isanewline |
27063 | 863 |
\end{isabellebody}% |
864 |
%%% Local Variables: |
|
865 |
%%% mode: latex |
|
866 |
%%% TeX-master: "root" |
|
867 |
%%% End: |