doc-src/IsarRef/Thy/Inner_Syntax.thy
changeset 46284 6233d0b74d71
parent 46282 83864b045a72
child 46285 30953ef09bcd
equal deleted inserted replaced
46283:d90a650a5fb9 46284:6233d0b74d71
    30 *}
    30 *}
    31 
    31 
    32 
    32 
    33 section {* Printing logical entities *}
    33 section {* Printing logical entities *}
    34 
    34 
    35 subsection {* Diagnostic commands *}
    35 subsection {* Diagnostic commands \label{sec:print-diag} *}
    36 
    36 
    37 text {*
    37 text {*
    38   \begin{matharray}{rcl}
    38   \begin{matharray}{rcl}
    39     @{command_def "typ"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
    39     @{command_def "typ"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
    40     @{command_def "term"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
    40     @{command_def "term"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
   102 
   102 
   103   \end{description}
   103   \end{description}
   104 
   104 
   105   All of the diagnostic commands above admit a list of @{text modes}
   105   All of the diagnostic commands above admit a list of @{text modes}
   106   to be specified, which is appended to the current print mode; see
   106   to be specified, which is appended to the current print mode; see
   107   \secref{sec:print-modes}.  Thus the output behavior may be modified
   107   also \secref{sec:print-modes}.  Thus the output behavior may be
   108   according particular print mode features.  For example, @{command
   108   modified according particular print mode features.  For example,
   109   "pr"}~@{text "(latex xsymbols)"} would print the current proof state
   109   @{command "pr"}~@{text "(latex xsymbols)"} would print the current
   110   with mathematical symbols and special characters represented in
   110   proof state with mathematical symbols and special characters
   111   {\LaTeX} source, according to the Isabelle style
   111   represented in {\LaTeX} source, according to the Isabelle style
   112   \cite{isabelle-sys}.
   112   \cite{isabelle-sys}.
   113 
   113 
   114   Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more
   114   Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more
   115   systematic way to include formal items into the printed text
   115   systematic way to include formal items into the printed text
   116   document.
   116   document.
   230 
   230 
   231   \end{description}
   231   \end{description}
   232 *}
   232 *}
   233 
   233 
   234 
   234 
       
   235 subsection {* Alternative print modes \label{sec:print-modes} *}
       
   236 
       
   237 text {*
       
   238   \begin{mldecls}
       
   239     @{index_ML print_mode_value: "unit -> string list"} \\
       
   240     @{index_ML Print_Mode.with_modes: "string list -> ('a -> 'b) -> 'a -> 'b"} \\
       
   241   \end{mldecls}
       
   242 
       
   243   The \emph{print mode} facility allows to modify various operations
       
   244   for printing.  Commands like @{command typ}, @{command term},
       
   245   @{command thm} (see \secref{sec:print-diag}) take additional print
       
   246   modes as optional argument.  The underlying ML operations are as
       
   247   follows.
       
   248 
       
   249   \begin{description}
       
   250 
       
   251   \item @{ML "print_mode_value ()"} yields the list of currently
       
   252   active print mode names.  This should be understood as symbolic
       
   253   representation of certain individual features for printing (with
       
   254   precedence from left to right).
       
   255 
       
   256   \item @{ML Print_Mode.with_modes}~@{text "modes f x"} evaluates
       
   257   @{text "f x"} in an execution context where the print mode is
       
   258   prepended by the given @{text "modes"}.  This provides a thread-safe
       
   259   way to augment print modes.  It is also monotonic in the set of mode
       
   260   names: it retains the default print mode that certain
       
   261   user-interfaces might have installed for their proper functioning!
       
   262 
       
   263   \end{description}
       
   264 
       
   265   \begin{warn}
       
   266   The old global reference @{ML print_mode} should never be used
       
   267   directly in applications.  Its main reason for being publicly
       
   268   accessible is to support historic versions of Proof~General.
       
   269   \end{warn}
       
   270 
       
   271   \medskip The pretty printer for inner syntax maintains alternative
       
   272   mixfix productions for any print mode name invented by the user, say
       
   273   in commands like @{command notation} or @{command abbreviation}.
       
   274   Mode names can be arbitrary, but the following ones have a specific
       
   275   meaning by convention:
       
   276 
       
   277   \begin{itemize}
       
   278 
       
   279   \item @{verbatim "\"\""} (the empty string): default mode;
       
   280   implicitly active as last element in the list of modes.
       
   281 
       
   282   \item @{verbatim input}: dummy print mode that is never active; may
       
   283   be used to specify notation that is only available for input.
       
   284 
       
   285   \item @{verbatim internal} dummy print mode that is never active;
       
   286   used internally in Isabelle/Pure.
       
   287 
       
   288   \item @{verbatim xsymbols}: enable proper mathematical symbols
       
   289   instead of ASCII art.\footnote{This traditional mode name stems from
       
   290   the ``X-Symbol'' package for old versions Proof~General with XEmacs,
       
   291   although that package has been superseded by Unicode in recent
       
   292   years.}
       
   293 
       
   294   \item @{verbatim HTML}: additional mode that is active in HTML
       
   295   presentation of Isabelle theory sources; allows to provide
       
   296   alternative output notation.
       
   297 
       
   298   \item @{verbatim latex}: additional mode that is active in {\LaTeX}
       
   299   document preparation of Isabelle theory sources; allows to provide
       
   300   alternative output notation.
       
   301 
       
   302   \end{itemize}
       
   303 *}
       
   304 
       
   305 
   235 subsection {* Printing limits *}
   306 subsection {* Printing limits *}
   236 
   307 
   237 text {*
   308 text {*
   238   \begin{mldecls}
   309   \begin{mldecls}
   239     @{index_ML Pretty.margin_default: "int Unsynchronized.ref"} \\
   310     @{index_ML Pretty.margin_default: "int Unsynchronized.ref"} \\