doc-src/IsarRef/Thy/document/Generic.tex
author wenzelm
Fri Oct 29 11:49:56 2010 +0200 (2010-10-29)
changeset 40255 9ffbc25e1606
parent 35613 9d3ff36ad4e1
child 40291 012ed4426fda
permissions -rw-r--r--
eliminated obsolete \_ escapes in rail environments;
wenzelm@26782
     1
%
wenzelm@26782
     2
\begin{isabellebody}%
wenzelm@26782
     3
\def\isabellecontext{Generic}%
wenzelm@26782
     4
%
wenzelm@26782
     5
\isadelimtheory
wenzelm@26782
     6
%
wenzelm@26782
     7
\endisadelimtheory
wenzelm@26782
     8
%
wenzelm@26782
     9
\isatagtheory
wenzelm@26782
    10
\isacommand{theory}\isamarkupfalse%
wenzelm@26782
    11
\ Generic\isanewline
wenzelm@26895
    12
\isakeyword{imports}\ Main\isanewline
wenzelm@26782
    13
\isakeyword{begin}%
wenzelm@26782
    14
\endisatagtheory
wenzelm@26782
    15
{\isafoldtheory}%
wenzelm@26782
    16
%
wenzelm@26782
    17
\isadelimtheory
wenzelm@26782
    18
%
wenzelm@26782
    19
\endisadelimtheory
wenzelm@26782
    20
%
wenzelm@26782
    21
\isamarkupchapter{Generic tools and packages \label{ch:gen-tools}%
wenzelm@26782
    22
}
wenzelm@26782
    23
\isamarkuptrue%
wenzelm@26782
    24
%
wenzelm@27042
    25
\isamarkupsection{Configuration options%
wenzelm@26782
    26
}
wenzelm@26782
    27
\isamarkuptrue%
wenzelm@26782
    28
%
wenzelm@26782
    29
\begin{isamarkuptext}%
wenzelm@26782
    30
Isabelle/Pure maintains a record of named configuration options
wenzelm@26782
    31
  within the theory or proof context, with values of type \verb|bool|, \verb|int|, or \verb|string|.  Tools may declare
wenzelm@26782
    32
  options in ML, and then refer to these values (relative to the
wenzelm@26782
    33
  context).  Thus global reference variables are easily avoided.  The
wenzelm@26782
    34
  user may change the value of a configuration option by means of an
wenzelm@26782
    35
  associated attribute of the same name.  This form of context
wenzelm@26902
    36
  declaration works particularly well with commands such as \hyperlink{command.declare}{\mbox{\isa{\isacommand{declare}}}} or \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}.
wenzelm@26782
    37
wenzelm@26782
    38
  For historical reasons, some tools cannot take the full proof
wenzelm@26782
    39
  context into account and merely refer to the background theory.
wenzelm@26782
    40
  This is accommodated by configuration options being declared as
wenzelm@26782
    41
  ``global'', which may not be changed within a local context.
wenzelm@26782
    42
wenzelm@26782
    43
  \begin{matharray}{rcll}
