doc-src/IsarImplementation/Thy/document/prelim.tex
author wenzelm
Wed, 30 Aug 2006 12:28:39 +0200
changeset 20438 9060c73a4578
parent 20430 fd646e926983
child 20447 5b75f1c4d7d6
permissions -rw-r--r--
updated;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     1
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{prelim}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     4
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     5
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     6
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     7
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     8
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     9
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    10
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    11
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    12
\isatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    13
\isacommand{theory}\isamarkupfalse%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    14
\ prelim\ \isakeyword{imports}\ base\ \isakeyword{begin}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    15
\endisatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    16
{\isafoldtheory}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    17
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    18
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    19
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    20
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    21
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    22
\isamarkupchapter{Preliminaries%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    23
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    24
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    25
%
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    26
\isamarkupsection{Contexts \label{sec:context}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    27
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    28
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    29
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    30
\begin{isamarkuptext}%
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    31
A logical context represents the background that is taken for
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    32
  granted when formulating statements and composing proofs.  It acts
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    33
  as a medium to produce formal content, depending on earlier material
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    34
  (declarations, results etc.).
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    35
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    36
  In particular, derivations within the primitive Pure logic can be
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    37
  described as a judgment \isa{{\isasymGamma}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\ {\isasymphi}}, meaning that a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    38
  proposition \isa{{\isasymphi}} is derivable from hypotheses \isa{{\isasymGamma}}
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    39
  within the theory \isa{{\isasymTheta}}.  There are logical reasons for
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    40
  keeping \isa{{\isasymTheta}} and \isa{{\isasymGamma}} separate: theories support type
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    41
  constructors and schematic polymorphism of constants and axioms,
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    42
  while the inner calculus of \isa{{\isasymGamma}\ {\isasymturnstile}\ {\isasymphi}} is limited to Simple
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    43
  Type Theory (with fixed type variables in the assumptions).
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    44
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    45
  \medskip Contexts and derivations are linked by the following key
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    46
  principles:
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    47
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    48
  \begin{itemize}
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    49
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    50
  \item Transfer: monotonicity of derivations admits results to be
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    51
  transferred into a larger context, i.e.\ \isa{{\isasymGamma}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\ {\isasymphi}}
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    52
  implies \isa{{\isasymGamma}{\isacharprime}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\isactrlsub {\isacharprime}\ {\isasymphi}} for contexts \isa{{\isasymTheta}{\isacharprime}\ {\isasymsupseteq}\ {\isasymTheta}} and \isa{{\isasymGamma}{\isacharprime}\ {\isasymsupseteq}\ {\isasymGamma}}.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    53
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    54
  \item Export: discharge of hypotheses admits results to be exported
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    55
  into a smaller context, i.e.\ \isa{{\isasymGamma}{\isacharprime}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\ {\isasymphi}} implies
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    56
  \isa{{\isasymGamma}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\ {\isasymDelta}\ {\isasymLongrightarrow}\ {\isasymphi}} where \isa{{\isasymGamma}{\isacharprime}\ {\isasymsupseteq}\ {\isasymGamma}} and \isa{{\isasymDelta}\ {\isacharequal}\ {\isasymGamma}{\isacharprime}\ {\isacharminus}\ {\isasymGamma}}.  Note that \isa{{\isasymTheta}} remains unchanged here, only the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    57
  \isa{{\isasymGamma}} part is affected.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    58
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    59
  \end{itemize}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    60
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    61
  \medskip Isabelle/Isar provides two different notions of abstract
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    62
  containers called \emph{theory context} and \emph{proof context},
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    63
  respectively.  These model the main characteristics of the primitive
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    64
  \isa{{\isasymTheta}} and \isa{{\isasymGamma}} above, without subscribing to any
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    65
  particular kind of content yet.  Instead, contexts merely impose a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    66
  certain policy of managing arbitrary \emph{context data}.  The
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    67
  system provides strongly typed mechanisms to declare new kinds of
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    68
  data at compile time.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    69
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    70
  Thus the internal bootstrap process of Isabelle/Pure eventually
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    71
  reaches a stage where certain data slots provide the logical content
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    72
  of \isa{{\isasymTheta}} and \isa{{\isasymGamma}} sketched above, but this does not
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    73
  stop there!  Various additional data slots support all kinds of
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    74
  mechanisms that are not necessarily part of the core logic.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    75
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    76
  For example, there would be data for canonical introduction and
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    77
  elimination rules for arbitrary operators (depending on the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    78
  object-logic and application), which enables users to perform
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    79
  standard proof steps implicitly (cf.\ the \isa{rule} method).
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    80
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    81
  Isabelle is able to bring forth more and more concepts successively.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    82
  In particular, an object-logic like Isabelle/HOL continues the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    83
  Isabelle/Pure setup by adding specific components for automated
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    84
  reasoning (classical reasoner, tableau prover, structured induction
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    85
  etc.) and derived specification mechanisms (inductive predicates,
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    86
  recursive functions etc.).  All of this is based on the generic data
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    87
  management by theory and proof contexts.%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    88
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    89
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    90
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    91
\isamarkupsubsection{Theory context \label{sec:context-theory}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    92
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    93
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    94
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    95
\begin{isamarkuptext}%
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    96
Each theory is explicitly named and holds a unique identifier.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    97
  There is a separate \emph{theory reference} for pointing backwards
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    98
  to the enclosing theory context of derived entities.  Theories are
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
    99
  related by a (nominal) sub-theory relation, which corresponds to the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   100
  canonical dependency graph: each theory is derived from a certain
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   101
  sub-graph of ancestor theories.  The \isa{merge} of two theories
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   102
  refers to the least upper bound, which actually degenerates into
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   103
  absorption of one theory into the other, due to the nominal
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   104
  sub-theory relation this.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   105
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   106
  The \isa{begin} operation starts a new theory by importing
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   107
  several parent theories and entering a special \isa{draft} mode,
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   108
  which is sustained until the final \isa{end} operation.  A draft
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   109
  mode theory acts like a linear type, where updates invalidate
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   110
  earlier drafts, but theory reference values will be propagated
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   111
  automatically.  Thus derived entities that ``belong'' to a draft
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   112
  might be transferred spontaneously to a larger context.  An
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   113
  invalidated draft is called ``stale''.  The \isa{copy} operation
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   114
  produces an auxiliary version with the same data content, but is
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   115
  unrelated to the original: updates of the copy do not affect the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   116
  original, neither does the sub-theory relation hold.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   117
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   118
  The example below shows a theory graph derived from \isa{Pure}.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   119
  Theory \isa{Length} imports \isa{Nat} and \isa{List}.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   120
  The linear draft mode is enabled during the ``\isa{{\isasymdots}}'' stage of
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   121
  the theory body.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   122
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   123
  \bigskip
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   124
  \begin{tabular}{rcccl}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   125
        &            & $Pure$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   126
        &            & $\downarrow$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   127
        &            & $FOL$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   128
        & $\swarrow$ &              & $\searrow$ & \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   129
  $Nat$ &            &              &            & $List$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   130
        & $\searrow$ &              & $\swarrow$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   131
        &            & $Length$ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   132
        &            & \multicolumn{3}{l}{~~$\isarkeyword{imports}$} \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   133
        &            & \multicolumn{3}{l}{~~$\isarkeyword{begin}$} \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   134
        &            & $\vdots$~~ \\
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   135
        &            & \multicolumn{3}{l}{~~$\isarkeyword{end}$} \\
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   136
  \end{tabular}
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   137
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   138
  \medskip In practice, derived theory operations mostly operate
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   139
  drafts, namely the body of the current portion of theory that the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   140
  user happens to be composing.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   141
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   142
 \medskip There is also a builtin theory history mechanism that amends for
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   143
  the destructive behaviour of theory drafts.  The \isa{checkpoint} operation produces an intermediate stepping stone that
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   144
  survives the next update unscathed: both the original and the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   145
  changed theory remain valid and are related by the sub-theory
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   146
  relation.  This recovering of pure theory values comes at the cost
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   147
  of extra internal bookeeping.  The cumulative effect of
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   148
  checkpointing is purged by the \isa{finish} operation.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   149
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   150
  History operations are usually managed by the system, e.g.\ notably
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   151
  in the Isar transaction loop.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   152
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   153
  \medskip
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   154
  FIXME theory data%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   155
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   156
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   157
%
20430
wenzelm
parents: 20429
diff changeset
   158
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   159
%
wenzelm
parents: 20429
diff changeset
   160
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   161
%
wenzelm
parents: 20429
diff changeset
   162
\isatagmlref
wenzelm
parents: 20429
diff changeset
   163
%
wenzelm
parents: 20429
diff changeset
   164
\begin{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   165
%
wenzelm
parents: 20429
diff changeset
   166
\end{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   167
\isamarkuptrue%
wenzelm
parents: 20429
diff changeset
   168
%
wenzelm
parents: 20429
diff changeset
   169
\endisatagmlref
wenzelm
parents: 20429
diff changeset
   170
{\isafoldmlref}%
wenzelm
parents: 20429
diff changeset
   171
%
wenzelm
parents: 20429
diff changeset
   172
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   173
%
wenzelm
parents: 20429
diff changeset
   174
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   175
%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   176
\isamarkupsubsection{Proof context \label{sec:context-proof}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   177
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   178
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   179
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   180
\begin{isamarkuptext}%
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   181
A proof context is an arbitrary container that is initialized from a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   182
  given theory.  The result contains a back-reference to the theory it
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   183
  belongs to, together with pure data.  No further bookkeeping is
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   184
  required here, thanks to the lack of destructive features.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   185
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   186
  There is no restriction on producing proof contexts, although the
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   187
  usual discipline is to follow block structure as a mental model: a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   188
  given context is extended consecutively, results are exported back
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   189
  into the original context.  In particular, the concept of Isar proof
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   190
  state models block-structured reasoning explicitly, using a stack of
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   191
  proof contexts.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   192
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   193
  Due to the lack of identification and back-referencing, entities
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   194
  derived in a proof context need to record inherent logical
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   195
  requirements explicitly.  For example, hypotheses used in a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   196
  derivation will be recorded separately within the sequent \isa{{\isasymGamma}\ {\isasymturnstile}\ {\isasymphi}}, just to make double sure.  Results could leak into an alien
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   197
  proof context do to programming errors, but Isabelle/Isar
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   198
  occasionally includes extra validity checks at the end of a
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   199
  sub-proof.
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   200
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   201
  \medskip
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   202
  FIXME proof data
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   203
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   204
\glossary{Proof context}{The static context of a structured proof,
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   205
acts like a local ``theory'' of the current portion of Isar proof
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   206
text, generalizes the idea of local hypotheses \isa{{\isasymGamma}} in
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   207
judgments \isa{{\isasymGamma}\ {\isasymturnstile}\ {\isasymphi}} of natural deduction calculi.  There is a
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   208
generic notion of introducing and discharging hypotheses.  Arbritrary
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   209
auxiliary context data may be adjoined.}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   210
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   211
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   212
%
20430
wenzelm
parents: 20429
diff changeset
   213
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   214
%
wenzelm
parents: 20429
diff changeset
   215
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   216
%
wenzelm
parents: 20429
diff changeset
   217
\isatagmlref
wenzelm
parents: 20429
diff changeset
   218
%
wenzelm
parents: 20429
diff changeset
   219
\begin{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   220
FIXME%
wenzelm
parents: 20429
diff changeset
   221
\end{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   222
\isamarkuptrue%
wenzelm
parents: 20429
diff changeset
   223
%
wenzelm
parents: 20429
diff changeset
   224
\endisatagmlref
wenzelm
parents: 20429
diff changeset
   225
{\isafoldmlref}%
wenzelm
parents: 20429
diff changeset
   226
%
wenzelm
parents: 20429
diff changeset
   227
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   228
%
wenzelm
parents: 20429
diff changeset
   229
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   230
%
20429
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   231
\isamarkupsubsection{Generic contexts%
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   232
}
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   233
\isamarkuptrue%
116255c9209b more on contexts;
wenzelm
parents: 20215
diff changeset
   234
%
20430
wenzelm
parents: 20429
diff changeset
   235
\begin{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   236
FIXME%
wenzelm
parents: 20429
diff changeset
   237
\end{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   238
\isamarkuptrue%
wenzelm
parents: 20429
diff changeset
   239
%
wenzelm
parents: 20429
diff changeset
   240
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   241
%
wenzelm
parents: 20429
diff changeset
   242
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   243
%
wenzelm
parents: 20429
diff changeset
   244
\isatagmlref
wenzelm
parents: 20429
diff changeset
   245
%
wenzelm
parents: 20429
diff changeset
   246
\begin{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   247
FIXME%
wenzelm
parents: 20429
diff changeset
   248
\end{isamarkuptext}%
wenzelm
parents: 20429
diff changeset
   249
\isamarkuptrue%
wenzelm
parents: 20429
diff changeset
   250
%
wenzelm
parents: 20429
diff changeset
   251
\endisatagmlref
wenzelm
parents: 20429
diff changeset
   252
{\isafoldmlref}%
wenzelm
parents: 20429
diff changeset
   253
%
wenzelm
parents: 20429
diff changeset
   254
\isadelimmlref
wenzelm
parents: 20429
diff changeset
   255
%
wenzelm
parents: 20429
diff changeset
   256
\endisadelimmlref
wenzelm
parents: 20429
diff changeset
   257
%
20438
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   258
\isamarkupsection{Named entities%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   259
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   260
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   261
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   262
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   263
Named entities of different kinds (logical constant, type,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   264
type class, theorem, method etc.) live in separate name spaces.  It is
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   265
usually clear from the occurrence of a name which kind of entity it
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   266
refers to.  For example, proof method \isa{foo} vs.\ theorem
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   267
\isa{foo} vs.\ logical constant \isa{foo} are easily
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   268
distinguished by means of the syntactic context.  A notable exception
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   269
are logical identifiers within a term (\secref{sec:terms}): constants,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   270
fixed variables, and bound variables all share the same identifier
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   271
syntax, but are distinguished by their scope.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   272
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   273
Each name space is organized as a collection of \emph{qualified
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   274
names}, which consist of a sequence of basic name components separated
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   275
by dots: \isa{Bar{\isachardot}bar{\isachardot}foo}, \isa{Bar{\isachardot}foo}, and \isa{foo}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   276
are examples for valid qualified names.  Name components are
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   277
subdivided into \emph{symbols}, which constitute the smallest textual
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   278
unit in Isabelle --- raw characters are normally not encountered
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   279
directly.%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   280
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   281
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   282
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   283
\isamarkupsubsection{Strings of symbols%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   284
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   285
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   286
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   287
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   288
Isabelle strings consist of a sequence of
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   289
symbols\glossary{Symbol}{The smalles unit of text in Isabelle,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   290
subsumes plain ASCII characters as well as an infinite collection of
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   291
named symbols (for greek, math etc.).}, which are either packed as an
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   292
actual \isa{string}, or represented as a list.  Each symbol is in
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   293
itself a small string of the following form:
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   294
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   295
\begin{enumerate}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   296
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   297
\item either a singleton ASCII character ``\isa{c}'' (with
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   298
character code 0--127), for example ``\verb,a,'',
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   299
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   300
\item or a regular symbol ``\verb,\,\verb,<,\isa{ident}\verb,>,'',
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   301
for example ``\verb,\,\verb,<alpha>,'',
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   302
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   303
\item or a control symbol ``\verb,\,\verb,<^,\isa{ident}\verb,>,'', for example ``\verb,\,\verb,<^bold>,'',
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   304
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   305
\item or a raw control symbol ``\verb,\,\verb,<^raw:,\isa{{\isasymdots}}\verb,>,'' where ``\isa{{\isasymdots}}'' refers to any
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   306
printable ASCII character (excluding ``\verb,.,'' and ``\verb,>,'') or
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   307
non-ASCII character, for example ``\verb,\,\verb,<^raw:$\sum_{i = 1}^n$>,'',
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   308
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   309
\item or a numbered raw control symbol ``\verb,\,\verb,<^raw,\isa{nnn}\verb,>, where \isa{nnn} are digits, for example
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   310
``\verb,\,\verb,<^raw42>,''.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   311
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   312
\end{enumerate}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   313
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   314
The \isa{ident} syntax for symbol names is \isa{letter\ {\isacharparenleft}letter\ {\isacharbar}\ digit{\isacharparenright}\isactrlsup {\isacharasterisk}}, where \isa{letter\ {\isacharequal}\ A{\isachardot}{\isachardot}Za{\isachardot}{\isachardot}Z} and \isa{digit\ {\isacharequal}\ {\isadigit{0}}{\isachardot}{\isachardot}{\isadigit{9}}}.  There are infinitely many regular symbols and
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   315
control symbols available, but a certain collection of standard
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   316
symbols is treated specifically.  For example,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   317
``\verb,\,\verb,<alpha>,'' is classified as a (non-ASCII) letter,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   318
which means it may occur within regular Isabelle identifier syntax.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   319
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   320
Output of symbols depends on the print mode (\secref{sec:print-mode}).
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   321
For example, the standard {\LaTeX} setup of the Isabelle document
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   322
preparation system would present ``\verb,\,\verb,<alpha>,'' as \isa{{\isasymalpha}}, and ``\verb,\,\verb,<^bold>,\verb,\,\verb,<alpha>,'' as \isa{\isactrlbold {\isasymalpha}}.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   323
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   324
\medskip It is important to note that the character set underlying
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   325
Isabelle symbols is plain 7-bit ASCII.  Since 8-bit characters are
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   326
passed through transparently, Isabelle may easily process actual
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   327
Unicode/UCS data (using the well-known UTF-8 encoding, for example).
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   328
Unicode provides its own collection of mathematical symbols, but there
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   329
is presently no link to Isabelle's named ones; both kinds of symbols
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   330
coexist independently.%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   331
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   332
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   333
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   334
\isadelimmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   335
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   336
\endisadelimmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   337
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   338
\isatagmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   339
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   340
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   341
\begin{mldecls}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   342
  \indexmltype{Symbol.symbol}\verb|type Symbol.symbol| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   343
  \indexml{Symbol.explode}\verb|Symbol.explode: string -> Symbol.symbol list| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   344
  \indexml{Symbol.is-letter}\verb|Symbol.is_letter: Symbol.symbol -> bool| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   345
  \indexml{Symbol.is-digit}\verb|Symbol.is_digit: Symbol.symbol -> bool| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   346
  \indexml{Symbol.is-quasi}\verb|Symbol.is_quasi: Symbol.symbol -> bool| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   347
  \indexml{Symbol.is-blank}\verb|Symbol.is_blank: Symbol.symbol -> bool| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   348
  \indexmltype{Symbol.sym}\verb|type Symbol.sym| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   349
  \indexml{Symbol.decode}\verb|Symbol.decode: Symbol.symbol -> Symbol.sym| \\
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   350
  \end{mldecls}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   351
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   352
  \begin{description}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   353
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   354
  \item \verb|Symbol.symbol| represents Isabelle symbols; this type
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   355
  is merely an alias for \verb|string|, but emphasizes the
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   356
  specific format encountered here.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   357
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   358
  \item \verb|Symbol.explode|~\isa{s} produces an actual symbol
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   359
  list from the packed form usually encountered as user input.  This
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   360
  function replaces \verb|String.explode| for virtually all purposes
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   361
  of manipulating text in Isabelle!  Plain \isa{implode} may be
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   362
  used for the reverse operation.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   363
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   364
  \item \verb|Symbol.is_letter|, \verb|Symbol.is_digit|, \verb|Symbol.is_quasi|, \verb|Symbol.is_blank| classify certain symbols
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   365
  (both ASCII and several named ones) according to fixed syntactic
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   366
  convections of Isabelle, e.g.\ see \cite{isabelle-isar-ref}.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   367
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   368
  \item \verb|Symbol.sym| is a concrete datatype that represents
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   369
  the different kinds of symbols explicitly as \verb|Symbol.Char|,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   370
  \verb|Symbol.Sym|, \verb|Symbol.Ctrl|, or \verb|Symbol.Raw|.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   371
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   372
  \item \verb|Symbol.decode| converts the string representation of a
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   373
  symbol into the explicit datatype version.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   374
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   375
  \end{description}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   376
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   377
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   378
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   379
\endisatagmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   380
{\isafoldmlref}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   381
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   382
\isadelimmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   383
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   384
\endisadelimmlref
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   385
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   386
\isamarkupsubsection{Qualified names and name spaces%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   387
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   388
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   389
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   390
\isadelimFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   391
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   392
\endisadelimFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   393
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   394
\isatagFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   395
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   396
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   397
Qualified names are constructed according to implicit naming
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   398
principles of the present context.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   399
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   400
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   401
The last component is called \emph{base name}; the remaining prefix of
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   402
qualification may be empty.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   403
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   404
Some practical conventions help to organize named entities more
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   405
systematically:
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   406
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   407
\begin{itemize}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   408
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   409
\item Names are qualified first by the theory name, second by an
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   410
optional ``structure''.  For example, a constant \isa{c} declared
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   411
as part of a certain structure \isa{b} (say a type definition) in
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   412
theory \isa{A} will be named \isa{A{\isachardot}b{\isachardot}c} internally.
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   413
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   414
\item
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   415
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   416
\item
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   417
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   418
\item
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   419
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   420
\item
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   421
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   422
\end{itemize}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   423
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   424
Names of different kinds of entities are basically independent, but
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   425
some practical naming conventions relate them to each other.  For
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   426
example, a constant \isa{foo} may be accompanied with theorems
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   427
\isa{foo{\isachardot}intro}, \isa{foo{\isachardot}elim}, \isa{foo{\isachardot}simps} etc.  The
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   428
same may happen for a type \isa{foo}, which is then apt to cause
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   429
clashes in the theorem name space!  To avoid this, we occasionally
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   430
follow an additional convention of suffixes that determine the
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   431
original kind of entity that a name has been derived.  For example,
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   432
constant \isa{foo} is associated with theorem \isa{foo{\isachardot}intro},
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   433
type \isa{foo} with theorem \isa{foo{\isacharunderscore}type{\isachardot}intro}, and type
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   434
class \isa{foo} with \isa{foo{\isacharunderscore}class{\isachardot}intro}.%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   435
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   436
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   437
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   438
\endisatagFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   439
{\isafoldFIXME}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   440
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   441
\isadelimFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   442
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   443
\endisadelimFIXME
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   444
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   445
\isamarkupsection{Structured output%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   446
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   447
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   448
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   449
\isamarkupsubsection{Pretty printing%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   450
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   451
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   452
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   453
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   454
FIXME%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   455
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   456
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   457
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   458
\isamarkupsubsection{Output channels%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   459
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   460
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   461
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   462
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   463
FIXME%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   464
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   465
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   466
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   467
\isamarkupsubsection{Print modes%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   468
}
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   469
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   470
%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   471
\begin{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   472
FIXME%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   473
\end{isamarkuptext}%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   474
\isamarkuptrue%
9060c73a4578 updated;
wenzelm
parents: 20430
diff changeset
   475
%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   476
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   477
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   478
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   479
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   480
\isatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   481
\isacommand{end}\isamarkupfalse%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   482
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   483
\endisatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   484
{\isafoldtheory}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   485
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   486
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   487
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   488
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   489
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   490
\end{isabellebody}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   491
%%% Local Variables:
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   492
%%% mode: latex
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   493
%%% TeX-master: "root"
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   494
%%% End: