src/Doc/Isar_Ref/Spec.thy
changeset 59939 7d46aa03696e
parent 59926 003dbac78546
child 59990 a81dc82ecba3
equal deleted inserted replaced
59938:f84b93187ab6 59939:7d46aa03696e
   113 text \<open>
   113 text \<open>
   114   \begin{matharray}{rcll}
   114   \begin{matharray}{rcll}
   115     @{command_def "context"} & : & @{text "theory \<rightarrow> local_theory"} \\
   115     @{command_def "context"} & : & @{text "theory \<rightarrow> local_theory"} \\
   116     @{command_def (local) "end"} & : & @{text "local_theory \<rightarrow> theory"} \\
   116     @{command_def (local) "end"} & : & @{text "local_theory \<rightarrow> theory"} \\
   117     @{keyword_def "private"} \\
   117     @{keyword_def "private"} \\
       
   118     @{keyword_def "restricted"} \\
   118   \end{matharray}
   119   \end{matharray}
   119 
   120 
   120   A local theory target is a specification context that is managed
   121   A local theory target is a specification context that is managed
   121   separately within the enclosing theory. Contexts may introduce parameters
   122   separately within the enclosing theory. Contexts may introduce parameters
   122   (fixed variables) and assumptions (hypotheses). Definitions and theorems
   123   (fixed variables) and assumptions (hypotheses). Definitions and theorems
   159   \item @{command (local) "end"} concludes the current local theory,
   160   \item @{command (local) "end"} concludes the current local theory,
   160   according to the nesting of contexts.  Note that a global @{command
   161   according to the nesting of contexts.  Note that a global @{command
   161   (global) "end"} has a different meaning: it concludes the theory
   162   (global) "end"} has a different meaning: it concludes the theory
   162   itself (\secref{sec:begin-thy}).
   163   itself (\secref{sec:begin-thy}).
   163   
   164   
   164   \item @{keyword "private"} may be given as a modifier to any local theory
   165   \item @{keyword "private"} or @{keyword "restricted"} may be given as
   165   command (before the command keyword). This limits name space accesses to
   166   modifiers before any local theory command. This limits name space accesses
   166   the current local scope, as determined by the enclosing @{command
   167   to the local scope, as determined by the enclosing @{command
   167   "context"}~@{keyword "begin"}~\dots~@{command "end"} block. Neither a
   168   "context"}~@{keyword "begin"}~\dots~@{command "end"} block. Outside its
   168   global theory nor a locale target have such a local scope by themselves:
   169   scope, a @{keyword "private"} name is inaccessible, and a @{keyword
   169   an extra unnamed context is required to use @{keyword "private"} here.
   170   "restricted"} name is only accessible with additional qualification.
       
   171 
       
   172   Neither a global @{command theory} nor a @{command locale} target provides
       
   173   a local scope by itself: an extra unnamed context is required to use
       
   174   @{keyword "private"} or @{keyword "restricted"} here.
   170 
   175 
   171   \item @{text "("}@{keyword_def "in"}~@{text "c)"} given after any local
   176   \item @{text "("}@{keyword_def "in"}~@{text "c)"} given after any local
   172   theory command specifies an immediate target, e.g.\ ``@{command
   177   theory command specifies an immediate target, e.g.\ ``@{command
   173   "definition"}~@{text "(\<IN> c)"}'' or ``@{command "theorem"}~@{text
   178   "definition"}~@{text "(\<IN> c)"}'' or ``@{command "theorem"}~@{text
   174   "(\<IN> c)"}''. This works both in a local or global theory context; the
   179   "(\<IN> c)"}''. This works both in a local or global theory context; the