src/Doc/Implementation/Prelim.thy
changeset 73764 35d8132633c6
parent 73763 eccc4a13216d
child 74561 8e6c973003c8
equal deleted inserted replaced
73763:eccc4a13216d 73764:35d8132633c6
   106   provides an immutable certificate of the background theory.
   106   provides an immutable certificate of the background theory.
   107 \<close>
   107 \<close>
   108 
   108 
   109 text %mlref \<open>
   109 text %mlref \<open>
   110   \begin{mldecls}
   110   \begin{mldecls}
   111   @{index_ML_type theory} \\
   111   @{define_ML_type theory} \\
   112   @{index_ML Context.eq_thy: "theory * theory -> bool"} \\
   112   @{define_ML Context.eq_thy: "theory * theory -> bool"} \\
   113   @{index_ML Context.subthy: "theory * theory -> bool"} \\
   113   @{define_ML Context.subthy: "theory * theory -> bool"} \\
   114   @{index_ML Theory.begin_theory: "string * Position.T -> theory list -> theory"} \\
   114   @{define_ML Theory.begin_theory: "string * Position.T -> theory list -> theory"} \\
   115   @{index_ML Theory.parents_of: "theory -> theory list"} \\
   115   @{define_ML Theory.parents_of: "theory -> theory list"} \\
   116   @{index_ML Theory.ancestors_of: "theory -> theory list"} \\
   116   @{define_ML Theory.ancestors_of: "theory -> theory list"} \\
   117   \end{mldecls}
   117   \end{mldecls}
   118 
   118 
   119   \<^descr> Type \<^ML_type>\<open>theory\<close> represents theory contexts.
   119   \<^descr> Type \<^ML_type>\<open>theory\<close> represents theory contexts.
   120 
   120 
   121   \<^descr> \<^ML>\<open>Context.eq_thy\<close>~\<open>(thy\<^sub>1, thy\<^sub>2)\<close> check strict identity of two
   121   \<^descr> \<^ML>\<open>Context.eq_thy\<close>~\<open>(thy\<^sub>1, thy\<^sub>2)\<close> check strict identity of two
   185   changed while the proof is still under construction!
   185   changed while the proof is still under construction!
   186 \<close>
   186 \<close>
   187 
   187 
   188 text %mlref \<open>
   188 text %mlref \<open>
   189   \begin{mldecls}
   189   \begin{mldecls}
   190   @{index_ML_type Proof.context} \\
   190   @{define_ML_type Proof.context} \\
   191   @{index_ML Proof_Context.init_global: "theory -> Proof.context"} \\
   191   @{define_ML Proof_Context.init_global: "theory -> Proof.context"} \\
   192   @{index_ML Proof_Context.theory_of: "Proof.context -> theory"} \\
   192   @{define_ML Proof_Context.theory_of: "Proof.context -> theory"} \\
   193   @{index_ML Proof_Context.transfer: "theory -> Proof.context -> Proof.context"} \\
   193   @{define_ML Proof_Context.transfer: "theory -> Proof.context -> Proof.context"} \\
   194   \end{mldecls}
   194   \end{mldecls}
   195 
   195 
   196   \<^descr> Type \<^ML_type>\<open>Proof.context\<close> represents proof contexts.
   196   \<^descr> Type \<^ML_type>\<open>Proof.context\<close> represents proof contexts.
   197 
   197 
   198   \<^descr> \<^ML>\<open>Proof_Context.init_global\<close>~\<open>thy\<close> produces a proof context derived
   198   \<^descr> \<^ML>\<open>Proof_Context.init_global\<close>~\<open>thy\<close> produces a proof context derived
   234   operation, which incurs a small runtime overhead.
   234   operation, which incurs a small runtime overhead.
   235 \<close>
   235 \<close>
   236 
   236 
   237 text %mlref \<open>
   237 text %mlref \<open>
   238   \begin{mldecls}
   238   \begin{mldecls}
   239   @{index_ML_type Context.generic} \\
   239   @{define_ML_type Context.generic} \\
   240   @{index_ML Context.theory_of: "Context.generic -> theory"} \\
   240   @{define_ML Context.theory_of: "Context.generic -> theory"} \\
   241   @{index_ML Context.proof_of: "Context.generic -> Proof.context"} \\
   241   @{define_ML Context.proof_of: "Context.generic -> Proof.context"} \\
   242   \end{mldecls}
   242   \end{mldecls}
   243 
   243 
   244   \<^descr> Type \<^ML_type>\<open>Context.generic\<close> is the direct sum of \<^ML_type>\<open>theory\<close>
   244   \<^descr> Type \<^ML_type>\<open>Context.generic\<close> is the direct sum of \<^ML_type>\<open>theory\<close>
   245   and \<^ML_type>\<open>Proof.context\<close>, with the datatype constructors \<^ML>\<open>Context.Theory\<close> and \<^ML>\<open>Context.Proof\<close>.
   245   and \<^ML_type>\<open>Proof.context\<close>, with the datatype constructors \<^ML>\<open>Context.Theory\<close> and \<^ML>\<open>Context.Proof\<close>.
   246 
   246 
   337   an Isabelle/ML module may maintain abstract values authentically.
   337   an Isabelle/ML module may maintain abstract values authentically.
   338 \<close>
   338 \<close>
   339 
   339 
   340 text %mlref \<open>
   340 text %mlref \<open>
   341   \begin{mldecls}
   341   \begin{mldecls}
   342   @{index_ML_functor Theory_Data} \\
   342   @{define_ML_functor Theory_Data} \\
   343   @{index_ML_functor Proof_Data} \\
   343   @{define_ML_functor Proof_Data} \\
   344   @{index_ML_functor Generic_Data} \\
   344   @{define_ML_functor Generic_Data} \\
   345   \end{mldecls}
   345   \end{mldecls}
   346 
   346 
   347   \<^descr> \<^ML_functor>\<open>Theory_Data\<close>\<open>(spec)\<close> declares data for type \<^ML_type>\<open>theory\<close>
   347   \<^descr> \<^ML_functor>\<open>Theory_Data\<close>\<open>(spec)\<close> declares data for type \<^ML_type>\<open>theory\<close>
   348   according to the specification provided as argument structure. The resulting
   348   according to the specification provided as argument structure. The resulting
   349   structure provides data init and access operations as described above.
   349   structure provides data init and access operations as described above.
   480   references.
   480   references.
   481 \<close>
   481 \<close>
   482 
   482 
   483 text %mlref \<open>
   483 text %mlref \<open>
   484   \begin{mldecls}
   484   \begin{mldecls}
   485   @{index_ML Config.get: "Proof.context -> 'a Config.T -> 'a"} \\
   485   @{define_ML Config.get: "Proof.context -> 'a Config.T -> 'a"} \\
   486   @{index_ML Config.map: "'a Config.T -> ('a -> 'a) -> Proof.context -> Proof.context"} \\
   486   @{define_ML Config.map: "'a Config.T -> ('a -> 'a) -> Proof.context -> Proof.context"} \\
   487   @{index_ML Attrib.setup_config_bool: "binding -> (Context.generic -> bool) ->
   487   @{define_ML Attrib.setup_config_bool: "binding -> (Context.generic -> bool) ->
   488   bool Config.T"} \\
   488   bool Config.T"} \\
   489   @{index_ML Attrib.setup_config_int: "binding -> (Context.generic -> int) ->
   489   @{define_ML Attrib.setup_config_int: "binding -> (Context.generic -> int) ->
   490   int Config.T"} \\
   490   int Config.T"} \\
   491   @{index_ML Attrib.setup_config_real: "binding -> (Context.generic -> real) ->
   491   @{define_ML Attrib.setup_config_real: "binding -> (Context.generic -> real) ->
   492   real Config.T"} \\
   492   real Config.T"} \\
   493   @{index_ML Attrib.setup_config_string: "binding -> (Context.generic -> string) ->
   493   @{define_ML Attrib.setup_config_string: "binding -> (Context.generic -> string) ->
   494   string Config.T"} \\
   494   string Config.T"} \\
   495   \end{mldecls}
   495   \end{mldecls}
   496 
   496 
   497   \<^descr> \<^ML>\<open>Config.get\<close>~\<open>ctxt config\<close> gets the value of \<open>config\<close> in the given
   497   \<^descr> \<^ML>\<open>Config.get\<close>~\<open>ctxt config\<close> gets the value of \<open>config\<close> in the given
   498   context.
   498   context.
   611   unused variant from this sequence.
   611   unused variant from this sequence.
   612 \<close>
   612 \<close>
   613 
   613 
   614 text %mlref \<open>
   614 text %mlref \<open>
   615   \begin{mldecls}
   615   \begin{mldecls}
   616   @{index_ML Name.internal: "string -> string"} \\
   616   @{define_ML Name.internal: "string -> string"} \\
   617   @{index_ML Name.skolem: "string -> string"} \\
   617   @{define_ML Name.skolem: "string -> string"} \\
   618   \end{mldecls}
   618   \end{mldecls}
   619   \begin{mldecls}
   619   \begin{mldecls}
   620   @{index_ML_type Name.context} \\
   620   @{define_ML_type Name.context} \\
   621   @{index_ML Name.context: Name.context} \\
   621   @{define_ML Name.context: Name.context} \\
   622   @{index_ML Name.declare: "string -> Name.context -> Name.context"} \\
   622   @{define_ML Name.declare: "string -> Name.context -> Name.context"} \\
   623   @{index_ML Name.invent: "Name.context -> string -> int -> string list"} \\
   623   @{define_ML Name.invent: "Name.context -> string -> int -> string list"} \\
   624   @{index_ML Name.variant: "string -> Name.context -> string * Name.context"} \\
   624   @{define_ML Name.variant: "string -> Name.context -> string * Name.context"} \\
   625   \end{mldecls}
   625   \end{mldecls}
   626   \begin{mldecls}
   626   \begin{mldecls}
   627   @{index_ML Variable.names_of: "Proof.context -> Name.context"} \\
   627   @{define_ML Variable.names_of: "Proof.context -> Name.context"} \\
   628   \end{mldecls}
   628   \end{mldecls}
   629 
   629 
   630   \<^descr> \<^ML>\<open>Name.internal\<close>~\<open>name\<close> produces an internal name by adding one
   630   \<^descr> \<^ML>\<open>Name.internal\<close>~\<open>name\<close> produces an internal name by adding one
   631   underscore.
   631   underscore.
   632 
   632 
   718   \<open>?x1, ?x7, ?x42\<close> becomes \<open>?x, ?xa, ?xb\<close>.
   718   \<open>?x1, ?x7, ?x42\<close> becomes \<open>?x, ?xa, ?xb\<close>.
   719 \<close>
   719 \<close>
   720 
   720 
   721 text %mlref \<open>
   721 text %mlref \<open>
   722   \begin{mldecls}
   722   \begin{mldecls}
   723   @{index_ML_type indexname = "string * int"} \\
   723   @{define_ML_type indexname = "string * int"} \\
   724   \end{mldecls}
   724   \end{mldecls}
   725 
   725 
   726   \<^descr> Type \<^ML_type>\<open>indexname\<close> represents indexed names. This is an
   726   \<^descr> Type \<^ML_type>\<open>indexname\<close> represents indexed names. This is an
   727   abbreviation for \<^ML_type>\<open>string * int\<close>. The second component is usually
   727   abbreviation for \<^ML_type>\<open>string * int\<close>. The second component is usually
   728   non-negative, except for situations where \<open>(x, -1)\<close> is used to inject basic
   728   non-negative, except for situations where \<open>(x, -1)\<close> is used to inject basic
   753   again to empty names.
   753   again to empty names.
   754 \<close>
   754 \<close>
   755 
   755 
   756 text %mlref \<open>
   756 text %mlref \<open>
   757   \begin{mldecls}
   757   \begin{mldecls}
   758   @{index_ML Long_Name.base_name: "string -> string"} \\
   758   @{define_ML Long_Name.base_name: "string -> string"} \\
   759   @{index_ML Long_Name.qualifier: "string -> string"} \\
   759   @{define_ML Long_Name.qualifier: "string -> string"} \\
   760   @{index_ML Long_Name.append: "string -> string -> string"} \\
   760   @{define_ML Long_Name.append: "string -> string -> string"} \\
   761   @{index_ML Long_Name.implode: "string list -> string"} \\
   761   @{define_ML Long_Name.implode: "string list -> string"} \\
   762   @{index_ML Long_Name.explode: "string -> string list"} \\
   762   @{define_ML Long_Name.explode: "string -> string list"} \\
   763   \end{mldecls}
   763   \end{mldecls}
   764 
   764 
   765   \<^descr> \<^ML>\<open>Long_Name.base_name\<close>~\<open>name\<close> returns the base name of a long name.
   765   \<^descr> \<^ML>\<open>Long_Name.base_name\<close>~\<open>name\<close> returns the base name of a long name.
   766 
   766 
   767   \<^descr> \<^ML>\<open>Long_Name.qualifier\<close>~\<open>name\<close> returns the qualifier of a long name.
   767   \<^descr> \<^ML>\<open>Long_Name.qualifier\<close>~\<open>name\<close> returns the qualifier of a long name.
   830   \end{tabular}
   830   \end{tabular}
   831 \<close>
   831 \<close>
   832 
   832 
   833 text %mlref \<open>
   833 text %mlref \<open>
   834   \begin{mldecls}
   834   \begin{mldecls}
   835   @{index_ML_type binding} \\
   835   @{define_ML_type binding} \\
   836   @{index_ML Binding.empty: binding} \\
   836   @{define_ML Binding.empty: binding} \\
   837   @{index_ML Binding.name: "string -> binding"} \\
   837   @{define_ML Binding.name: "string -> binding"} \\
   838   @{index_ML Binding.qualify: "bool -> string -> binding -> binding"} \\
   838   @{define_ML Binding.qualify: "bool -> string -> binding -> binding"} \\
   839   @{index_ML Binding.prefix: "bool -> string -> binding -> binding"} \\
   839   @{define_ML Binding.prefix: "bool -> string -> binding -> binding"} \\
   840   @{index_ML Binding.concealed: "binding -> binding"} \\
   840   @{define_ML Binding.concealed: "binding -> binding"} \\
   841   @{index_ML Binding.print: "binding -> string"} \\
   841   @{define_ML Binding.print: "binding -> string"} \\
   842   \end{mldecls}
   842   \end{mldecls}
   843   \begin{mldecls}
   843   \begin{mldecls}
   844   @{index_ML_type Name_Space.naming} \\
   844   @{define_ML_type Name_Space.naming} \\
   845   @{index_ML Name_Space.global_naming: Name_Space.naming} \\
   845   @{define_ML Name_Space.global_naming: Name_Space.naming} \\
   846   @{index_ML Name_Space.add_path: "string -> Name_Space.naming -> Name_Space.naming"} \\
   846   @{define_ML Name_Space.add_path: "string -> Name_Space.naming -> Name_Space.naming"} \\
   847   @{index_ML Name_Space.full_name: "Name_Space.naming -> binding -> string"} \\
   847   @{define_ML Name_Space.full_name: "Name_Space.naming -> binding -> string"} \\
   848   \end{mldecls}
   848   \end{mldecls}
   849   \begin{mldecls}
   849   \begin{mldecls}
   850   @{index_ML_type Name_Space.T} \\
   850   @{define_ML_type Name_Space.T} \\
   851   @{index_ML Name_Space.empty: "string -> Name_Space.T"} \\
   851   @{define_ML Name_Space.empty: "string -> Name_Space.T"} \\
   852   @{index_ML Name_Space.merge: "Name_Space.T * Name_Space.T -> Name_Space.T"} \\
   852   @{define_ML Name_Space.merge: "Name_Space.T * Name_Space.T -> Name_Space.T"} \\
   853   @{index_ML Name_Space.declare: "Context.generic -> bool ->
   853   @{define_ML Name_Space.declare: "Context.generic -> bool ->
   854   binding -> Name_Space.T -> string * Name_Space.T"} \\
   854   binding -> Name_Space.T -> string * Name_Space.T"} \\
   855   @{index_ML Name_Space.intern: "Name_Space.T -> string -> string"} \\
   855   @{define_ML Name_Space.intern: "Name_Space.T -> string -> string"} \\
   856   @{index_ML Name_Space.extern: "Proof.context -> Name_Space.T -> string -> string"} \\
   856   @{define_ML Name_Space.extern: "Proof.context -> Name_Space.T -> string -> string"} \\
   857   @{index_ML Name_Space.is_concealed: "Name_Space.T -> string -> bool"}
   857   @{define_ML Name_Space.is_concealed: "Name_Space.T -> string -> bool"}
   858   \end{mldecls}
   858   \end{mldecls}
   859 
   859 
   860   \<^descr> Type \<^ML_type>\<open>binding\<close> represents the abstract concept of name bindings.
   860   \<^descr> Type \<^ML_type>\<open>binding\<close> represents the abstract concept of name bindings.
   861 
   861 
   862   \<^descr> \<^ML>\<open>Binding.empty\<close> is the empty binding.
   862   \<^descr> \<^ML>\<open>Binding.empty\<close> is the empty binding.