doc-src/IsarRef/Thy/Inner_Syntax.thy
changeset 28765 da8f6f4a74be
parent 28763 b5e6122ff575
child 28766 accab7594b8e
equal deleted inserted replaced
28764:b65194fe4434 28765:da8f6f4a74be
    94   systematic way to include formal items into the printed text
    94   systematic way to include formal items into the printed text
    95   document.
    95   document.
    96 *}
    96 *}
    97 
    97 
    98 
    98 
    99 subsection {* Printing limits *}
       
   100 
       
   101 text {*
       
   102   \begin{mldecls}
       
   103     @{index_ML Pretty.setdepth: "int -> unit"} \\
       
   104     @{index_ML Pretty.setmargin: "int -> unit"} \\
       
   105     @{index_ML print_depth: "int -> unit"} \\
       
   106   \end{mldecls}
       
   107 
       
   108   These ML functions set limits for pretty printed text output.
       
   109 
       
   110   \begin{description}
       
   111 
       
   112   \item @{ML Pretty.setdepth}~@{text d} tells the pretty printer to
       
   113   limit the printing depth to @{text d}.  This affects the display of
       
   114   types, terms, theorems etc.  The default value is 0, which permits
       
   115   printing to an arbitrary depth.  Useful values for @{text d} are 10
       
   116   and 20.
       
   117 
       
   118   \item @{ML Pretty.setmargin}~@{text m} tells the pretty printer to
       
   119   assume a right margin (page width) of @{text m}.  The initial margin
       
   120   is 76.  User interfaces may adapt this default automatically, when
       
   121   resizing windows etc.
       
   122 
       
   123   \item @{ML print_depth}~@{text n} limits the printing depth of the
       
   124   ML toplevel pretty printer; the precise effect depends on the ML
       
   125   compiler and run-time system.  Typically @{text n} should be less
       
   126   than 10.  Bigger values such as 100--1000 are useful for debugging.
       
   127 
       
   128   \end{description}
       
   129 *}
       
   130 
       
   131 
       
   132 subsection {* Details of printed content *}
    99 subsection {* Details of printed content *}
   133 
   100 
   134 text {*
   101 text {*
   135   \begin{mldecls} 
   102   \begin{mldecls} 
   136     @{index_ML show_types: "bool ref"} & default @{ML false} \\
   103     @{index_ML show_types: "bool ref"} & default @{ML false} \\
   138     @{index_ML show_consts: "bool ref"} & default @{ML false} \\
   105     @{index_ML show_consts: "bool ref"} & default @{ML false} \\
   139     @{index_ML long_names: "bool ref"} & default @{ML false} \\
   106     @{index_ML long_names: "bool ref"} & default @{ML false} \\
   140     @{index_ML short_names: "bool ref"} & default @{ML false} \\
   107     @{index_ML short_names: "bool ref"} & default @{ML false} \\
   141     @{index_ML unique_names: "bool ref"} & default @{ML true} \\
   108     @{index_ML unique_names: "bool ref"} & default @{ML true} \\
   142     @{index_ML show_brackets: "bool ref"} & default @{ML false} \\
   109     @{index_ML show_brackets: "bool ref"} & default @{ML false} \\
   143     @{index_ML eta_contract: "bool ref"} \\
   110     @{index_ML eta_contract: "bool ref"} & default @{ML true} \\
   144     @{index_ML goals_limit: "int ref"} & default @{ML 10} \\
   111     @{index_ML goals_limit: "int ref"} & default @{ML 10} \\
   145     @{index_ML Proof.show_main_goal: "bool ref"} & default @{ML false} \\
   112     @{index_ML Proof.show_main_goal: "bool ref"} & default @{ML false} \\
   146     @{index_ML show_hyps: "bool ref"} & default @{ML false} \\
   113     @{index_ML show_hyps: "bool ref"} & default @{ML false} \\
   147     @{index_ML show_tags: "bool ref"} & default @{ML false} \\
   114     @{index_ML show_tags: "bool ref"} & default @{ML false} \\
       
   115     @{index_ML show_question_marks: "bool ref"} & default @{ML true} \\
   148   \end{mldecls}
   116   \end{mldecls}
   149 
   117 
   150   These global ML variables control the detail of information that is
   118   These global ML variables control the detail of information that is
   151   displayed for types, terms, theorems, goals etc.
   119   displayed for types, terms, theorems, goals etc.
       
   120 
       
   121   In interactive sessions, the user interface usually manages these
       
   122   global parameters of the Isabelle process, even with some concept of
       
   123   persistence.  Nonetheless it is occasionally useful to manipulate ML
       
   124   variables directly, e.g.\ using @{command "ML_val"} or @{command
       
   125   "ML_command"}.
       
   126 
       
   127   Batch-mode logic sessions may be configured by putting appropriate
       
   128   ML text directly into the @{verbatim ROOT.ML} file.
   152 
   129 
   153   \begin{description}
   130   \begin{description}
   154 
   131 
   155   \item @{ML show_types} and @{ML show_sorts} control printing of type
   132   \item @{ML show_types} and @{ML show_sorts} control printing of type
   156   constraints for term variables, and sort constraints for type
   133   constraints for term variables, and sort constraints for type
   161   Note that displaying types and sorts may explain why a polymorphic
   138   Note that displaying types and sorts may explain why a polymorphic
   162   inference rule fails to resolve with some goal, or why a rewrite
   139   inference rule fails to resolve with some goal, or why a rewrite
   163   rule does not apply as expected.
   140   rule does not apply as expected.
   164 
   141 
   165   \item @{ML show_consts} controls printing of types of constants when
   142   \item @{ML show_consts} controls printing of types of constants when
   166   printing proof states.  Note that the output can be enormous as
   143   displaying a goal state.
   167   polymorphic constants often occur at several different type
   144 
   168   instances.
   145   Note that the output can be enormous, because polymorphic constants
       
   146   often occur at several different type instances.
   169 
   147 
   170   \item @{ML long_names}, @{ML short_names}, and @{ML unique_names}
   148   \item @{ML long_names}, @{ML short_names}, and @{ML unique_names}
   171   modify the way of printing qualified names in external form.  See
   149   control the way of printing fully qualified internal names in
   172   also the description of document antiquotation options in
   150   external form.  See also \secref{sec:antiq} for the document
   173   \secref{sec:antiq}.
   151   antiquotation options of the same names.
   174 
   152 
   175   \item @{ML show_brackets} controls insertion of bracketing in pretty
   153   \item @{ML show_brackets} controls bracketing in pretty printed
   176   printed output.  If set to @{ML true}, all sub-expressions of the
   154   output.  If set to @{ML true}, all sub-expressions of the pretty
   177   pretty printing tree will be parenthesized, even if this produces
   155   printing tree will be parenthesized, even if this produces malformed
   178   malformed term syntax!  This crude way of showing the full structure
   156   term syntax!  This crude way of showing the internal structure of
   179   of pretty printed entities might help to diagnose problems with
   157   pretty printed entities may occasionally help to diagnose problems
   180   operator priorities, for example.
   158   with operator priorities, for example.
   181 
   159 
   182   \item @{ML eta_contract} controls @{text "\<eta>"}-contracted printing of
   160   \item @{ML eta_contract} controls @{text "\<eta>"}-contracted printing of
   183   terms.
   161   terms.
   184 
   162 
   185   The @{text \<eta>}-contraction law asserts @{prop "(\<lambda>x. f x) \<equiv> f"},
   163   The @{text \<eta>}-contraction law asserts @{prop "(\<lambda>x. f x) \<equiv> f"},
   193   Setting @{ML eta_contract} makes Isabelle perform @{text
   171   Setting @{ML eta_contract} makes Isabelle perform @{text
   194   \<eta>}-contractions before printing, so that @{term "\<lambda>h. F (\<lambda>x. h x)"}
   172   \<eta>}-contractions before printing, so that @{term "\<lambda>h. F (\<lambda>x. h x)"}
   195   appears simply as @{text F}.
   173   appears simply as @{text F}.
   196 
   174 
   197   Note that the distinction between a term and its @{text \<eta>}-expanded
   175   Note that the distinction between a term and its @{text \<eta>}-expanded
   198   form occasionally matters.
   176   form occasionally matters.  While higher-order resolution and
   199 
   177   rewriting operate modulo @{text "\<alpha>\<beta>\<eta>"}-conversion, some other tools
       
   178   might look at terms more discretely.
   200 
   179 
   201   \item @{ML goals_limit} controls the maximum number of subgoals to
   180   \item @{ML goals_limit} controls the maximum number of subgoals to
   202   be shown in proof state output.
   181   be shown in goal output.
   203 
   182 
   204   \item @{ML Proof.show_main_goal} controls whether the main result to
   183   \item @{ML Proof.show_main_goal} controls whether the main result to
   205   be proven should be displayed.  This information might be relevant
   184   be proven should be displayed.  This information might be relevant
   206   for schematic goals, to see the current claim being synthesized.
   185   for schematic goals, to inspect the current claim that has been
       
   186   synthesized so far.
   207 
   187 
   208   \item @{ML show_hyps} controls printing of implicit hypotheses of
   188   \item @{ML show_hyps} controls printing of implicit hypotheses of
   209   local facts.  Normally, only those hypotheses are displayed that are
   189   local facts.  Normally, only those hypotheses are displayed that are
   210   \emph{not} covered by the assumptions of the current context: this
   190   \emph{not} covered by the assumptions of the current context: this
   211   situation indicates a fault in some tool being used.
   191   situation indicates a fault in some tool being used.
   212 
   192 
   213   By setting @{ML show_hyps} to @{ML true}, output of all hypotheses
   193   By setting @{ML show_hyps} to @{ML true}, output of \emph{all}
   214   can be enforced.  Which is occasionally usefule for diagnostic
   194   hypotheses can be enforced, which is occasionally useful for
   215   purposes.
   195   diagnostic purposes.
   216 
   196 
   217   \item @{ML show_tags} controls printing of extra annotations within
   197   \item @{ML show_tags} controls printing of extra annotations within
   218   theorems, such as the case names being attached by the attribute
   198   theorems, such as internal position information, or the case names
   219   @{attribute case_names}.
   199   being attached by the attribute @{attribute case_names}.
       
   200 
       
   201   Note that the @{attribute tagged} and @{attribute untagged}
       
   202   attributes provide low-level access to the collection of tags
       
   203   associated with a theorem.
       
   204 
       
   205   \item @{ML show_question_marks} controls printing of question marks
       
   206   for schematic variables, such as @{text ?x}.  Only the leading
       
   207   question mark is affected, the remaining text is unchanged
       
   208   (including proper markup for schematic variables that might be
       
   209   relevant for user interfaces).
       
   210 
       
   211   \end{description}
       
   212 *}
       
   213 
       
   214 
       
   215 subsection {* Printing limits *}
       
   216 
       
   217 text {*
       
   218   \begin{mldecls}
       
   219     @{index_ML Pretty.setdepth: "int -> unit"} \\
       
   220     @{index_ML Pretty.setmargin: "int -> unit"} \\
       
   221     @{index_ML print_depth: "int -> unit"} \\
       
   222   \end{mldecls}
       
   223 
       
   224   These ML functions set limits for pretty printed text.
       
   225 
       
   226   \begin{description}
       
   227 
       
   228   \item @{ML Pretty.setdepth}~@{text d} tells the pretty printer to
       
   229   limit the printing depth to @{text d}.  This affects the display of
       
   230   types, terms, theorems etc.  The default value is 0, which permits
       
   231   printing to an arbitrary depth.  Other useful values for @{text d}
       
   232   are 10 and 20.
       
   233 
       
   234   \item @{ML Pretty.setmargin}~@{text m} tells the pretty printer to
       
   235   assume a right margin (page width) of @{text m}.  The initial margin
       
   236   is 76, but user interfaces might adapt the margin automatically when
       
   237   resizing windows.
       
   238 
       
   239   \item @{ML print_depth}~@{text n} limits the printing depth of the
       
   240   ML toplevel pretty printer; the precise effect depends on the ML
       
   241   compiler and run-time system.  Typically @{text n} should be less
       
   242   than 10.  Bigger values such as 100--1000 are useful for debugging.
   220 
   243 
   221   \end{description}
   244   \end{description}
   222 *}
   245 *}
   223 
   246 
   224 
   247