doc-src/IsarImplementation/Thy/document/prelim.tex
changeset 20450 725a91601ed1
parent 20449 f8a7a8236c68
child 20451 27ea2ba48fa3
equal deleted inserted replaced
20449:f8a7a8236c68 20450:725a91601ed1
   117   The \isa{checkpoint} operation produces an intermediate stepping
   117   The \isa{checkpoint} operation produces an intermediate stepping
   118   stone that will survive the next update unscathed: both the original
   118   stone that will survive the next update unscathed: both the original
   119   and the changed theory remain valid and are related by the
   119   and the changed theory remain valid and are related by the
   120   sub-theory relation.  Checkpointing essentially recovers purely
   120   sub-theory relation.  Checkpointing essentially recovers purely
   121   functional theory values, at the expense of some extra internal
   121   functional theory values, at the expense of some extra internal
   122   bookeeping.
   122   bookkeeping.
   123 
   123 
   124   The \isa{copy} operation produces an auxiliary version that has
   124   The \isa{copy} operation produces an auxiliary version that has
   125   the same data content, but is unrelated to the original: updates of
   125   the same data content, but is unrelated to the original: updates of
   126   the copy do not affect the original, neither does the sub-theory
   126   the copy do not affect the original, neither does the sub-theory
   127   relation hold.
   127   relation hold.
   129   \medskip The example in \figref{fig:ex-theory} below shows a theory
   129   \medskip The example in \figref{fig:ex-theory} below shows a theory
   130   graph derived from \isa{Pure}. Theory \isa{Length} imports
   130   graph derived from \isa{Pure}. Theory \isa{Length} imports
   131   \isa{Nat} and \isa{List}.  The theory body consists of a
   131   \isa{Nat} and \isa{List}.  The theory body consists of a
   132   sequence of updates, working mostly on drafts.  Intermediate
   132   sequence of updates, working mostly on drafts.  Intermediate
   133   checkpoints may occur as well, due to the history mechanism provided
   133   checkpoints may occur as well, due to the history mechanism provided
   134   by the Isar toplevel, cf.\ \secref{sec:isar-toplevel}.
   134   by the Isar top-level, cf.\ \secref{sec:isar-toplevel}.
   135 
   135 
   136   \begin{figure}[htb]
   136   \begin{figure}[htb]
   137   \begin{center}
   137   \begin{center}
   138   \begin{tabular}{rcccl}
   138   \begin{tabular}{rcccl}
   139         &            & \isa{Pure} \\
   139         &            & \isa{Pure} \\
   300 \isamarkuptrue%
   300 \isamarkuptrue%
   301 %
   301 %
   302 \begin{isamarkuptext}%
   302 \begin{isamarkuptext}%
   303 A generic context is the disjoint sum of either a theory or proof
   303 A generic context is the disjoint sum of either a theory or proof
   304   context.  Occasionally, this simplifies uniform treatment of generic
   304   context.  Occasionally, this simplifies uniform treatment of generic
   305   context data, typically extralogical information.  Operations on
   305   context data, typically extra-logical information.  Operations on
   306   generic contexts include the usual injections, partial selections,
   306   generic contexts include the usual injections, partial selections,
   307   and combinators for lifting operations on either component of the
   307   and combinators for lifting operations on either component of the
   308   disjoint sum.
   308   disjoint sum.
   309 
   309 
   310   Moreover, there are total operations \isa{theory{\isacharunderscore}of} and \isa{proof{\isacharunderscore}of} to convert a generic context into either kind: a theory
   310   Moreover, there are total operations \isa{theory{\isacharunderscore}of} and \isa{proof{\isacharunderscore}of} to convert a generic context into either kind: a theory
   362   \paragraph{Theory data} may refer to destructive entities, which are
   362   \paragraph{Theory data} may refer to destructive entities, which are
   363   maintained in correspondence to the linear evolution of theory
   363   maintained in correspondence to the linear evolution of theory
   364   values, or explicit copies.\footnote{Most existing instances of
   364   values, or explicit copies.\footnote{Most existing instances of
   365   destructive theory data are merely historical relics (e.g.\ the
   365   destructive theory data are merely historical relics (e.g.\ the
   366   destructive theorem storage, and destructive hints for the
   366   destructive theorem storage, and destructive hints for the
   367   Simplifier and Classical rules).}  A theory data declaration needs to
   367   Simplifier and Classical rules).}  A theory data declaration needs
   368   provide the following information:
   368   to implement the following specification:
   369 
   369 
   370   \medskip
   370   \medskip
   371   \begin{tabular}{ll}
   371   \begin{tabular}{ll}
   372   \isa{name{\isacharcolon}\ string} \\
   372   \isa{name{\isacharcolon}\ string} \\
   373   \isa{T} & the ML type \\
   373   \isa{T} & the ML type \\
   383   messages; \isa{copy} is just the identity for pure data; \isa{extend} is acts like a unitary version of \isa{merge}, both
   383   messages; \isa{copy} is just the identity for pure data; \isa{extend} is acts like a unitary version of \isa{merge}, both
   384   should also include the functionality of \isa{copy} for impure
   384   should also include the functionality of \isa{copy} for impure
   385   data.
   385   data.
   386 
   386 
   387   \paragraph{Proof context data} is purely functional.  It is declared
   387   \paragraph{Proof context data} is purely functional.  It is declared
   388   by providing the following information:
   388   by implementing the following specification:
   389 
   389 
   390   \medskip
   390   \medskip
   391   \begin{tabular}{ll}
   391   \begin{tabular}{ll}
   392   \isa{name{\isacharcolon}\ string} \\
   392   \isa{name{\isacharcolon}\ string} \\
   393   \isa{T} & the ML type \\
   393   \isa{T} & the ML type \\
   427   component may maintain abstract values authentically, without other
   427   component may maintain abstract values authentically, without other
   428   components interfering.%
   428   components interfering.%
   429 \end{isamarkuptext}%
   429 \end{isamarkuptext}%
   430 \isamarkuptrue%
   430 \isamarkuptrue%
   431 %
   431 %
       
   432 \isadelimmlref
       
   433 %
       
   434 \endisadelimmlref
       
   435 %
       
   436 \isatagmlref
       
   437 %
       
   438 \begin{isamarkuptext}%
       
   439 \begin{mldecls}
       
   440   \indexmlfunctor{TheoryDataFun}\verb|functor TheoryDataFun| \\
       
   441   \indexmlfunctor{ProofDataFun}\verb|functor ProofDataFun| \\
       
   442   \indexmlfunctor{GenericDataFun}\verb|functor GenericDataFun| \\
       
   443   \end{mldecls}
       
   444 
       
   445   \begin{description}
       
   446 
       
   447   \item \verb|TheoryDataFun|\isa{{\isacharparenleft}spec{\isacharparenright}} declares data for
       
   448   type \verb|theory| according to the specification provided as
       
   449   argument structure.  The result structure provides init and access
       
   450   operations as described above.
       
   451 
       
   452   \item \verb|ProofDataFun|\isa{{\isacharparenleft}spec{\isacharparenright}} is analogous for
       
   453   type \verb|Proof.context|.
       
   454 
       
   455   \item \verb|GenericDataFun|\isa{{\isacharparenleft}spec{\isacharparenright}} is analogous for
       
   456   type \verb|Context.generic|.
       
   457 
       
   458   \end{description}%
       
   459 \end{isamarkuptext}%
       
   460 \isamarkuptrue%
       
   461 %
       
   462 \endisatagmlref
       
   463 {\isafoldmlref}%
       
   464 %
       
   465 \isadelimmlref
       
   466 %
       
   467 \endisadelimmlref
       
   468 %
   432 \isamarkupsection{Named entities%
   469 \isamarkupsection{Named entities%
   433 }
   470 }
   434 \isamarkuptrue%
   471 \isamarkuptrue%
   435 %
   472 %
   436 \begin{isamarkuptext}%
   473 \begin{isamarkuptext}%
   458 }
   495 }
   459 \isamarkuptrue%
   496 \isamarkuptrue%
   460 %
   497 %
   461 \begin{isamarkuptext}%
   498 \begin{isamarkuptext}%
   462 Isabelle strings consist of a sequence of
   499 Isabelle strings consist of a sequence of
   463 symbols\glossary{Symbol}{The smalles unit of text in Isabelle,
   500 symbols\glossary{Symbol}{The smallest unit of text in Isabelle,
   464 subsumes plain ASCII characters as well as an infinite collection of
   501 subsumes plain ASCII characters as well as an infinite collection of
   465 named symbols (for greek, math etc.).}, which are either packed as an
   502 named symbols (for greek, math etc.).}, which are either packed as an
   466 actual \isa{string}, or represented as a list.  Each symbol is in
   503 actual \isa{string}, or represented as a list.  Each symbol is in
   467 itself a small string of the following form:
   504 itself a small string of the following form:
   468 
   505 
   559 %
   596 %
   560 \isamarkupsubsection{Qualified names and name spaces%
   597 \isamarkupsubsection{Qualified names and name spaces%
   561 }
   598 }
   562 \isamarkuptrue%
   599 \isamarkuptrue%
   563 %
   600 %
   564 \isadelimFIXME
   601 \begin{isamarkuptext}%
   565 %
   602 FIXME
   566 \endisadelimFIXME
   603 
   567 %
   604   Qualified names are constructed according to implicit naming
   568 \isatagFIXME
   605   principles of the present context.
   569 %
   606 
   570 \begin{isamarkuptext}%
   607 
   571 Qualified names are constructed according to implicit naming
   608   The last component is called \emph{base name}; the remaining prefix
   572 principles of the present context.
   609   of qualification may be empty.
   573 
   610 
   574 
   611   Some practical conventions help to organize named entities more
   575 The last component is called \emph{base name}; the remaining prefix of
   612   systematically:
   576 qualification may be empty.
   613 
   577 
   614   \begin{itemize}
   578 Some practical conventions help to organize named entities more
   615 
   579 systematically:
   616   \item Names are qualified first by the theory name, second by an
   580 
   617   optional ``structure''.  For example, a constant \isa{c}
   581 \begin{itemize}
   618   declared as part of a certain structure \isa{b} (say a type
   582 
   619   definition) in theory \isa{A} will be named \isa{A{\isachardot}b{\isachardot}c}
   583 \item Names are qualified first by the theory name, second by an
   620   internally.
   584 optional ``structure''.  For example, a constant \isa{c} declared
   621 
   585 as part of a certain structure \isa{b} (say a type definition) in
   622   \item
   586 theory \isa{A} will be named \isa{A{\isachardot}b{\isachardot}c} internally.
   623 
   587 
   624   \item
   588 \item
   625 
   589 
   626   \item
   590 \item
   627 
   591 
   628   \item
   592 \item
   629 
   593 
   630   \end{itemize}
   594 \item
   631 
   595 
   632   Names of different kinds of entities are basically independent, but
   596 \end{itemize}
   633   some practical naming conventions relate them to each other.  For
   597 
   634   example, a constant \isa{foo} may be accompanied with theorems
   598 Names of different kinds of entities are basically independent, but
   635   \isa{foo{\isachardot}intro}, \isa{foo{\isachardot}elim}, \isa{foo{\isachardot}simps} etc.
   599 some practical naming conventions relate them to each other.  For
   636   The same may happen for a type \isa{foo}, which is then apt to
   600 example, a constant \isa{foo} may be accompanied with theorems
   637   cause clashes in the theorem name space!  To avoid this, we
   601 \isa{foo{\isachardot}intro}, \isa{foo{\isachardot}elim}, \isa{foo{\isachardot}simps} etc.  The
   638   occasionally follow an additional convention of suffixes that
   602 same may happen for a type \isa{foo}, which is then apt to cause
   639   determine the original kind of entity that a name has been derived.
   603 clashes in the theorem name space!  To avoid this, we occasionally
   640   For example, constant \isa{foo} is associated with theorem
   604 follow an additional convention of suffixes that determine the
   641   \isa{foo{\isachardot}intro}, type \isa{foo} with theorem \isa{foo{\isacharunderscore}type{\isachardot}intro}, and type class \isa{foo} with \isa{foo{\isacharunderscore}class{\isachardot}intro}.%
   605 original kind of entity that a name has been derived.  For example,
   642 \end{isamarkuptext}%
   606 constant \isa{foo} is associated with theorem \isa{foo{\isachardot}intro},
   643 \isamarkuptrue%
   607 type \isa{foo} with theorem \isa{foo{\isacharunderscore}type{\isachardot}intro}, and type
       
   608 class \isa{foo} with \isa{foo{\isacharunderscore}class{\isachardot}intro}.%
       
   609 \end{isamarkuptext}%
       
   610 \isamarkuptrue%
       
   611 %
       
   612 \endisatagFIXME
       
   613 {\isafoldFIXME}%
       
   614 %
       
   615 \isadelimFIXME
       
   616 %
       
   617 \endisadelimFIXME
       
   618 %
   644 %
   619 \isamarkupsection{Structured output%
   645 \isamarkupsection{Structured output%
   620 }
   646 }
   621 \isamarkuptrue%
   647 \isamarkuptrue%
   622 %
   648 %