39 \begin{matharray}{rcl} |
39 \begin{matharray}{rcl} |
40 @{command_def "print_commands"}\<open>\<^sup>*\<close> & : & \<open>any \<rightarrow>\<close> \\ |
40 @{command_def "print_commands"}\<open>\<^sup>*\<close> & : & \<open>any \<rightarrow>\<close> \\ |
41 @{command_def "help"}\<open>\<^sup>*\<close> & : & \<open>any \<rightarrow>\<close> \\ |
41 @{command_def "help"}\<open>\<^sup>*\<close> & : & \<open>any \<rightarrow>\<close> \\ |
42 \end{matharray} |
42 \end{matharray} |
43 |
43 |
44 @{rail \<open> |
44 \<^rail>\<open> |
45 @@{command help} (@{syntax name} * ) |
45 @@{command help} (@{syntax name} * ) |
46 \<close>} |
46 \<close> |
47 |
47 |
48 \<^descr> @{command "print_commands"} prints all outer syntax keywords |
48 \<^descr> @{command "print_commands"} prints all outer syntax keywords |
49 and commands. |
49 and commands. |
50 |
50 |
51 \<^descr> @{command "help"}~\<open>pats\<close> retrieves outer syntax |
51 \<^descr> @{command "help"}~\<open>pats\<close> retrieves outer syntax |
105 @{syntax_def term_var} & = & \<^verbatim>\<open>?\<close>\<open>short_ident |\<close>~~\<^verbatim>\<open>?\<close>\<open>short_ident\<close>\<^verbatim>\<open>.\<close>\<open>nat\<close> \\ |
105 @{syntax_def term_var} & = & \<^verbatim>\<open>?\<close>\<open>short_ident |\<close>~~\<^verbatim>\<open>?\<close>\<open>short_ident\<close>\<^verbatim>\<open>.\<close>\<open>nat\<close> \\ |
106 @{syntax_def type_ident} & = & \<^verbatim>\<open>'\<close>\<open>short_ident\<close> \\ |
106 @{syntax_def type_ident} & = & \<^verbatim>\<open>'\<close>\<open>short_ident\<close> \\ |
107 @{syntax_def type_var} & = & \<^verbatim>\<open>?\<close>\<open>type_ident |\<close>~~\<^verbatim>\<open>?\<close>\<open>type_ident\<close>\<^verbatim>\<open>.\<close>\<open>nat\<close> \\ |
107 @{syntax_def type_var} & = & \<^verbatim>\<open>?\<close>\<open>type_ident |\<close>~~\<^verbatim>\<open>?\<close>\<open>type_ident\<close>\<^verbatim>\<open>.\<close>\<open>nat\<close> \\ |
108 @{syntax_def string} & = & \<^verbatim>\<open>"\<close> \<open>\<dots>\<close> \<^verbatim>\<open>"\<close> \\ |
108 @{syntax_def string} & = & \<^verbatim>\<open>"\<close> \<open>\<dots>\<close> \<^verbatim>\<open>"\<close> \\ |
109 @{syntax_def altstring} & = & \<^verbatim>\<open>`\<close> \<open>\<dots>\<close> \<^verbatim>\<open>`\<close> \\ |
109 @{syntax_def altstring} & = & \<^verbatim>\<open>`\<close> \<open>\<dots>\<close> \<^verbatim>\<open>`\<close> \\ |
110 @{syntax_def cartouche} & = & @{verbatim "\<open>"} \<open>\<dots>\<close> @{verbatim "\<close>"} \\ |
110 @{syntax_def cartouche} & = & \<^verbatim>\<open>\<open>\<close> \<open>\<dots>\<close> \<^verbatim>\<open>\<close>\<close> \\ |
111 @{syntax_def verbatim} & = & \<^verbatim>\<open>{*\<close> \<open>\<dots>\<close> \<^verbatim>\<open>*}\<close> \\[1ex] |
111 @{syntax_def verbatim} & = & \<^verbatim>\<open>{*\<close> \<open>\<dots>\<close> \<^verbatim>\<open>*}\<close> \\[1ex] |
112 |
112 |
113 \<open>letter\<close> & = & \<open>latin |\<close>~~\<^verbatim>\<open>\\<close>\<^verbatim>\<open><\<close>\<open>latin\<close>\<^verbatim>\<open>>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\\<close>\<^verbatim>\<open><\<close>\<open>latin latin\<close>\<^verbatim>\<open>>\<close>~~\<open>| greek |\<close> \\ |
113 \<open>letter\<close> & = & \<open>latin |\<close>~~\<^verbatim>\<open>\\<close>\<^verbatim>\<open><\<close>\<open>latin\<close>\<^verbatim>\<open>>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\\<close>\<^verbatim>\<open><\<close>\<open>latin latin\<close>\<^verbatim>\<open>>\<close>~~\<open>| greek |\<close> \\ |
114 \<open>subscript\<close> & = & \<^verbatim>\<open>\<^sub>\<close> \\ |
114 \<open>subscript\<close> & = & \<^verbatim>\<open>\<^sub>\<close> \\ |
115 \<open>quasiletter\<close> & = & \<open>letter | digit |\<close>~~\<^verbatim>\<open>_\<close>~~\<open>|\<close>~~\<^verbatim>\<open>'\<close> \\ |
115 \<open>quasiletter\<close> & = & \<open>letter | digit |\<close>~~\<^verbatim>\<open>_\<close>~~\<open>|\<close>~~\<^verbatim>\<open>'\<close> \\ |
127 & & \<^verbatim>\<open>\<Upsilon>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Phi>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Psi>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Omega>\<close> \\ |
127 & & \<^verbatim>\<open>\<Upsilon>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Phi>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Psi>\<close>~~\<open>|\<close>~~\<^verbatim>\<open>\<Omega>\<close> \\ |
128 \end{supertabular} |
128 \end{supertabular} |
129 \end{center} |
129 \end{center} |
130 |
130 |
131 A @{syntax_ref term_var} or @{syntax_ref type_var} describes an unknown, |
131 A @{syntax_ref term_var} or @{syntax_ref type_var} describes an unknown, |
132 which is internally a pair of base name and index (ML type @{ML_type |
132 which is internally a pair of base name and index (ML type \<^ML_type>\<open>indexname\<close>). These components are either separated by a dot as in \<open>?x.1\<close> or |
133 indexname}). These components are either separated by a dot as in \<open>?x.1\<close> or |
|
134 \<open>?x7.3\<close> or run together as in \<open>?x1\<close>. The latter form is possible if the base |
133 \<open>?x7.3\<close> or run together as in \<open>?x1\<close>. The latter form is possible if the base |
135 name does not end with digits. If the index is 0, it may be dropped |
134 name does not end with digits. If the index is 0, it may be dropped |
136 altogether: \<open>?x\<close> and \<open>?x0\<close> and \<open>?x.0\<close> all refer to the same unknown, with |
135 altogether: \<open>?x\<close> and \<open>?x0\<close> and \<open>?x.0\<close> all refer to the same unknown, with |
137 basename \<open>x\<close> and index 0. |
136 basename \<open>x\<close> and index 0. |
138 |
137 |
145 The body of @{syntax_ref verbatim} may consist of any text not containing |
144 The body of @{syntax_ref verbatim} may consist of any text not containing |
146 ``\<^verbatim>\<open>*}\<close>''; this allows to include quotes without further escapes, but there |
145 ``\<^verbatim>\<open>*}\<close>''; this allows to include quotes without further escapes, but there |
147 is no way to escape ``\<^verbatim>\<open>*}\<close>''. Cartouches do not have this limitation. |
146 is no way to escape ``\<^verbatim>\<open>*}\<close>''. Cartouches do not have this limitation. |
148 |
147 |
149 A @{syntax_ref cartouche} consists of arbitrary text, with properly balanced |
148 A @{syntax_ref cartouche} consists of arbitrary text, with properly balanced |
150 blocks of ``@{verbatim "\<open>"}~\<open>\<dots>\<close>~@{verbatim "\<close>"}''. Note that the rendering |
149 blocks of ``\<^verbatim>\<open>\<open>\<close>~\<open>\<dots>\<close>~\<^verbatim>\<open>\<close>\<close>''. Note that the rendering |
151 of cartouche delimiters is usually like this: ``\<open>\<open> \<dots> \<close>\<close>''. |
150 of cartouche delimiters is usually like this: ``\<open>\<open> \<dots> \<close>\<close>''. |
152 |
151 |
153 Source comments take the form \<^verbatim>\<open>(*\<close>~\<open>\<dots>\<close>~\<^verbatim>\<open>*)\<close> and may be nested: the text is |
152 Source comments take the form \<^verbatim>\<open>(*\<close>~\<open>\<dots>\<close>~\<^verbatim>\<open>*)\<close> and may be nested: the text is |
154 removed after lexical analysis of the input and thus not suitable for |
153 removed after lexical analysis of the input and thus not suitable for |
155 documentation. The Isar syntax also provides proper \<^emph>\<open>document comments\<close> |
154 documentation. The Isar syntax also provides proper \<^emph>\<open>document comments\<close> |
179 text \<open> |
178 text \<open> |
180 Entity @{syntax name} usually refers to any name of types, constants, |
179 Entity @{syntax name} usually refers to any name of types, constants, |
181 theorems etc.\ Quoted strings provide an escape for non-identifier names or |
180 theorems etc.\ Quoted strings provide an escape for non-identifier names or |
182 those ruled out by outer syntax keywords (e.g.\ quoted \<^verbatim>\<open>"let"\<close>). |
181 those ruled out by outer syntax keywords (e.g.\ quoted \<^verbatim>\<open>"let"\<close>). |
183 |
182 |
184 @{rail \<open> |
183 \<^rail>\<open> |
185 @{syntax_def name}: @{syntax short_ident} | @{syntax long_ident} | |
184 @{syntax_def name}: @{syntax short_ident} | @{syntax long_ident} | |
186 @{syntax sym_ident} | @{syntax nat} | @{syntax string} |
185 @{syntax sym_ident} | @{syntax nat} | @{syntax string} |
187 ; |
186 ; |
188 @{syntax_def par_name}: '(' @{syntax name} ')' |
187 @{syntax_def par_name}: '(' @{syntax name} ')' |
189 \<close>} |
188 \<close> |
190 |
189 |
191 A @{syntax_def system_name} is like @{syntax name}, but it excludes |
190 A @{syntax_def system_name} is like @{syntax name}, but it excludes |
192 white-space characters and needs to conform to file-name notation. Name |
191 white-space characters and needs to conform to file-name notation. Name |
193 components that are special on Windows (e.g.\ \<^verbatim>\<open>CON\<close>, \<^verbatim>\<open>PRN\<close>, \<^verbatim>\<open>AUX\<close>) are |
192 components that are special on Windows (e.g.\ \<^verbatim>\<open>CON\<close>, \<^verbatim>\<open>PRN\<close>, \<^verbatim>\<open>AUX\<close>) are |
194 excluded on all platforms. |
193 excluded on all platforms. |
200 text \<open> |
199 text \<open> |
201 The outer lexical syntax (\secref{sec:outer-lex}) admits natural numbers and |
200 The outer lexical syntax (\secref{sec:outer-lex}) admits natural numbers and |
202 floating point numbers. These are combined as @{syntax int} and @{syntax |
201 floating point numbers. These are combined as @{syntax int} and @{syntax |
203 real} as follows. |
202 real} as follows. |
204 |
203 |
205 @{rail \<open> |
204 \<^rail>\<open> |
206 @{syntax_def int}: @{syntax nat} | '-' @{syntax nat} |
205 @{syntax_def int}: @{syntax nat} | '-' @{syntax nat} |
207 ; |
206 ; |
208 @{syntax_def real}: @{syntax float} | @{syntax int} |
207 @{syntax_def real}: @{syntax float} | @{syntax int} |
209 \<close>} |
208 \<close> |
210 |
209 |
211 Note that there is an overlap with the category @{syntax name}, which also |
210 Note that there is an overlap with the category @{syntax name}, which also |
212 includes @{syntax nat}. |
211 includes @{syntax nat}. |
213 \<close> |
212 \<close> |
214 |
213 |
221 balancing of cartouche delimiters. Quoted strings are possible as well, but |
220 balancing of cartouche delimiters. Quoted strings are possible as well, but |
222 require escaped quotes when nested. As a shortcut, tokens that appear as |
221 require escaped quotes when nested. As a shortcut, tokens that appear as |
223 plain identifiers in the outer language may be used as inner language |
222 plain identifiers in the outer language may be used as inner language |
224 content without delimiters. |
223 content without delimiters. |
225 |
224 |
226 @{rail \<open> |
225 \<^rail>\<open> |
227 @{syntax_def embedded}: @{syntax cartouche} | @{syntax string} | |
226 @{syntax_def embedded}: @{syntax cartouche} | @{syntax string} | |
228 @{syntax short_ident} | @{syntax long_ident} | @{syntax sym_ident} | |
227 @{syntax short_ident} | @{syntax long_ident} | @{syntax sym_ident} | |
229 @{syntax term_var} | @{syntax type_ident} | @{syntax type_var} | @{syntax nat} |
228 @{syntax term_var} | @{syntax type_ident} | @{syntax type_var} | @{syntax nat} |
230 \<close>} |
229 \<close> |
231 \<close> |
230 \<close> |
232 |
231 |
233 |
232 |
234 subsection \<open>Document text\<close> |
233 subsection \<open>Document text\<close> |
235 |
234 |
237 A chunk of document @{syntax text} is usually given as @{syntax cartouche} |
236 A chunk of document @{syntax text} is usually given as @{syntax cartouche} |
238 \<open>\<open>\<dots>\<close>\<close> or @{syntax verbatim}, i.e.\ enclosed in \<^verbatim>\<open>{*\<close>~\<open>\<dots>\<close>~\<^verbatim>\<open>*}\<close>. For |
237 \<open>\<open>\<dots>\<close>\<close> or @{syntax verbatim}, i.e.\ enclosed in \<^verbatim>\<open>{*\<close>~\<open>\<dots>\<close>~\<^verbatim>\<open>*}\<close>. For |
239 convenience, any of the smaller text unit that conforms to @{syntax name} is |
238 convenience, any of the smaller text unit that conforms to @{syntax name} is |
240 admitted as well. |
239 admitted as well. |
241 |
240 |
242 @{rail \<open> |
241 \<^rail>\<open> |
243 @{syntax_def text}: @{syntax embedded} | @{syntax verbatim} |
242 @{syntax_def text}: @{syntax embedded} | @{syntax verbatim} |
244 \<close>} |
243 \<close> |
245 |
244 |
246 Typical uses are document markup commands, like \<^theory_text>\<open>chapter\<close>, \<^theory_text>\<open>section\<close> etc. |
245 Typical uses are document markup commands, like \<^theory_text>\<open>chapter\<close>, \<^theory_text>\<open>section\<close> etc. |
247 (\secref{sec:markup}). |
246 (\secref{sec:markup}). |
248 \<close> |
247 \<close> |
249 |
248 |
282 Classes are specified by plain names. Sorts have a very simple inner syntax, |
281 Classes are specified by plain names. Sorts have a very simple inner syntax, |
283 which is either a single class name \<open>c\<close> or a list \<open>{c\<^sub>1, \<dots>, c\<^sub>n}\<close> referring |
282 which is either a single class name \<open>c\<close> or a list \<open>{c\<^sub>1, \<dots>, c\<^sub>n}\<close> referring |
284 to the intersection of these classes. The syntax of type arities is given |
283 to the intersection of these classes. The syntax of type arities is given |
285 directly at the outer level. |
284 directly at the outer level. |
286 |
285 |
287 @{rail \<open> |
286 \<^rail>\<open> |
288 @{syntax_def classdecl}: @{syntax name} (('<' | '\<subseteq>') (@{syntax name} + ','))? |
287 @{syntax_def classdecl}: @{syntax name} (('<' | '\<subseteq>') (@{syntax name} + ','))? |
289 ; |
288 ; |
290 @{syntax_def sort}: @{syntax embedded} |
289 @{syntax_def sort}: @{syntax embedded} |
291 ; |
290 ; |
292 @{syntax_def arity}: ('(' (@{syntax sort} + ',') ')')? @{syntax sort} |
291 @{syntax_def arity}: ('(' (@{syntax sort} + ',') ')')? @{syntax sort} |
293 \<close>} |
292 \<close> |
294 \<close> |
293 \<close> |
295 |
294 |
296 |
295 |
297 subsection \<open>Types and terms \label{sec:types-terms}\<close> |
296 subsection \<open>Types and terms \label{sec:types-terms}\<close> |
298 |
297 |
306 example, one may just write \<^verbatim>\<open>x\<close> instead of quoted \<^verbatim>\<open>"x"\<close>. Note that |
305 example, one may just write \<^verbatim>\<open>x\<close> instead of quoted \<^verbatim>\<open>"x"\<close>. Note that |
307 symbolic identifiers (e.g.\ \<^verbatim>\<open>++\<close> or \<open>\<forall>\<close> are available as well, provided |
306 symbolic identifiers (e.g.\ \<^verbatim>\<open>++\<close> or \<open>\<forall>\<close> are available as well, provided |
308 these have not been superseded by commands or other keywords already (such |
307 these have not been superseded by commands or other keywords already (such |
309 as \<^verbatim>\<open>=\<close> or \<^verbatim>\<open>+\<close>). |
308 as \<^verbatim>\<open>=\<close> or \<^verbatim>\<open>+\<close>). |
310 |
309 |
311 @{rail \<open> |
310 \<^rail>\<open> |
312 @{syntax_def type}: @{syntax embedded} |
311 @{syntax_def type}: @{syntax embedded} |
313 ; |
312 ; |
314 @{syntax_def term}: @{syntax embedded} |
313 @{syntax_def term}: @{syntax embedded} |
315 ; |
314 ; |
316 @{syntax_def prop}: @{syntax embedded} |
315 @{syntax_def prop}: @{syntax embedded} |
317 \<close>} |
316 \<close> |
318 |
317 |
319 Positional instantiations are specified as a sequence of terms, or the |
318 Positional instantiations are specified as a sequence of terms, or the |
320 placeholder ``\<open>_\<close>'' (underscore), which means to skip a position. |
319 placeholder ``\<open>_\<close>'' (underscore), which means to skip a position. |
321 |
320 |
322 @{rail \<open> |
321 \<^rail>\<open> |
323 @{syntax_def inst}: '_' | @{syntax term} |
322 @{syntax_def inst}: '_' | @{syntax term} |
324 ; |
323 ; |
325 @{syntax_def insts}: (@{syntax inst} *) |
324 @{syntax_def insts}: (@{syntax inst} *) |
326 \<close>} |
325 \<close> |
327 |
326 |
328 Named instantiations are specified as pairs of assignments \<open>v = t\<close>, which |
327 Named instantiations are specified as pairs of assignments \<open>v = t\<close>, which |
329 refer to schematic variables in some theorem that is instantiated. Both type |
328 refer to schematic variables in some theorem that is instantiated. Both type |
330 and terms instantiations are admitted, and distinguished by the usual syntax |
329 and terms instantiations are admitted, and distinguished by the usual syntax |
331 of variable names. |
330 of variable names. |
332 |
331 |
333 @{rail \<open> |
332 \<^rail>\<open> |
334 @{syntax_def named_inst}: variable '=' (type | term) |
333 @{syntax_def named_inst}: variable '=' (type | term) |
335 ; |
334 ; |
336 @{syntax_def named_insts}: (named_inst @'and' +) |
335 @{syntax_def named_insts}: (named_inst @'and' +) |
337 ; |
336 ; |
338 variable: @{syntax name} | @{syntax term_var} | @{syntax type_ident} | @{syntax type_var} |
337 variable: @{syntax name} | @{syntax term_var} | @{syntax type_ident} | @{syntax type_var} |
339 \<close>} |
338 \<close> |
340 |
339 |
341 Type declarations and definitions usually refer to @{syntax typespec} on the |
340 Type declarations and definitions usually refer to @{syntax typespec} on the |
342 left-hand side. This models basic type constructor application at the outer |
341 left-hand side. This models basic type constructor application at the outer |
343 syntax level. Note that only plain postfix notation is available here, but |
342 syntax level. Note that only plain postfix notation is available here, but |
344 no infixes. |
343 no infixes. |
345 |
344 |
346 @{rail \<open> |
345 \<^rail>\<open> |
347 @{syntax_def typespec}: |
346 @{syntax_def typespec}: |
348 (() | @{syntax type_ident} | '(' ( @{syntax type_ident} + ',' ) ')') @{syntax name} |
347 (() | @{syntax type_ident} | '(' ( @{syntax type_ident} + ',' ) ')') @{syntax name} |
349 ; |
348 ; |
350 @{syntax_def typespec_sorts}: |
349 @{syntax_def typespec_sorts}: |
351 (() | (@{syntax type_ident} ('::' @{syntax sort})?) | |
350 (() | (@{syntax type_ident} ('::' @{syntax sort})?) | |
352 '(' ( (@{syntax type_ident} ('::' @{syntax sort})?) + ',' ) ')') @{syntax name} |
351 '(' ( (@{syntax type_ident} ('::' @{syntax sort})?) + ',' ) ')') @{syntax name} |
353 \<close>} |
352 \<close> |
354 \<close> |
353 \<close> |
355 |
354 |
356 |
355 |
357 subsection \<open>Term patterns and declarations \label{sec:term-decls}\<close> |
356 subsection \<open>Term patterns and declarations \label{sec:term-decls}\<close> |
358 |
357 |
360 Wherever explicit propositions (or term fragments) occur in a proof text, |
359 Wherever explicit propositions (or term fragments) occur in a proof text, |
361 casual binding of schematic term variables may be given specified via |
360 casual binding of schematic term variables may be given specified via |
362 patterns of the form ``\<^theory_text>\<open>(is p\<^sub>1 \<dots> p\<^sub>n)\<close>''. This works both for @{syntax |
361 patterns of the form ``\<^theory_text>\<open>(is p\<^sub>1 \<dots> p\<^sub>n)\<close>''. This works both for @{syntax |
363 term} and @{syntax prop}. |
362 term} and @{syntax prop}. |
364 |
363 |
365 @{rail \<open> |
364 \<^rail>\<open> |
366 @{syntax_def term_pat}: '(' (@'is' @{syntax term} +) ')' |
365 @{syntax_def term_pat}: '(' (@'is' @{syntax term} +) ')' |
367 ; |
366 ; |
368 @{syntax_def prop_pat}: '(' (@'is' @{syntax prop} +) ')' |
367 @{syntax_def prop_pat}: '(' (@'is' @{syntax prop} +) ')' |
369 \<close>} |
368 \<close> |
370 |
369 |
371 \<^medskip> |
370 \<^medskip> |
372 Declarations of local variables \<open>x :: \<tau>\<close> and logical propositions \<open>a : \<phi>\<close> |
371 Declarations of local variables \<open>x :: \<tau>\<close> and logical propositions \<open>a : \<phi>\<close> |
373 represent different views on the same principle of introducing a local |
372 represent different views on the same principle of introducing a local |
374 scope. In practice, one may usually omit the typing of @{syntax vars} (due |
373 scope. In practice, one may usually omit the typing of @{syntax vars} (due |
375 to type-inference), and the naming of propositions (due to implicit |
374 to type-inference), and the naming of propositions (due to implicit |
376 references of current facts). In any case, Isar proof elements usually admit |
375 references of current facts). In any case, Isar proof elements usually admit |
377 to introduce multiple such items simultaneously. |
376 to introduce multiple such items simultaneously. |
378 |
377 |
379 @{rail \<open> |
378 \<^rail>\<open> |
380 @{syntax_def vars}: |
379 @{syntax_def vars}: |
381 (((@{syntax name} +) ('::' @{syntax type})? | |
380 (((@{syntax name} +) ('::' @{syntax type})? | |
382 @{syntax name} ('::' @{syntax type})? @{syntax mixfix}) + @'and') |
381 @{syntax name} ('::' @{syntax type})? @{syntax mixfix}) + @'and') |
383 ; |
382 ; |
384 @{syntax_def props}: @{syntax thmdecl}? (@{syntax prop} @{syntax prop_pat}? +) |
383 @{syntax_def props}: @{syntax thmdecl}? (@{syntax prop} @{syntax prop_pat}? +) |
385 ; |
384 ; |
386 @{syntax_def props'}: (@{syntax prop} @{syntax prop_pat}? +) |
385 @{syntax_def props'}: (@{syntax prop} @{syntax prop_pat}? +) |
387 \<close>} |
386 \<close> |
388 |
387 |
389 The treatment of multiple declarations corresponds to the complementary |
388 The treatment of multiple declarations corresponds to the complementary |
390 focus of @{syntax vars} versus @{syntax props}. In ``\<open>x\<^sub>1 \<dots> x\<^sub>n :: \<tau>\<close>'' the |
389 focus of @{syntax vars} versus @{syntax props}. In ``\<open>x\<^sub>1 \<dots> x\<^sub>n :: \<tau>\<close>'' the |
391 typing refers to all variables, while in \<open>a: \<phi>\<^sub>1 \<dots> \<phi>\<^sub>n\<close> the naming refers to |
390 typing refers to all variables, while in \<open>a: \<phi>\<^sub>1 \<dots> \<phi>\<^sub>n\<close> the naming refers to |
392 all propositions collectively. Isar language elements that refer to @{syntax |
391 all propositions collectively. Isar language elements that refer to @{syntax |
405 The attribute argument specifications may be any sequence of atomic entities |
404 The attribute argument specifications may be any sequence of atomic entities |
406 (identifiers, strings etc.), or properly bracketed argument lists. Below |
405 (identifiers, strings etc.), or properly bracketed argument lists. Below |
407 @{syntax atom} refers to any atomic entity, including any @{syntax keyword} |
406 @{syntax atom} refers to any atomic entity, including any @{syntax keyword} |
408 conforming to @{syntax sym_ident}. |
407 conforming to @{syntax sym_ident}. |
409 |
408 |
410 @{rail \<open> |
409 \<^rail>\<open> |
411 @{syntax_def atom}: @{syntax name} | @{syntax type_ident} | |
410 @{syntax_def atom}: @{syntax name} | @{syntax type_ident} | |
412 @{syntax type_var} | @{syntax term_var} | @{syntax nat} | @{syntax float} | |
411 @{syntax type_var} | @{syntax term_var} | @{syntax nat} | @{syntax float} | |
413 @{syntax keyword} | @{syntax cartouche} |
412 @{syntax keyword} | @{syntax cartouche} |
414 ; |
413 ; |
415 arg: @{syntax atom} | '(' @{syntax args} ')' | '[' @{syntax args} ']' |
414 arg: @{syntax atom} | '(' @{syntax args} ')' | '[' @{syntax args} ']' |
416 ; |
415 ; |
417 @{syntax_def args}: arg * |
416 @{syntax_def args}: arg * |
418 ; |
417 ; |
419 @{syntax_def attributes}: '[' (@{syntax name} @{syntax args} * ',') ']' |
418 @{syntax_def attributes}: '[' (@{syntax name} @{syntax args} * ',') ']' |
420 \<close>} |
419 \<close> |
421 |
420 |
422 Theorem specifications come in several flavors: @{syntax axmdecl} and |
421 Theorem specifications come in several flavors: @{syntax axmdecl} and |
423 @{syntax thmdecl} usually refer to axioms, assumptions or results of goal |
422 @{syntax thmdecl} usually refer to axioms, assumptions or results of goal |
424 statements, while @{syntax thmdef} collects lists of existing theorems. |
423 statements, while @{syntax thmdef} collects lists of existing theorems. |
425 Existing theorems are given by @{syntax thm} and @{syntax thms}, the |
424 Existing theorems are given by @{syntax thm} and @{syntax thms}, the |
445 abbreviates a theorem reference involving an internal dummy fact, which will |
444 abbreviates a theorem reference involving an internal dummy fact, which will |
446 be ignored later on. So only the effect of the attribute on the background |
445 be ignored later on. So only the effect of the attribute on the background |
447 context will persist. This form of in-place declarations is particularly |
446 context will persist. This form of in-place declarations is particularly |
448 useful with commands like @{command "declare"} and @{command "using"}. |
447 useful with commands like @{command "declare"} and @{command "using"}. |
449 |
448 |
450 @{rail \<open> |
449 \<^rail>\<open> |
451 @{syntax_def axmdecl}: @{syntax name} @{syntax attributes}? ':' |
450 @{syntax_def axmdecl}: @{syntax name} @{syntax attributes}? ':' |
452 ; |
451 ; |
453 @{syntax_def thmbind}: |
452 @{syntax_def thmbind}: |
454 @{syntax name} @{syntax attributes} | @{syntax name} | @{syntax attributes} |
453 @{syntax name} @{syntax attributes} | @{syntax name} | @{syntax attributes} |
455 ; |
454 ; |
479 |
478 |
480 Multiple specifications are delimited by ``\<open>|\<close>'' to emphasize separate |
479 Multiple specifications are delimited by ``\<open>|\<close>'' to emphasize separate |
481 cases: each with its own scope of inferred types for free variables. |
480 cases: each with its own scope of inferred types for free variables. |
482 |
481 |
483 |
482 |
484 @{rail \<open> |
483 \<^rail>\<open> |
485 @{syntax_def for_fixes}: (@'for' @{syntax vars})? |
484 @{syntax_def for_fixes}: (@'for' @{syntax vars})? |
486 ; |
485 ; |
487 @{syntax_def multi_specs}: (@{syntax structured_spec} + '|') |
486 @{syntax_def multi_specs}: (@{syntax structured_spec} + '|') |
488 ; |
487 ; |
489 @{syntax_def structured_spec}: |
488 @{syntax_def structured_spec}: |
490 @{syntax thmdecl}? @{syntax prop} @{syntax spec_prems} @{syntax for_fixes} |
489 @{syntax thmdecl}? @{syntax prop} @{syntax spec_prems} @{syntax for_fixes} |
491 ; |
490 ; |
492 @{syntax_def spec_prems}: (@'if' ((@{syntax prop}+) + @'and'))? |
491 @{syntax_def spec_prems}: (@'if' ((@{syntax prop}+) + @'and'))? |
493 ; |
492 ; |
494 @{syntax_def specification}: @{syntax vars} @'where' @{syntax multi_specs} |
493 @{syntax_def specification}: @{syntax vars} @'where' @{syntax multi_specs} |
495 \<close>} |
494 \<close> |
496 \<close> |
495 \<close> |
497 |
496 |
498 |
497 |
499 section \<open>Diagnostic commands\<close> |
498 section \<open>Diagnostic commands\<close> |
500 |
499 |
511 @{command_def "unused_thms"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
510 @{command_def "unused_thms"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
512 @{command_def "print_facts"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
511 @{command_def "print_facts"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
513 @{command_def "print_term_bindings"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
512 @{command_def "print_term_bindings"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\ |
514 \end{matharray} |
513 \end{matharray} |
515 |
514 |
516 @{rail \<open> |
515 \<^rail>\<open> |
517 (@@{command print_theory} | |
516 (@@{command print_theory} | |
518 @@{command print_definitions} | |
517 @@{command print_definitions} | |
519 @@{command print_methods} | |
518 @@{command print_methods} | |
520 @@{command print_attributes} | |
519 @@{command print_attributes} | |
521 @@{command print_theorems} | |
520 @@{command print_theorems} | |
532 ('name' ':' @{syntax name} | 'strict' ':' @{syntax type} | @{syntax type}) |
531 ('name' ':' @{syntax name} | 'strict' ':' @{syntax type} | @{syntax type}) |
533 ; |
532 ; |
534 @@{command thm_deps} @{syntax thmrefs} |
533 @@{command thm_deps} @{syntax thmrefs} |
535 ; |
534 ; |
536 @@{command unused_thms} ((@{syntax name} +) '-' (@{syntax name} * ))? |
535 @@{command unused_thms} ((@{syntax name} +) '-' (@{syntax name} * ))? |
537 \<close>} |
536 \<close> |
538 |
537 |
539 These commands print certain parts of the theory and proof context. Note |
538 These commands print certain parts of the theory and proof context. Note |
540 that there are some further ones available, such as for the set of rules |
539 that there are some further ones available, such as for the set of rules |
541 declared for simplifications. |
540 declared for simplifications. |
542 |
541 |