doc-src/IsarRef/Thy/document/Proof.tex
author wenzelm
Thu, 15 May 2008 17:39:20 +0200
changeset 26902 8db1e960d636
parent 26895 d066f9db833b
child 26907 75466ad27dd7
permissions -rw-r--r--
updated generated file;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26869
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     1
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{Proof}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     4
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     5
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     6
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     7
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     8
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
     9
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    10
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    11
\isatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    12
\isacommand{theory}\isamarkupfalse%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    13
\ Proof\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    14
\isakeyword{imports}\ Main\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    15
\isakeyword{begin}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    16
\endisatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    17
{\isafoldtheory}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    18
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    19
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    20
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    21
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    22
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    23
\isamarkupchapter{Proofs%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    24
}
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    25
\isamarkuptrue%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
    26
%
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    27
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    28
Proof commands perform transitions of Isar/VM machine
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    29
  configurations, which are block-structured, consisting of a stack of
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    30
  nodes with three main components: logical proof context, current
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    31
  facts, and open goals.  Isar/VM transitions are \emph{typed}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    32
  according to the following three different modes of operation:
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    33
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    34
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    35
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    36
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}] means that a new goal has just been
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    37
  stated that is now to be \emph{proven}; the next command may refine
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    38
  it by some proof method, and enter a sub-proof to establish the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    39
  actual result.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    40
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    41
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}}] is like a nested theory mode: the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    42
  context may be augmented by \emph{stating} additional assumptions,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    43
  intermediate results etc.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    44
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    45
  \item [\isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}}] is intermediate between \isa{{\isachardoublequote}proof{\isacharparenleft}state{\isacharparenright}{\isachardoublequote}} and \isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}: existing facts (i.e.\
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    46
  the contents of the special ``\indexref{}{fact}{this}\hyperlink{fact.this}{\mbox{\isa{this}}}'' register) have been
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    47
  just picked up in order to be used when refining the goal claimed
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    48
  next.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    49
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    50
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    51
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    52
  The proof mode indicator may be read as a verb telling the writer
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    53
  what kind of operation may be performed next.  The corresponding
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    54
  typings of proof commands restricts the shape of well-formed proof
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    55
  texts to particular command sequences.  So dynamic arrangements of
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    56
  commands eventually turn out as static texts of a certain structure.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    57
  \Appref{ap:refcard} gives a simplified grammar of the overall
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    58
  (extensible) language emerging that way.%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    59
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    60
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    61
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    62
\isamarkupsection{Context elements \label{sec:proof-context}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    63
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    64
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    65
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    66
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    67
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    68
    \indexdef{}{command}{fix}\hypertarget{command.fix}{\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    69
    \indexdef{}{command}{assume}\hypertarget{command.assume}{\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    70
    \indexdef{}{command}{presume}\hypertarget{command.presume}{\hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    71
    \indexdef{}{command}{def}\hypertarget{command.def}{\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    72
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    73
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    74
  The logical proof context consists of fixed variables and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    75
  assumptions.  The former closely correspond to Skolem constants, or
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    76
  meta-level universal quantification as provided by the Isabelle/Pure
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    77
  logical framework.  Introducing some \emph{arbitrary, but fixed}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    78
  variable via ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}'' results in a local value
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    79
  that may be used in the subsequent proof as any other variable or
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    80
  constant.  Furthermore, any result \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} exported from
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    81
  the context will be universally closed wrt.\ \isa{x} at the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    82
  outermost level: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymAnd}x{\isachardot}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} (this is expressed in normal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    83
  form using Isabelle's meta-variables).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    84
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    85
  Similarly, introducing some assumption \isa{{\isasymchi}} has two effects.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    86
  On the one hand, a local theorem is created that may be used as a
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    87
  fact in subsequent proof steps.  On the other hand, any result
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    88
  \isa{{\isachardoublequote}{\isasymchi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} exported from the context becomes conditional wrt.\
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    89
  the assumption: \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymchi}\ {\isasymLongrightarrow}\ {\isasymphi}{\isachardoublequote}}.  Thus, solving an enclosing goal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    90
  using such a result would basically introduce a new subgoal stemming
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    91
  from the assumption.  How this situation is handled depends on the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    92
  version of assumption command used: while \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    93
  insists on solving the subgoal by unification with some premise of
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    94
  the goal, \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} leaves the subgoal unchanged in order
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    95
  to be proved later by the user.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    96
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
    97
  Local definitions, introduced by ``\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', are achieved by combining ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}'' with
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    98
  another version of assumption that causes any hypothetical equation
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
    99
  \isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}} to be eliminated by the reflexivity rule.  Thus,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   100
  exporting some result \isa{{\isachardoublequote}x\ {\isasymequiv}\ t\ {\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}{\isachardoublequote}} yields \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isacharbrackleft}t{\isacharbrackright}{\isachardoublequote}}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   101
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   102
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   103
    'fix' (vars + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   104
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   105
    ('assume' | 'presume') (props + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   106
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   107
    'def' (def + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   108
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   109
    def: thmdecl? \\ name ('==' | equiv) term termpat?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   110
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   111
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   112
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   113
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   114
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   115
  \item [\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}] introduces a local variable
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   116
  \isa{x} that is \emph{arbitrary, but fixed.}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   117
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   118
  \item [\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] introduce a local fact \isa{{\isachardoublequote}{\isasymphi}\ {\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} by
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   119
  assumption.  Subsequent results applied to an enclosing goal (e.g.\
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   120
  by \indexref{}{command}{show}\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}) are handled as follows: \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} expects to be able to unify with existing premises in the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   121
  goal, while \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} leaves \isa{{\isasymphi}} as new subgoals.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   122
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   123
  Several lists of assumptions may be given (separated by
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   124
  \indexref{}{keyword}{and}\hyperlink{keyword.and}{\mbox{\isa{\isakeyword{and}}}}; the resulting list of current facts consists
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   125
  of all of these concatenated.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   126
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   127
  \item [\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}] introduces a local
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   128
  (non-polymorphic) definition.  In results exported from the context,
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   129
  \isa{x} is replaced by \isa{t}.  Basically, ``\hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'' abbreviates ``\hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{x}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}x\ {\isasymequiv}\ t{\isachardoublequote}}'', with the resulting
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   130
  hypothetical equation solved by reflexivity.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   131
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   132
  The default name for the definitional equation is \isa{x{\isacharunderscore}def}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   133
  Several simultaneous definitions may be given at the same time.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   134
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   135
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   136
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   137
  The special name \indexref{}{fact}{prems}\hyperlink{fact.prems}{\mbox{\isa{prems}}} refers to all assumptions of the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   138
  current context as a list of theorems.  This feature should be used
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   139
  with great care!  It is better avoided in final proof texts.%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   140
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   141
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   142
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   143
\isamarkupsection{Facts and forward chaining%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   144
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   145
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   146
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   147
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   148
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   149
    \indexdef{}{command}{note}\hypertarget{command.note}{\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   150
    \indexdef{}{command}{then}\hypertarget{command.then}{\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}} & : & \isartrans{proof(state)}{proof(chain)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   151
    \indexdef{}{command}{from}\hypertarget{command.from}{\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}} & : & \isartrans{proof(state)}{proof(chain)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   152
    \indexdef{}{command}{with}\hypertarget{command.with}{\hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}}} & : & \isartrans{proof(state)}{proof(chain)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   153
    \indexdef{}{command}{using}\hypertarget{command.using}{\hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}} & : & \isartrans{proof(prove)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   154
    \indexdef{}{command}{unfolding}\hypertarget{command.unfolding}{\hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}}} & : & \isartrans{proof(prove)}{proof(prove)} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   155
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   156
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   157
  New facts are established either by assumption or proof of local
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   158
  statements.  Any fact will usually be involved in further proofs,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   159
  either as explicit arguments of proof methods, or when forward
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   160
  chaining towards the next goal via \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} (and variants);
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   161
  \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}} and \hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}} are composite forms
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   162
  involving \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}.  The \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}} elements
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   163
  augments the collection of used facts \emph{after} a goal has been
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   164
  stated.  Note that the special theorem name \indexref{}{fact}{this}\hyperlink{fact.this}{\mbox{\isa{this}}} refers
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   165
  to the most recently established facts, but only \emph{before}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   166
  issuing a follow-up claim.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   167
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   168
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   169
    'note' (thmdef? thmrefs + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   170
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   171
    ('from' | 'with' | 'using' | 'unfolding') (thmrefs + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   172
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   173
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   174
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   175
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   176
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   177
  \item [\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}a\ {\isacharequal}\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}]
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   178
  recalls existing facts \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ b\isactrlsub n{\isachardoublequote}}, binding
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   179
  the result as \isa{a}.  Note that attributes may be involved as
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   180
  well, both on the left and right hand sides.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   181
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   182
  \item [\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}] indicates forward chaining by the current
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   183
  facts in order to establish the goal to be claimed next.  The
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   184
  initial proof method invoked to refine that will be offered the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   185
  facts to do ``anything appropriate'' (see also
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   186
  \secref{sec:proof-steps}).  For example, method \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   187
  (see \secref{sec:pure-meth-att}) would typically do an elimination
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   188
  rather than an introduction.  Automatic methods usually insert the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   189
  facts into the goal state before operation.  This provides a simple
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   190
  scheme to control relevance of facts in automated proof search.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   191
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   192
  \item [\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{b}] abbreviates ``\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{b}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}''; thus \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}} is
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   193
  equivalent to ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   194
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   195
  \item [\hyperlink{command.with}{\mbox{\isa{\isacommand{with}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   196
  abbreviates ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n\ {\isasymAND}\ this{\isachardoublequote}}''; thus the forward chaining is from earlier facts together
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   197
  with the current ones.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   198
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   199
  \item [\hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}] augments
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   200
  the facts being currently indicated for use by a subsequent
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   201
  refinement step (such as \indexref{}{command}{apply}\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}} or \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   202
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   203
  \item [\hyperlink{command.unfolding}{\mbox{\isa{\isacommand{unfolding}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}] is
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   204
  structurally similar to \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}, but unfolds definitional
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   205
  equations \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}} throughout the goal state
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   206
  and facts.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   207
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   208
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   209
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   210
  Forward chaining with an empty list of theorems is the same as not
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   211
  chaining at all.  Thus ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{nothing}'' has no
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   212
  effect apart from entering \isa{{\isachardoublequote}prove{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode, since
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   213
  \indexref{}{fact}{nothing}\hyperlink{fact.nothing}{\mbox{\isa{nothing}}} is bound to the empty list of theorems.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   214
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   215
  Basic proof methods (such as \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}}) expect multiple
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   216
  facts to be given in their proper order, corresponding to a prefix
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   217
  of the premises of the rule involved.  Note that positions may be
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   218
  easily skipped using something like \hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{{\isachardoublequote}{\isacharunderscore}\ {\isasymAND}\ a\ {\isasymAND}\ b{\isachardoublequote}}, for example.  This involves the trivial rule
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   219
  \isa{{\isachardoublequote}PROP\ {\isasympsi}\ {\isasymLongrightarrow}\ PROP\ {\isasympsi}{\isachardoublequote}}, which is bound in Isabelle/Pure as
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   220
  ``\indexref{}{fact}{\_}\hyperlink{fact._}{\mbox{\isa{{\isacharunderscore}}}}'' (underscore).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   221
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   222
  Automated methods (such as \hyperlink{method.simp}{\mbox{\isa{simp}}} or \hyperlink{method.auto}{\mbox{\isa{auto}}}) just
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   223
  insert any given facts before their usual operation.  Depending on
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   224
  the kind of procedure involved, the order of facts is less
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   225
  significant here.%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   226
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   227
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   228
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   229
\isamarkupsection{Goal statements \label{sec:goals}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   230
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   231
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   232
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   233
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   234
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   235
    \indexdef{}{command}{lemma}\hypertarget{command.lemma}{\hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   236
    \indexdef{}{command}{theorem}\hypertarget{command.theorem}{\hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   237
    \indexdef{}{command}{corollary}\hypertarget{command.corollary}{\hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}} & : & \isartrans{local{\dsh}theory}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   238
    \indexdef{}{command}{have}\hypertarget{command.have}{\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   239
    \indexdef{}{command}{show}\hypertarget{command.show}{\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   240
    \indexdef{}{command}{hence}\hypertarget{command.hence}{\hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}}} & : & \isartrans{proof(state)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   241
    \indexdef{}{command}{thus}\hypertarget{command.thus}{\hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}}} & : & \isartrans{proof(state)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   242
    \indexdef{}{command}{print\_statement}\hypertarget{command.print_statement}{\hyperlink{command.print_statement}{\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   243
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   244
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   245
  From a theory context, proof mode is entered by an initial goal
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   246
  command such as \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}, \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}, or
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   247
  \hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}.  Within a proof, new claims may be
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   248
  introduced locally as well; four variants are available here to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   249
  indicate whether forward chaining of facts should be performed
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   250
  initially (via \indexref{}{command}{then}\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}), and whether the final result
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   251
  is meant to solve some pending goal.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   252
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   253
  Goals may consist of multiple statements, resulting in a list of
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   254
  facts eventually.  A pending multi-goal is internally represented as
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   255
  a meta-level conjunction (printed as \isa{{\isachardoublequote}{\isacharampersand}{\isacharampersand}{\isachardoublequote}}), which is usually
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   256
  split into the corresponding number of sub-goals prior to an initial
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   257
  method application, via \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   258
  (\secref{sec:proof-steps}) or \indexref{}{command}{apply}\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   259
  (\secref{sec:tactic-commands}).  The \indexref{}{method}{induct}\hyperlink{method.induct}{\mbox{\isa{induct}}} method
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   260
  covered in \secref{sec:cases-induct} acts on multiple claims
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   261
  simultaneously.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   262
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   263
  Claims at the theory level may be either in short or long form.  A
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   264
  short goal merely consists of several simultaneous propositions
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   265
  (often just one).  A long goal includes an explicit context
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   266
  specification for the subsequent conclusion, involving local
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   267
  parameters and assumptions.  Here the role of each part of the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   268
  statement is explicitly marked by separate keywords (see also
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   269
  \secref{sec:locale}); the local assumptions being introduced here
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   270
  are available as \indexref{}{fact}{assms}\hyperlink{fact.assms}{\mbox{\isa{assms}}} in the proof.  Moreover, there
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   271
  are two kinds of conclusions: \indexdef{}{element}{shows}\hypertarget{element.shows}{\hyperlink{element.shows}{\mbox{\isa{\isakeyword{shows}}}}} states several
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   272
  simultaneous propositions (essentially a big conjunction), while
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   273
  \indexdef{}{element}{obtains}\hypertarget{element.obtains}{\hyperlink{element.obtains}{\mbox{\isa{\isakeyword{obtains}}}}} claims several simultaneous simultaneous
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   274
  contexts of (essentially a big disjunction of eliminated parameters
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   275
  and assumptions, cf.\ \secref{sec:obtain}).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   276
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   277
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   278
    ('lemma' | 'theorem' | 'corollary') target? (goal | longgoal)
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   279
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   280
    ('have' | 'show' | 'hence' | 'thus') goal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   281
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   282
    'print\_statement' modes? thmrefs
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   283
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   284
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   285
    goal: (props + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   286
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   287
    longgoal: thmdecl? (contextelem *) conclusion
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   288
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   289
    conclusion: 'shows' goal | 'obtains' (parname? case + '|')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   290
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   291
    case: (vars + 'and') 'where' (props + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   292
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   293
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   294
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   295
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   296
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   297
  \item [\hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] enters proof mode with
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   298
  \isa{{\isasymphi}} as main goal, eventually resulting in some fact \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} to be put back into the target context.  An additional
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   299
  \railnonterm{context} specification may build up an initial proof
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   300
  context for the subsequent claim; this includes local definitions
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   301
  and syntax as well, see the definition of \hyperlink{syntax.contextelem}{\mbox{\isa{contextelem}}} in
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   302
  \secref{sec:locale}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   303
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   304
  \item [\hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} and \hyperlink{command.corollary}{\mbox{\isa{\isacommand{corollary}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] are essentially the same as \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}, but the facts are internally marked as
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   305
  being of a different kind.  This discrimination acts like a formal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   306
  comment.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   307
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   308
  \item [\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] claims a local goal,
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   309
  eventually resulting in a fact within the current logical context.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   310
  This operation is completely independent of any pending sub-goals of
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   311
  an enclosing goal statements, so \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} may be freely
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   312
  used for experimental exploration of potential results within a
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   313
  proof body.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   314
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   315
  \item [\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] is like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}} plus a second stage to refine some pending
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   316
  sub-goal for each one of the finished result, after having been
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   317
  exported into the corresponding context (at the head of the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   318
  sub-proof of this \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} command).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   319
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   320
  To accommodate interactive debugging, resulting rules are printed
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   321
  before being applied internally.  Even more, interactive execution
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   322
  of \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} predicts potential failure and displays the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   323
  resulting error as a warning beforehand.  Watch out for the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   324
  following message:
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   325
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   326
  %FIXME proper antiquitation
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   327
  \begin{ttbox}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   328
  Problem! Local statement will fail to solve any pending goal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   329
  \end{ttbox}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   330
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   331
  \item [\hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}}] abbreviates ``\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}'', i.e.\ claims a local goal to be proven by forward
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   332
  chaining the current facts.  Note that \hyperlink{command.hence}{\mbox{\isa{\isacommand{hence}}}} is also
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   333
  equivalent to ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   334
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   335
  \item [\hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}}] abbreviates ``\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}''.  Note that \hyperlink{command.thus}{\mbox{\isa{\isacommand{thus}}}} is also equivalent to
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   336
  ``\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{this}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   337
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   338
  \item [\hyperlink{command.print_statement}{\mbox{\isa{\isacommand{print{\isacharunderscore}statement}}}}~\isa{a}] prints facts from the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   339
  current theory or proof context in long statement form, according to
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   340
  the syntax for \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}} given above.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   341
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   342
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   343
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   344
  Any goal statement causes some term abbreviations (such as
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   345
  \indexref{}{variable}{?thesis}\hyperlink{variable.?thesis}{\mbox{\isa{{\isacharquery}thesis}}}) to be bound automatically, see also
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   346
  \secref{sec:term-abbrev}.  Furthermore, the local context of a
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   347
  (non-atomic) goal is provided via the \indexref{}{case}{rule\_context}\hyperlink{case.rule_context}{\mbox{\isa{rule{\isacharunderscore}context}}} case.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   348
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   349
  The optional case names of \indexref{}{element}{obtains}\hyperlink{element.obtains}{\mbox{\isa{\isakeyword{obtains}}}} have a twofold
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   350
  meaning: (1) during the of this claim they refer to the the local
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   351
  context introductions, (2) the resulting rule is annotated
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   352
  accordingly to support symbolic case splits when used with the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   353
  \indexref{}{method}{cases}\hyperlink{method.cases}{\mbox{\isa{cases}}} method (cf.  \secref{sec:cases-induct}).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   354
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   355
  \medskip
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   356
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   357
  \begin{warn}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   358
    Isabelle/Isar suffers theory-level goal statements to contain
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   359
    \emph{unbound schematic variables}, although this does not conform
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   360
    to the aim of human-readable proof documents!  The main problem
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   361
    with schematic goals is that the actual outcome is usually hard to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   362
    predict, depending on the behavior of the proof methods applied
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   363
    during the course of reasoning.  Note that most semi-automated
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   364
    methods heavily depend on several kinds of implicit rule
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   365
    declarations within the current theory context.  As this would
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   366
    also result in non-compositional checking of sub-proofs,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   367
    \emph{local goals} are not allowed to be schematic at all.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   368
    Nevertheless, schematic goals do have their use in Prolog-style
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   369
    interactive synthesis of proven results, usually by stepwise
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   370
    refinement via emulation of traditional Isabelle tactic scripts
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   371
    (see also \secref{sec:tactic-commands}).  In any case, users
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   372
    should know what they are doing.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   373
  \end{warn}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   374
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   375
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   376
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   377
\isamarkupsection{Initial and terminal proof steps \label{sec:proof-steps}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   378
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   379
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   380
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   381
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   382
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   383
    \indexdef{}{command}{proof}\hypertarget{command.proof}{\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}} & : & \isartrans{proof(prove)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   384
    \indexdef{}{command}{qed}\hypertarget{command.qed}{\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   385
    \indexdef{}{command}{by}\hypertarget{command.by}{\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   386
    \indexdef{}{command}{..}\hypertarget{command.ddot}{\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   387
    \indexdef{}{command}{.}\hypertarget{command.dot}{\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   388
    \indexdef{}{command}{sorry}\hypertarget{command.sorry}{\hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}}} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   389
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   390
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   391
  Arbitrary goal refinement via tactics is considered harmful.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   392
  Structured proof composition in Isar admits proof methods to be
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   393
  invoked in two places only.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   394
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   395
  \begin{enumerate}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   396
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   397
  \item An \emph{initial} refinement step \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} reduces a newly stated goal to a number
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   398
  of sub-goals that are to be solved later.  Facts are passed to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   399
  \isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} for forward chaining, if so indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   400
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   401
  \item A \emph{terminal} conclusion step \indexref{}{command}{qed}\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} is intended to solve remaining goals.  No facts are
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   402
  passed to \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   403
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   404
  \end{enumerate}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   405
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   406
  The only other (proper) way to affect pending goals in a proof body
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   407
  is by \indexref{}{command}{show}\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}, which involves an explicit statement of
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   408
  what is to be solved eventually.  Thus we avoid the fundamental
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   409
  problem of unstructured tactic scripts that consist of numerous
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   410
  consecutive goal transformations, with invisible effects.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   411
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   412
  \medskip As a general rule of thumb for good proof style, initial
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   413
  proof methods should either solve the goal completely, or constitute
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   414
  some well-understood reduction to new sub-goals.  Arbitrary
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   415
  automatic proof tools that are prone leave a large number of badly
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   416
  structured sub-goals are no help in continuing the proof document in
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   417
  an intelligible manner.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   418
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   419
  Unless given explicitly by the user, the default initial method is
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   420
  ``\indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}}'', which applies a single standard elimination
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   421
  or introduction rule according to the topmost symbol involved.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   422
  There is no separate default terminal method.  Any remaining goals
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   423
  are always solved by assumption in the very last step.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   424
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   425
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   426
    'proof' method?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   427
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   428
    'qed' method?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   429
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   430
    'by' method method?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   431
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   432
    ('.' | '..' | 'sorry')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   433
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   434
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   435
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   436
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   437
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   438
  \item [\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}] refines the goal by
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   439
  proof method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}; facts for forward chaining are
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   440
  passed if so indicated by \isa{{\isachardoublequote}proof{\isacharparenleft}chain{\isacharparenright}{\isachardoublequote}} mode.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   441
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   442
  \item [\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}] refines any remaining
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   443
  goals by proof method \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} and concludes the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   444
  sub-proof by assumption.  If the goal had been \isa{{\isachardoublequote}show{\isachardoublequote}} (or
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   445
  \isa{{\isachardoublequote}thus{\isachardoublequote}}), some pending sub-goal is solved as well by the rule
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   446
  resulting from the result \emph{exported} into the enclosing goal
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   447
  context.  Thus \isa{{\isachardoublequote}qed{\isachardoublequote}} may fail for two reasons: either \isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}} fails, or the resulting rule does not fit to any
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   448
  pending goal\footnote{This includes any additional ``strong''
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   449
  assumptions as introduced by \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}.} of the enclosing
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   450
  context.  Debugging such a situation might involve temporarily
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   451
  changing \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} into \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, or weakening the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   452
  local context by replacing occurrences of \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} by
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   453
  \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}}.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   454
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   455
  \item [\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}}] is a
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   456
  \emph{terminal proof}\index{proof!terminal}; it abbreviates
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   457
  \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}~\isa{{\isachardoublequote}qed{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{2}}{\isachardoublequote}}, but with backtracking across both methods.  Debugging
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   458
  an unsuccessful \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}\ m\isactrlsub {\isadigit{2}}{\isachardoublequote}}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   459
  command can be done by expanding its definition; in many cases
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   460
  \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}} (or even \isa{{\isachardoublequote}apply{\isachardoublequote}}~\isa{{\isachardoublequote}m\isactrlsub {\isadigit{1}}{\isachardoublequote}}) is already sufficient to see the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   461
  problem.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   462
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   463
  \item [``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}''] is a \emph{default
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   464
  proof}\index{proof!default}; it abbreviates \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}rule{\isachardoublequote}}.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   465
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   466
  \item [``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}''] is a \emph{trivial
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   467
  proof}\index{proof!trivial}; it abbreviates \hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}this{\isachardoublequote}}.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   468
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   469
  \item [\hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}}] is a \emph{fake proof}\index{proof!fake}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   470
  pretending to solve the pending claim without further ado.  This
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   471
  only works in interactive development, or if the \verb|quick_and_dirty| flag is enabled (in ML).  Facts emerging from fake
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   472
  proofs are not the real thing.  Internally, each theorem container
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   473
  is tainted by an oracle invocation, which is indicated as ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' in the printed result.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   474
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   475
  The most important application of \hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}} is to support
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   476
  experimentation and top-down proof development.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   477
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   478
  \end{descr}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   479
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   480
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   481
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   482
\isamarkupsection{Fundamental methods and attributes \label{sec:pure-meth-att}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   483
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   484
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   485
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   486
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   487
The following proof methods and attributes refer to basic logical
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   488
  operations of Isar.  Further methods and attributes are provided by
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   489
  several generic and object-logic specific tools and packages (see
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   490
  \chref{ch:gen-tools} and \chref{ch:hol}).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   491
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   492
  \begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   493
    \indexdef{}{method}{-}\hypertarget{method.-}{\hyperlink{method.-}{\mbox{\isa{{\isacharminus}}}}} & : & \isarmeth \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   494
    \indexdef{}{method}{fact}\hypertarget{method.fact}{\hyperlink{method.fact}{\mbox{\isa{fact}}}} & : & \isarmeth \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   495
    \indexdef{}{method}{assumption}\hypertarget{method.assumption}{\hyperlink{method.assumption}{\mbox{\isa{assumption}}}} & : & \isarmeth \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   496
    \indexdef{}{method}{this}\hypertarget{method.this}{\hyperlink{method.this}{\mbox{\isa{this}}}} & : & \isarmeth \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   497
    \indexdef{}{method}{rule}\hypertarget{method.rule}{\hyperlink{method.rule}{\mbox{\isa{rule}}}} & : & \isarmeth \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   498
    \indexdef{}{method}{iprover}\hypertarget{method.iprover}{\hyperlink{method.iprover}{\mbox{\isa{iprover}}}} & : & \isarmeth \\[0.5ex]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   499
    \indexdef{Pure}{attribute}{intro}\hypertarget{attribute.Pure.intro}{\hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   500
    \indexdef{Pure}{attribute}{elim}\hypertarget{attribute.Pure.elim}{\hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   501
    \indexdef{Pure}{attribute}{dest}\hypertarget{attribute.Pure.dest}{\hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   502
    \indexdef{}{attribute}{rule}\hypertarget{attribute.rule}{\hyperlink{attribute.rule}{\mbox{\isa{rule}}}} & : & \isaratt \\[0.5ex]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   503
    \indexdef{}{attribute}{OF}\hypertarget{attribute.OF}{\hyperlink{attribute.OF}{\mbox{\isa{OF}}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   504
    \indexdef{}{attribute}{of}\hypertarget{attribute.of}{\hyperlink{attribute.of}{\mbox{\isa{of}}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   505
    \indexdef{}{attribute}{where}\hypertarget{attribute.where}{\hyperlink{attribute.where}{\mbox{\isa{where}}}} & : & \isaratt \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   506
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   507
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   508
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   509
    'fact' thmrefs?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   510
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   511
    'rule' thmrefs?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   512
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   513
    'iprover' ('!' ?) (rulemod *)
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   514
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   515
    rulemod: ('intro' | 'elim' | 'dest') ((('!' | () | '?') nat?) | 'del') ':' thmrefs
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   516
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   517
    ('intro' | 'elim' | 'dest') ('!' | () | '?') nat?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   518
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   519
    'rule' 'del'
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   520
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   521
    'OF' thmrefs
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   522
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   523
    'of' insts ('concl' ':' insts)?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   524
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   525
    'where' ((name | var | typefree | typevar) '=' (type | term) * 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   526
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   527
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   528
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   529
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   530
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   531
  \item [``\hyperlink{method.-}{\mbox{\isa{{\isacharminus}}}}'' (minus)] does nothing but insert the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   532
  forward chaining facts as premises into the goal.  Note that command
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   533
  \indexref{}{command}{proof}\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} without any method actually performs a single
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   534
  reduction step using the \indexref{}{method}{rule}\hyperlink{method.rule}{\mbox{\isa{rule}}} method; thus a plain
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   535
  \emph{do-nothing} proof step would be ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}{\isacharminus}{\isachardoublequote}}'' rather than \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} alone.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   536
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   537
  \item [\hyperlink{method.fact}{\mbox{\isa{fact}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] composes
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   538
  some fact from \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} (or implicitly from
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   539
  the current proof context) modulo unification of schematic type and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   540
  term variables.  The rule structure is not taken into account, i.e.\
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   541
  meta-level implication is considered atomic.  This is the same
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   542
  principle underlying literal facts (cf.\ \secref{sec:syn-att}):
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   543
  ``\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}~\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{fact}'' is
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   544
  equivalent to ``\hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\verb|`|\isa{{\isasymphi}}\verb|`|'' provided that \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} is an instance of some known
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   545
  \isa{{\isachardoublequote}{\isasymturnstile}\ {\isasymphi}{\isachardoublequote}} in the proof context.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   546
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   547
  \item [\hyperlink{method.assumption}{\mbox{\isa{assumption}}}] solves some goal by a single assumption
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   548
  step.  All given facts are guaranteed to participate in the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   549
  refinement; this means there may be only 0 or 1 in the first place.
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   550
  Recall that \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} (\secref{sec:proof-steps}) already
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   551
  concludes any remaining sub-goals by assumption, so structured
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   552
  proofs usually need not quote the \hyperlink{method.assumption}{\mbox{\isa{assumption}}} method at
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   553
  all.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   554
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   555
  \item [\hyperlink{method.this}{\mbox{\isa{this}}}] applies all of the current facts directly as
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   556
  rules.  Recall that ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' (dot) abbreviates ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{this}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   557
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   558
  \item [\hyperlink{method.rule}{\mbox{\isa{rule}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] applies some
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   559
  rule given as argument in backward manner; facts are used to reduce
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   560
  the rule before applying it to the goal.  Thus \hyperlink{method.rule}{\mbox{\isa{rule}}}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   561
  without facts is plain introduction, while with facts it becomes
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   562
  elimination.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   563
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   564
  When no arguments are given, the \hyperlink{method.rule}{\mbox{\isa{rule}}} method tries to pick
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   565
  appropriate rules automatically, as declared in the current context
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   566
  using the \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}, \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}},
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   567
  \hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}} attributes (see below).  This is the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   568
  default behavior of \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} and ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}'' 
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   569
  (double-dot) steps (see \secref{sec:proof-steps}).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   570
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   571
  \item [\hyperlink{method.iprover}{\mbox{\isa{iprover}}}] performs intuitionistic proof search,
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   572
  depending on specifically declared rules from the context, or given
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   573
  as explicit arguments.  Chained facts are inserted into the goal
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   574
  before commencing proof search; ``\hyperlink{method.iprover}{\mbox{\isa{iprover}}}\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' 
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   575
  means to include the current \hyperlink{fact.prems}{\mbox{\isa{prems}}} as well.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   576
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   577
  Rules need to be classified as \hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}},
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   578
  \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}, or \hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}; here the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   579
  ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' indicator refers to ``safe'' rules, which may be
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   580
  applied aggressively (without considering back-tracking later).
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   581
  Rules declared with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'' are ignored in proof search (the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   582
  single-step \hyperlink{method.rule}{\mbox{\isa{rule}}} method still observes these).  An
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   583
  explicit weight annotation may be given as well; otherwise the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   584
  number of rule premises will be taken into account here.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   585
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   586
  \item [\hyperlink{attribute.Pure.intro}{\mbox{\isa{intro}}}, \hyperlink{attribute.Pure.elim}{\mbox{\isa{elim}}}, and
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   587
  \hyperlink{attribute.Pure.dest}{\mbox{\isa{dest}}}] declare introduction, elimination, and
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   588
  destruct rules, to be used with the \hyperlink{method.rule}{\mbox{\isa{rule}}} and \hyperlink{method.iprover}{\mbox{\isa{iprover}}} methods.  Note that the latter will ignore rules declared
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   589
  with ``\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}}'', while ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}''  are used most
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   590
  aggressively.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   591
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   592
  The classical reasoner (see \secref{sec:classical}) introduces its
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   593
  own variants of these attributes; use qualified names to access the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   594
  present versions of Isabelle/Pure, i.e.\ \hyperlink{attribute.Pure.Pure.intro}{\mbox{\isa{Pure{\isachardot}intro}}}.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   595
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   596
  \item [\hyperlink{attribute.rule}{\mbox{\isa{rule}}}~\isa{del}] undeclares introduction,
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   597
  elimination, or destruct rules.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   598
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   599
  \item [\hyperlink{attribute.OF}{\mbox{\isa{OF}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] applies some
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   600
  theorem to all of the given rules \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   601
  (in parallel).  This corresponds to the \verb|"op MRS"| operation in
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   602
  ML, but note the reversed order.  Positions may be effectively
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   603
  skipped by including ``\isa{{\isacharunderscore}}'' (underscore) as argument.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   604
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   605
  \item [\hyperlink{attribute.of}{\mbox{\isa{of}}}~\isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}\ {\isasymdots}\ t\isactrlsub n{\isachardoublequote}}] performs
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   606
  positional instantiation of term variables.  The terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}} are substituted for any schematic
26895
d066f9db833b updated generated file;
wenzelm
parents: 26870
diff changeset
   607
  variables occurring in a theorem from left to right; ``\isa{{\isacharunderscore}}''
d066f9db833b updated generated file;
wenzelm
parents: 26870
diff changeset
   608
  (underscore) indicates to skip a position.  Arguments following a
d066f9db833b updated generated file;
wenzelm
parents: 26870
diff changeset
   609
  ``\isa{{\isachardoublequote}concl{\isacharcolon}{\isachardoublequote}}'' specification refer to positions of the
d066f9db833b updated generated file;
wenzelm
parents: 26870
diff changeset
   610
  conclusion of a rule.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   611
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   612
  \item [\hyperlink{attribute.where}{\mbox{\isa{where}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ x\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}}] performs named instantiation of schematic
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   613
  type and term variables occurring in a theorem.  Schematic variables
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   614
  have to be specified on the left-hand side (e.g.\ \isa{{\isachardoublequote}{\isacharquery}x{\isadigit{1}}{\isachardot}{\isadigit{3}}{\isachardoublequote}}).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   615
  The question mark may be omitted if the variable name is a plain
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   616
  identifier without index.  As type instantiations are inferred from
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   617
  term instantiations, explicit type instantiations are seldom
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   618
  necessary.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   619
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   620
  \end{descr}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   621
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   622
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   623
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   624
\isamarkupsection{Term abbreviations \label{sec:term-abbrev}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   625
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   626
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   627
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   628
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   629
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   630
    \indexdef{}{command}{let}\hypertarget{command.let}{\hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   631
    \indexdef{}{keyword}{is}\hypertarget{keyword.is}{\hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}}} & : & syntax \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   632
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   633
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   634
  Abbreviations may be either bound by explicit \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}~\isa{{\isachardoublequote}p\ {\isasymequiv}\ t{\isachardoublequote}} statements, or by annotating assumptions or
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   635
  goal statements with a list of patterns ``\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}''.  In both cases, higher-order matching is invoked to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   636
  bind extra-logical term variables, which may be either named
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   637
  schematic variables of the form \isa{{\isacharquery}x}, or nameless dummies
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   638
  ``\hyperlink{variable._}{\mbox{\isa{{\isacharunderscore}}}}'' (underscore). Note that in the \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   639
  form the patterns occur on the left-hand side, while the \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} patterns are in postfix position.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   640
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   641
  Polymorphism of term bindings is handled in Hindley-Milner style,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   642
  similar to ML.  Type variables referring to local assumptions or
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   643
  open goal statements are \emph{fixed}, while those of finished
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   644
  results or bound by \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}} may occur in \emph{arbitrary}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   645
  instances later.  Even though actual polymorphism should be rarely
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   646
  used in practice, this mechanism is essential to achieve proper
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   647
  incremental type-inference, as the user proceeds to build up the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   648
  Isar proof text from left to right.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   649
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   650
  \medskip Term abbreviations are quite different from local
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   651
  definitions as introduced via \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} (see
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   652
  \secref{sec:proof-context}).  The latter are visible within the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   653
  logic as actual equations, while abbreviations disappear during the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   654
  input process just after type checking.  Also note that \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} does not support polymorphism.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   655
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   656
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   657
    'let' ((term + 'and') '=' term + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   658
    ;  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   659
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   660
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   661
  The syntax of \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} patterns follows \railnonterm{termpat}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   662
  or \railnonterm{proppat} (see \secref{sec:term-decls}).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   663
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   664
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   665
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   666
  \item [\hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}~\isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}\ {\isacharequal}\ t\isactrlsub {\isadigit{1}}\ {\isasymAND}\ {\isasymdots}\ p\isactrlsub n\ {\isacharequal}\ t\isactrlsub n{\isachardoublequote}}] binds any text variables in patterns \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} by simultaneous higher-order matching
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   667
  against terms \isa{{\isachardoublequote}t\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ t\isactrlsub n{\isachardoublequote}}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   668
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   669
  \item [\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}] resembles \hyperlink{command.let}{\mbox{\isa{\isacommand{let}}}}, but matches \isa{{\isachardoublequote}p\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ p\isactrlsub n{\isachardoublequote}} against the
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   670
  preceding statement.  Also note that \hyperlink{keyword.is}{\mbox{\isa{\isakeyword{is}}}} is not a
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   671
  separate command, but part of others (such as \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}},
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   672
  \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}} etc.).
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   673
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   674
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   675
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   676
  Some \emph{implicit} term abbreviations\index{term abbreviations}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   677
  for goals and facts are available as well.  For any open goal,
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   678
  \indexref{}{variable}{thesis}\hyperlink{variable.thesis}{\mbox{\isa{thesis}}} refers to its object-level statement,
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   679
  abstracted over any meta-level parameters (if present).  Likewise,
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   680
  \indexref{}{variable}{this}\hyperlink{variable.this}{\mbox{\isa{this}}} is bound for fact statements resulting from
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   681
  assumptions or finished goals.  In case \hyperlink{variable.this}{\mbox{\isa{this}}} refers to
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   682
  an object-logic statement that is an application \isa{{\isachardoublequote}f\ t{\isachardoublequote}}, then
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   683
  \isa{t} is bound to the special text variable ``\hyperlink{variable.dots}{\mbox{\isa{{\isasymdots}}}}''
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   684
  (three dots).  The canonical application of this convenience are
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   685
  calculational proofs (see \secref{sec:calculation}).%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   686
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   687
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   688
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   689
\isamarkupsection{Block structure%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   690
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   691
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   692
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   693
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   694
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   695
    \indexdef{}{command}{next}\hypertarget{command.next}{\hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   696
    \indexdef{}{command}{\{}\hypertarget{command.braceleft}{\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   697
    \indexdef{}{command}{\}}\hypertarget{command.braceright}{\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   698
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   699
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   700
  While Isar is inherently block-structured, opening and closing
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   701
  blocks is mostly handled rather casually, with little explicit
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   702
  user-intervention.  Any local goal statement automatically opens
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   703
  \emph{two} internal blocks, which are closed again when concluding
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   704
  the sub-proof (by \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} etc.).  Sections of different
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   705
  context within a sub-proof may be switched via \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}},
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   706
  which is just a single block-close followed by block-open again.
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   707
  The effect of \hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}} is to reset the local proof context;
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   708
  there is no goal focus involved here!
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   709
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   710
  For slightly more advanced applications, there are explicit block
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   711
  parentheses as well.  These typically achieve a stronger forward
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   712
  style of reasoning.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   713
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   714
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   715
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   716
  \item [\hyperlink{command.next}{\mbox{\isa{\isacommand{next}}}}] switches to a fresh block within a
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   717
  sub-proof, resetting the local context to the initial one.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   718
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   719
  \item [\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}} and \hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}}] explicitly open and close
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   720
  blocks.  Any current facts pass through ``\hyperlink{command.braceleft}{\mbox{\isa{\isacommand{{\isacharbraceleft}}}}}''
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   721
  unchanged, while ``\hyperlink{command.braceright}{\mbox{\isa{\isacommand{{\isacharbraceright}}}}}'' causes any result to be
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   722
  \emph{exported} into the enclosing context.  Thus fixed variables
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   723
  are generalized, assumptions discharged, and local definitions
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   724
  unfolded (cf.\ \secref{sec:proof-context}).  There is no difference
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   725
  of \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} and \hyperlink{command.presume}{\mbox{\isa{\isacommand{presume}}}} in this mode of
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   726
  forward reasoning --- in contrast to plain backward reasoning with
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   727
  the result exported at \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} time.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   728
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   729
  \end{descr}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   730
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   731
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   732
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   733
\isamarkupsection{Emulating tactic scripts \label{sec:tactic-commands}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   734
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   735
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   736
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   737
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   738
The Isar provides separate commands to accommodate tactic-style
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   739
  proof scripts within the same system.  While being outside the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   740
  orthodox Isar proof language, these might come in handy for
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   741
  interactive exploration and debugging, or even actual tactical proof
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   742
  within new-style theories (to benefit from document preparation, for
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   743
  example).  See also \secref{sec:tactics} for actual tactics, that
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   744
  have been encapsulated as proof methods.  Proper proof methods may
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   745
  be used in scripts, too.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   746
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   747
  \begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   748
    \indexdef{}{command}{apply}\hypertarget{command.apply}{\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(prove)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   749
    \indexdef{}{command}{apply\_end}\hypertarget{command.apply_end}{\hyperlink{command.apply_end}{\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   750
    \indexdef{}{command}{done}\hypertarget{command.done}{\hyperlink{command.done}{\mbox{\isa{\isacommand{done}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(prove)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   751
    \indexdef{}{command}{defer}\hypertarget{command.defer}{\hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   752
    \indexdef{}{command}{prefer}\hypertarget{command.prefer}{\hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   753
    \indexdef{}{command}{back}\hypertarget{command.back}{\hyperlink{command.back}{\mbox{\isa{\isacommand{back}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof}{proof} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   754
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   755
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   756
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   757
    ( 'apply' | 'apply\_end' ) method
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   758
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   759
    'defer' nat?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   760
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   761
    'prefer' nat
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   762
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   763
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   764
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   765
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   766
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   767
  \item [\hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}~\isa{m}] applies proof method \isa{m}
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   768
  in initial position, but unlike \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}} it retains
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   769
  ``\isa{{\isachardoublequote}proof{\isacharparenleft}prove{\isacharparenright}{\isachardoublequote}}'' mode.  Thus consecutive method
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   770
  applications may be given just as in tactic scripts.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   771
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   772
  Facts are passed to \isa{m} as indicated by the goal's
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   773
  forward-chain mode, and are \emph{consumed} afterwards.  Thus any
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   774
  further \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}} command would always work in a purely
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   775
  backward manner.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   776
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   777
  \item [\hyperlink{command.apply_end}{\mbox{\isa{\isacommand{apply{\isacharunderscore}end}}}}~\isa{{\isachardoublequote}m{\isachardoublequote}}] applies proof method
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   778
  \isa{m} as if in terminal position.  Basically, this simulates a
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   779
  multi-step tactic script for \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}, but may be given
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   780
  anywhere within the proof body.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   781
  
26895
d066f9db833b updated generated file;
wenzelm
parents: 26870
diff changeset
   782
  No facts are passed to \isa{m} here.  Furthermore, the static
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   783
  context is that of the enclosing goal (as for actual \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}).  Thus the proof method may not refer to any assumptions
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   784
  introduced in the current body, for example.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   785
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   786
  \item [\hyperlink{command.done}{\mbox{\isa{\isacommand{done}}}}] completes a proof script, provided that
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   787
  the current goal state is solved completely.  Note that actual
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   788
  structured proof commands (e.g.\ ``\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' or \hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}}) may be used to conclude proof scripts as well.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   789
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   790
  \item [\hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}}~\isa{n} and \hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}}~\isa{n}] shuffle the list of pending goals: \hyperlink{command.defer}{\mbox{\isa{\isacommand{defer}}}} puts off
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   791
  sub-goal \isa{n} to the end of the list (\isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}} by
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   792
  default), while \hyperlink{command.prefer}{\mbox{\isa{\isacommand{prefer}}}} brings sub-goal \isa{n} to the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   793
  front.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   794
  
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   795
  \item [\hyperlink{command.back}{\mbox{\isa{\isacommand{back}}}}] does back-tracking over the result
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   796
  sequence of the latest proof command.  Basically, any proof command
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   797
  may return multiple results.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   798
  
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   799
  \end{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   800
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   801
  Any proper Isar proof method may be used with tactic script commands
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   802
  such as \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}.  A few additional emulations of actual
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   803
  tactics are provided as well; these would be never used in actual
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   804
  structured proofs, of course.%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   805
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   806
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   807
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   808
\isamarkupsection{Omitting proofs%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   809
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   810
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   811
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   812
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   813
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   814
    \indexdef{}{command}{oops}\hypertarget{command.oops}{\hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}}} & : & \isartrans{proof}{theory} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   815
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   816
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   817
  The \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} command discontinues the current proof
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   818
  attempt, while considering the partial proof text as properly
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   819
  processed.  This is conceptually quite different from ``faking''
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   820
  actual proofs via \indexref{}{command}{sorry}\hyperlink{command.sorry}{\mbox{\isa{\isacommand{sorry}}}} (see
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   821
  \secref{sec:proof-steps}): \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} does not observe the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   822
  proof structure at all, but goes back right to the theory level.
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   823
  Furthermore, \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} does not produce any result theorem
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   824
  --- there is no intended claim to be able to complete the proof
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   825
  anyhow.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   826
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   827
  A typical application of \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} is to explain Isar proofs
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   828
  \emph{within} the system itself, in conjunction with the document
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   829
  preparation tools of Isabelle described in \cite{isabelle-sys}.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   830
  Thus partial or even wrong proof attempts can be discussed in a
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   831
  logically sound manner.  Note that the Isabelle {\LaTeX} macros can
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   832
  be easily adapted to print something like ``\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}'' instead of
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   833
  the keyword ``\hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   834
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   835
  \medskip The \hyperlink{command.oops}{\mbox{\isa{\isacommand{oops}}}} command is undo-able, unlike
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   836
  \indexref{}{command}{kill}\hyperlink{command.kill}{\mbox{\isa{\isacommand{kill}}}} (see \secref{sec:history}).  The effect is to
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   837
  get back to the theory just before the opening of the proof.%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   838
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   839
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   840
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   841
\isamarkupsection{Generalized elimination \label{sec:obtain}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   842
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   843
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   844
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   845
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   846
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   847
    \indexdef{}{command}{obtain}\hypertarget{command.obtain}{\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}} & : & \isartrans{proof(state)}{proof(prove)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   848
    \indexdef{}{command}{guess}\hypertarget{command.guess}{\hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isartrans{proof(state)}{proof(prove)} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   849
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   850
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   851
  Generalized elimination means that additional elements with certain
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   852
  properties may be introduced in the current context, by virtue of a
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   853
  locally proven ``soundness statement''.  Technically speaking, the
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   854
  \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} language element is like a declaration of
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   855
  \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}} and \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} (see also see
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   856
  \secref{sec:proof-context}), together with a soundness proof of its
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   857
  additional claim.  According to the nature of existential reasoning,
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   858
  assumptions get eliminated from any result exported from the context
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   859
  later, provided that the corresponding parameters do \emph{not}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   860
  occur in the conclusion.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   861
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   862
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   863
    'obtain' parname? (vars + 'and') 'where' (props + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   864
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   865
    'guess' (vars + 'and')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   866
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   867
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   868
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   869
  The derived Isar command \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} is defined as follows
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   870
  (where \isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ b\isactrlsub k{\isachardoublequote}} shall refer to (optional)
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   871
  facts indicated for forward chaining).
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   872
  \begin{matharray}{l}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   873
    \isa{{\isachardoublequote}{\isasymlangle}using\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub k{\isasymrangle}{\isachardoublequote}}~~\hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m\ {\isasymWHERE}\ a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ \ {\isasymlangle}proof{\isasymrangle}\ {\isasymequiv}{\isachardoublequote}} \\[1ex]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   874
    \quad \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}{\isasymAnd}thesis{\isachardot}\ {\isacharparenleft}{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isacharparenright}\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   875
    \quad \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{succeed} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   876
    \qquad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{thesis} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   877
    \qquad \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}that\ {\isacharbrackleft}Pure{\isachardot}intro{\isacharquery}{\isacharbrackright}{\isacharcolon}\ {\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   878
    \qquad \hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{thesis} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   879
    \quad\qquad \hyperlink{command.apply}{\mbox{\isa{\isacommand{apply}}}}~\isa{{\isacharminus}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   880
    \quad\qquad \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}~\isa{{\isachardoublequote}b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub k\ \ {\isasymlangle}proof{\isasymrangle}{\isachardoublequote}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   881
    \quad \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   882
    \quad \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}}~\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardoublequote}}~\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}\ a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   883
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   884
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   885
  Typically, the soundness proof is relatively straight-forward, often
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   886
  just by canonical automated tools such as ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{simp}'' or ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{blast}''.  Accordingly, the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   887
  ``\isa{that}'' reduction above is declared as simplification and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   888
  introduction rule.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   889
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   890
  In a sense, \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} represents at the level of Isar
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   891
  proofs what would be meta-logical existential quantifiers and
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   892
  conjunctions.  This concept has a broad range of useful
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   893
  applications, ranging from plain elimination (or introduction) of
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   894
  object-level existential and conjunctions, to elimination over
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   895
  results of symbolic evaluation of recursive definitions, for
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   896
  example.  Also note that \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} without parameters acts
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   897
  much like \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, where the result is treated as a
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   898
  genuine assumption.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   899
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   900
  An alternative name to be used instead of ``\isa{that}'' above may
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   901
  be given in parentheses.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   902
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   903
  \medskip The improper variant \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}} is similar to
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   904
  \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}}, but derives the obtained statement from the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   905
  course of reasoning!  The proof starts with a fixed goal \isa{thesis}.  The subsequent proof may refine this to anything of the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   906
  form like \isa{{\isachardoublequote}{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub m{\isachardot}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymphi}\isactrlsub n\ {\isasymLongrightarrow}\ thesis{\isachardoublequote}}, but must not introduce new subgoals.  The
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   907
  final goal state is then used as reduction rule for the obtain
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   908
  scheme described above.  Obtained parameters \isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub m{\isachardoublequote}} are marked as internal by default, which prevents the
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   909
  proof context from being polluted by ad-hoc variables.  The variable
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   910
  names and type constraints given as arguments for \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}}
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   911
  specify a prefix of obtained parameters explicitly in the text.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   912
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   913
  It is important to note that the facts introduced by \hyperlink{command.obtain}{\mbox{\isa{\isacommand{obtain}}}} and \hyperlink{command.guess}{\mbox{\isa{\isacommand{guess}}}} may not be polymorphic: any
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   914
  type-variables occurring here are fixed in the present context!%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   915
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   916
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   917
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   918
\isamarkupsection{Calculational reasoning \label{sec:calculation}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   919
}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   920
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   921
%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   922
\begin{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   923
\begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   924
    \indexdef{}{command}{also}\hypertarget{command.also}{\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   925
    \indexdef{}{command}{finally}\hypertarget{command.finally}{\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}} & : & \isartrans{proof(state)}{proof(chain)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   926
    \indexdef{}{command}{moreover}\hypertarget{command.moreover}{\hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}}} & : & \isartrans{proof(state)}{proof(state)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   927
    \indexdef{}{command}{ultimately}\hypertarget{command.ultimately}{\hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}}} & : & \isartrans{proof(state)}{proof(chain)} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   928
    \indexdef{}{command}{print\_trans\_rules}\hypertarget{command.print_trans_rules}{\hyperlink{command.print_trans_rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}trans{\isacharunderscore}rules}}}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   929
    \hyperlink{attribute.trans}{\mbox{\isa{trans}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   930
    \hyperlink{attribute.sym}{\mbox{\isa{sym}}} & : & \isaratt \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   931
    \hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}} & : & \isaratt \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   932
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   933
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   934
  Calculational proof is forward reasoning with implicit application
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   935
  of transitivity rules (such those of \isa{{\isachardoublequote}{\isacharequal}{\isachardoublequote}}, \isa{{\isachardoublequote}{\isasymle}{\isachardoublequote}},
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   936
  \isa{{\isachardoublequote}{\isacharless}{\isachardoublequote}}).  Isabelle/Isar maintains an auxiliary fact register
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   937
  \indexref{}{fact}{calculation}\hyperlink{fact.calculation}{\mbox{\isa{calculation}}} for accumulating results obtained by
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   938
  transitivity composed with the current result.  Command \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} updates \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} involving \hyperlink{fact.this}{\mbox{\isa{this}}}, while
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   939
  \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} exhibits the final \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   940
  forward chaining towards the next goal statement.  Both commands
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   941
  require valid current facts, i.e.\ may occur only after commands
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   942
  that produce theorems such as \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}, \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}, or some finished proof of \hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}, \hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}} etc.  The \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} and \hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}}
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   943
  commands are similar to \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}},
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   944
  but only collect further results in \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} without
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   945
  applying any rules yet.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   946
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   947
  Also note that the implicit term abbreviation ``\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}'' has
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   948
  its canonical application with calculational proofs.  It refers to
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   949
  the argument of the preceding statement. (The argument of a curried
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   950
  infix expression happens to be its right-hand side.)
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   951
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   952
  Isabelle/Isar calculations are implicitly subject to block structure
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   953
  in the sense that new threads of calculational reasoning are
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   954
  commenced for any new block (as opened by a local goal, for
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   955
  example).  This means that, apart from being able to nest
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   956
  calculations, there is no separate \emph{begin-calculation} command
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   957
  required.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   958
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   959
  \medskip The Isar calculation proof commands may be defined as
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   960
  follows:\footnote{We suppress internal bookkeeping such as proper
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   961
  handling of block-structure.}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   962
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   963
  \begin{matharray}{rcl}
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   964
    \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isachardoublequote}\isactrlsub {\isadigit{0}}{\isachardoublequote}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ this{\isachardoublequote}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   965
    \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}\isa{{\isachardoublequote}\isactrlsub n\isactrlsub {\isacharplus}\isactrlsub {\isadigit{1}}{\isachardoublequote}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ trans\ {\isacharbrackleft}OF\ calculation\ this{\isacharbrackright}{\isachardoublequote}} \\[0.5ex]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   966
    \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} & \equiv & \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{calculation} \\[0.5ex]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   967
    \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} & \equiv & \hyperlink{command.note}{\mbox{\isa{\isacommand{note}}}}~\isa{{\isachardoublequote}calculation\ {\isacharequal}\ calculation\ this{\isachardoublequote}} \\
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   968
    \hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}} & \equiv & \hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\isa{calculation} \\
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   969
  \end{matharray}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   970
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   971
  \begin{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   972
    ('also' | 'finally') ('(' thmrefs ')')?
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   973
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   974
    'trans' (() | 'add' | 'del')
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   975
    ;
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   976
  \end{rail}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   977
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   978
  \begin{descr}
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   979
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   980
  \item [\hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\isa{{\isachardoublequote}{\isacharparenleft}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharparenright}{\isachardoublequote}}]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   981
  maintains the auxiliary \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} register as follows.
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   982
  The first occurrence of \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} in some calculational
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   983
  thread initializes \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by \hyperlink{fact.this}{\mbox{\isa{this}}}. Any
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   984
  subsequent \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} on the same level of block-structure
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   985
  updates \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} by some transitivity rule applied to
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   986
  \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} and \hyperlink{fact.this}{\mbox{\isa{this}}} (in that order).  Transitivity
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   987
  rules are picked from the current context, unless alternative rules
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   988
  are given as explicit arguments.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   989
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   990
  \item [\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\isa{{\isachardoublequote}{\isacharparenleft}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharparenright}{\isachardoublequote}}]
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   991
  maintaining \hyperlink{fact.calculation}{\mbox{\isa{calculation}}} in the same way as \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}, and concludes the current calculational thread.  The final
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   992
  result is exhibited as fact for forward chaining towards the next
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   993
  goal. Basically, \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}} just abbreviates \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}}~\hyperlink{command.from}{\mbox{\isa{\isacommand{from}}}}~\hyperlink{fact.calculation}{\mbox{\isa{calculation}}}.  Typical idioms for
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   994
  concluding calculational proofs are ``\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\hyperlink{command.show}{\mbox{\isa{\isacommand{show}}}}~\isa{{\isacharquery}thesis}~\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}'' and ``\hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isasymphi}}~\hyperlink{command.dot}{\mbox{\isa{\isacommand{{\isachardot}}}}}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   995
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   996
  \item [\hyperlink{command.moreover}{\mbox{\isa{\isacommand{moreover}}}} and \hyperlink{command.ultimately}{\mbox{\isa{\isacommand{ultimately}}}}] are
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
   997
  analogous to \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}, but collect
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   998
  results only, without applying rules.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
   999
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1000
  \item [\hyperlink{command.print_trans_rules}{\mbox{\isa{\isacommand{print{\isacharunderscore}trans{\isacharunderscore}rules}}}}] prints the list of
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1001
  transitivity rules (for calculational commands \hyperlink{command.also}{\mbox{\isa{\isacommand{also}}}} and
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1002
  \hyperlink{command.finally}{\mbox{\isa{\isacommand{finally}}}}) and symmetry rules (for the \hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}} operation and single step elimination patters) of the
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1003
  current context.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1004
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1005
  \item [\hyperlink{attribute.trans}{\mbox{\isa{trans}}}] declares theorems as transitivity rules.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1006
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1007
  \item [\hyperlink{attribute.sym}{\mbox{\isa{sym}}}] declares symmetry rules, as well as
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1008
  \hyperlink{attribute.Pure.elim}{\mbox{\isa{Pure{\isachardot}elim}}}\isa{{\isachardoublequote}{\isacharquery}{\isachardoublequote}} rules.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1009
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1010
  \item [\hyperlink{attribute.symmetric}{\mbox{\isa{symmetric}}}] resolves a theorem with some rule
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1011
  declared as \hyperlink{attribute.sym}{\mbox{\isa{sym}}} in the current context.  For example,
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1012
  ``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}{\isacharbrackleft}symmetric{\isacharbrackright}{\isacharcolon}\ x\ {\isacharequal}\ y{\isachardoublequote}}'' produces a
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1013
  swapped fact derived from that assumption.
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1014
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1015
  In structured proof texts it is often more appropriate to use an
26902
8db1e960d636 updated generated file;
wenzelm
parents: 26895
diff changeset
  1016
  explicit single-step elimination proof, such as ``\hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}}~\isa{{\isachardoublequote}x\ {\isacharequal}\ y{\isachardoublequote}}~\hyperlink{command.then}{\mbox{\isa{\isacommand{then}}}}~\hyperlink{command.have}{\mbox{\isa{\isacommand{have}}}}~\isa{{\isachardoublequote}y\ {\isacharequal}\ x{\isachardoublequote}}~\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isachardot}{\isachardot}}}}}''.
26870
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1017
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1018
  \end{descr}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1019
\end{isamarkuptext}%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1020
\isamarkuptrue%
94bedbb34b92 misc reorganization;
wenzelm
parents: 26869
diff changeset
  1021
%
26869
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1022
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1023
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1024
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1025
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1026
\isatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1027
\isacommand{end}\isamarkupfalse%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1028
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1029
\endisatagtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1030
{\isafoldtheory}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1031
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1032
\isadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1033
%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1034
\endisadelimtheory
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1035
\isanewline
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1036
\end{isabellebody}%
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1037
%%% Local Variables:
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1038
%%% mode: latex
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1039
%%% TeX-master: "root"
3bc332135aa7 added chapters for "Specifications" and "Proofs";
wenzelm
parents:
diff changeset
  1040
%%% End: