129 @{index_ML Theory.ancestors_of: "theory -> theory list"} \\ |
129 @{index_ML Theory.ancestors_of: "theory -> theory list"} \\ |
130 \end{mldecls} |
130 \end{mldecls} |
131 |
131 |
132 \begin{description} |
132 \begin{description} |
133 |
133 |
134 \item Type @{ML_type theory} represents theory contexts. |
134 \<^descr> Type @{ML_type theory} represents theory contexts. |
135 |
135 |
136 \item @{ML "Context.eq_thy"}~@{text "(thy\<^sub>1, thy\<^sub>2)"} check strict |
136 \<^descr> @{ML "Context.eq_thy"}~@{text "(thy\<^sub>1, thy\<^sub>2)"} check strict |
137 identity of two theories. |
137 identity of two theories. |
138 |
138 |
139 \item @{ML "Context.subthy"}~@{text "(thy\<^sub>1, thy\<^sub>2)"} compares theories |
139 \<^descr> @{ML "Context.subthy"}~@{text "(thy\<^sub>1, thy\<^sub>2)"} compares theories |
140 according to the intrinsic graph structure of the construction. |
140 according to the intrinsic graph structure of the construction. |
141 This sub-theory relation is a nominal approximation of inclusion |
141 This sub-theory relation is a nominal approximation of inclusion |
142 (@{text "\<subseteq>"}) of the corresponding content (according to the |
142 (@{text "\<subseteq>"}) of the corresponding content (according to the |
143 semantics of the ML modules that implement the data). |
143 semantics of the ML modules that implement the data). |
144 |
144 |
145 \item @{ML "Theory.begin_theory"}~@{text "name parents"} constructs |
145 \<^descr> @{ML "Theory.begin_theory"}~@{text "name parents"} constructs |
146 a new theory based on the given parents. This ML function is |
146 a new theory based on the given parents. This ML function is |
147 normally not invoked directly. |
147 normally not invoked directly. |
148 |
148 |
149 \item @{ML "Theory.parents_of"}~@{text "thy"} returns the direct |
149 \<^descr> @{ML "Theory.parents_of"}~@{text "thy"} returns the direct |
150 ancestors of @{text thy}. |
150 ancestors of @{text thy}. |
151 |
151 |
152 \item @{ML "Theory.ancestors_of"}~@{text "thy"} returns all |
152 \<^descr> @{ML "Theory.ancestors_of"}~@{text "thy"} returns all |
153 ancestors of @{text thy} (not including @{text thy} itself). |
153 ancestors of @{text thy} (not including @{text thy} itself). |
154 |
154 |
155 \end{description} |
155 \end{description} |
156 \<close> |
156 \<close> |
157 |
157 |
279 @{index_ML Context.proof_of: "Context.generic -> Proof.context"} \\ |
279 @{index_ML Context.proof_of: "Context.generic -> Proof.context"} \\ |
280 \end{mldecls} |
280 \end{mldecls} |
281 |
281 |
282 \begin{description} |
282 \begin{description} |
283 |
283 |
284 \item Type @{ML_type Context.generic} is the direct sum of @{ML_type |
284 \<^descr> Type @{ML_type Context.generic} is the direct sum of @{ML_type |
285 "theory"} and @{ML_type "Proof.context"}, with the datatype |
285 "theory"} and @{ML_type "Proof.context"}, with the datatype |
286 constructors @{ML "Context.Theory"} and @{ML "Context.Proof"}. |
286 constructors @{ML "Context.Theory"} and @{ML "Context.Proof"}. |
287 |
287 |
288 \item @{ML Context.theory_of}~@{text "context"} always produces a |
288 \<^descr> @{ML Context.theory_of}~@{text "context"} always produces a |
289 theory from the generic @{text "context"}, using @{ML |
289 theory from the generic @{text "context"}, using @{ML |
290 "Proof_Context.theory_of"} as required. |
290 "Proof_Context.theory_of"} as required. |
291 |
291 |
292 \item @{ML Context.proof_of}~@{text "context"} always produces a |
292 \<^descr> @{ML Context.proof_of}~@{text "context"} always produces a |
293 proof context from the generic @{text "context"}, using @{ML |
293 proof context from the generic @{text "context"}, using @{ML |
294 "Proof_Context.init_global"} as required (note that this re-initializes the |
294 "Proof_Context.init_global"} as required (note that this re-initializes the |
295 context data with each invocation). |
295 context data with each invocation). |
296 |
296 |
297 \end{description} |
297 \end{description} |
544 string Config.T"} \\ |
544 string Config.T"} \\ |
545 \end{mldecls} |
545 \end{mldecls} |
546 |
546 |
547 \begin{description} |
547 \begin{description} |
548 |
548 |
549 \item @{ML Config.get}~@{text "ctxt config"} gets the value of |
549 \<^descr> @{ML Config.get}~@{text "ctxt config"} gets the value of |
550 @{text "config"} in the given context. |
550 @{text "config"} in the given context. |
551 |
551 |
552 \item @{ML Config.map}~@{text "config f ctxt"} updates the context |
552 \<^descr> @{ML Config.map}~@{text "config f ctxt"} updates the context |
553 by updating the value of @{text "config"}. |
553 by updating the value of @{text "config"}. |
554 |
554 |
555 \item @{text "config ="}~@{ML Attrib.setup_config_bool}~@{text "name |
555 \<^descr> @{text "config ="}~@{ML Attrib.setup_config_bool}~@{text "name |
556 default"} creates a named configuration option of type @{ML_type |
556 default"} creates a named configuration option of type @{ML_type |
557 bool}, with the given @{text "default"} depending on the application |
557 bool}, with the given @{text "default"} depending on the application |
558 context. The resulting @{text "config"} can be used to get/map its |
558 context. The resulting @{text "config"} can be used to get/map its |
559 value in a given context. There is an implicit update of the |
559 value in a given context. There is an implicit update of the |
560 background theory that registers the option as attribute with some |
560 background theory that registers the option as attribute with some |
561 concrete syntax. |
561 concrete syntax. |
562 |
562 |
563 \item @{ML Attrib.config_int}, @{ML Attrib.config_real}, and @{ML |
563 \<^descr> @{ML Attrib.config_int}, @{ML Attrib.config_real}, and @{ML |
564 Attrib.config_string} work like @{ML Attrib.config_bool}, but for |
564 Attrib.config_string} work like @{ML Attrib.config_bool}, but for |
565 types @{ML_type int} and @{ML_type string}, respectively. |
565 types @{ML_type int} and @{ML_type string}, respectively. |
566 |
566 |
567 \end{description} |
567 \end{description} |
568 \<close> |
568 \<close> |
690 @{index_ML Variable.names_of: "Proof.context -> Name.context"} \\ |
690 @{index_ML Variable.names_of: "Proof.context -> Name.context"} \\ |
691 \end{mldecls} |
691 \end{mldecls} |
692 |
692 |
693 \begin{description} |
693 \begin{description} |
694 |
694 |
695 \item @{ML Name.internal}~@{text "name"} produces an internal name |
695 \<^descr> @{ML Name.internal}~@{text "name"} produces an internal name |
696 by adding one underscore. |
696 by adding one underscore. |
697 |
697 |
698 \item @{ML Name.skolem}~@{text "name"} produces a Skolem name by |
698 \<^descr> @{ML Name.skolem}~@{text "name"} produces a Skolem name by |
699 adding two underscores. |
699 adding two underscores. |
700 |
700 |
701 \item Type @{ML_type Name.context} represents the context of already |
701 \<^descr> Type @{ML_type Name.context} represents the context of already |
702 used names; the initial value is @{ML "Name.context"}. |
702 used names; the initial value is @{ML "Name.context"}. |
703 |
703 |
704 \item @{ML Name.declare}~@{text "name"} enters a used name into the |
704 \<^descr> @{ML Name.declare}~@{text "name"} enters a used name into the |
705 context. |
705 context. |
706 |
706 |
707 \item @{ML Name.invent}~@{text "context name n"} produces @{text |
707 \<^descr> @{ML Name.invent}~@{text "context name n"} produces @{text |
708 "n"} fresh names derived from @{text "name"}. |
708 "n"} fresh names derived from @{text "name"}. |
709 |
709 |
710 \item @{ML Name.variant}~@{text "name context"} produces a fresh |
710 \<^descr> @{ML Name.variant}~@{text "name context"} produces a fresh |
711 variant of @{text "name"}; the result is declared to the context. |
711 variant of @{text "name"}; the result is declared to the context. |
712 |
712 |
713 \item @{ML Variable.names_of}~@{text "ctxt"} retrieves the context |
713 \<^descr> @{ML Variable.names_of}~@{text "ctxt"} retrieves the context |
714 of declared type and term variable names. Projecting a proof |
714 of declared type and term variable names. Projecting a proof |
715 context down to a primitive name context is occasionally useful when |
715 context down to a primitive name context is occasionally useful when |
716 invoking lower-level operations. Regular management of ``fresh |
716 invoking lower-level operations. Regular management of ``fresh |
717 variables'' is done by suitable operations of structure @{ML_structure |
717 variables'' is done by suitable operations of structure @{ML_structure |
718 Variable}, which is also able to provide an official status of |
718 Variable}, which is also able to provide an official status of |
947 @{index_ML Name_Space.is_concealed: "Name_Space.T -> string -> bool"} |
947 @{index_ML Name_Space.is_concealed: "Name_Space.T -> string -> bool"} |
948 \end{mldecls} |
948 \end{mldecls} |
949 |
949 |
950 \begin{description} |
950 \begin{description} |
951 |
951 |
952 \item Type @{ML_type binding} represents the abstract concept of |
952 \<^descr> Type @{ML_type binding} represents the abstract concept of |
953 name bindings. |
953 name bindings. |
954 |
954 |
955 \item @{ML Binding.empty} is the empty binding. |
955 \<^descr> @{ML Binding.empty} is the empty binding. |
956 |
956 |
957 \item @{ML Binding.name}~@{text "name"} produces a binding with base |
957 \<^descr> @{ML Binding.name}~@{text "name"} produces a binding with base |
958 name @{text "name"}. Note that this lacks proper source position |
958 name @{text "name"}. Note that this lacks proper source position |
959 information; see also the ML antiquotation @{ML_antiquotation |
959 information; see also the ML antiquotation @{ML_antiquotation |
960 binding}. |
960 binding}. |
961 |
961 |
962 \item @{ML Binding.qualify}~@{text "mandatory name binding"} |
962 \<^descr> @{ML Binding.qualify}~@{text "mandatory name binding"} |
963 prefixes qualifier @{text "name"} to @{text "binding"}. The @{text |
963 prefixes qualifier @{text "name"} to @{text "binding"}. The @{text |
964 "mandatory"} flag tells if this name component always needs to be |
964 "mandatory"} flag tells if this name component always needs to be |
965 given in name space accesses --- this is mostly @{text "false"} in |
965 given in name space accesses --- this is mostly @{text "false"} in |
966 practice. Note that this part of qualification is typically used in |
966 practice. Note that this part of qualification is typically used in |
967 derived specification mechanisms. |
967 derived specification mechanisms. |
968 |
968 |
969 \item @{ML Binding.prefix} is similar to @{ML Binding.qualify}, but |
969 \<^descr> @{ML Binding.prefix} is similar to @{ML Binding.qualify}, but |
970 affects the system prefix. This part of extra qualification is |
970 affects the system prefix. This part of extra qualification is |
971 typically used in the infrastructure for modular specifications, |
971 typically used in the infrastructure for modular specifications, |
972 notably ``local theory targets'' (see also \chref{ch:local-theory}). |
972 notably ``local theory targets'' (see also \chref{ch:local-theory}). |
973 |
973 |
974 \item @{ML Binding.concealed}~@{text "binding"} indicates that the |
974 \<^descr> @{ML Binding.concealed}~@{text "binding"} indicates that the |
975 binding shall refer to an entity that serves foundational purposes |
975 binding shall refer to an entity that serves foundational purposes |
976 only. This flag helps to mark implementation details of |
976 only. This flag helps to mark implementation details of |
977 specification mechanism etc. Other tools should not depend on the |
977 specification mechanism etc. Other tools should not depend on the |
978 particulars of concealed entities (cf.\ @{ML |
978 particulars of concealed entities (cf.\ @{ML |
979 Name_Space.is_concealed}). |
979 Name_Space.is_concealed}). |
980 |
980 |
981 \item @{ML Binding.print}~@{text "binding"} produces a string |
981 \<^descr> @{ML Binding.print}~@{text "binding"} produces a string |
982 representation for human-readable output, together with some formal |
982 representation for human-readable output, together with some formal |
983 markup that might get used in GUI front-ends, for example. |
983 markup that might get used in GUI front-ends, for example. |
984 |
984 |
985 \item Type @{ML_type Name_Space.naming} represents the abstract |
985 \<^descr> Type @{ML_type Name_Space.naming} represents the abstract |
986 concept of a naming policy. |
986 concept of a naming policy. |
987 |
987 |
988 \item @{ML Name_Space.global_naming} is the default naming policy: it is |
988 \<^descr> @{ML Name_Space.global_naming} is the default naming policy: it is |
989 global and lacks any path prefix. In a regular theory context this is |
989 global and lacks any path prefix. In a regular theory context this is |
990 augmented by a path prefix consisting of the theory name. |
990 augmented by a path prefix consisting of the theory name. |
991 |
991 |
992 \item @{ML Name_Space.add_path}~@{text "path naming"} augments the |
992 \<^descr> @{ML Name_Space.add_path}~@{text "path naming"} augments the |
993 naming policy by extending its path component. |
993 naming policy by extending its path component. |
994 |
994 |
995 \item @{ML Name_Space.full_name}~@{text "naming binding"} turns a |
995 \<^descr> @{ML Name_Space.full_name}~@{text "naming binding"} turns a |
996 name binding (usually a basic name) into the fully qualified |
996 name binding (usually a basic name) into the fully qualified |
997 internal name, according to the given naming policy. |
997 internal name, according to the given naming policy. |
998 |
998 |
999 \item Type @{ML_type Name_Space.T} represents name spaces. |
999 \<^descr> Type @{ML_type Name_Space.T} represents name spaces. |
1000 |
1000 |
1001 \item @{ML Name_Space.empty}~@{text "kind"} and @{ML Name_Space.merge}~@{text |
1001 \<^descr> @{ML Name_Space.empty}~@{text "kind"} and @{ML Name_Space.merge}~@{text |
1002 "(space\<^sub>1, space\<^sub>2)"} are the canonical operations for |
1002 "(space\<^sub>1, space\<^sub>2)"} are the canonical operations for |
1003 maintaining name spaces according to theory data management |
1003 maintaining name spaces according to theory data management |
1004 (\secref{sec:context-data}); @{text "kind"} is a formal comment |
1004 (\secref{sec:context-data}); @{text "kind"} is a formal comment |
1005 to characterize the purpose of a name space. |
1005 to characterize the purpose of a name space. |
1006 |
1006 |
1007 \item @{ML Name_Space.declare}~@{text "context strict binding |
1007 \<^descr> @{ML Name_Space.declare}~@{text "context strict binding |
1008 space"} enters a name binding as fully qualified internal name into |
1008 space"} enters a name binding as fully qualified internal name into |
1009 the name space, using the naming of the context. |
1009 the name space, using the naming of the context. |
1010 |
1010 |
1011 \item @{ML Name_Space.intern}~@{text "space name"} internalizes a |
1011 \<^descr> @{ML Name_Space.intern}~@{text "space name"} internalizes a |
1012 (partially qualified) external name. |
1012 (partially qualified) external name. |
1013 |
1013 |
1014 This operation is mostly for parsing! Note that fully qualified |
1014 This operation is mostly for parsing! Note that fully qualified |
1015 names stemming from declarations are produced via @{ML |
1015 names stemming from declarations are produced via @{ML |
1016 "Name_Space.full_name"} and @{ML "Name_Space.declare"} |
1016 "Name_Space.full_name"} and @{ML "Name_Space.declare"} |
1017 (or their derivatives for @{ML_type theory} and |
1017 (or their derivatives for @{ML_type theory} and |
1018 @{ML_type Proof.context}). |
1018 @{ML_type Proof.context}). |
1019 |
1019 |
1020 \item @{ML Name_Space.extern}~@{text "ctxt space name"} externalizes a |
1020 \<^descr> @{ML Name_Space.extern}~@{text "ctxt space name"} externalizes a |
1021 (fully qualified) internal name. |
1021 (fully qualified) internal name. |
1022 |
1022 |
1023 This operation is mostly for printing! User code should not rely on |
1023 This operation is mostly for printing! User code should not rely on |
1024 the precise result too much. |
1024 the precise result too much. |
1025 |
1025 |
1026 \item @{ML Name_Space.is_concealed}~@{text "space name"} indicates |
1026 \<^descr> @{ML Name_Space.is_concealed}~@{text "space name"} indicates |
1027 whether @{text "name"} refers to a strictly private entity that |
1027 whether @{text "name"} refers to a strictly private entity that |
1028 other tools are supposed to ignore! |
1028 other tools are supposed to ignore! |
1029 |
1029 |
1030 \end{description} |
1030 \end{description} |
1031 \<close> |
1031 \<close> |