src/Doc/Isar_Ref/Spec.thy
changeset 71166 c9433e8e314e
parent 70608 d997c7ba3305
child 71567 9a29e883a934
equal deleted inserted replaced
71165:03afc8252225 71166:c9433e8e314e
   616   \<^descr> \<^theory_text>\<open>print_locales\<close> prints the names of all locales of the current theory;
   616   \<^descr> \<^theory_text>\<open>print_locales\<close> prints the names of all locales of the current theory;
   617   the ``\<open>!\<close>'' option indicates extra verbosity.
   617   the ``\<open>!\<close>'' option indicates extra verbosity.
   618 
   618 
   619   \<^descr> \<^theory_text>\<open>locale_deps\<close> visualizes all locales and their relations as a Hasse
   619   \<^descr> \<^theory_text>\<open>locale_deps\<close> visualizes all locales and their relations as a Hasse
   620   diagram. This includes locales defined as type classes (\secref{sec:class}).
   620   diagram. This includes locales defined as type classes (\secref{sec:class}).
   621   See also \<^theory_text>\<open>print_dependencies\<close> below.
       
   622 
   621 
   623   \<^descr> @{method intro_locales} and @{method unfold_locales} repeatedly expand all
   622   \<^descr> @{method intro_locales} and @{method unfold_locales} repeatedly expand all
   624   introduction rules of locale predicates of the theory. While @{method
   623   introduction rules of locale predicates of the theory. While @{method
   625   intro_locales} only applies the \<open>loc.intro\<close> introduction rules and therefore
   624   intro_locales} only applies the \<open>loc.intro\<close> introduction rules and therefore
   626   does not descend to assumptions, @{method unfold_locales} is more aggressive
   625   does not descend to assumptions, @{method unfold_locales} is more aggressive
   642   \begin{matharray}{rcl}
   641   \begin{matharray}{rcl}
   643     @{command "interpretation"} & : & \<open>local_theory \<rightarrow> proof(prove)\<close> \\
   642     @{command "interpretation"} & : & \<open>local_theory \<rightarrow> proof(prove)\<close> \\
   644     @{command_def "interpret"} & : & \<open>proof(state) | proof(chain) \<rightarrow> proof(prove)\<close> \\
   643     @{command_def "interpret"} & : & \<open>proof(state) | proof(chain) \<rightarrow> proof(prove)\<close> \\
   645     @{command_def "global_interpretation"} & : & \<open>theory | local_theory \<rightarrow> proof(prove)\<close> \\
   644     @{command_def "global_interpretation"} & : & \<open>theory | local_theory \<rightarrow> proof(prove)\<close> \\
   646     @{command_def "sublocale"} & : & \<open>theory | local_theory \<rightarrow> proof(prove)\<close> \\
   645     @{command_def "sublocale"} & : & \<open>theory | local_theory \<rightarrow> proof(prove)\<close> \\
   647     @{command_def "print_dependencies"}\<open>\<^sup>*\<close> & : & \<open>context \<rightarrow>\<close> \\
       
   648     @{command_def "print_interps"}\<open>\<^sup>*\<close> & :  & \<open>context \<rightarrow>\<close> \\
   646     @{command_def "print_interps"}\<open>\<^sup>*\<close> & :  & \<open>context \<rightarrow>\<close> \\
   649   \end{matharray}
   647   \end{matharray}
   650 
   648 
   651   Locales may be instantiated, and the resulting instantiated declarations
   649   Locales may be instantiated, and the resulting instantiated declarations
   652   added to the current context. This requires proof (of the instantiated
   650   added to the current context. This requires proof (of the instantiated
   662     ;
   660     ;
   663     @@{command global_interpretation} @{syntax locale_expr} definitions?
   661     @@{command global_interpretation} @{syntax locale_expr} definitions?
   664     ;
   662     ;
   665     @@{command sublocale} (@{syntax name} ('<' | '\<subseteq>'))? @{syntax locale_expr} \<newline>
   663     @@{command sublocale} (@{syntax name} ('<' | '\<subseteq>'))? @{syntax locale_expr} \<newline>
   666       definitions?
   664       definitions?
   667     ;
       
   668     @@{command print_dependencies} '!'? @{syntax locale_expr}
       
   669     ;
   665     ;
   670     @@{command print_interps} @{syntax name}
   666     @@{command print_interps} @{syntax name}
   671     ;
   667     ;
   672 
   668 
   673     definitions: @'defines' (@{syntax thmdecl}? @{syntax name} \<newline>
   669     definitions: @'defines' (@{syntax thmdecl}? @{syntax name} \<newline>
   758 
   754 
   759   In a named context block the \<^theory_text>\<open>sublocale\<close> command may also be used, but the
   755   In a named context block the \<^theory_text>\<open>sublocale\<close> command may also be used, but the
   760   locale argument must be omitted. The command then refers to the locale (or
   756   locale argument must be omitted. The command then refers to the locale (or
   761   class) target of the context block.
   757   class) target of the context block.
   762 
   758 
   763   \<^descr> \<^theory_text>\<open>print_dependencies expr\<close> is useful for understanding the effect of an
   759   \<^descr> \<^theory_text>\<open>print_interps name\<close> lists all interpretations of locale \<open>name\<close> in the
   764   interpretation of \<open>expr\<close> in the current context. It lists all locale
       
   765   instances for which interpretations would be added to the current context.
       
   766   Variant \<^theory_text>\<open>print_dependencies!\<close> does not generalize parameters and assumes an
       
   767   empty context --- that is, it prints all locale instances that would be
       
   768   considered for interpretation. The latter is useful for understanding the
       
   769   dependencies of a locale expression.
       
   770 
       
   771   \<^descr> \<^theory_text>\<open>print_interps locale\<close> lists all interpretations of \<open>locale\<close> in the
       
   772   current theory or proof context, including those due to a combination of an
   760   current theory or proof context, including those due to a combination of an
   773   \<^theory_text>\<open>interpretation\<close> or \<^theory_text>\<open>interpret\<close> and one or several \<^theory_text>\<open>sublocale\<close>
   761   \<^theory_text>\<open>interpretation\<close> or \<^theory_text>\<open>interpret\<close> and one or several \<^theory_text>\<open>sublocale\<close>
   774   declarations.
   762   declarations.
   775 
   763 
   776   \begin{warn}
   764   \begin{warn}