wenzelm@28788
    44
    \indexdef{}{command}{print\_configs}\hypertarget{command.print-configs}{\hyperlink{command.print-configs}{\mbox{\isa{\isacommand{print{\isacharunderscore}configs}}}}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\
wenzelm@26782
    45
  \end{matharray}
wenzelm@26782
    46
wenzelm@26782
    47
  \begin{rail}
wenzelm@26782
    48
    name ('=' ('true' | 'false' | int | name))?
wenzelm@26782
    49
  \end{rail}
wenzelm@26782
    50
wenzelm@28788
    51
  \begin{description}
wenzelm@26782
    52
  
wenzelm@28788
    53
  \item \hyperlink{command.print-configs}{\mbox{\isa{\isacommand{print{\isacharunderscore}configs}}}} prints the available configuration
wenzelm@28788
    54
  options, with names, types, and current values.
wenzelm@26782
    55
  
wenzelm@28788
    56
  \item \isa{{\isachardoublequote}name\ {\isacharequal}\ value{\isachardoublequote}} as an attribute expression modifies the
wenzelm@28788
    57
  named option, with the syntax of the value depending on the option's
wenzelm@28788
    58
  type.  For \verb|bool| the default value is \isa{true}.  Any
wenzelm@28788
    59
  attempt to change a global option in a local context is ignored.
wenzelm@26782
    60
wenzelm@28788
    61
  \end{description}%
wenzelm@26782
    62
\end{isamarkuptext}%
wenzelm@26782
    63
\isamarkuptrue%
wenzelm@26782
    64
%
wenzelm@27042
    65
\isamarkupsection{Basic proof tools%
wenzelm@26782
    66
}
wenzelm@26782
    67
\isamarkuptrue%
wenzelm@26782
    68
%
wenzelm@26782
    69
\isamarkupsubsection{Miscellaneous methods and attributes \label{sec:misc-meth-att}%
wenzelm@26782
    70
}
wenzelm@26782
    71
\isamarkuptrue%
wenzelm@26782
    72
%
wenzelm@26782
    73
\begin{isamarkuptext}%
wenzelm@26782
    74
\begin{matharray}{rcl}
wenzelm@28788
    75
    \indexdef{}{method}{unfold}\hypertarget{method.unfold}{\hyperlink{method.unfold}{\mbox{\isa{unfold}}}} & : & \isa{method} \\
wenzelm@28788
    76
    \indexdef{}{method}{fold}\hypertarget{method.fold}{\hyperlink{method.fold}{\mbox{\isa{fold}}}} & : & \isa{method} \\
wenzelm@28788
    77
    \indexdef{}{method}{insert}\hypertarget{method.insert}{\hyperlink{method.insert}{\mbox{\isa{insert}}}} & : & \isa{method} \\[0.5ex]
wenzelm@28788
    78
    \indexdef{}{method}{erule}\hypertarget{method.erule}{\hyperlink{method.erule}{\mbox{\isa{erule}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
    79
    \indexdef{}{method}{drule}\hypertarget{method.drule}{\hyperlink{method.drule}{\mbox{\isa{drule}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
    80
    \indexdef{}{method}{frule}\hypertarget{method.frule}{\hyperlink{method.frule}{\mbox{\isa{frule}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
    81
    \indexdef{}{method}{succeed}\hypertarget{method.succeed}{\hyperlink{method.succeed}{\mbox{\isa{succeed}}}} & : & \isa{method} \\
wenzelm@28788
    82
    \indexdef{}{method}{fail}\hypertarget{method.fail}{\hyperlink{method.fail}{\mbox{\isa{fail}}}} & : & \isa{method} \\
wenzelm@26782
    83
  \end{matharray}
wenzelm@26782
    84
wenzelm@26782
    85
  \begin{rail}
wenzelm@26782
    86
    ('fold' | 'unfold' | 'insert') thmrefs
wenzelm@26782
    87
    ;
wenzelm@26782
    88
    ('erule' | 'drule' | 'frule') ('('nat')')? thmrefs
wenzelm@26782
    89
    ;
wenzelm@26782
    90
  \end{rail}
wenzelm@26782
    91
wenzelm@28788
    92
  \begin{description}
wenzelm@26782
    93
  
wenzelm@28788
    94
  \item \hyperlink{method.unfold}{\mbox{\isa{unfold}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} and \hyperlink{method.fold}{\mbox{\isa{fold}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} expand (or fold back) the given definitions throughout
wenzelm@28788
    95
  all goals; any chained facts provided are inserted into the goal and
wenzelm@28788
    96
  subject to rewriting as well.
wenzelm@26782
    97
wenzelm@28788
    98
  \item \hyperlink{method.insert}{\mbox{\isa{insert}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} inserts theorems as facts
wenzelm@28788
    99
  into all goals of the proof state.  Note that current facts
wenzelm@28788
   100
  indicated for forward chaining are ignored.
wenzelm@26782
   101
wenzelm@30397
   102
  \item \hyperlink{method.erule}{\mbox{\isa{erule}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}, \hyperlink{method.drule}{\mbox{\isa{drule}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}, and \hyperlink{method.frule}{\mbox{\isa{frule}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} are similar to the basic \hyperlink{method.rule}{\mbox{\isa{rule}}}
wenzelm@30397
   103
  method (see \secref{sec:pure-meth-att}), but apply rules by
wenzelm@30397
   104
  elim-resolution, destruct-resolution, and forward-resolution,
wenzelm@30397
   105
  respectively \cite{isabelle-implementation}.  The optional natural
wenzelm@30397
   106
  number argument (default 0) specifies additional assumption steps to
wenzelm@30397
   107
  be performed here.
wenzelm@26782
   108
wenzelm@26782
   109
  Note that these methods are improper ones, mainly serving for
wenzelm@26782
   110
  experimentation and tactic script emulation.  Different modes of
wenzelm@26782
   111
  basic rule application are usually expressed in Isar at the proof
wenzelm@26782
   112
  language level, rather than via implicit proof state manipulations.
wenzelm@26782
   113
  For example, a proper single-step elimination would be done using
wenzelm@26902
   114
  the plain \hyperlink{method.rule}{\mbox{\isa{rule}}} method, with forward chaining of current
wenzelm@26782
   115
  facts.
wenzelm@26782
   116
wenzelm@28788
   117
  \item \hyperlink{method.succeed}{\mbox{\isa{succeed}}} yields a single (unchanged) result; it is
wenzelm@26842
   118
  the identity of the ``\isa{{\isachardoublequote}{\isacharcomma}{\isachardoublequote}}'' method combinator (cf.\
wenzelm@28788
   119
  \secref{sec:proof-meth}).
wenzelm@26782
   120
wenzelm@28788
   121
  \item \hyperlink{method.fail}{\mbox{\isa{fail}}} yields an empty result sequence; it is the
wenzelm@26842
   122
  identity of the ``\isa{{\isachardoublequote}{\isacharbar}{\isachardoublequote}}'' method combinator (cf.\
wenzelm@28788
   123
  \secref{sec:proof-meth}).
wenzelm@26782
   124
wenzelm@28788
   125
  \end{description}
wenzelm@26782
   126
wenzelm@26782
   127
  \begin{matharray}{rcl}
wenzelm@28788
   128
    \indexdef{}{attribute}{tagged}\hypertarget{attribute.tagged}{\hyperlink{attribute.tagged}{\mbox{\isa{tagged}}}} & : & \isa{attribute} \\
wenzelm@28788
   129
    \indexdef{}{attribute}{untagged}\hypertarget{attribute.untagged}{\hyperlink{attribute.untagged}{\mbox{\isa{untagged}}}} & : & \isa{attribute} \\[0.5ex]
wenzelm@28788
   130
    \indexdef{}{attribute}{THEN}\hypertarget{attribute.THEN}{\hyperlink{attribute.THEN}{\mbox{\isa{THEN}}}} & : & \isa{attribute} \\
wenzelm@28788
   131
    \indexdef{}{attribute}{COMP}\hypertarget{attribute.COMP}{\hyperlink{attribute.COMP}{\mbox{\isa{COMP}}}} & : & \isa{attribute} \\[0.5ex]
wenzelm@28788
   132
    \indexdef{}{attribute}{unfolded}\hypertarget{attribute.unfolded}{\hyperlink{attribute.unfolded}{\mbox{\isa{unfolded}}}} & : & \isa{attribute} \\
wenzelm@28788
   133
    \indexdef{}{attribute}{folded}\hypertarget{attribute.folded}{\hyperlink{attribute.folded}{\mbox{\isa{folded}}}} & : & \isa{attribute} \\[0.5ex]
wenzelm@28788
   134
    \indexdef{}{attribute}{rotated}\hypertarget{attribute.rotated}{\hyperlink{attribute.rotated}{\mbox{\isa{rotated}}}} & : & \isa{attribute} \\
wenzelm@28788
   135
    \indexdef{Pure}{attribute}{elim\_format}\hypertarget{attribute.Pure.elim-format}{\hyperlink{attribute.Pure.elim-format}{\mbox{\isa{elim{\isacharunderscore}format}}}} & : & \isa{attribute} \\
wenzelm@28788
   136
    \indexdef{}{attribute}{standard}\hypertarget{attribute.standard}{\hyperlink{attribute.standard}{\mbox{\isa{standard}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{attribute} \\
wenzelm@28788
   137
    \indexdef{}{attribute}{no\_vars}\hypertarget{attribute.no-vars}{\hyperlink{attribute.no-vars}{\mbox{\isa{no{\isacharunderscore}vars}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{attribute} \\
wenzelm@26782
   138
  \end{matharray}
wenzelm@26782
   139
wenzelm@26782
   140
  \begin{rail}
wenzelm@28788
   141
    'tagged' name name
wenzelm@26782
   142
    ;
wenzelm@26782
   143
    'untagged' name
wenzelm@26782
   144
    ;
wenzelm@26782
   145
    ('THEN' | 'COMP') ('[' nat ']')? thmref
wenzelm@26782
   146
    ;
wenzelm@26782
   147
    ('unfolded' | 'folded') thmrefs
wenzelm@26782
   148
    ;
wenzelm@26782
   149
    'rotated' ( int )?
wenzelm@26782
   150
  \end{rail}
wenzelm@26782
   151
wenzelm@28788
   152
  \begin{description}
wenzelm@26782
   153
wenzelm@28788
   154
  \item \hyperlink{attribute.tagged}{\mbox{\isa{tagged}}}~\isa{{\isachardoublequote}name\ value{\isachardoublequote}} and \hyperlink{attribute.untagged}{\mbox{\isa{untagged}}}~\isa{name} add and remove \emph{tags} of some theorem.
wenzelm@26782
   155
  Tags may be any list of string pairs that serve as formal comment.
wenzelm@28788
   156
  The first string is considered the tag name, the second its value.
wenzelm@28788
   157
  Note that \hyperlink{attribute.untagged}{\mbox{\isa{untagged}}} removes any tags of the same name.
wenzelm@26782
   158
wenzelm@28788
   159
  \item \hyperlink{attribute.THEN}{\mbox{\isa{THEN}}}~\isa{a} and \hyperlink{attribute.COMP}{\mbox{\isa{COMP}}}~\isa{a}
wenzelm@26902
   160
  compose rules by resolution.  \hyperlink{attribute.THEN}{\mbox{\isa{THEN}}} resolves with the
wenzelm@26782
   161
  first premise of \isa{a} (an alternative position may be also
wenzelm@26902
   162
  specified); the \hyperlink{attribute.COMP}{\mbox{\isa{COMP}}} version skips the automatic
wenzelm@30463
   163
  lifting process that is normally intended (cf.\ \verb|op RS| and
wenzelm@30463
   164
  \verb|op COMP| in \cite{isabelle-implementation}).
wenzelm@26782
   165
  
wenzelm@28788
   166
  \item \hyperlink{attribute.unfolded}{\mbox{\isa{unfolded}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} and \hyperlink{attribute.folded}{\mbox{\isa{folded}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} expand and fold back again the given
wenzelm@28788
   167
  definitions throughout a rule.
wenzelm@26782
   168
wenzelm@28788
   169
  \item \hyperlink{attribute.rotated}{\mbox{\isa{rotated}}}~\isa{n} rotate the premises of a
wenzelm@26782
   170
  theorem by \isa{n} (default 1).
wenzelm@26782
   171
wenzelm@28788
   172
  \item \hyperlink{attribute.Pure.elim-format}{\mbox{\isa{elim{\isacharunderscore}format}}} turns a destruction rule into
wenzelm@28788
   173
  elimination rule format, by resolving with the rule \isa{{\isachardoublequote}PROP\ A\ {\isasymLongrightarrow}\ {\isacharparenleft}PROP\ A\ {\isasymLongrightarrow}\ PROP\ B{\isacharparenright}\ {\isasymLongrightarrow}\ PROP\ B{\isachardoublequote}}.
wenzelm@26782
   174
  
wenzelm@26782
   175
  Note that the Classical Reasoner (\secref{sec:classical}) provides
wenzelm@26782
   176
  its own version of this operation.
wenzelm@26782
   177
wenzelm@28788
   178
  \item \hyperlink{attribute.standard}{\mbox{\isa{standard}}} puts a theorem into the standard form of
wenzelm@28788
   179
  object-rules at the outermost theory level.  Note that this
wenzelm@26782
   180
  operation violates the local proof context (including active
wenzelm@26782
   181
  locales).
wenzelm@26782
   182
wenzelm@28788
   183
  \item \hyperlink{attribute.no-vars}{\mbox{\isa{no{\isacharunderscore}vars}}} replaces schematic variables by free
wenzelm@26782
   184
  ones; this is mainly for tuning output of pretty printed theorems.
wenzelm@26782
   185
wenzelm@28788
   186
  \end{description}%
wenzelm@26782
   187
\end{isamarkuptext}%
wenzelm@26782
   188
\isamarkuptrue%
wenzelm@26782
   189
%
wenzelm@27047
   190
\isamarkupsubsection{Low-level equational reasoning%
wenzelm@27047
   191
}
wenzelm@27047
   192
\isamarkuptrue%
wenzelm@27047
   193
%
wenzelm@27047
   194
\begin{isamarkuptext}%
wenzelm@27047
   195
\begin{matharray}{rcl}
wenzelm@28788
   196
    \indexdef{}{method}{subst}\hypertarget{method.subst}{\hyperlink{method.subst}{\mbox{\isa{subst}}}} & : & \isa{method} \\
wenzelm@28788
   197
    \indexdef{}{method}{hypsubst}\hypertarget{method.hypsubst}{\hyperlink{method.hypsubst}{\mbox{\isa{hypsubst}}}} & : & \isa{method} \\
wenzelm@28788
   198
    \indexdef{}{method}{split}\hypertarget{method.split}{\hyperlink{method.split}{\mbox{\isa{split}}}} & : & \isa{method} \\
wenzelm@27047
   199
  \end{matharray}
wenzelm@27047
   200
wenzelm@27047
   201
  \begin{rail}
wenzelm@27047
   202
    'subst' ('(' 'asm' ')')? ('(' (nat+) ')')? thmref
wenzelm@27047
   203
    ;
wenzelm@27047
   204
    'split' ('(' 'asm' ')')? thmrefs
wenzelm@27047
   205
    ;
wenzelm@27047
   206
  \end{rail}
wenzelm@27047
   207
wenzelm@27047
   208
  These methods provide low-level facilities for equational reasoning
wenzelm@27047
   209
  that are intended for specialized applications only.  Normally,
wenzelm@27047
   210
  single step calculations would be performed in a structured text
wenzelm@27047
   211
  (see also \secref{sec:calculation}), while the Simplifier methods
wenzelm@27047
   212
  provide the canonical way for automated normalization (see
wenzelm@27047
   213
  \secref{sec:simplifier}).
wenzelm@27047
   214
wenzelm@28788
   215
  \begin{description}
wenzelm@27047
   216
wenzelm@28788
   217
  \item \hyperlink{method.subst}{\mbox{\isa{subst}}}~\isa{eq} performs a single substitution step
wenzelm@28788
   218
  using rule \isa{eq}, which may be either a meta or object
wenzelm@27047
   219
  equality.
wenzelm@27047
   220
wenzelm@28788
   221
  \item \hyperlink{method.subst}{\mbox{\isa{subst}}}~\isa{{\isachardoublequote}{\isacharparenleft}asm{\isacharparenright}\ eq{\isachardoublequote}} substitutes in an
wenzelm@27047
   222
  assumption.
wenzelm@27047
   223
wenzelm@28788
   224
  \item \hyperlink{method.subst}{\mbox{\isa{subst}}}~\isa{{\isachardoublequote}{\isacharparenleft}i\ {\isasymdots}\ j{\isacharparenright}\ eq{\isachardoublequote}} performs several
wenzelm@27047
   225
  substitutions in the conclusion. The numbers \isa{i} to \isa{j}
wenzelm@27047
   226
  indicate the positions to substitute at.  Positions are ordered from
wenzelm@27047
   227
  the top of the term tree moving down from left to right. For
wenzelm@27047
   228
  example, in \isa{{\isachardoublequote}{\isacharparenleft}a\ {\isacharplus}\ b{\isacharparenright}\ {\isacharplus}\ {\isacharparenleft}c\ {\isacharplus}\ d{\isacharparenright}{\isachardoublequote}} there are three positions
wenzelm@28788
   229
  where commutativity of \isa{{\isachardoublequote}{\isacharplus}{\isachardoublequote}} is applicable: 1 refers to \isa{{\isachardoublequote}a\ {\isacharplus}\ b{\isachardoublequote}}, 2 to the whole term, and 3 to \isa{{\isachardoublequote}c\ {\isacharplus}\ d{\isachardoublequote}}.
wenzelm@27047
   230
wenzelm@27047
   231
  If the positions in the list \isa{{\isachardoublequote}{\isacharparenleft}i\ {\isasymdots}\ j{\isacharparenright}{\isachardoublequote}} are non-overlapping
wenzelm@27047
   232
  (e.g.\ \isa{{\isachardoublequote}{\isacharparenleft}{\isadigit{2}}\ {\isadigit{3}}{\isacharparenright}{\isachardoublequote}} in \isa{{\isachardoublequote}{\isacharparenleft}a\ {\isacharplus}\ b{\isacharparenright}\ {\isacharplus}\ {\isacharparenleft}c\ {\isacharplus}\ d{\isacharparenright}{\isachardoublequote}}) you may
wenzelm@27047
   233
  assume all substitutions are performed simultaneously.  Otherwise
wenzelm@27047
   234
  the behaviour of \isa{subst} is not specified.
wenzelm@27047
   235
wenzelm@28788
   236
  \item \hyperlink{method.subst}{\mbox{\isa{subst}}}~\isa{{\isachardoublequote}{\isacharparenleft}asm{\isacharparenright}\ {\isacharparenleft}i\ {\isasymdots}\ j{\isacharparenright}\ eq{\isachardoublequote}} performs the
wenzelm@27072
   237
  substitutions in the assumptions. The positions refer to the
wenzelm@27072
   238
  assumptions in order from left to right.  For example, given in a
wenzelm@27072
   239
  goal of the form \isa{{\isachardoublequote}P\ {\isacharparenleft}a\ {\isacharplus}\ b{\isacharparenright}\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}c\ {\isacharplus}\ d{\isacharparenright}\ {\isasymLongrightarrow}\ {\isasymdots}{\isachardoublequote}}, position 1 of
wenzelm@27072
   240
  commutativity of \isa{{\isachardoublequote}{\isacharplus}{\isachardoublequote}} is the subterm \isa{{\isachardoublequote}a\ {\isacharplus}\ b{\isachardoublequote}} and
wenzelm@27072
   241
  position 2 is the subterm \isa{{\isachardoublequote}c\ {\isacharplus}\ d{\isachardoublequote}}.
wenzelm@27047
   242
wenzelm@28788
   243
  \item \hyperlink{method.hypsubst}{\mbox{\isa{hypsubst}}} performs substitution using some
wenzelm@27047
   244
  assumption; this only works for equations of the form \isa{{\isachardoublequote}x\ {\isacharequal}\ t{\isachardoublequote}} where \isa{x} is a free or bound variable.
wenzelm@27047
   245
wenzelm@28788
   246
  \item \hyperlink{method.split}{\mbox{\isa{split}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} performs single-step case
wenzelm@28788
   247
  splitting using the given rules.  By default, splitting is performed
wenzelm@28788
   248
  in the conclusion of a goal; the \isa{{\isachardoublequote}{\isacharparenleft}asm{\isacharparenright}{\isachardoublequote}} option indicates to
wenzelm@28788
   249
  operate on assumptions instead.
wenzelm@27047
   250
  
wenzelm@27047
   251
  Note that the \hyperlink{method.simp}{\mbox{\isa{simp}}} method already involves repeated
wenzelm@27047
   252
  application of split rules as declared in the current context.
wenzelm@27047
   253
wenzelm@28788
   254
  \end{description}%
wenzelm@27047
   255
\end{isamarkuptext}%
wenzelm@27047
   256
\isamarkuptrue%
wenzelm@27047
   257
%
wenzelm@26782
   258
\isamarkupsubsection{Further tactic emulations \label{sec:tactics}%
wenzelm@26782
   259
}
wenzelm@26782
   260
\isamarkuptrue%
wenzelm@26782
   261
%
wenzelm@26782
   262
\begin{isamarkuptext}%
wenzelm@26782
   263
The following improper proof methods emulate traditional tactics.
wenzelm@26782
   264
  These admit direct access to the goal state, which is normally
wenzelm@26782
   265
  considered harmful!  In particular, this may involve both numbered
wenzelm@26782
   266
  goal addressing (default 1), and dynamic instantiation within the
wenzelm@26782
   267
  scope of some subgoal.
wenzelm@26782
   268
wenzelm@26782
   269
  \begin{warn}
wenzelm@26782
   270
    Dynamic instantiations refer to universally quantified parameters
wenzelm@26782
   271
    of a subgoal (the dynamic context) rather than fixed variables and
wenzelm@26782
   272
    term abbreviations of a (static) Isar context.
wenzelm@26782
   273
  \end{warn}
wenzelm@26782
   274
wenzelm@26782
   275
  Tactic emulation methods, unlike their ML counterparts, admit
wenzelm@26782
   276
  simultaneous instantiation from both dynamic and static contexts.
wenzelm@26782
   277
  If names occur in both contexts goal parameters hide locally fixed
wenzelm@26782
   278
  variables.  Likewise, schematic variables refer to term
wenzelm@26782
   279
  abbreviations, if present in the static context.  Otherwise the
wenzelm@26782
   280
  schematic variable is interpreted as a schematic variable and left
wenzelm@26782
   281
  to be solved by unification with certain parts of the subgoal.
wenzelm@26782
   282
wenzelm@26782
   283
  Note that the tactic emulation proof methods in Isabelle/Isar are
wenzelm@26782
   284
  consistently named \isa{foo{\isacharunderscore}tac}.  Note also that variable names
wenzelm@26782
   285
  occurring on left hand sides of instantiations must be preceded by a
wenzelm@26782
   286
  question mark if they coincide with a keyword or contain dots.  This
wenzelm@26902
   287
  is consistent with the attribute \hyperlink{attribute.where}{\mbox{\isa{where}}} (see
wenzelm@26782
   288
  \secref{sec:pure-meth-att}).
wenzelm@26782
   289
wenzelm@26782
   290
  \begin{matharray}{rcl}
wenzelm@28788
   291
    \indexdef{}{method}{rule\_tac}\hypertarget{method.rule-tac}{\hyperlink{method.rule-tac}{\mbox{\isa{rule{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   292
    \indexdef{}{method}{erule\_tac}\hypertarget{method.erule-tac}{\hyperlink{method.erule-tac}{\mbox{\isa{erule{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   293
    \indexdef{}{method}{drule\_tac}\hypertarget{method.drule-tac}{\hyperlink{method.drule-tac}{\mbox{\isa{drule{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   294
    \indexdef{}{method}{frule\_tac}\hypertarget{method.frule-tac}{\hyperlink{method.frule-tac}{\mbox{\isa{frule{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   295
    \indexdef{}{method}{cut\_tac}\hypertarget{method.cut-tac}{\hyperlink{method.cut-tac}{\mbox{\isa{cut{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   296
    \indexdef{}{method}{thin\_tac}\hypertarget{method.thin-tac}{\hyperlink{method.thin-tac}{\mbox{\isa{thin{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   297
    \indexdef{}{method}{subgoal\_tac}\hypertarget{method.subgoal-tac}{\hyperlink{method.subgoal-tac}{\mbox{\isa{subgoal{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   298
    \indexdef{}{method}{rename\_tac}\hypertarget{method.rename-tac}{\hyperlink{method.rename-tac}{\mbox{\isa{rename{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   299
    \indexdef{}{method}{rotate\_tac}\hypertarget{method.rotate-tac}{\hyperlink{method.rotate-tac}{\mbox{\isa{rotate{\isacharunderscore}tac}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   300
    \indexdef{}{method}{tactic}\hypertarget{method.tactic}{\hyperlink{method.tactic}{\mbox{\isa{tactic}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@28788
   301
    \indexdef{}{method}{raw\_tactic}\hypertarget{method.raw-tactic}{\hyperlink{method.raw-tactic}{\mbox{\isa{raw{\isacharunderscore}tactic}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{method} \\
wenzelm@26782
   302
  \end{matharray}
wenzelm@26782
   303
wenzelm@26782
   304
  \begin{rail}
wenzelm@40255
   305
    ( 'rule_tac' | 'erule_tac' | 'drule_tac' | 'frule_tac' | 'cut_tac' | 'thin_tac' ) goalspec?
wenzelm@26782
   306
    ( insts thmref | thmrefs )
wenzelm@26782
   307
    ;
wenzelm@40255
   308
    'subgoal_tac' goalspec? (prop +)
wenzelm@26782
   309
    ;
wenzelm@40255
   310
    'rename_tac' goalspec? (name +)
wenzelm@26782
   311
    ;
wenzelm@40255
   312
    'rotate_tac' goalspec? int?
wenzelm@26782
   313
    ;
wenzelm@27224
   314
    ('tactic' | 'raw_tactic') text
wenzelm@26782
   315
    ;
wenzelm@26782
   316
wenzelm@26782
   317
    insts: ((name '=' term) + 'and') 'in'
wenzelm@26782
   318
    ;
wenzelm@26782
   319
  \end{rail}
wenzelm@26782
   320
wenzelm@28788
   321
\begin{description}
wenzelm@26782
   322
wenzelm@28788
   323
  \item \hyperlink{method.rule-tac}{\mbox{\isa{rule{\isacharunderscore}tac}}} etc. do resolution of rules with explicit
wenzelm@30397
   324
  instantiation.  This works the same way as the ML tactics \verb|res_inst_tac| etc. (see \cite{isabelle-implementation})
wenzelm@26782
   325
wenzelm@26782
   326
  Multiple rules may be only given if there is no instantiation; then
wenzelm@26907
   327
  \hyperlink{method.rule-tac}{\mbox{\isa{rule{\isacharunderscore}tac}}} is the same as \verb|resolve_tac| in ML (see
wenzelm@30397
   328
  \cite{isabelle-implementation}).
wenzelm@26782
   329
wenzelm@28788
   330
  \item \hyperlink{method.cut-tac}{\mbox{\isa{cut{\isacharunderscore}tac}}} inserts facts into the proof state as
wenzelm@27210
   331
  assumption of a subgoal, see also \verb|Tactic.cut_facts_tac| in
wenzelm@30397
   332
  \cite{isabelle-implementation}.  Note that the scope of schematic
wenzelm@26782
   333
  variables is spread over the main goal statement.  Instantiations
wenzelm@28788
   334
  may be given as well, see also ML tactic \verb|cut_inst_tac| in
wenzelm@30397
   335
  \cite{isabelle-implementation}.
wenzelm@26782
   336
wenzelm@28788
   337
  \item \hyperlink{method.thin-tac}{\mbox{\isa{thin{\isacharunderscore}tac}}}~\isa{{\isasymphi}} deletes the specified assumption
wenzelm@28788
   338
  from a subgoal; note that \isa{{\isasymphi}} may contain schematic variables.
wenzelm@30397
   339
  See also \verb|thin_tac| in \cite{isabelle-implementation}.
wenzelm@28788
   340
wenzelm@28788
   341
  \item \hyperlink{method.subgoal-tac}{\mbox{\isa{subgoal{\isacharunderscore}tac}}}~\isa{{\isasymphi}} adds \isa{{\isasymphi}} as an
wenzelm@30397
   342
  assumption to a subgoal.  See also \verb|subgoal_tac| and \verb|subgoals_tac| in \cite{isabelle-implementation}.
wenzelm@26782
   343
wenzelm@28788
   344
  \item \hyperlink{method.rename-tac}{\mbox{\isa{rename{\isacharunderscore}tac}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n{\isachardoublequote}} renames parameters of a
wenzelm@28788
   345
  goal according to the list \isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub n{\isachardoublequote}}, which refers to the
wenzelm@28788
   346
  \emph{suffix} of variables.
wenzelm@26782
   347
wenzelm@28788
   348
  \item \hyperlink{method.rotate-tac}{\mbox{\isa{rotate{\isacharunderscore}tac}}}~\isa{n} rotates the assumptions of a
wenzelm@26782
   349
  goal by \isa{n} positions: from right to left if \isa{n} is
wenzelm@26782
   350
  positive, and from left to right if \isa{n} is negative; the
wenzelm@26782
   351
  default value is 1.  See also \verb|rotate_tac| in
wenzelm@30397
   352
  \cite{isabelle-implementation}.
wenzelm@26782
   353
wenzelm@28788
   354
  \item \hyperlink{method.tactic}{\mbox{\isa{tactic}}}~\isa{{\isachardoublequote}text{\isachardoublequote}} produces a proof method from
wenzelm@26782
   355
  any ML text of type \verb|tactic|.  Apart from the usual ML
wenzelm@27224
   356
  environment and the current proof context, the ML code may refer to
wenzelm@27224
   357
  the locally bound values \verb|facts|, which indicates any
wenzelm@27224
   358
  current facts used for forward-chaining.
wenzelm@26782
   359
wenzelm@28788
   360
  \item \hyperlink{method.raw-tactic}{\mbox{\isa{raw{\isacharunderscore}tactic}}} is similar to \hyperlink{method.tactic}{\mbox{\isa{tactic}}}, but
wenzelm@27224
   361
  presents the goal state in its raw internal form, where simultaneous
wenzelm@27224
   362
  subgoals appear as conjunction of the logical framework instead of
wenzelm@27224
   363
  the usual split into several subgoals.  While feature this is useful
wenzelm@27224
   364
  for debugging of complex method definitions, it should not never
wenzelm@27224
   365
  appear in production theories.
wenzelm@26782
   366
wenzelm@28788
   367
  \end{description}%
wenzelm@26782
   368
\end{isamarkuptext}%
wenzelm@26782
   369
\isamarkuptrue%
wenzelm@26782
   370
%
wenzelm@27042
   371
\isamarkupsection{The Simplifier \label{sec:simplifier}%
wenzelm@26782
   372
}
wenzelm@26782
   373
\isamarkuptrue%
wenzelm@26782
   374
%
wenzelm@27042
   375
\isamarkupsubsection{Simplification methods%
wenzelm@26782
   376
}
wenzelm@26782
   377
\isamarkuptrue%
wenzelm@26782
   378
%
wenzelm@26782
   379
\begin{isamarkuptext}%
wenzelm@26782
   380
\begin{matharray}{rcl}
wenzelm@28788
   381
    \indexdef{}{method}{simp}\hypertarget{method.simp}{\hyperlink{method.simp}{\mbox{\isa{simp}}}} & : & \isa{method} \\
wenzelm@28788
   382
    \indexdef{}{method}{simp\_all}\hypertarget{method.simp-all}{\hyperlink{method.simp-all}{\mbox{\isa{simp{\isacharunderscore}all}}}} & : & \isa{method} \\
wenzelm@26782
   383
  \end{matharray}
wenzelm@26782
   384
wenzelm@26782
   385
  \indexouternonterm{simpmod}
wenzelm@26782
   386
  \begin{rail}
wenzelm@40255
   387
    ('simp' | 'simp_all') opt? (simpmod *)
wenzelm@26782
   388
    ;
wenzelm@26782
   389
wenzelm@40255
   390
    opt: '(' ('no_asm' | 'no_asm_simp' | 'no_asm_use' | 'asm_lr' ) ')'
wenzelm@26782
   391
    ;
wenzelm@26782
   392
    simpmod: ('add' | 'del' | 'only' | 'cong' (() | 'add' | 'del') |
wenzelm@26782
   393
      'split' (() | 'add' | 'del')) ':' thmrefs
wenzelm@26782
   394
    ;
wenzelm@26782
   395
  \end{rail}
wenzelm@26782
   396
wenzelm@28788
   397
  \begin{description}
wenzelm@26782
   398
wenzelm@28788
   399
  \item \hyperlink{method.simp}{\mbox{\isa{simp}}} invokes the Simplifier, after declaring
wenzelm@26782
   400
  additional rules according to the arguments given.  Note that the
wenzelm@26782
   401
  \railtterm{only} modifier first removes all other rewrite rules,
wenzelm@26782
   402
  congruences, and looper tactics (including splits), and then behaves
wenzelm@26782
   403
  like \railtterm{add}.
wenzelm@26782
   404
wenzelm@26782
   405
  \medskip The \railtterm{cong} modifiers add or delete Simplifier
wenzelm@26782
   406
  congruence rules (see also \cite{isabelle-ref}), the default is to
wenzelm@26782
   407
  add.
wenzelm@26782
   408
wenzelm@26782
   409
  \medskip The \railtterm{split} modifiers add or delete rules for the
wenzelm@26782
   410
  Splitter (see also \cite{isabelle-ref}), the default is to add.
wenzelm@26782
   411
  This works only if the Simplifier method has been properly setup to
wenzelm@26782
   412
  include the Splitter (all major object logics such HOL, HOLCF, FOL,
wenzelm@26782
   413
  ZF do this already).
wenzelm@26782
   414
wenzelm@28788
   415
  \item \hyperlink{method.simp-all}{\mbox{\isa{simp{\isacharunderscore}all}}} is similar to \hyperlink{method.simp}{\mbox{\isa{simp}}}, but acts on
wenzelm@26782
   416
  all goals (backwards from the last to the first one).
wenzelm@26782
   417
wenzelm@28788
   418
  \end{description}
wenzelm@26782
   419
wenzelm@26782
   420
  By default the Simplifier methods take local assumptions fully into
wenzelm@26782
   421
  account, using equational assumptions in the subsequent
wenzelm@26782
   422
  normalization process, or simplifying assumptions themselves (cf.\
wenzelm@30397
   423
  \verb|asm_full_simp_tac| in \cite{isabelle-ref}).  In structured
wenzelm@30397
   424
  proofs this is usually quite well behaved in practice: just the
wenzelm@30397
   425
  local premises of the actual goal are involved, additional facts may
wenzelm@30397
   426
  be inserted via explicit forward-chaining (via \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}},
wenzelm@35613
   427
  \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}, \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}} etc.).
wenzelm@26782
   428
wenzelm@26782
   429
  Additional Simplifier options may be specified to tune the behavior
wenzelm@26782
   430
  further (mostly for unstructured scripts with many accidental local
wenzelm@26842
   431
  facts): ``\isa{{\isachardoublequote}{\isacharparenleft}no{\isacharunderscore}asm{\isacharparenright}{\isachardoublequote}}'' means assumptions are ignored
wenzelm@26842
   432
  completely (cf.\ \verb|simp_tac|), ``\isa{{\isachardoublequote}{\isacharparenleft}no{\isacharunderscore}asm{\isacharunderscore}simp{\isacharparenright}{\isachardoublequote}}'' means
wenzelm@26782
   433
  assumptions are used in the simplification of the conclusion but are
wenzelm@26842
   434
  not themselves simplified (cf.\ \verb|asm_simp_tac|), and ``\isa{{\isachardoublequote}{\isacharparenleft}no{\isacharunderscore}asm{\isacharunderscore}use{\isacharparenright}{\isachardoublequote}}'' means assumptions are simplified but are not used
wenzelm@26782
   435
  in the simplification of each other or the conclusion (cf.\ \verb|full_simp_tac|).  For compatibility reasons, there is also an option
wenzelm@26842
   436
  ``\isa{{\isachardoublequote}{\isacharparenleft}asm{\isacharunderscore}lr{\isacharparenright}{\isachardoublequote}}'', which means that an assumption is only used
wenzelm@26782
   437
  for simplifying assumptions which are to the right of it (cf.\ \verb|asm_lr_simp_tac|).
wenzelm@26782
   438
wenzelm@27094
   439
  The configuration option \isa{{\isachardoublequote}depth{\isacharunderscore}limit{\isachardoublequote}} limits the number of
wenzelm@26782
   440
  recursive invocations of the simplifier during conditional
wenzelm@26782
   441
  rewriting.
wenzelm@26782
   442
wenzelm@26782
   443
  \medskip The Splitter package is usually configured to work as part
wenzelm@26842
   444
  of the Simplifier.  The effect of repeatedly applying \verb|split_tac| can be simulated by ``\isa{{\isachardoublequote}{\isacharparenleft}simp\ only{\isacharcolon}\ split{\isacharcolon}\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharparenright}{\isachardoublequote}}''.  There is also a separate \isa{split}
wenzelm@26782
   445
  method available for single-step case splitting.%
wenzelm@26782
   446
\end{isamarkuptext}%
wenzelm@26782
   447
\isamarkuptrue%
wenzelm@26782
   448
%
wenzelm@27042
   449
\isamarkupsubsection{Declaring rules%
wenzelm@26782
   450
}
wenzelm@26782
   451
\isamarkuptrue%
wenzelm@26782
   452
%
wenzelm@26782
   453
\begin{isamarkuptext}%
wenzelm@26782
   454
\begin{matharray}{rcl}
wenzelm@28788
   455
    \indexdef{}{command}{print\_simpset}\hypertarget{command.print-simpset}{\hyperlink{command.print-simpset}{\mbox{\isa{\isacommand{print{\isacharunderscore}simpset}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\
wenzelm@28788
   456
    \indexdef{}{attribute}{simp}\hypertarget{attribute.simp}{\hyperlink{attribute.simp}{\mbox{\isa{simp}}}} & : & \isa{attribute} \\
wenzelm@28788
   457
    \indexdef{}{attribute}{cong}\hypertarget{attribute.cong}{\hyperlink{attribute.cong}{\mbox{\isa{cong}}}} & : & \isa{attribute} \\
wenzelm@28788
   458
    \indexdef{}{attribute}{split}\hypertarget{attribute.split}{\hyperlink{attribute.split}{\mbox{\isa{split}}}} & : & \isa{attribute} \\
wenzelm@26782
   459
  \end{matharray}
wenzelm@26782
   460
wenzelm@26782
   461
  \begin{rail}
wenzelm@26782
   462
    ('simp' | 'cong' | 'split') (() | 'add' | 'del')
wenzelm@26782
   463
    ;
wenzelm@26782
   464
  \end{rail}
wenzelm@26782
   465
wenzelm@28788
   466
  \begin{description}
wenzelm@26782
   467
wenzelm@28788
   468
  \item \hyperlink{command.print-simpset}{\mbox{\isa{\isacommand{print{\isacharunderscore}simpset}}}} prints the collection of rules
wenzelm@26782
   469
  declared to the Simplifier, which is also known as ``simpset''
wenzelm@26782
   470
  internally \cite{isabelle-ref}.
wenzelm@26782
   471
wenzelm@28788
   472
  \item \hyperlink{attribute.simp}{\mbox{\isa{simp}}} declares simplification rules.
wenzelm@26782
   473
wenzelm@28788
   474
  \item \hyperlink{attribute.cong}{\mbox{\isa{cong}}} declares congruence rules.
wenzelm@26782
   475
wenzelm@28788
   476
  \item \hyperlink{attribute.split}{\mbox{\isa{split}}} declares case split rules.
wenzelm@26782
   477
wenzelm@28788
   478
  \end{description}%
wenzelm@26782
   479
\end{isamarkuptext}%
wenzelm@26782
   480
\isamarkuptrue%
wenzelm@26782
   481
%
wenzelm@27042
   482
\isamarkupsubsection{Simplification procedures%
wenzelm@26782
   483
}
wenzelm@26782
   484
\isamarkuptrue%
wenzelm@26782
   485
%
wenzelm@26782
   486
\begin{isamarkuptext}%
wenzelm@26782
   487
\begin{matharray}{rcl}
wenzelm@28788
   488
    \indexdef{}{command}{simproc\_setup}\hypertarget{command.simproc-setup}{\hyperlink{command.simproc-setup}{\mbox{\isa{\isacommand{simproc{\isacharunderscore}setup}}}}} & : & \isa{{\isachardoublequote}local{\isacharunderscore}theory\ {\isasymrightarrow}\ local{\isacharunderscore}theory{\isachardoublequote}} \\
wenzelm@28788
   489
    simproc & : & \isa{attribute} \\
wenzelm@26782
   490
  \end{matharray}
wenzelm@26782
   491
wenzelm@26782
   492
  \begin{rail}
wenzelm@40255
   493
    'simproc_setup' name '(' (term + '|') ')' '=' text \\ ('identifier' (nameref+))?
wenzelm@26782
   494
    ;
wenzelm@26782
   495
wenzelm@26782
   496
    'simproc' (('add' ':')? | 'del' ':') (name+)
wenzelm@26782
   497
    ;
wenzelm@26782
   498
  \end{rail}
wenzelm@26782
   499
wenzelm@28788
   500
  \begin{description}
wenzelm@26782
   501
wenzelm@28788
   502
  \item \hyperlink{command.simproc-setup}{\mbox{\isa{\isacommand{simproc{\isacharunderscore}setup}}}} defines a named simplification
wenzelm@26782
   503
  procedure that is invoked by the Simplifier whenever any of the
wenzelm@26782
   504
  given term patterns match the current redex.  The implementation,
wenzelm@30269
   505
  which is provided as ML source text, needs to be of type \verb|morphism -> simpset -> cterm -> thm option|, where the \verb|cterm| represents the current redex \isa{r} and the result is
wenzelm@26842
   506
  supposed to be some proven rewrite rule \isa{{\isachardoublequote}r\ {\isasymequiv}\ r{\isacharprime}{\isachardoublequote}} (or a
wenzelm@26782
   507
  generalized version), or \verb|NONE| to indicate failure.  The
wenzelm@26782
   508
  \verb|simpset| argument holds the full context of the current
wenzelm@26782
   509
  Simplifier invocation, including the actual Isar proof context.  The
wenzelm@26782
   510
  \verb|morphism| informs about the difference of the original
wenzelm@26782
   511
  compilation context wrt.\ the one of the actual application later
wenzelm@26902
   512
  on.  The optional \hyperlink{keyword.identifier}{\mbox{\isa{\isakeyword{identifier}}}} specifies theorems that
wenzelm@26782
   513
  represent the logical content of the abstract theory of this
wenzelm@26782
   514
  simproc.
wenzelm@26782
   515
wenzelm@26782
   516
  Morphisms and identifiers are only relevant for simprocs that are
wenzelm@26782
   517
  defined within a local target context, e.g.\ in a locale.
wenzelm@26782
   518
wenzelm@28788
   519
  \item \isa{{\isachardoublequote}simproc\ add{\isacharcolon}\ name{\isachardoublequote}} and \isa{{\isachardoublequote}simproc\ del{\isacharcolon}\ name{\isachardoublequote}}
wenzelm@26782
   520
  add or delete named simprocs to the current Simplifier context.  The
wenzelm@26907
   521
  default is to add a simproc.  Note that \hyperlink{command.simproc-setup}{\mbox{\isa{\isacommand{simproc{\isacharunderscore}setup}}}}
wenzelm@26782
   522
  already adds the new simproc to the subsequent context.
wenzelm@26782
   523
wenzelm@28788
   524
  \end{description}%
wenzelm@26782
   525
\end{isamarkuptext}%
wenzelm@26782
   526
\isamarkuptrue%
wenzelm@26782
   527
%
wenzelm@27042
   528
\isamarkupsubsection{Forward simplification%
wenzelm@26782
   529
}
wenzelm@26782
   530
\isamarkuptrue%
wenzelm@26782
   531
%
wenzelm@26782
   532
\begin{isamarkuptext}%
wenzelm@26782
   533
\begin{matharray}{rcl}
wenzelm@28788
   534
    \indexdef{}{attribute}{simplified}\hypertarget{attribute.simplified}{\hyperlink{attribute.simplified}{\mbox{\isa{simplified}}}} & : & \isa{attribute} \\
wenzelm@26782
   535
  \end{matharray}
wenzelm@26782
   536
wenzelm@26782
   537
  \begin{rail}
wenzelm@26782
   538
    'simplified' opt? thmrefs?
wenzelm@26782
   539
    ;
wenzelm@26782
   540
wenzelm@40255
   541
    opt: '(' ('no_asm' | 'no_asm_simp' | 'no_asm_use') ')'
wenzelm@26782
   542
    ;
wenzelm@26782
   543
  \end{rail}
wenzelm@26782
   544
wenzelm@28788
   545
  \begin{description}
wenzelm@26782
   546
  
wenzelm@28788
   547
  \item \hyperlink{attribute.simplified}{\mbox{\isa{simplified}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}} causes a theorem to
wenzelm@28788
   548
  be simplified, either by exactly the specified rules \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}}, or the implicit Simplifier context if no arguments are given.
wenzelm@28788
   549
  The result is fully simplified by default, including assumptions and
wenzelm@28788
   550
  conclusion; the options \isa{no{\isacharunderscore}asm} etc.\ tune the Simplifier in
wenzelm@28788
   551
  the same way as the for the \isa{simp} method.
wenzelm@26782
   552
wenzelm@26782
   553
  Note that forward simplification restricts the simplifier to its
wenzelm@26782
   554
  most basic operation of term rewriting; solver and looper tactics
wenzelm@26782
   555
  \cite{isabelle-ref} are \emph{not} involved here.  The \isa{simplified} attribute should be only rarely required under normal
wenzelm@26782
   556
  circumstances.
wenzelm@26782
   557
wenzelm@28788
   558
  \end{description}%
wenzelm@26782
   559
\end{isamarkuptext}%
wenzelm@26782
   560
\isamarkuptrue%
wenzelm@26782
   561
%
wenzelm@27042
   562
\isamarkupsection{The Classical Reasoner \label{sec:classical}%
wenzelm@26782
   563
}
wenzelm@26782
   564
\isamarkuptrue%
wenzelm@26782
   565
%
wenzelm@27042
   566
\isamarkupsubsection{Basic methods%
wenzelm@26782
   567
}
wenzelm@26782
   568
\isamarkuptrue%
wenzelm@26782
   569
%
wenzelm@26782
   570
\begin{isamarkuptext}%
wenzelm@26782
   571
\begin{matharray}{rcl}
wenzelm@28788
   572
    \indexdef{}{method}{rule}\hypertarget{method.rule}{\hyperlink{method.rule}{\mbox{\isa{rule}}}} & : & \isa{method} \\
wenzelm@28788
   573
    \indexdef{}{method}{contradiction}\hypertarget{method.contradiction}{\hyperlink{method.contradiction}{\mbox{\isa{contradiction}}}} & : & \isa{method} \\
wenzelm@28788
   574
    \indexdef{}{method}{intro}\hypertarget{method.intro}{\hyperlink{method.intro}{\mbox{\isa{intro}}}} & : & \isa{method} \\
wenzelm@28788
   575
    \indexdef{}{method}{elim}\hypertarget{method.elim}{\hyperlink{method.elim}{\mbox{\isa{elim}}}} & : & \isa{method} \\
wenzelm@26782
   576
  \end{matharray}
wenzelm@26782
   577
wenzelm@26782
   578
  \begin{rail}
wenzelm@26782
   579
    ('rule' | 'intro' | 'elim') thmrefs?
wenzelm@26782
   580
    ;
wenzelm@26782
   581
  \end{rail}
wenzelm@26782
   582
wenzelm@28788
   583
  \begin{description}
wenzelm@26782
   584
wenzelm@28788
   585
  \item \hyperlink{method.rule}{\mbox{\isa{rule}}} as offered by the Classical Reasoner is a
wenzelm@26782
   586
  refinement over the primitive one (see \secref{sec:pure-meth-att}).
wenzelm@26782
   587
  Both versions essentially work the same, but the classical version
wenzelm@26782
   588
  observes the classical rule context in addition to that of
wenzelm@26782
   589
  Isabelle/Pure.
wenzelm@26782
   590
wenzelm@26782
   591
  Common object logics (HOL, ZF, etc.) declare a rich collection of
wenzelm@26782
   592
  classical rules (even if these would qualify as intuitionistic
wenzelm@26782
   593
  ones), but only few declarations to the rule context of
wenzelm@26782
   594
  Isabelle/Pure (\secref{sec:pure-meth-att}).
wenzelm@26782
   595
wenzelm@28788
   596
  \item \hyperlink{method.contradiction}{\mbox{\isa{contradiction}}} solves some goal by contradiction,
wenzelm@26842
   597
  deriving any result from both \isa{{\isachardoublequote}{\isasymnot}\ A{\isachardoublequote}} and \isa{A}.  Chained
wenzelm@26782
   598
  facts, which are guaranteed to participate, may appear in either
wenzelm@26782
   599
  order.
wenzelm@26782
   600
wenzelm@28788
   601
  \item \hyperlink{method.intro}{\mbox{\isa{intro}}} and \hyperlink{method.elim}{\mbox{\isa{elim}}} repeatedly refine some goal
wenzelm@28788
   602
  by intro- or elim-resolution, after having inserted any chained
wenzelm@26902
   603
  facts.  Exactly the rules given as arguments are taken into account;
wenzelm@26902
   604
  this allows fine-tuned decomposition of a proof problem, in contrast
wenzelm@26902
   605
  to common automated tools.
wenzelm@26782
   606
wenzelm@28788
   607
  \end{description}%
wenzelm@26782
   608
\end{isamarkuptext}%
wenzelm@26782
   609
\isamarkuptrue%
wenzelm@26782
   610
%
wenzelm@27042
   611
\isamarkupsubsection{Automated methods%
wenzelm@26782
   612
}
wenzelm@26782
   613
\isamarkuptrue%
wenzelm@26782
   614
%
wenzelm@26782
   615
\begin{isamarkuptext}%
wenzelm@26782
   616
\begin{matharray}{rcl}
wenzelm@28788
   617
    \indexdef{}{method}{blast}\hypertarget{method.blast}{\hyperlink{method.blast}{\mbox{\isa{blast}}}} & : & \isa{method} \\
wenzelm@28788
   618
    \indexdef{}{method}{fast}\hypertarget{method.fast}{\hyperlink{method.fast}{\mbox{\isa{fast}}}} & : & \isa{method} \\
wenzelm@28788
   619
    \indexdef{}{method}{slow}\hypertarget{method.slow}{\hyperlink{method.slow}{\mbox{\isa{slow}}}} & : & \isa{method} \\
wenzelm@28788
   620
    \indexdef{}{method}{best}\hypertarget{method.best}{\hyperlink{method.best}{\mbox{\isa{best}}}} & : & \isa{method} \\
wenzelm@28788
   621
    \indexdef{}{method}{safe}\hypertarget{method.safe}{\hyperlink{method.safe}{\mbox{\isa{safe}}}} & : & \isa{method} \\
wenzelm@28788
   622
    \indexdef{}{method}{clarify}\hypertarget{method.clarify}{\hyperlink{method.clarify}{\mbox{\isa{clarify}}}} & : & \isa{method} \\
wenzelm@26782
   623
  \end{matharray}
wenzelm@26782
   624
wenzelm@26782
   625
  \indexouternonterm{clamod}
wenzelm@26782
   626
  \begin{rail}
wenzelm@35613
   627
    'blast' nat? (clamod *)
wenzelm@26782
   628
    ;
wenzelm@35613
   629
    ('fast' | 'slow' | 'best' | 'safe' | 'clarify') (clamod *)
wenzelm@26782
   630
    ;
wenzelm@26782
   631
wenzelm@26782
   632
    clamod: (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del') ':' thmrefs
wenzelm@26782
   633
    ;
wenzelm@26782
   634
  \end{rail}
wenzelm@26782
   635
wenzelm@28788
   636
  \begin{description}
wenzelm@26782
   637
wenzelm@28788
   638
  \item \hyperlink{method.blast}{\mbox{\isa{blast}}} refers to the classical tableau prover (see
wenzelm@30397
   639
  \verb|blast_tac| in \cite{isabelle-ref}).  The optional argument
wenzelm@30397
   640
  specifies a user-supplied search bound (default 20).
wenzelm@26782
   641
wenzelm@28788
   642
  \item \hyperlink{method.fast}{\mbox{\isa{fast}}}, \hyperlink{method.slow}{\mbox{\isa{slow}}}, \hyperlink{method.best}{\mbox{\isa{best}}}, \hyperlink{method.safe}{\mbox{\isa{safe}}}, and \hyperlink{method.clarify}{\mbox{\isa{clarify}}} refer to the generic classical
wenzelm@30397
   643
  reasoner.  See \verb|fast_tac|, \verb|slow_tac|, \verb|best_tac|, \verb|safe_tac|, and \verb|clarify_tac| in \cite{isabelle-ref} for more
wenzelm@30397
   644
  information.
wenzelm@26782
   645
wenzelm@28788
   646
  \end{description}
wenzelm@26782
   647
wenzelm@26782
   648
  Any of the above methods support additional modifiers of the context
wenzelm@26782
   649
  of classical rules.  Their semantics is analogous to the attributes
wenzelm@26782
   650
  given before.  Facts provided by forward chaining are inserted into
wenzelm@35613
   651
  the goal before commencing proof search.%
wenzelm@26782
   652
\end{isamarkuptext}%
wenzelm@26782
   653
\isamarkuptrue%
wenzelm@26782
   654
%
wenzelm@27042
   655
\isamarkupsubsection{Combined automated methods \label{sec:clasimp}%
wenzelm@26782
   656
}
wenzelm@26782
   657
\isamarkuptrue%
wenzelm@26782
   658
%
wenzelm@26782
   659
\begin{isamarkuptext}%
wenzelm@26782
   660
\begin{matharray}{rcl}
wenzelm@28788
   661
    \indexdef{}{method}{auto}\hypertarget{method.auto}{\hyperlink{method.auto}{\mbox{\isa{auto}}}} & : & \isa{method} \\
wenzelm@28788
   662
    \indexdef{}{method}{force}\hypertarget{method.force}{\hyperlink{method.force}{\mbox{\isa{force}}}} & : & \isa{method} \\
wenzelm@28788
   663
    \indexdef{}{method}{clarsimp}\hypertarget{method.clarsimp}{\hyperlink{method.clarsimp}{\mbox{\isa{clarsimp}}}} & : & \isa{method} \\
wenzelm@28788
   664
    \indexdef{}{method}{fastsimp}\hypertarget{method.fastsimp}{\hyperlink{method.fastsimp}{\mbox{\isa{fastsimp}}}} & : & \isa{method} \\
wenzelm@28788
   665
    \indexdef{}{method}{slowsimp}\hypertarget{method.slowsimp}{\hyperlink{method.slowsimp}{\mbox{\isa{slowsimp}}}} & : & \isa{method} \\
wenzelm@28788
   666
    \indexdef{}{method}{bestsimp}\hypertarget{method.bestsimp}{\hyperlink{method.bestsimp}{\mbox{\isa{bestsimp}}}} & : & \isa{method} \\
wenzelm@26782
   667
  \end{matharray}
wenzelm@26782
   668
wenzelm@26782
   669
  \indexouternonterm{clasimpmod}
wenzelm@26782
   670
  \begin{rail}
wenzelm@35613
   671
    'auto' (nat nat)? (clasimpmod *)
wenzelm@26782
   672
    ;
wenzelm@35613
   673
    ('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') (clasimpmod *)
wenzelm@26782
   674
    ;
wenzelm@26782
   675
wenzelm@26782
   676
    clasimpmod: ('simp' (() | 'add' | 'del' | 'only') |
wenzelm@26782
   677
      ('cong' | 'split') (() | 'add' | 'del') |
wenzelm@26782
   678
      'iff' (((() | 'add') '?'?) | 'del') |
wenzelm@26782
   679
      (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del')) ':' thmrefs
wenzelm@26782
   680
  \end{rail}
wenzelm@26782
   681
wenzelm@28788
   682
  \begin{description}
wenzelm@26782
   683
wenzelm@28788
   684
  \item \hyperlink{method.auto}{\mbox{\isa{auto}}}, \hyperlink{method.force}{\mbox{\isa{force}}}, \hyperlink{method.clarsimp}{\mbox{\isa{clarsimp}}}, \hyperlink{method.fastsimp}{\mbox{\isa{fastsimp}}}, \hyperlink{method.slowsimp}{\mbox{\isa{slowsimp}}}, and \hyperlink{method.bestsimp}{\mbox{\isa{bestsimp}}} provide access
wenzelm@28788
   685
  to Isabelle's combined simplification and classical reasoning
wenzelm@26782
   686
  tactics.  These correspond to \verb|auto_tac|, \verb|force_tac|, \verb|clarsimp_tac|, and Classical Reasoner tactics with the Simplifier
wenzelm@30397
   687
  added as wrapper, see \cite{isabelle-ref} for more information.  The
wenzelm@30397
   688
  modifier arguments correspond to those given in
wenzelm@26782
   689
  \secref{sec:simplifier} and \secref{sec:classical}.  Just note that
wenzelm@26782
   690
  the ones related to the Simplifier are prefixed by \railtterm{simp}
wenzelm@26782
   691
  here.
wenzelm@26782
   692
wenzelm@26782
   693
  Facts provided by forward chaining are inserted into the goal before
wenzelm@35613
   694
  doing the search.
wenzelm@26782
   695
wenzelm@28788
   696
  \end{description}%
wenzelm@26782
   697
\end{isamarkuptext}%
wenzelm@26782
   698
\isamarkuptrue%
wenzelm@26782
   699
%
wenzelm@27042
   700
\isamarkupsubsection{Declaring rules%
wenzelm@26782
   701
}
wenzelm@26782
   702
\isamarkuptrue%
wenzelm@26782
   703
%
wenzelm@26782
   704
\begin{isamarkuptext}%
wenzelm@26782
   705
\begin{matharray}{rcl}
wenzelm@28788
   706
    \indexdef{}{command}{print\_claset}\hypertarget{command.print-claset}{\hyperlink{command.print-claset}{\mbox{\isa{\isacommand{print{\isacharunderscore}claset}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isa{{\isachardoublequote}context\ {\isasymrightarrow}{\isachardoublequote}} \\
wenzelm@28788
   707
    \indexdef{}{attribute}{intro}\hypertarget{attribute.intro}{\hyperlink{attribute.intro}{\mbox{\isa{intro}}}} & : & \isa{attribute} \\
wenzelm@28788
   708
    \indexdef{}{attribute}{elim}\hypertarget{attribute.elim}{\hyperlink{attribute.elim}{\mbox{\isa{elim}}}} & : & \isa{attribute} \\
wenzelm@28788
   709
    \indexdef{}{attribute}{dest}\hypertarget{attribute.dest}{\hyperlink{attribute.dest}{\mbox{\isa{dest}}}} & : & \isa{attribute} \\
wenzelm@28788
   710
    \indexdef{}{attribute}{rule}\hypertarget{attribute.rule}{\hyperlink{attribute.rule}{\mbox{\isa{rule}}}} & : & \isa{attribute} \\
wenzelm@28788
   711
    \indexdef{}{attribute}{iff}\hypertarget{attribute.iff}{\hyperlink{attribute.iff}{\mbox{\isa{iff}}}} & : & \isa{attribute} \\
wenzelm@26782
   712
  \end{matharray}
wenzelm@26782
   713
wenzelm@26782
   714
  \begin{rail}
wenzelm@26782
   715
    ('intro' | 'elim' | 'dest') ('!' | () | '?') nat?
wenzelm@26782
   716
    ;
wenzelm@26782
   717
    'rule' 'del'
wenzelm@26782
   718
    ;
wenzelm@26782
   719
    'iff' (((() | 'add') '?'?) | 'del')
wenzelm@26782
   720
    ;
wenzelm@26782
   721
  \end{rail}
wenzelm@26782
   722
wenzelm@28788
   723
  \begin{description}
wenzelm@26782
   724
wenzelm@28788
   725
  \item \hyperlink{command.print-claset}{\mbox{\isa{\isacommand{print{\isacharunderscore}claset}}}} prints the collection of rules
wenzelm@26782
   726
  declared to the Classical Reasoner, which is also known as
wenzelm@26782
   727
  ``claset'' internally \cite{isabelle-ref}.
wenzelm@26782
   728
  
wenzelm@28788
   729
  \item \hyperlink{attribute.intro}{\mbox{\isa{intro}}}, \hyperlink{attribute.elim}{\mbox{\isa{elim}}}, and \hyperlink{attribute.dest}{\mbox{\isa{dest}}}
wenzelm@26782
   730
  declare introduction, elimination, and destruction rules,
wenzelm@26782
   731
  respectively.  By default, rules are considered as \emph{unsafe}
wenzelm@26842
   732
  (i.e.\ not applied blindly without backtracking), while ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' classifies as \emph{safe}.  Rule declarations marked by
wenzelm@26842
   733
  ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'' coincide with those of Isabelle/Pure, cf.\
wenzelm@26782
   734
  \secref{sec:pure-meth-att} (i.e.\ are only applied in single steps
wenzelm@26902
   735
  of the \hyperlink{method.rule}{\mbox{\isa{rule}}} method).  The optional natural number
wenzelm@26782
   736
  specifies an explicit weight argument, which is ignored by automated
wenzelm@26782
   737
  tools, but determines the search order of single rule steps.
wenzelm@26782
   738
wenzelm@28788
   739
  \item \hyperlink{attribute.rule}{\mbox{\isa{rule}}}~\isa{del} deletes introduction,
wenzelm@26782
   740
  elimination, or destruction rules from the context.
wenzelm@26782
   741
wenzelm@28788
   742
  \item \hyperlink{attribute.iff}{\mbox{\isa{iff}}} declares logical equivalences to the
wenzelm@26782
   743
  Simplifier and the Classical reasoner at the same time.
wenzelm@26782
   744
  Non-conditional rules result in a ``safe'' introduction and
wenzelm@26782
   745
  elimination pair; conditional ones are considered ``unsafe''.  Rules
wenzelm@26842
   746
  with negative conclusion are automatically inverted (using \isa{{\isachardoublequote}{\isasymnot}{\isachardoublequote}}-elimination internally).
wenzelm@26782
   747
wenzelm@26902
   748
  The ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'' version of \hyperlink{attribute.iff}{\mbox{\isa{iff}}} declares rules to
wenzelm@26782
   749
  the Isabelle/Pure context only, and omits the Simplifier
wenzelm@26782
   750
  declaration.
wenzelm@26782
   751
wenzelm@28788
   752
  \end{description}%
wenzelm@26782
   753
\end{isamarkuptext}%
wenzelm@26782
   754
\isamarkuptrue%
wenzelm@26782
   755
%
wenzelm@27042
   756
\isamarkupsubsection{Classical operations%
wenzelm@26782
   757
}
wenzelm@26782
   758
\isamarkuptrue%
wenzelm@26782
   759
%
wenzelm@26782
   760
\begin{isamarkuptext}%
wenzelm@26782
   761
\begin{matharray}{rcl}
wenzelm@28788
   762
    \indexdef{}{attribute}{swapped}\hypertarget{attribute.swapped}{\hyperlink{attribute.swapped}{\mbox{\isa{swapped}}}} & : & \isa{attribute} \\
wenzelm@26782
   763
  \end{matharray}
wenzelm@26782
   764
wenzelm@28788
   765
  \begin{description}
wenzelm@26782
   766
wenzelm@28788
   767
  \item \hyperlink{attribute.swapped}{\mbox{\isa{swapped}}} turns an introduction rule into an
wenzelm@26842
   768
  elimination, by resolving with the classical swap principle \isa{{\isachardoublequote}{\isacharparenleft}{\isasymnot}\ B\ {\isasymLongrightarrow}\ A{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isasymnot}\ A\ {\isasymLongrightarrow}\ B{\isacharparenright}{\isachardoublequote}}.
wenzelm@26782
   769
wenzelm@28788
   770
  \end{description}%
wenzelm@26782
   771
\end{isamarkuptext}%
wenzelm@26782
   772
\isamarkuptrue%
wenzelm@26782
   773
%
wenzelm@27047
   774
\isamarkupsection{Object-logic setup \label{sec:object-logic}%
wenzelm@26790
   775
}
wenzelm@26790
   776
\isamarkuptrue%
wenzelm@26790
   777
%
wenzelm@26790
   778
\begin{isamarkuptext}%
wenzelm@26790
   779
\begin{matharray}{rcl}
wenzelm@28788
   780
    \indexdef{}{command}{judgment}\hypertarget{command.judgment}{\hyperlink{command.judgment}{\mbox{\isa{\isacommand{judgment}}}}} & : & \isa{{\isachardoublequote}theory\ {\isasymrightarrow}\ theory{\isachardoublequote}} \\
wenzelm@28788
   781
    \indexdef{}{method}{atomize}\hypertarget{method.atomize}{\hyperlink{method.atomize}{\mbox{\isa{atomize}}}} & : & \isa{method} \\
wenzelm@28788
   782
    \indexdef{}{attribute}{atomize}\hypertarget{attribute.atomize}{\hyperlink{attribute.atomize}{\mbox{\isa{atomize}}}} & : & \isa{attribute} \\
wenzelm@28788
   783
    \indexdef{}{attribute}{rule\_format}\hypertarget{attribute.rule-format}{\hyperlink{attribute.rule-format}{\mbox{\isa{rule{\isacharunderscore}format}}}} & : & \isa{attribute} \\
wenzelm@28788
   784
    \indexdef{}{attribute}{rulify}\hypertarget{attribute.rulify}{\hyperlink{attribute.rulify}{\mbox{\isa{rulify}}}} & : & \isa{attribute} \\
wenzelm@26790
   785
  \end{matharray}
wenzelm@26790
   786
wenzelm@26790
   787
  The very starting point for any Isabelle object-logic is a ``truth
wenzelm@26790
   788
  judgment'' that links object-level statements to the meta-logic
wenzelm@26790
   789
  (with its minimal language of \isa{prop} that covers universal
wenzelm@26842
   790
  quantification \isa{{\isachardoublequote}{\isasymAnd}{\isachardoublequote}} and implication \isa{{\isachardoublequote}{\isasymLongrightarrow}{\isachardoublequote}}).
wenzelm@26790
   791
wenzelm@26790
   792
  Common object-logics are sufficiently expressive to internalize rule
wenzelm@26842
   793
  statements over \isa{{\isachardoublequote}{\isasymAnd}{\isachardoublequote}} and \isa{{\isachardoublequote}{\isasymLongrightarrow}{\isachardoublequote}} within their own
wenzelm@26790
   794
  language.  This is useful in certain situations where a rule needs
wenzelm@26790
   795
  to be viewed as an atomic statement from the meta-level perspective,
wenzelm@26842
   796
  e.g.\ \isa{{\isachardoublequote}{\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ A\ {\isasymLongrightarrow}\ P\ x{\isachardoublequote}} versus \isa{{\isachardoublequote}{\isasymforall}x\ {\isasymin}\ A{\isachardot}\ P\ x{\isachardoublequote}}.
wenzelm@26790
   797
wenzelm@26902
   798
  From the following language elements, only the \hyperlink{method.atomize}{\mbox{\isa{atomize}}}
wenzelm@26907
   799
  method and \hyperlink{attribute.rule-format}{\mbox{\isa{rule{\isacharunderscore}format}}} attribute are occasionally
wenzelm@26790
   800
  required by end-users, the rest is for those who need to setup their
wenzelm@26790
   801
  own object-logic.  In the latter case existing formulations of
wenzelm@26790
   802
  Isabelle/FOL or Isabelle/HOL may be taken as realistic examples.
wenzelm@26790
   803
wenzelm@26790
   804
  Generic tools may refer to the information provided by object-logic
wenzelm@26790
   805
  declarations internally.
wenzelm@26790
   806
wenzelm@26790
   807
  \begin{rail}
wenzelm@26790
   808
    'judgment' constdecl
wenzelm@26790
   809
    ;
wenzelm@26790
   810
    'atomize' ('(' 'full' ')')?
wenzelm@26790
   811
    ;
wenzelm@40255
   812
    'rule_format' ('(' 'noasm' ')')?
wenzelm@26790
   813
    ;
wenzelm@26790
   814
  \end{rail}
wenzelm@26790
   815
wenzelm@28788
   816
  \begin{description}
wenzelm@26790
   817
  
wenzelm@28788
   818
  \item \hyperlink{command.judgment}{\mbox{\isa{\isacommand{judgment}}}}~\isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}\ {\isacharparenleft}mx{\isacharparenright}{\isachardoublequote}} declares constant
wenzelm@28788
   819
  \isa{c} as the truth judgment of the current object-logic.  Its
wenzelm@28788
   820
  type \isa{{\isasymsigma}} should specify a coercion of the category of
wenzelm@28788
   821
  object-level propositions to \isa{prop} of the Pure meta-logic;
wenzelm@28788
   822
  the mixfix annotation \isa{{\isachardoublequote}{\isacharparenleft}mx{\isacharparenright}{\isachardoublequote}} would typically just link the
wenzelm@28788
   823
  object language (internally of syntactic category \isa{logic})
wenzelm@28788
   824
  with that of \isa{prop}.  Only one \hyperlink{command.judgment}{\mbox{\isa{\isacommand{judgment}}}}
wenzelm@28788
   825
  declaration may be given in any theory development.
wenzelm@26790
   826
  
wenzelm@28788
   827
  \item \hyperlink{method.atomize}{\mbox{\isa{atomize}}} (as a method) rewrites any non-atomic
wenzelm@26790
   828
  premises of a sub-goal, using the meta-level equations declared via
wenzelm@26902
   829
  \hyperlink{attribute.atomize}{\mbox{\isa{atomize}}} (as an attribute) beforehand.  As a result,
wenzelm@26790
   830
  heavily nested goals become amenable to fundamental operations such
wenzelm@26902
   831
  as resolution (cf.\ the \hyperlink{method.rule}{\mbox{\isa{rule}}} method).  Giving the ``\isa{{\isachardoublequote}{\isacharparenleft}full{\isacharparenright}{\isachardoublequote}}'' option here means to turn the whole subgoal into an
wenzelm@26790
   832
  object-statement (if possible), including the outermost parameters
wenzelm@26790
   833
  and assumptions as well.
wenzelm@26790
   834
wenzelm@26902
   835
  A typical collection of \hyperlink{attribute.atomize}{\mbox{\isa{atomize}}} rules for a particular
wenzelm@26790
   836
  object-logic would provide an internalization for each of the
wenzelm@26842
   837
  connectives of \isa{{\isachardoublequote}{\isasymAnd}{\isachardoublequote}}, \isa{{\isachardoublequote}{\isasymLongrightarrow}{\isachardoublequote}}, and \isa{{\isachardoublequote}{\isasymequiv}{\isachardoublequote}}.
wenzelm@26790
   838
  Meta-level conjunction should be covered as well (this is
wenzelm@26790
   839
  particularly important for locales, see \secref{sec:locale}).
wenzelm@26790
   840
wenzelm@28788
   841
  \item \hyperlink{attribute.rule-format}{\mbox{\isa{rule{\isacharunderscore}format}}} rewrites a theorem by the equalities
wenzelm@28788
   842
  declared as \hyperlink{attribute.rulify}{\mbox{\isa{rulify}}} rules in the current object-logic.
wenzelm@28788
   843
  By default, the result is fully normalized, including assumptions
wenzelm@28788
   844
  and conclusions at any depth.  The \isa{{\isachardoublequote}{\isacharparenleft}no{\isacharunderscore}asm{\isacharparenright}{\isachardoublequote}} option
wenzelm@28788
   845
  restricts the transformation to the conclusion of a rule.
wenzelm@26790
   846
wenzelm@26907
   847
  In common object-logics (HOL, FOL, ZF), the effect of \hyperlink{attribute.rule-format}{\mbox{\isa{rule{\isacharunderscore}format}}} is to replace (bounded) universal quantification
wenzelm@26842
   848
  (\isa{{\isachardoublequote}{\isasymforall}{\isachardoublequote}}) and implication (\isa{{\isachardoublequote}{\isasymlongrightarrow}{\isachardoublequote}}) by the corresponding
wenzelm@26842
   849
  rule statements over \isa{{\isachardoublequote}{\isasymAnd}{\isachardoublequote}} and \isa{{\isachardoublequote}{\isasymLongrightarrow}{\isachardoublequote}}.
wenzelm@26790
   850
wenzelm@28788
   851
  \end{description}%
wenzelm@26790
   852
\end{isamarkuptext}%
wenzelm@26790
   853
\isamarkuptrue%
wenzelm@26790
   854
%
wenzelm@26782
   855
\isadelimtheory
wenzelm@26782
   856
%
wenzelm@26782
   857
\endisadelimtheory
wenzelm@26782
   858
%
wenzelm@26782
   859
\isatagtheory
wenzelm@26782
   860
\isacommand{end}\isamarkupfalse%
wenzelm@26782
   861
%
wenzelm@26782
   862
\endisatagtheory
wenzelm@26782
   863
{\isafoldtheory}%
wenzelm@26782
   864
%
wenzelm@26782
   865
\isadelimtheory
wenzelm@26782
   866
%
wenzelm@26782
   867
\endisadelimtheory
wenzelm@26782
   868
\isanewline
wenzelm@26782
   869
\end{isabellebody}%
wenzelm@26782
   870
%%% Local Variables:
wenzelm@26782
   871
%%% mode: latex
wenzelm@26782
   872
%%% TeX-master: "root"
wenzelm@26782
   873
%%% End: