doc-src/IsarRef/Thy/Spec.thy
changeset 30461 00323c45ea83
parent 30242 aea5d7fa7ef5
child 30526 7f9a9ec1c94d
equal deleted inserted replaced
30460:c999618d225e 30461:00323c45ea83
   797     @{command_def "ML"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
   797     @{command_def "ML"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
   798     @{command_def "ML_prf"} & : & @{text "proof \<rightarrow> proof"} \\
   798     @{command_def "ML_prf"} & : & @{text "proof \<rightarrow> proof"} \\
   799     @{command_def "ML_val"} & : & @{text "any \<rightarrow>"} \\
   799     @{command_def "ML_val"} & : & @{text "any \<rightarrow>"} \\
   800     @{command_def "ML_command"} & : & @{text "any \<rightarrow>"} \\
   800     @{command_def "ML_command"} & : & @{text "any \<rightarrow>"} \\
   801     @{command_def "setup"} & : & @{text "theory \<rightarrow> theory"} \\
   801     @{command_def "setup"} & : & @{text "theory \<rightarrow> theory"} \\
       
   802     @{command_def "local_setup"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
   802   \end{matharray}
   803   \end{matharray}
   803 
   804 
   804   \begin{mldecls}
   805   \begin{mldecls}
   805     @{index_ML bind_thms: "string * thm list -> unit"} \\
   806     @{index_ML bind_thms: "string * thm list -> unit"} \\
   806     @{index_ML bind_thm: "string * thm -> unit"} \\
   807     @{index_ML bind_thm: "string * thm -> unit"} \\
   807   \end{mldecls}
   808   \end{mldecls}
   808 
   809 
   809   \begin{rail}
   810   \begin{rail}
   810     'use' name
   811     'use' name
   811     ;
   812     ;
   812     ('ML' | 'ML\_prf' | 'ML\_val' | 'ML\_command' | 'setup') text
   813     ('ML' | 'ML\_prf' | 'ML\_val' | 'ML\_command' | 'setup' | 'local\_setup') text
   813     ;
   814     ;
   814   \end{rail}
   815   \end{rail}
   815 
   816 
   816   \begin{description}
   817   \begin{description}
   817 
   818 
   818   \item @{command "use"}~@{text "file"} reads and executes ML
   819   \item @{command "use"}~@{text "file"} reads and executes ML
   819   commands from @{text "file"}.  The current theory context is passed
   820   commands from @{text "file"}.  The current theory context is passed
   820   down to the ML toplevel and may be modified, using @{ML [source=false]
   821   down to the ML toplevel and may be modified, using @{ML
   821   "Context.>>"} or derived ML commands.  The file name is checked with
   822   "Context.>>"} or derived ML commands.  The file name is checked with
   822   the @{keyword_ref "uses"} dependency declaration given in the theory
   823   the @{keyword_ref "uses"} dependency declaration given in the theory
   823   header (see also \secref{sec:begin-thy}).
   824   header (see also \secref{sec:begin-thy}).
   824 
   825 
   825   Top-level ML bindings are stored within the (global or local) theory
   826   Top-level ML bindings are stored within the (global or local) theory
   843   updated.  @{command "ML_val"} echos the bindings produced at the ML
   844   updated.  @{command "ML_val"} echos the bindings produced at the ML
   844   toplevel, but @{command "ML_command"} is silent.
   845   toplevel, but @{command "ML_command"} is silent.
   845   
   846   
   846   \item @{command "setup"}~@{text "text"} changes the current theory
   847   \item @{command "setup"}~@{text "text"} changes the current theory
   847   context by applying @{text "text"}, which refers to an ML expression
   848   context by applying @{text "text"}, which refers to an ML expression
   848   of type @{ML_type [source=false] "theory -> theory"}.  This enables
   849   of type @{ML_type "theory -> theory"}.  This enables to initialize
   849   to initialize any object-logic specific tools and packages written
   850   any object-logic specific tools and packages written in ML, for
   850   in ML, for example.
   851   example.
       
   852 
       
   853   \item @{command "local_setup"} is similar to @{command "setup"} for
       
   854   a local theory context, and an ML expression of type @{ML_type
       
   855   "local_theory -> local_theory"}.  This allows to
       
   856   invoke local theory specification packages without going through
       
   857   concrete outer syntax, for example.
   851 
   858 
   852   \item @{ML bind_thms}~@{text "(name, thms)"} stores a list of
   859   \item @{ML bind_thms}~@{text "(name, thms)"} stores a list of
   853   theorems produced in ML both in the theory context and the ML
   860   theorems produced in ML both in the theory context and the ML
   854   toplevel, associating it with the provided name.  Theorems are put
   861   toplevel, associating it with the provided name.  Theorems are put
   855   into a global ``standard'' format before being stored.
   862   into a global ``standard'' format before being stored.