1 theory Spec |
1 theory Spec |
2 imports Base Main |
2 imports Base Main |
3 begin |
3 begin |
4 |
4 |
5 chapter {* Specifications *} |
5 chapter \<open>Specifications\<close> |
6 |
6 |
7 text {* |
7 text \<open> |
8 The Isabelle/Isar theory format integrates specifications and |
8 The Isabelle/Isar theory format integrates specifications and |
9 proofs, supporting interactive development with unlimited undo |
9 proofs, supporting interactive development with unlimited undo |
10 operation. There is an integrated document preparation system (see |
10 operation. There is an integrated document preparation system (see |
11 \chref{ch:document-prep}), for typesetting formal developments |
11 \chref{ch:document-prep}), for typesetting formal developments |
12 together with informal text. The resulting hyper-linked PDF |
12 together with informal text. The resulting hyper-linked PDF |
17 stating some @{command theorem} or @{command lemma} at the theory |
17 stating some @{command theorem} or @{command lemma} at the theory |
18 level, and left again with the final conclusion (e.g.\ via @{command |
18 level, and left again with the final conclusion (e.g.\ via @{command |
19 qed}). Some theory specification mechanisms also require a proof, |
19 qed}). Some theory specification mechanisms also require a proof, |
20 such as @{command typedef} in HOL, which demands non-emptiness of |
20 such as @{command typedef} in HOL, which demands non-emptiness of |
21 the representing sets. |
21 the representing sets. |
22 *} |
22 \<close> |
23 |
23 |
24 |
24 |
25 section {* Defining theories \label{sec:begin-thy} *} |
25 section \<open>Defining theories \label{sec:begin-thy}\<close> |
26 |
26 |
27 text {* |
27 text \<open> |
28 \begin{matharray}{rcl} |
28 \begin{matharray}{rcl} |
29 @{command_def "theory"} & : & @{text "toplevel \<rightarrow> theory"} \\ |
29 @{command_def "theory"} & : & @{text "toplevel \<rightarrow> theory"} \\ |
30 @{command_def (global) "end"} & : & @{text "theory \<rightarrow> toplevel"} \\ |
30 @{command_def (global) "end"} & : & @{text "theory \<rightarrow> toplevel"} \\ |
31 \end{matharray} |
31 \end{matharray} |
32 |
32 |
93 targets @{command locale} or @{command class} may involve a |
93 targets @{command locale} or @{command class} may involve a |
94 @{keyword "begin"} that needs to be matched by @{command (local) |
94 @{keyword "begin"} that needs to be matched by @{command (local) |
95 "end"}, according to the usual rules for nested blocks. |
95 "end"}, according to the usual rules for nested blocks. |
96 |
96 |
97 \end{description} |
97 \end{description} |
98 *} |
98 \<close> |
99 |
99 |
100 |
100 |
101 section {* Local theory targets \label{sec:target} *} |
101 section \<open>Local theory targets \label{sec:target}\<close> |
102 |
102 |
103 text {* |
103 text \<open> |
104 \begin{matharray}{rcll} |
104 \begin{matharray}{rcll} |
105 @{command_def "context"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
105 @{command_def "context"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
106 @{command_def (local) "end"} & : & @{text "local_theory \<rightarrow> theory"} \\ |
106 @{command_def (local) "end"} & : & @{text "local_theory \<rightarrow> theory"} \\ |
107 \end{matharray} |
107 \end{matharray} |
108 |
108 |
180 @{text "?x"}. |
180 @{text "?x"}. |
181 |
181 |
182 \medskip The Isabelle/HOL library contains numerous applications of |
182 \medskip The Isabelle/HOL library contains numerous applications of |
183 locales and classes, e.g.\ see @{file "~~/src/HOL/Algebra"}. An |
183 locales and classes, e.g.\ see @{file "~~/src/HOL/Algebra"}. An |
184 example for an unnamed auxiliary contexts is given in @{file |
184 example for an unnamed auxiliary contexts is given in @{file |
185 "~~/src/HOL/Isar_Examples/Group_Context.thy"}. *} |
185 "~~/src/HOL/Isar_Examples/Group_Context.thy"}.\<close> |
186 |
186 |
187 |
187 |
188 section {* Bundled declarations \label{sec:bundle} *} |
188 section \<open>Bundled declarations \label{sec:bundle}\<close> |
189 |
189 |
190 text {* |
190 text \<open> |
191 \begin{matharray}{rcl} |
191 \begin{matharray}{rcl} |
192 @{command_def "bundle"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
192 @{command_def "bundle"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
193 @{command_def "print_bundles"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow> "} \\ |
193 @{command_def "print_bundles"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow> "} \\ |
194 @{command_def "include"} & : & @{text "proof(state) \<rightarrow> proof(state)"} \\ |
194 @{command_def "include"} & : & @{text "proof(state) \<rightarrow> proof(state)"} \\ |
195 @{command_def "including"} & : & @{text "proof(prove) \<rightarrow> proof(prove)"} \\ |
195 @{command_def "including"} & : & @{text "proof(prove) \<rightarrow> proof(prove)"} \\ |
247 statements of @{command theorem} etc. |
247 statements of @{command theorem} etc. |
248 |
248 |
249 \end{description} |
249 \end{description} |
250 |
250 |
251 Here is an artificial example of bundling various configuration |
251 Here is an artificial example of bundling various configuration |
252 options: *} |
252 options:\<close> |
253 |
253 |
254 bundle trace = [[simp_trace, linarith_trace, metis_trace, smt_trace]] |
254 bundle trace = [[simp_trace, linarith_trace, metis_trace, smt_trace]] |
255 |
255 |
256 lemma "x = x" |
256 lemma "x = x" |
257 including trace by metis |
257 including trace by metis |
258 |
258 |
259 |
259 |
260 section {* Term definitions \label{sec:term-definitions} *} |
260 section \<open>Term definitions \label{sec:term-definitions}\<close> |
261 |
261 |
262 text {* |
262 text \<open> |
263 \begin{matharray}{rcll} |
263 \begin{matharray}{rcll} |
264 @{command_def "definition"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
264 @{command_def "definition"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
265 @{attribute_def "defn"} & : & @{text attribute} \\ |
265 @{attribute_def "defn"} & : & @{text attribute} \\ |
266 @{command_def "print_defn_rules"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow> "} \\ |
266 @{command_def "print_defn_rules"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow> "} \\ |
267 @{command_def "abbreviation"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
267 @{command_def "abbreviation"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
322 |
322 |
323 \item @{command "print_abbrevs"} prints all constant abbreviations |
323 \item @{command "print_abbrevs"} prints all constant abbreviations |
324 of the current context. |
324 of the current context. |
325 |
325 |
326 \end{description} |
326 \end{description} |
327 *} |
327 \<close> |
328 |
328 |
329 |
329 |
330 section {* Axiomatizations \label{sec:axiomatizations} *} |
330 section \<open>Axiomatizations \label{sec:axiomatizations}\<close> |
331 |
331 |
332 text {* |
332 text \<open> |
333 \begin{matharray}{rcll} |
333 \begin{matharray}{rcll} |
334 @{command_def "axiomatization"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
334 @{command_def "axiomatization"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
335 \end{matharray} |
335 \end{matharray} |
336 |
336 |
337 @{rail \<open> |
337 @{rail \<open> |
364 within Isabelle/Pure, but in an application environment like Isabelle/HOL |
364 within Isabelle/Pure, but in an application environment like Isabelle/HOL |
365 the user normally stays within definitional mechanisms provided by the |
365 the user normally stays within definitional mechanisms provided by the |
366 logic and its libraries. |
366 logic and its libraries. |
367 |
367 |
368 \end{description} |
368 \end{description} |
369 *} |
369 \<close> |
370 |
370 |
371 |
371 |
372 section {* Generic declarations *} |
372 section \<open>Generic declarations\<close> |
373 |
373 |
374 text {* |
374 text \<open> |
375 \begin{matharray}{rcl} |
375 \begin{matharray}{rcl} |
376 @{command_def "declaration"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
376 @{command_def "declaration"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
377 @{command_def "syntax_declaration"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
377 @{command_def "syntax_declaration"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
378 @{command_def "declare"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
378 @{command_def "declare"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
379 \end{matharray} |
379 \end{matharray} |
415 unlike @{command "theorems"} or @{command "lemmas"} (cf.\ |
415 unlike @{command "theorems"} or @{command "lemmas"} (cf.\ |
416 \secref{sec:theorems}), so @{command "declare"} only has the effect |
416 \secref{sec:theorems}), so @{command "declare"} only has the effect |
417 of applying attributes as included in the theorem specification. |
417 of applying attributes as included in the theorem specification. |
418 |
418 |
419 \end{description} |
419 \end{description} |
420 *} |
420 \<close> |
421 |
421 |
422 |
422 |
423 section {* Locales \label{sec:locale} *} |
423 section \<open>Locales \label{sec:locale}\<close> |
424 |
424 |
425 text {* |
425 text \<open> |
426 A locale is a functor that maps parameters (including implicit type |
426 A locale is a functor that maps parameters (including implicit type |
427 parameters) and a specification to a list of declarations. The |
427 parameters) and a specification to a list of declarations. The |
428 syntax of locales is modeled after the Isar proof context commands |
428 syntax of locales is modeled after the Isar proof context commands |
429 (cf.\ \secref{sec:proof-context}). |
429 (cf.\ \secref{sec:proof-context}). |
430 |
430 |
441 as a local theory. In this process, which is called \emph{roundup}, |
441 as a local theory. In this process, which is called \emph{roundup}, |
442 redundant locale instances are omitted. A locale instance is |
442 redundant locale instances are omitted. A locale instance is |
443 redundant if it is subsumed by an instance encountered earlier. A |
443 redundant if it is subsumed by an instance encountered earlier. A |
444 more detailed description of this process is available elsewhere |
444 more detailed description of this process is available elsewhere |
445 @{cite Ballarin2014}. |
445 @{cite Ballarin2014}. |
446 *} |
446 \<close> |
447 |
447 |
448 |
448 |
449 subsection {* Locale expressions \label{sec:locale-expr} *} |
449 subsection \<open>Locale expressions \label{sec:locale-expr}\<close> |
450 |
450 |
451 text {* |
451 text \<open> |
452 A \emph{locale expression} denotes a context composed of instances |
452 A \emph{locale expression} denotes a context composed of instances |
453 of existing locales. The context consists of the declaration |
453 of existing locales. The context consists of the declaration |
454 elements from the locale instances. Redundant locale instances are |
454 elements from the locale instances. Redundant locale instances are |
455 omitted according to roundup. |
455 omitted according to roundup. |
456 |
456 |
487 ``\texttt{?}'' nor ``\texttt{!}'' are present, the command's default |
487 ``\texttt{?}'' nor ``\texttt{!}'' are present, the command's default |
488 is used. For @{command "interpretation"} and @{command "interpret"} |
488 is used. For @{command "interpretation"} and @{command "interpret"} |
489 the default is ``mandatory'', for @{command "locale"} and @{command |
489 the default is ``mandatory'', for @{command "locale"} and @{command |
490 "sublocale"} the default is ``optional''. Qualifiers play no role |
490 "sublocale"} the default is ``optional''. Qualifiers play no role |
491 in determining whether one locale instance subsumes another. |
491 in determining whether one locale instance subsumes another. |
492 *} |
492 \<close> |
493 |
493 |
494 |
494 |
495 subsection {* Locale declarations *} |
495 subsection \<open>Locale declarations\<close> |
496 |
496 |
497 text {* |
497 text \<open> |
498 \begin{matharray}{rcl} |
498 \begin{matharray}{rcl} |
499 @{command_def "locale"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
499 @{command_def "locale"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
500 @{command_def "print_locale"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
500 @{command_def "print_locale"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
501 @{command_def "print_locales"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
501 @{command_def "print_locales"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
502 @{command_def "locale_deps"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
502 @{command_def "locale_deps"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
629 specifications entailed by the context, both from target statements, |
629 specifications entailed by the context, both from target statements, |
630 and from interpretations (see below). New goals that are entailed |
630 and from interpretations (see below). New goals that are entailed |
631 by the current context are discharged automatically. |
631 by the current context are discharged automatically. |
632 |
632 |
633 \end{description} |
633 \end{description} |
634 *} |
634 \<close> |
635 |
635 |
636 |
636 |
637 subsection {* Locale interpretation *} |
637 subsection \<open>Locale interpretation\<close> |
638 |
638 |
639 text {* |
639 text \<open> |
640 \begin{matharray}{rcl} |
640 \begin{matharray}{rcl} |
641 @{command_def "interpretation"} & : & @{text "theory | local_theory \<rightarrow> proof(prove)"} \\ |
641 @{command_def "interpretation"} & : & @{text "theory | local_theory \<rightarrow> proof(prove)"} \\ |
642 @{command_def "interpret"} & : & @{text "proof(state) | proof(chain) \<rightarrow> proof(prove)"} \\ |
642 @{command_def "interpret"} & : & @{text "proof(state) | proof(chain) \<rightarrow> proof(prove)"} \\ |
643 @{command_def "sublocale"} & : & @{text "theory | local_theory \<rightarrow> proof(prove)"} \\ |
643 @{command_def "sublocale"} & : & @{text "theory | local_theory \<rightarrow> proof(prove)"} \\ |
644 @{command_def "print_dependencies"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
644 @{command_def "print_dependencies"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\ |
791 is interpreted twice and the instantiation of the second |
791 is interpreted twice and the instantiation of the second |
792 interpretation is more general than the interpretation of the |
792 interpretation is more general than the interpretation of the |
793 first. The locale package does not attempt to remove subsumed |
793 first. The locale package does not attempt to remove subsumed |
794 interpretations. |
794 interpretations. |
795 \end{warn} |
795 \end{warn} |
796 *} |
796 \<close> |
797 |
797 |
798 |
798 |
799 section {* Classes \label{sec:class} *} |
799 section \<open>Classes \label{sec:class}\<close> |
800 |
800 |
801 text {* |
801 text \<open> |
802 \begin{matharray}{rcl} |
802 \begin{matharray}{rcl} |
803 @{command_def "class"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
803 @{command_def "class"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
804 @{command_def "instantiation"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
804 @{command_def "instantiation"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
805 @{command_def "instance"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
805 @{command_def "instance"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
806 @{command "instance"} & : & @{text "theory \<rightarrow> proof(prove)"} \\ |
806 @{command "instance"} & : & @{text "theory \<rightarrow> proof(prove)"} \\ |
907 default proof step (e.g.\ of @{command "proof"}). In particular, |
907 default proof step (e.g.\ of @{command "proof"}). In particular, |
908 instantiation of trivial (syntactic) classes may be performed by a |
908 instantiation of trivial (syntactic) classes may be performed by a |
909 single ``@{command ".."}'' proof step. |
909 single ``@{command ".."}'' proof step. |
910 |
910 |
911 \end{description} |
911 \end{description} |
912 *} |
912 \<close> |
913 |
913 |
914 |
914 |
915 subsection {* The class target *} |
915 subsection \<open>The class target\<close> |
916 |
916 |
917 text {* |
917 text \<open> |
918 %FIXME check |
918 %FIXME check |
919 |
919 |
920 A named context may refer to a locale (cf.\ \secref{sec:target}). |
920 A named context may refer to a locale (cf.\ \secref{sec:target}). |
921 If this locale is also a class @{text c}, apart from the common |
921 If this locale is also a class @{text c}, apart from the common |
922 locale target behaviour the following happens. |
922 locale target behaviour the following happens. |
934 global operations @{text "g[?\<alpha> :: c]"} uniformly. Type inference |
934 global operations @{text "g[?\<alpha> :: c]"} uniformly. Type inference |
935 resolves ambiguities. In rare cases, manual type annotations are |
935 resolves ambiguities. In rare cases, manual type annotations are |
936 needed. |
936 needed. |
937 |
937 |
938 \end{itemize} |
938 \end{itemize} |
939 *} |
939 \<close> |
940 |
940 |
941 |
941 |
942 subsection {* Co-regularity of type classes and arities *} |
942 subsection \<open>Co-regularity of type classes and arities\<close> |
943 |
943 |
944 text {* The class relation together with the collection of |
944 text \<open>The class relation together with the collection of |
945 type-constructor arities must obey the principle of |
945 type-constructor arities must obey the principle of |
946 \emph{co-regularity} as defined below. |
946 \emph{co-regularity} as defined below. |
947 |
947 |
948 \medskip For the subsequent formulation of co-regularity we assume |
948 \medskip For the subsequent formulation of co-regularity we assume |
949 that the class relation is closed by transitivity and reflexivity. |
949 that the class relation is closed by transitivity and reflexivity. |
971 argument sorts need to be related in the same way. |
971 argument sorts need to be related in the same way. |
972 |
972 |
973 \medskip Co-regularity is a very fundamental property of the |
973 \medskip Co-regularity is a very fundamental property of the |
974 order-sorted algebra of types. For example, it entails principle |
974 order-sorted algebra of types. For example, it entails principle |
975 types and most general unifiers, e.g.\ see @{cite "nipkow-prehofer"}. |
975 types and most general unifiers, e.g.\ see @{cite "nipkow-prehofer"}. |
976 *} |
976 \<close> |
977 |
977 |
978 |
978 |
979 section {* Unrestricted overloading *} |
979 section \<open>Unrestricted overloading\<close> |
980 |
980 |
981 text {* |
981 text \<open> |
982 \begin{matharray}{rcl} |
982 \begin{matharray}{rcl} |
983 @{command_def "overloading"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
983 @{command_def "overloading"} & : & @{text "theory \<rightarrow> local_theory"} \\ |
984 \end{matharray} |
984 \end{matharray} |
985 |
985 |
986 Isabelle/Pure's definitional schemes support certain forms of |
986 Isabelle/Pure's definitional schemes support certain forms of |
1018 exotic overloading (see \secref{sec:consts} for a precise description). |
1018 exotic overloading (see \secref{sec:consts} for a precise description). |
1019 It is at the discretion of the user to avoid |
1019 It is at the discretion of the user to avoid |
1020 malformed theory specifications! |
1020 malformed theory specifications! |
1021 |
1021 |
1022 \end{description} |
1022 \end{description} |
1023 *} |
1023 \<close> |
1024 |
1024 |
1025 |
1025 |
1026 section {* Incorporating ML code \label{sec:ML} *} |
1026 section \<open>Incorporating ML code \label{sec:ML}\<close> |
1027 |
1027 |
1028 text {* |
1028 text \<open> |
1029 \begin{matharray}{rcl} |
1029 \begin{matharray}{rcl} |
1030 @{command_def "SML_file"} & : & @{text "theory \<rightarrow> theory"} \\ |
1030 @{command_def "SML_file"} & : & @{text "theory \<rightarrow> theory"} \\ |
1031 @{command_def "ML_file"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1031 @{command_def "ML_file"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1032 @{command_def "ML"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1032 @{command_def "ML"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1033 @{command_def "ML_prf"} & : & @{text "proof \<rightarrow> proof"} \\ |
1033 @{command_def "ML_prf"} & : & @{text "proof \<rightarrow> proof"} \\ |
1106 In principle, attributes can operate both on a given theorem and the |
1106 In principle, attributes can operate both on a given theorem and the |
1107 implicit context, although in practice only one is modified and the |
1107 implicit context, although in practice only one is modified and the |
1108 other serves as parameter. Here are examples for these two cases: |
1108 other serves as parameter. Here are examples for these two cases: |
1109 |
1109 |
1110 \end{description} |
1110 \end{description} |
1111 *} |
1111 \<close> |
1112 |
1112 |
1113 attribute_setup my_rule = {* |
1113 attribute_setup my_rule = \<open> |
1114 Attrib.thms >> (fn ths => |
1114 Attrib.thms >> (fn ths => |
1115 Thm.rule_attribute |
1115 Thm.rule_attribute |
1116 (fn context: Context.generic => fn th: thm => |
1116 (fn context: Context.generic => fn th: thm => |
1117 let val th' = th OF ths |
1117 let val th' = th OF ths |
1118 in th' end)) *} |
1118 in th' end))\<close> |
1119 |
1119 |
1120 attribute_setup my_declaration = {* |
1120 attribute_setup my_declaration = \<open> |
1121 Attrib.thms >> (fn ths => |
1121 Attrib.thms >> (fn ths => |
1122 Thm.declaration_attribute |
1122 Thm.declaration_attribute |
1123 (fn th: thm => fn context: Context.generic => |
1123 (fn th: thm => fn context: Context.generic => |
1124 let val context' = context |
1124 let val context' = context |
1125 in context' end)) *} |
1125 in context' end))\<close> |
1126 |
1126 |
1127 text {* |
1127 text \<open> |
1128 \begin{description} |
1128 \begin{description} |
1129 |
1129 |
1130 \item @{attribute ML_print_depth} controls the printing depth of the ML |
1130 \item @{attribute ML_print_depth} controls the printing depth of the ML |
1131 toplevel pretty printer; the precise effect depends on the ML compiler and |
1131 toplevel pretty printer; the precise effect depends on the ML compiler and |
1132 run-time system. Typically the limit should be less than 10. Bigger values |
1132 run-time system. Typically the limit should be less than 10. Bigger values |
1147 Runtime.exn_trace} into ML code for debugging @{cite |
1147 Runtime.exn_trace} into ML code for debugging @{cite |
1148 "isabelle-implementation"}, closer to the point where it actually |
1148 "isabelle-implementation"}, closer to the point where it actually |
1149 happens. |
1149 happens. |
1150 |
1150 |
1151 \end{description} |
1151 \end{description} |
1152 *} |
1152 \<close> |
1153 |
1153 |
1154 |
1154 |
1155 section {* Primitive specification elements *} |
1155 section \<open>Primitive specification elements\<close> |
1156 |
1156 |
1157 subsection {* Sorts *} |
1157 subsection \<open>Sorts\<close> |
1158 |
1158 |
1159 text {* |
1159 text \<open> |
1160 \begin{matharray}{rcll} |
1160 \begin{matharray}{rcll} |
1161 @{command_def "default_sort"} & : & @{text "local_theory \<rightarrow> local_theory"} |
1161 @{command_def "default_sort"} & : & @{text "local_theory \<rightarrow> local_theory"} |
1162 \end{matharray} |
1162 \end{matharray} |
1163 |
1163 |
1164 @{rail \<open> |
1164 @{rail \<open> |
1179 When merging theories, the default sorts of the parents are |
1179 When merging theories, the default sorts of the parents are |
1180 logically intersected, i.e.\ the representations as lists of classes |
1180 logically intersected, i.e.\ the representations as lists of classes |
1181 are joined. |
1181 are joined. |
1182 |
1182 |
1183 \end{description} |
1183 \end{description} |
1184 *} |
1184 \<close> |
1185 |
1185 |
1186 |
1186 |
1187 subsection {* Types \label{sec:types-pure} *} |
1187 subsection \<open>Types \label{sec:types-pure}\<close> |
1188 |
1188 |
1189 text {* |
1189 text \<open> |
1190 \begin{matharray}{rcll} |
1190 \begin{matharray}{rcll} |
1191 @{command_def "type_synonym"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1191 @{command_def "type_synonym"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1192 @{command_def "typedecl"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1192 @{command_def "typedecl"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1193 \end{matharray} |
1193 \end{matharray} |
1194 |
1194 |
1222 free-form axiomatizations can coexist with other axiomatization schemes |
1222 free-form axiomatizations can coexist with other axiomatization schemes |
1223 for types, notably @{command_def typedef} in Isabelle/HOL |
1223 for types, notably @{command_def typedef} in Isabelle/HOL |
1224 (\secref{sec:hol-typedef}), or any other extension that people might have |
1224 (\secref{sec:hol-typedef}), or any other extension that people might have |
1225 introduced elsewhere. |
1225 introduced elsewhere. |
1226 \end{warn} |
1226 \end{warn} |
1227 *} |
1227 \<close> |
1228 |
1228 |
1229 |
1229 |
1230 subsection {* Constants and definitions \label{sec:consts} *} |
1230 subsection \<open>Constants and definitions \label{sec:consts}\<close> |
1231 |
1231 |
1232 text {* |
1232 text \<open> |
1233 \begin{matharray}{rcl} |
1233 \begin{matharray}{rcl} |
1234 @{command_def "consts"} & : & @{text "theory \<rightarrow> theory"} \\ |
1234 @{command_def "consts"} & : & @{text "theory \<rightarrow> theory"} \\ |
1235 @{command_def "defs"} & : & @{text "theory \<rightarrow> theory"} \\ |
1235 @{command_def "defs"} & : & @{text "theory \<rightarrow> theory"} \\ |
1236 \end{matharray} |
1236 \end{matharray} |
1237 |
1237 |
1299 potentially overloaded. Unless this option is given, a warning |
1299 potentially overloaded. Unless this option is given, a warning |
1300 message would be issued for any definitional equation with a more |
1300 message would be issued for any definitional equation with a more |
1301 special type than that of the corresponding constant declaration. |
1301 special type than that of the corresponding constant declaration. |
1302 |
1302 |
1303 \end{description} |
1303 \end{description} |
1304 *} |
1304 \<close> |
1305 |
1305 |
1306 |
1306 |
1307 section {* Naming existing theorems \label{sec:theorems} *} |
1307 section \<open>Naming existing theorems \label{sec:theorems}\<close> |
1308 |
1308 |
1309 text {* |
1309 text \<open> |
1310 \begin{matharray}{rcll} |
1310 \begin{matharray}{rcll} |
1311 @{command_def "lemmas"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1311 @{command_def "lemmas"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1312 @{command_def "theorems"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1312 @{command_def "theorems"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1313 @{command_def "named_theorems"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1313 @{command_def "named_theorems"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
1314 \end{matharray} |
1314 \end{matharray} |
1338 an attribute with the usual @{text add}/@{text del} syntax (e.g.\ see |
1338 an attribute with the usual @{text add}/@{text del} syntax (e.g.\ see |
1339 \secref{sec:simp-rules}) to maintain the content incrementally, in |
1339 \secref{sec:simp-rules}) to maintain the content incrementally, in |
1340 canonical declaration order of the text structure. |
1340 canonical declaration order of the text structure. |
1341 |
1341 |
1342 \end{description} |
1342 \end{description} |
1343 *} |
1343 \<close> |
1344 |
1344 |
1345 |
1345 |
1346 section {* Oracles *} |
1346 section \<open>Oracles\<close> |
1347 |
1347 |
1348 text {* |
1348 text \<open> |
1349 \begin{matharray}{rcll} |
1349 \begin{matharray}{rcll} |
1350 @{command_def "oracle"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
1350 @{command_def "oracle"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
1351 \end{matharray} |
1351 \end{matharray} |
1352 |
1352 |
1353 Oracles allow Isabelle to take advantage of external reasoners such |
1353 Oracles allow Isabelle to take advantage of external reasoners such |
1381 \end{description} |
1381 \end{description} |
1382 |
1382 |
1383 See @{file "~~/src/HOL/ex/Iff_Oracle.thy"} for a worked example of |
1383 See @{file "~~/src/HOL/ex/Iff_Oracle.thy"} for a worked example of |
1384 defining a new primitive rule as oracle, and turning it into a proof |
1384 defining a new primitive rule as oracle, and turning it into a proof |
1385 method. |
1385 method. |
1386 *} |
1386 \<close> |
1387 |
1387 |
1388 |
1388 |
1389 section {* Name spaces *} |
1389 section \<open>Name spaces\<close> |
1390 |
1390 |
1391 text {* |
1391 text \<open> |
1392 \begin{matharray}{rcl} |
1392 \begin{matharray}{rcl} |
1393 @{command_def "hide_class"} & : & @{text "theory \<rightarrow> theory"} \\ |
1393 @{command_def "hide_class"} & : & @{text "theory \<rightarrow> theory"} \\ |
1394 @{command_def "hide_type"} & : & @{text "theory \<rightarrow> theory"} \\ |
1394 @{command_def "hide_type"} & : & @{text "theory \<rightarrow> theory"} \\ |
1395 @{command_def "hide_const"} & : & @{text "theory \<rightarrow> theory"} \\ |
1395 @{command_def "hide_const"} & : & @{text "theory \<rightarrow> theory"} \\ |
1396 @{command_def "hide_fact"} & : & @{text "theory \<rightarrow> theory"} \\ |
1396 @{command_def "hide_fact"} & : & @{text "theory \<rightarrow> theory"} \\ |
1421 \item @{command "hide_type"}, @{command "hide_const"}, and @{command |
1421 \item @{command "hide_type"}, @{command "hide_const"}, and @{command |
1422 "hide_fact"} are similar to @{command "hide_class"}, but hide types, |
1422 "hide_fact"} are similar to @{command "hide_class"}, but hide types, |
1423 constants, and facts, respectively. |
1423 constants, and facts, respectively. |
1424 |
1424 |
1425 \end{description} |
1425 \end{description} |
1426 *} |
1426 \<close> |
1427 |
1427 |
1428 end |
1428 end |