doc-src/TutorialI/Documents/Documents.thy
changeset 12681 84188d1574ee
parent 12674 106d62d106fc
child 12683 99c662efd2fd
equal deleted inserted replaced
12680:1556a7637439 12681:84188d1574ee
   311   The Isar proof language \cite{Wenzel-PhD}, which is not covered in
   311   The Isar proof language \cite{Wenzel-PhD}, which is not covered in
   312   this book, admits to write formal proof texts that are acceptable
   312   this book, admits to write formal proof texts that are acceptable
   313   both to the machine and human readers at the same time.  Thus
   313   both to the machine and human readers at the same time.  Thus
   314   marginal comments and explanations may be kept at a minimum.  Even
   314   marginal comments and explanations may be kept at a minimum.  Even
   315   without proper coverage of human-readable proofs, Isabelle document
   315   without proper coverage of human-readable proofs, Isabelle document
   316   is very useful to produce formally derived texts.  Unstructured
   316   preparation is very useful to produce formally derived texts.
   317   proof scripts given here may be just ignored by readers, or
   317   Unstructured proof scripts given here may be just ignored by
   318   intentionally suppressed from the text by the writer (see also
   318   readers, or intentionally suppressed from the text by the writer
   319   \S\ref{sec:doc-prep-suppress}).
   319   (see also \S\ref{sec:doc-prep-suppress}).
   320 
   320 
   321   \medskip The Isabelle document preparation system essentially acts
   321   \medskip The Isabelle document preparation system essentially acts
   322   as a front-end to {\LaTeX}.  After checking specifications and
   322   as a front-end to {\LaTeX}.  After checking specifications and
   323   proofs formally, the theory sources are turned into typesetting
   323   proofs formally, the theory sources are turned into typesetting
   324   instructions in a schematic manner.  This enables users to write
   324   instructions in a schematic manner.  This enables users to write
   331 
   331 
   332 text {*
   332 text {*
   333   In contrast to the highly interactive mode of Isabelle/Isar theory
   333   In contrast to the highly interactive mode of Isabelle/Isar theory
   334   development, the document preparation stage essentially works in
   334   development, the document preparation stage essentially works in
   335   batch-mode.  An Isabelle \bfindex{session} consists of a collection
   335   batch-mode.  An Isabelle \bfindex{session} consists of a collection
   336   of theory source files that contribute to a single output document
   336   of theory source files that contribute to an output document
   337   eventually.  Each session is derived from a single parent one,
   337   eventually.  Each session is derived from a single parent, usually
   338   usually an object-logic image like \texttt{HOL}.  This results in an
   338   an object-logic image like \texttt{HOL}.  This results in an overall
   339   overall tree structure, which is reflected by the output location in
   339   tree structure, which is reflected by the output location in the
   340   the file system (usually rooted at \verb,~/isabelle/browser_info,).
   340   file system (usually rooted at \verb,~/isabelle/browser_info,).
   341 
   341 
   342   \medskip Here is the canonical arrangement of sources of a session
   342   \medskip Here is the canonical arrangement of sources of a session
   343   called \texttt{MySession}:
   343   called \texttt{MySession}:
   344 
   344 
   345   \begin{itemize}
   345   \begin{itemize}
   362   \texttt{session.tex} will contain {\LaTeX} commands to include all
   362   \texttt{session.tex} will contain {\LaTeX} commands to include all
   363   generated files in topologically sorted order, so
   363   generated files in topologically sorted order, so
   364   \verb,\input{session}, in \texttt{root.tex} does the job in most
   364   \verb,\input{session}, in \texttt{root.tex} does the job in most
   365   situations.
   365   situations.
   366 
   366 
   367   \item \texttt{IsaMakefile} outside of the directory
   367   \item \texttt{IsaMakefile} holds appropriate dependencies and
   368   \texttt{MySession} holds appropriate dependencies and invocations of
   368   invocations of Isabelle tools to control the batch job.  In fact,
   369   Isabelle tools to control the batch job.  In fact, several sessions
   369   several sessions may be controlled by the same \texttt{IsaMakefile}.
   370   may be controlled by the same \texttt{IsaMakefile}.  See also
   370   See also \cite{isabelle-sys} for further details, especially on
   371   \cite{isabelle-sys} for further details, especially on
       
   372   \texttt{isatool usedir} and \texttt{isatool make}.
   371   \texttt{isatool usedir} and \texttt{isatool make}.
   373 
   372 
   374   \end{itemize}
   373   \end{itemize}
   375 
   374 
   376   With everything put in its proper place, \texttt{isatool make}
   375   With everything put in its proper place, \texttt{isatool make}
   397   fall back on DVI output by changing \texttt{usedir} options in
   396   fall back on DVI output by changing \texttt{usedir} options in
   398   \texttt{IsaMakefile} \cite{isabelle-sys}.}
   397   \texttt{IsaMakefile} \cite{isabelle-sys}.}
   399 
   398 
   400   \medskip One may now start to populate the directory
   399   \medskip One may now start to populate the directory
   401   \texttt{MySession}, and the file \texttt{MySession/ROOT.ML}
   400   \texttt{MySession}, and the file \texttt{MySession/ROOT.ML}
   402   accordingly.  \texttt{MySession/document/root.tex} should be also
   401   accordingly.  \texttt{MySession/document/root.tex} should also be
   403   adapted at some point; the default version is mostly
   402   adapted at some point; the default version is mostly
   404   self-explanatory.  Note that \verb,\isabellestyle, enables
   403   self-explanatory.  Note that \verb,\isabellestyle, enables
   405   fine-tuning of the general appearance of characters and mathematical
   404   fine-tuning of the general appearance of characters and mathematical
   406   symbols (see also \S\ref{sec:doc-prep-symbols}).
   405   symbols (see also \S\ref{sec:doc-prep-symbols}).
   407 
   406 
   431 
   430 
   432 text {*
   431 text {*
   433   The large-scale structure of Isabelle documents follows existing
   432   The large-scale structure of Isabelle documents follows existing
   434   {\LaTeX} conventions, with chapters, sections, subsubsections etc.
   433   {\LaTeX} conventions, with chapters, sections, subsubsections etc.
   435   The Isar language includes separate \bfindex{markup commands}, which
   434   The Isar language includes separate \bfindex{markup commands}, which
   436   do not effect the formal content of a theory (or proof), but result
   435   do not affect the formal meaning of a theory (or proof), but result
   437   in corresponding {\LaTeX} elements.
   436   in corresponding {\LaTeX} elements.
   438 
   437 
   439   There are separate markup commands depending on the textual context:
   438   There are separate markup commands depending on the textual context:
   440   in header position (just before \isakeyword{theory}), within the
   439   in header position (just before \isakeyword{theory}), within the
   441   theory body, or within a proof.  The header needs to be treated
   440   theory body, or within a proof.  The header needs to be treated
   527   \verb,(,\verb,*,~\dots~\verb,*,\verb,),, essentially act like white
   526   \verb,(,\verb,*,~\dots~\verb,*,\verb,),, essentially act like white
   528   space and do not really contribute to the content.  They mainly
   527   space and do not really contribute to the content.  They mainly
   529   serve technical purposes to mark certain oddities in the raw input
   528   serve technical purposes to mark certain oddities in the raw input
   530   text.  In contrast, \bfindex{formal comments} are portions of text
   529   text.  In contrast, \bfindex{formal comments} are portions of text
   531   that are associated with formal Isabelle/Isar commands
   530   that are associated with formal Isabelle/Isar commands
   532   (\bfindex{marginal comments}), or as stanalone paragraphs within a
   531   (\bfindex{marginal comments}), or as standalone paragraphs within a
   533   theory or proof context (\bfindex{text blocks}).
   532   theory or proof context (\bfindex{text blocks}).
   534 
   533 
   535   \medskip Marginal comments are part of each command's concrete
   534   \medskip Marginal comments are part of each command's concrete
   536   syntax \cite{isabelle-ref}; the common form is ``\verb,--,~$text$''
   535   syntax \cite{isabelle-ref}; the common form is ``\verb,--,~$text$''
   537   where $text$ is delimited by \verb,",\dots\verb,", or
   536   where $text$ is delimited by \verb,",\dots\verb,", or
   648   For example, \texttt{\at}\verb,{text "\<forall>\<exists>"}, produces @{text
   647   For example, \texttt{\at}\verb,{text "\<forall>\<exists>"}, produces @{text
   649   "\<forall>\<exists>"}, according to the standard interpretation of these symbol
   648   "\<forall>\<exists>"}, according to the standard interpretation of these symbol
   650   (cf.\ \S\ref{sec:doc-prep-symbols}).  Thus we achieve consistent
   649   (cf.\ \S\ref{sec:doc-prep-symbols}).  Thus we achieve consistent
   651   mathematical notation in both the formal and informal parts of the
   650   mathematical notation in both the formal and informal parts of the
   652   document very easily.  Manual {\LaTeX} code would leave more control
   651   document very easily.  Manual {\LaTeX} code would leave more control
   653   over the type-setting, but is also slightly more tedious.
   652   over the typesetting, but is also slightly more tedious.
   654 *}
   653 *}
   655 
   654 
   656 
   655 
   657 subsection {* Interpretation of Symbols \label{sec:doc-prep-symbols} *}
   656 subsection {* Interpretation of Symbols \label{sec:doc-prep-symbols} *}
   658 
   657 
   659 text {*
   658 text {*
   660   As has been pointed out before (\S\ref{sec:syntax-symbols}),
   659   As has been pointed out before (\S\ref{sec:syntax-symbols}),
   661   Isabelle symbols are the smallest syntactic entities --- a
   660   Isabelle symbols are the smallest syntactic entities --- a
   662   straight-forward generalization of ASCII characters.  While Isabelle
   661   straightforward generalization of ASCII characters.  While Isabelle
   663   does not impose any interpretation of the infinite collection of
   662   does not impose any interpretation of the infinite collection of
   664   named symbols, {\LaTeX} documents show canonical glyphs for certain
   663   named symbols, {\LaTeX} documents show canonical glyphs for certain
   665   standard symbols \cite[appendix~A]{isabelle-sys}.
   664   standard symbols \cite[appendix~A]{isabelle-sys}.
   666 
   665 
   667   The {\LaTeX} code produced from Isabelle text follows a relatively
   666   The {\LaTeX} code produced from Isabelle text follows a relatively
   694   \medskip The \verb,\isabellestyle, macro provides a high-level
   693   \medskip The \verb,\isabellestyle, macro provides a high-level
   695   interface to tune the general appearance of individual symbols.  For
   694   interface to tune the general appearance of individual symbols.  For
   696   example, \verb,\isabellestyle{it}, uses the italics text style to
   695   example, \verb,\isabellestyle{it}, uses the italics text style to
   697   mimic the general appearance of the {\LaTeX} math mode; double
   696   mimic the general appearance of the {\LaTeX} math mode; double
   698   quotes are not printed at all.  The resulting quality of
   697   quotes are not printed at all.  The resulting quality of
   699   type-setting is quite good, so this should usually be the default
   698   typesetting is quite good, so this should usually be the default
   700   style for real production work that gets distributed to a broader
   699   style for real production work that gets distributed to a broader
   701   audience.
   700   audience.
   702 *}
   701 *}
   703 
   702 
   704 
   703 
   724 
   723 
   725 \begin{verbatim}
   724 \begin{verbatim}
   726   no_document use_thy "T";
   725   no_document use_thy "T";
   727 \end{verbatim}
   726 \end{verbatim}
   728 
   727 
   729   \medskip Theory output may be also suppressed in smaller portions.
   728   \medskip Theory output may also be suppressed in smaller portions.
   730   For example, research articles, or slides usually do not include the
   729   For example, research articles, or slides usually do not include the
   731   formal content in full.  In order to delimit \bfindex{ignored
   730   formal content in full.  In order to delimit \bfindex{ignored
   732   material} special source comments
   731   material} special source comments
   733   \verb,(,\verb,*,\verb,<,\verb,*,\verb,), and
   732   \verb,(,\verb,*,\verb,<,\verb,*,\verb,), and
   734   \verb,(,\verb,*,\verb,>,\verb,*,\verb,), may be included in the
   733   \verb,(,\verb,*,\verb,>,\verb,*,\verb,), may be included in the
   750   \verb,(,\verb,*,\verb,>,\verb,*,\verb,), \\
   749   \verb,(,\verb,*,\verb,>,\verb,*,\verb,), \\
   751   \end{tabular}
   750   \end{tabular}
   752 
   751 
   753   \medskip
   752   \medskip
   754 
   753 
   755   Text may be suppressed in a fine grained manner.  We may even drop
   754   Text may be suppressed in a fine-grained manner.  We may even drop
   756   vital parts of a formal proof, pretending that things have been
   755   vital parts of a formal proof, pretending that things have been
   757   simpler than in reality.  For example, the following ``fully
   756   simpler than in reality.  For example, the following ``fully
   758   automatic'' proof is actually a fake:
   757   automatic'' proof is actually a fake:
   759 *}
   758 *}
   760 
   759 
   767 \begin{verbatim}
   766 \begin{verbatim}
   768   by (auto(*<*)simp add: int_less_le(*>*))
   767   by (auto(*<*)simp add: int_less_le(*>*))
   769 \end{verbatim}
   768 \end{verbatim}
   770 %(*
   769 %(*
   771 
   770 
   772   \medskip Ignoring portions of printed does demand some care by the
   771   \medskip Ignoring portions of printed text does demand some care by
   773   writer.  First of all, the writer is responsible not to obfuscate
   772   the writer.  First of all, the writer is responsible not to
   774   the underlying formal development in an unduly manner.  It is fairly
   773   obfuscate the underlying formal development in an unduly manner.  It
   775   easy to invalidate the remaining visible text, e.g.\ by referencing
   774   is fairly easy to invalidate the remaining visible text, e.g.\ by
   776   questionable formal items (strange definitions, arbitrary axioms
   775   referencing questionable formal items (strange definitions,
   777   etc.) that have been hidden from sight beforehand.
   776   arbitrary axioms etc.) that have been hidden from sight beforehand.
   778 
   777 
   779   Authentic reports of formal theories, say as part of a library,
   778   Authentic reports of formal theories, say as part of a library,
   780   usually should refrain from suppressing parts of the text at all.
   779   usually should refrain from suppressing parts of the text at all.
   781   Other users may need the full information for their own derivative
   780   Other users may need the full information for their own derivative
   782   work.  If a particular formalization appears inadequate for general
   781   work.  If a particular formalization appears inadequate for general