src/Doc/Isar_Ref/Framework.thy
author wenzelm
Wed, 14 Oct 2015 15:10:32 +0200
changeset 61439 2bf52eec4e8a
parent 61421 e0825405d398
child 61477 e467ae7aa808
permissions -rw-r--r--
more symbols;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
     1
theory Framework
42651
e3fdb7c96be5 formal Base theory;
wenzelm
parents: 42626
diff changeset
     2
imports Base Main
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
     3
begin
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
     4
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
     5
chapter \<open>The Isabelle/Isar Framework \label{ch:isar-framework}\<close>
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
     6
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
     7
text \<open>
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
     8
  Isabelle/Isar @{cite "Wenzel:1999:TPHOL" and "Wenzel-PhD" and
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
     9
  "Nipkow-TYPES02" and "Wenzel-Paulson:2006" and "Wenzel:2006:Festschrift"}
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    10
  is intended as a generic framework for developing formal
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    11
  mathematical documents with full proof checking.  Definitions and
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    12
  proofs are organized as theories.  An assembly of theory sources may
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    13
  be presented as a printed document; see also
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    14
  \chref{ch:document-prep}.
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    15
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    16
  The main objective of Isar is the design of a human-readable
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    17
  structured proof language, which is called the ``primary proof
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    18
  format'' in Isar terminology.  Such a primary proof language is
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    19
  somewhere in the middle between the extremes of primitive proof
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    20
  objects and actual natural language.  In this respect, Isar is a bit
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    21
  more formalistic than Mizar @{cite "Trybulec:1993:MizarFeatures" and
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    22
  "Rudnicki:1992:MizarOverview" and "Wiedijk:1999:Mizar"},
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    23
  using logical symbols for certain reasoning schemes where Mizar
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    24
  would prefer English words; see @{cite "Wenzel-Wiedijk:2002"} for
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    25
  further comparisons of these systems.
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    26
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    27
  So Isar challenges the traditional way of recording informal proofs
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    28
  in mathematical prose, as well as the common tendency to see fully
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    29
  formal proofs directly as objects of some logical calculus (e.g.\
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    30
  @{text "\<lambda>"}-terms in a version of type theory).  In fact, Isar is
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    31
  better understood as an interpreter of a simple block-structured
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    32
  language for describing the data flow of local facts and goals,
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    33
  interspersed with occasional invocations of proof methods.
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    34
  Everything is reduced to logical inferences internally, but these
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    35
  steps are somewhat marginal compared to the overall bookkeeping of
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    36
  the interpretation process.  Thanks to careful design of the syntax
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    37
  and semantics of Isar language elements, a formal record of Isar
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    38
  instructions may later appear as an intelligible text to the
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    39
  attentive reader.
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    40
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    41
  The Isar proof language has emerged from careful analysis of some
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    42
  inherent virtues of the existing logical framework of Isabelle/Pure
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    43
  @{cite "paulson-found" and "paulson700"}, notably composition of higher-order
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    44
  natural deduction rules, which is a generalization of Gentzen's
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    45
  original calculus @{cite "Gentzen:1935"}.  The approach of generic
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    46
  inference systems in Pure is continued by Isar towards actual proof
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    47
  texts.
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    48
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    49
  Concrete applications require another intermediate layer: an
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    50
  object-logic.  Isabelle/HOL @{cite "isa-tutorial"} (simply-typed
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    51
  set-theory) is being used most of the time; Isabelle/ZF
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
    52
  @{cite "isabelle-ZF"} is less extensively developed, although it would
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
    53
  probably fit better for classical mathematics.
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    54
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
    55
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
    56
  In order to illustrate natural deduction in Isar, we shall
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    57
  refer to the background theory and library of Isabelle/HOL.  This
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    58
  includes common notions of predicate logic, naive set-theory etc.\
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    59
  using fairly standard mathematical notation.  From the perspective
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    60
  of generic natural deduction there is nothing special about the
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    61
  logical connectives of HOL (@{text "\<and>"}, @{text "\<or>"}, @{text "\<forall>"},
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    62
  @{text "\<exists>"}, etc.), only the resulting reasoning principles are
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    63
  relevant to the user.  There are similar rules available for
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    64
  set-theory operators (@{text "\<inter>"}, @{text "\<union>"}, @{text "\<Inter>"}, @{text
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    65
  "\<Union>"}, etc.), or any other theory developed in the library (lattice
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    66
  theory, topology etc.).
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    67
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    68
  Subsequently we briefly review fragments of Isar proof texts
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    69
  corresponding directly to such general deduction schemes.  The
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    70
  examples shall refer to set-theory, to minimize the danger of
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    71
  understanding connectives of predicate logic as something special.
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    72
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
    73
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
    74
  The following deduction performs @{text "\<inter>"}-introduction,
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    75
  working forwards from assumptions towards the conclusion.  We give
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    76
  both the Isar text, and depict the primitive rule involved, as
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    77
  determined by unification of the problem against rules that are
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
    78
  declared in the library context.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    79
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    80
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    81
text_raw \<open>\medskip\begin{minipage}{0.6\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    82
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    83
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
    84
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
    85
begin
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    86
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    87
    assume "x \<in> A" and "x \<in> B"
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    88
    then have "x \<in> A \<inter> B" ..
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    89
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
    90
end
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    91
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    92
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    93
text_raw \<open>\end{minipage}\begin{minipage}{0.4\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    94
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    95
text \<open>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    96
  \infer{@{prop "x \<in> A \<inter> B"}}{@{prop "x \<in> A"} & @{prop "x \<in> B"}}
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    97
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
    98
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
    99
text_raw \<open>\end{minipage}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   100
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   101
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   102
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   103
  Note that @{command assume} augments the proof
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   104
  context, @{command then} indicates that the current fact shall be
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   105
  used in the next step, and @{command have} states an intermediate
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   106
  goal.  The two dots ``@{command ".."}'' refer to a complete proof of
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   107
  this claim, using the indicated facts and a canonical rule from the
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   108
  context.  We could have been more explicit here by spelling out the
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   109
  final proof step via the @{command "by"} command:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   110
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   111
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   112
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   113
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   114
begin
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   115
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   116
    assume "x \<in> A" and "x \<in> B"
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   117
    then have "x \<in> A \<inter> B" by (rule IntI)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   118
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   119
end
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   120
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   121
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   122
text \<open>
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   123
  The format of the @{text "\<inter>"}-introduction rule represents
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   124
  the most basic inference, which proceeds from given premises to a
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   125
  conclusion, without any nested proof context involved.
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   126
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   127
  The next example performs backwards introduction on @{term "\<Inter>\<A>"},
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   128
  the intersection of all sets within a given set.  This requires a
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   129
  nested proof of set membership within a local context, where @{term
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   130
  A} is an arbitrary-but-fixed member of the collection:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   131
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   132
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   133
text_raw \<open>\medskip\begin{minipage}{0.6\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   134
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   135
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   136
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   137
begin
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   138
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   139
    have "x \<in> \<Inter>\<A>"
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   140
    proof
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   141
      fix A
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   142
      assume "A \<in> \<A>"
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   143
      show "x \<in> A" sorry %noproof
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   144
    qed
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   145
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   146
end
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   147
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   148
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   149
text_raw \<open>\end{minipage}\begin{minipage}{0.4\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   150
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   151
text \<open>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   152
  \infer{@{prop "x \<in> \<Inter>\<A>"}}{\infer*{@{prop "x \<in> A"}}{@{text "[A][A \<in> \<A>]"}}}
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   153
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   154
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   155
text_raw \<open>\end{minipage}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   156
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   157
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   158
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   159
  This Isar reasoning pattern again refers to the
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   160
  primitive rule depicted above.  The system determines it in the
56594
e3a06699a13f tuned spelling;
wenzelm
parents: 56451
diff changeset
   161
  ``@{command proof}'' step, which could have been spelled out more
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   162
  explicitly as ``@{command proof}~@{text "(rule InterI)"}''.  Note
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   163
  that the rule involves both a local parameter @{term "A"} and an
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   164
  assumption @{prop "A \<in> \<A>"} in the nested reasoning.  This kind of
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   165
  compound rule typically demands a genuine sub-proof in Isar, working
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   166
  backwards rather than forwards as seen before.  In the proof body we
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   167
  encounter the @{command fix}-@{command assume}-@{command show}
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   168
  outline of nested sub-proofs that is typical for Isar.  The final
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   169
  @{command show} is like @{command have} followed by an additional
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   170
  refinement of the enclosing claim, using the rule derived from the
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   171
  proof body.
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   172
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   173
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   174
  The next example involves @{term "\<Union>\<A>"}, which can be
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   175
  characterized as the set of all @{term "x"} such that @{prop "\<exists>A. x
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   176
  \<in> A \<and> A \<in> \<A>"}.  The elimination rule for @{prop "x \<in> \<Union>\<A>"} does
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   177
  not mention @{text "\<exists>"} and @{text "\<and>"} at all, but admits to obtain
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   178
  directly a local @{term "A"} such that @{prop "x \<in> A"} and @{prop "A
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   179
  \<in> \<A>"} hold.  This corresponds to the following Isar proof and
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   180
  inference rule, respectively:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   181
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   182
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   183
text_raw \<open>\medskip\begin{minipage}{0.6\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   184
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   185
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   186
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   187
begin
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   188
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   189
    assume "x \<in> \<Union>\<A>"
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   190
    then have C
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   191
    proof
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   192
      fix A
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   193
      assume "x \<in> A" and "A \<in> \<A>"
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   194
      show C sorry %noproof
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   195
    qed
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   196
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   197
end
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   198
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   199
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   200
text_raw \<open>\end{minipage}\begin{minipage}{0.4\textwidth}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   201
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   202
text \<open>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   203
  \infer{@{prop "C"}}{@{prop "x \<in> \<Union>\<A>"} & \infer*{@{prop "C"}~}{@{text "[A][x \<in> A, A \<in> \<A>]"}}}
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   204
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   205
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   206
text_raw \<open>\end{minipage}\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   207
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   208
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   209
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   210
  Although the Isar proof follows the natural
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   211
  deduction rule closely, the text reads not as natural as
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   212
  anticipated.  There is a double occurrence of an arbitrary
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   213
  conclusion @{prop "C"}, which represents the final result, but is
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   214
  irrelevant for now.  This issue arises for any elimination rule
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   215
  involving local parameters.  Isar provides the derived language
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   216
  element @{command obtain}, which is able to perform the same
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   217
  elimination proof more conveniently:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   218
\<close>
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   219
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   220
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   221
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   222
begin
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   223
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   224
    assume "x \<in> \<Union>\<A>"
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   225
    then obtain A where "x \<in> A" and "A \<in> \<A>" ..
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   226
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   227
end
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   228
(*>*)
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   229
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   230
text \<open>
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   231
  Here we avoid to mention the final conclusion @{prop "C"}
29721
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   232
  and return to plain forward reasoning.  The rule involved in the
df4e53d18ebc added introductory examples;
wenzelm
parents: 29716
diff changeset
   233
  ``@{command ".."}'' proof is the same as before.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   234
\<close>
29716
b6266c4c68fe basic setup for chapter "The Isabelle/Isar Framework";
wenzelm
parents:
diff changeset
   235
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   236
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   237
section \<open>The Pure framework \label{sec:framework-pure}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   238
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   239
text \<open>
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   240
  The Pure logic @{cite "paulson-found" and "paulson700"} is an intuitionistic
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   241
  fragment of higher-order logic @{cite "church40"}.  In type-theoretic
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   242
  parlance, there are three levels of @{text "\<lambda>"}-calculus with
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   243
  corresponding arrows @{text "\<Rightarrow>"}/@{text "\<And>"}/@{text "\<Longrightarrow>"}:
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   244
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   245
  \<^medskip>
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   246
  \begin{tabular}{ll}
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   247
  @{text "\<alpha> \<Rightarrow> \<beta>"} & syntactic function space (terms depending on terms) \\
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   248
  @{text "\<And>x. B(x)"} & universal quantification (proofs depending on terms) \\
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   249
  @{text "A \<Longrightarrow> B"} & implication (proofs depending on proofs) \\
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   250
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   251
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   252
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   253
  Here only the types of syntactic terms, and the
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   254
  propositions of proof terms have been shown.  The @{text
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   255
  "\<lambda>"}-structure of proofs can be recorded as an optional feature of
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   256
  the Pure inference kernel @{cite "Berghofer-Nipkow:2000:TPHOL"}, but
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   257
  the formal system can never depend on them due to \emph{proof
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   258
  irrelevance}.
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   259
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   260
  On top of this most primitive layer of proofs, Pure implements a
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   261
  generic calculus for nested natural deduction rules, similar to
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   262
  @{cite "Schroeder-Heister:1984"}.  Here object-logic inferences are
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   263
  internalized as formulae over @{text "\<And>"} and @{text "\<Longrightarrow>"}.
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   264
  Combining such rule statements may involve higher-order unification
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   265
  @{cite "paulson-natural"}.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   266
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   267
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   268
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   269
subsection \<open>Primitive inferences\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   270
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   271
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   272
  Term syntax provides explicit notation for abstraction @{text "\<lambda>x ::
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   273
  \<alpha>. b(x)"} and application @{text "b a"}, while types are usually
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   274
  implicit thanks to type-inference; terms of type @{text "prop"} are
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   275
  called propositions.  Logical statements are composed via @{text "\<And>x
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   276
  :: \<alpha>. B(x)"} and @{text "A \<Longrightarrow> B"}.  Primitive reasoning operates on
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   277
  judgments of the form @{text "\<Gamma> \<turnstile> \<phi>"}, with standard introduction
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   278
  and elimination rules for @{text "\<And>"} and @{text "\<Longrightarrow>"} that refer to
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   279
  fixed parameters @{text "x\<^sub>1, \<dots>, x\<^sub>m"} and hypotheses
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   280
  @{text "A\<^sub>1, \<dots>, A\<^sub>n"} from the context @{text "\<Gamma>"};
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   281
  the corresponding proof terms are left implicit.  The subsequent
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   282
  inference rules define @{text "\<Gamma> \<turnstile> \<phi>"} inductively, relative to a
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   283
  collection of axioms:
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   284
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   285
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   286
  \infer{@{text "\<turnstile> A"}}{(@{text "A"} \text{~axiom})}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   287
  \qquad
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   288
  \infer{@{text "A \<turnstile> A"}}{}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   289
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   290
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   291
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   292
  \infer{@{text "\<Gamma> \<turnstile> \<And>x. B(x)"}}{@{text "\<Gamma> \<turnstile> B(x)"} & @{text "x \<notin> \<Gamma>"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   293
  \qquad
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   294
  \infer{@{text "\<Gamma> \<turnstile> B(a)"}}{@{text "\<Gamma> \<turnstile> \<And>x. B(x)"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   295
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   296
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   297
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   298
  \infer{@{text "\<Gamma> - A \<turnstile> A \<Longrightarrow> B"}}{@{text "\<Gamma> \<turnstile> B"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   299
  \qquad
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   300
  \infer{@{text "\<Gamma>\<^sub>1 \<union> \<Gamma>\<^sub>2 \<turnstile> B"}}{@{text "\<Gamma>\<^sub>1 \<turnstile> A \<Longrightarrow> B"} & @{text "\<Gamma>\<^sub>2 \<turnstile> A"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   301
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   302
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   303
  Furthermore, Pure provides a built-in equality @{text "\<equiv> :: \<alpha> \<Rightarrow> \<alpha> \<Rightarrow>
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   304
  prop"} with axioms for reflexivity, substitution, extensionality,
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   305
  and @{text "\<alpha>\<beta>\<eta>"}-conversion on @{text "\<lambda>"}-terms.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   306
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   307
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   308
  An object-logic introduces another layer on top of Pure,
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   309
  e.g.\ with types @{text "i"} for individuals and @{text "o"} for
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   310
  propositions, term constants @{text "Trueprop :: o \<Rightarrow> prop"} as
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   311
  (implicit) derivability judgment and connectives like @{text "\<and> :: o
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   312
  \<Rightarrow> o \<Rightarrow> o"} or @{text "\<forall> :: (i \<Rightarrow> o) \<Rightarrow> o"}, and axioms for object-level
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   313
  rules such as @{text "conjI: A \<Longrightarrow> B \<Longrightarrow> A \<and> B"} or @{text "allI: (\<And>x. B
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   314
  x) \<Longrightarrow> \<forall>x. B x"}.  Derived object rules are represented as theorems of
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   315
  Pure.  After the initial object-logic setup, further axiomatizations
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   316
  are usually avoided; plain definitions and derived principles are
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   317
  used exclusively.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   318
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   319
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   320
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   321
subsection \<open>Reasoning with rules \label{sec:framework-resolution}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   322
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   323
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   324
  Primitive inferences mostly serve foundational purposes.  The main
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   325
  reasoning mechanisms of Pure operate on nested natural deduction
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   326
  rules expressed as formulae, using @{text "\<And>"} to bind local
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   327
  parameters and @{text "\<Longrightarrow>"} to express entailment.  Multiple
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   328
  parameters and premises are represented by repeating these
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   329
  connectives in a right-associative manner.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   330
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   331
  Since @{text "\<And>"} and @{text "\<Longrightarrow>"} commute thanks to the theorem
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   332
  @{prop "(A \<Longrightarrow> (\<And>x. B x)) \<equiv> (\<And>x. A \<Longrightarrow> B x)"}, we may assume w.l.o.g.\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   333
  that rule statements always observe the normal form where
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   334
  quantifiers are pulled in front of implications at each level of
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   335
  nesting.  This means that any Pure proposition may be presented as a
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   336
  \emph{Hereditary Harrop Formula} @{cite "Miller:1991"} which is of the
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   337
  form @{text "\<And>x\<^sub>1 \<dots> x\<^sub>m. H\<^sub>1 \<Longrightarrow> \<dots> H\<^sub>n \<Longrightarrow>
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   338
  A"} for @{text "m, n \<ge> 0"}, and @{text "A"} atomic, and @{text
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   339
  "H\<^sub>1, \<dots>, H\<^sub>n"} being recursively of the same format.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   340
  Following the convention that outermost quantifiers are implicit,
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   341
  Horn clauses @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> A"} are a special
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   342
  case of this.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   343
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   344
  For example, @{text "\<inter>"}-introduction rule encountered before is
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   345
  represented as a Pure theorem as follows:
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   346
  \[
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   347
  @{text "IntI:"}~@{prop "x \<in> A \<Longrightarrow> x \<in> B \<Longrightarrow> x \<in> A \<inter> B"}
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   348
  \]
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   349
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   350
  This is a plain Horn clause, since no further nesting on
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   351
  the left is involved.  The general @{text "\<Inter>"}-introduction
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   352
  corresponds to a Hereditary Harrop Formula with one additional level
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   353
  of nesting:
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   354
  \[
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   355
  @{text "InterI:"}~@{prop "(\<And>A. A \<in> \<A> \<Longrightarrow> x \<in> A) \<Longrightarrow> x \<in> \<Inter>\<A>"}
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   356
  \]
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   357
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   358
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   359
  Goals are also represented as rules: @{text "A\<^sub>1 \<Longrightarrow>
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   360
  \<dots> A\<^sub>n \<Longrightarrow> C"} states that the sub-goals @{text "A\<^sub>1, \<dots>,
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   361
  A\<^sub>n"} entail the result @{text "C"}; for @{text "n = 0"} the
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   362
  goal is finished.  To allow @{text "C"} being a rule statement
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   363
  itself, we introduce the protective marker @{text "# :: prop \<Rightarrow>
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   364
  prop"}, which is defined as identity and hidden from the user.  We
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   365
  initialize and finish goal states as follows:
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   366
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   367
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   368
  \begin{array}{c@ {\qquad}c}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   369
  \infer[(@{inference_def init})]{@{text "C \<Longrightarrow> #C"}}{} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   370
  \infer[(@{inference_def finish})]{@{text C}}{@{text "#C"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   371
  \end{array}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   372
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   373
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   374
  Goal states are refined in intermediate proof steps until
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   375
  a finished form is achieved.  Here the two main reasoning principles
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   376
  are @{inference resolution}, for back-chaining a rule against a
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   377
  sub-goal (replacing it by zero or more sub-goals), and @{inference
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   378
  assumption}, for solving a sub-goal (finding a short-circuit with
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   379
  local assumptions).  Below @{text "\<^vec>x"} stands for @{text
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 48985
diff changeset
   380
  "x\<^sub>1, \<dots>, x\<^sub>n"} (@{text "n \<ge> 0"}).
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   381
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   382
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   383
  \infer[(@{inference_def resolution})]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   384
  {@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> \<^vec>A (\<^vec>a \<^vec>x))\<vartheta> \<Longrightarrow> C\<vartheta>"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   385
  {\begin{tabular}{rl}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   386
    @{text "rule:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   387
    @{text "\<^vec>A \<^vec>a \<Longrightarrow> B \<^vec>a"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   388
    @{text "goal:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   389
    @{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> B' \<^vec>x) \<Longrightarrow> C"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   390
    @{text "goal unifier:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   391
    @{text "(\<lambda>\<^vec>x. B (\<^vec>a \<^vec>x))\<vartheta> = B'\<vartheta>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   392
   \end{tabular}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   393
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   394
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   395
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   396
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   397
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   398
  \infer[(@{inference_def assumption})]{@{text "C\<vartheta>"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   399
  {\begin{tabular}{rl}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   400
    @{text "goal:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   401
    @{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> A \<^vec>x) \<Longrightarrow> C"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   402
    @{text "assm unifier:"} & @{text "A\<vartheta> = H\<^sub>i\<vartheta>"}~~\text{(for some~@{text "H\<^sub>i"})} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   403
   \end{tabular}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   404
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   405
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   406
  The following trace illustrates goal-oriented reasoning in
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   407
  Isabelle/Pure:
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   408
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   409
  {\footnotesize
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   410
  \<^medskip>
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   411
  \begin{tabular}{r@ {\quad}l}
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   412
  @{text "(A \<and> B \<Longrightarrow> B \<and> A) \<Longrightarrow> #(A \<and> B \<Longrightarrow> B \<and> A)"} & @{text "(init)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   413
  @{text "(A \<and> B \<Longrightarrow> B) \<Longrightarrow> (A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(resolution B \<Longrightarrow> A \<Longrightarrow> B \<and> A)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   414
  @{text "(A \<and> B \<Longrightarrow> A \<and> B) \<Longrightarrow> (A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(resolution A \<and> B \<Longrightarrow> B)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   415
  @{text "(A \<and> B \<Longrightarrow> A) \<Longrightarrow> #\<dots>"} & @{text "(assumption)"} \\
48279
ddf866029eb2 more accurate imitation of formal text;
wenzelm
parents: 42666
diff changeset
   416
  @{text "(A \<and> B \<Longrightarrow> A \<and> B) \<Longrightarrow> #\<dots>"} & @{text "(resolution A \<and> B \<Longrightarrow> A)"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   417
  @{text "#\<dots>"} & @{text "(assumption)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   418
  @{text "A \<and> B \<Longrightarrow> B \<and> A"} & @{text "(finish)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   419
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   420
  \<^medskip>
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   421
  }
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   422
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   423
  Compositions of @{inference assumption} after @{inference
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   424
  resolution} occurs quite often, typically in elimination steps.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   425
  Traditional Isabelle tactics accommodate this by a combined
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   426
  @{inference_def elim_resolution} principle.  In contrast, Isar uses
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   427
  a slightly more refined combination, where the assumptions to be
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   428
  closed are marked explicitly, using again the protective marker
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   429
  @{text "#"}:
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   430
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   431
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   432
  \infer[(@{inference refinement})]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   433
  {@{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> \<^vec>G' (\<^vec>a \<^vec>x))\<vartheta> \<Longrightarrow> C\<vartheta>"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   434
  {\begin{tabular}{rl}
42666
fee67c099d03 use existing \<hyphen>;
wenzelm
parents: 42651
diff changeset
   435
    @{text "sub\<hyphen>proof:"} &
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   436
    @{text "\<^vec>G \<^vec>a \<Longrightarrow> B \<^vec>a"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   437
    @{text "goal:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   438
    @{text "(\<And>\<^vec>x. \<^vec>H \<^vec>x \<Longrightarrow> B' \<^vec>x) \<Longrightarrow> C"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   439
    @{text "goal unifier:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   440
    @{text "(\<lambda>\<^vec>x. B (\<^vec>a \<^vec>x))\<vartheta> = B'\<vartheta>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   441
    @{text "assm unifiers:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   442
    @{text "(\<lambda>\<^vec>x. G\<^sub>j (\<^vec>a \<^vec>x))\<vartheta> = #H\<^sub>i\<vartheta>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   443
    & \quad (for each marked @{text "G\<^sub>j"} some @{text "#H\<^sub>i"}) \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   444
   \end{tabular}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   445
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   446
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   447
  Here the @{text "sub\<hyphen>proof"} rule stems from the
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   448
  main @{command fix}-@{command assume}-@{command show} outline of
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   449
  Isar (cf.\ \secref{sec:framework-subproof}): each assumption
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   450
  indicated in the text results in a marked premise @{text "G"} above.
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   451
  The marking enforces resolution against one of the sub-goal's
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   452
  premises.  Consequently, @{command fix}-@{command assume}-@{command
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   453
  show} enables to fit the result of a sub-proof quite robustly into a
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   454
  pending sub-goal, while maintaining a good measure of flexibility.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   455
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   456
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   457
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   458
section \<open>The Isar proof language \label{sec:framework-isar}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   459
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   460
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   461
  Structured proofs are presented as high-level expressions for
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   462
  composing entities of Pure (propositions, facts, and goals).  The
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   463
  Isar proof language allows to organize reasoning within the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   464
  underlying rule calculus of Pure, but Isar is not another logical
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   465
  calculus!
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   466
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   467
  Isar is an exercise in sound minimalism.  Approximately half of the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   468
  language is introduced as primitive, the rest defined as derived
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   469
  concepts.  The following grammar describes the core language
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   470
  (category @{text "proof"}), which is embedded into theory
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   471
  specification elements such as @{command theorem}; see also
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   472
  \secref{sec:framework-stmt} for the separate category @{text
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   473
  "statement"}.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   474
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   475
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   476
  \begin{tabular}{rcl}
42666
fee67c099d03 use existing \<hyphen>;
wenzelm
parents: 42651
diff changeset
   477
    @{text "theory\<hyphen>stmt"} & = & @{command "theorem"}~@{text "statement proof  |"}~~@{command "definition"}~@{text "\<dots>  |  \<dots>"} \\[1ex]
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   478
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   479
    @{text "proof"} & = & @{text "prfx\<^sup>*"}~@{command "proof"}~@{text "method\<^sup>? stmt\<^sup>*"}~@{command "qed"}~@{text "method\<^sup>?"} \\[1ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   480
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   481
    @{text prfx} & = & @{command "using"}~@{text "facts"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   482
    & @{text "|"} & @{command "unfolding"}~@{text "facts"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   483
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   484
    @{text stmt} & = & @{command "{"}~@{text "stmt\<^sup>*"}~@{command "}"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   485
    & @{text "|"} & @{command "next"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   486
    & @{text "|"} & @{command "note"}~@{text "name = facts"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   487
    & @{text "|"} & @{command "let"}~@{text "term = term"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   488
    & @{text "|"} & @{command "fix"}~@{text "var\<^sup>+"} \\
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   489
    & @{text "|"} & @{command assume}~@{text "\<guillemotleft>inference\<guillemotright> name: props"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   490
    & @{text "|"} & @{command "then"}@{text "\<^sup>?"}~@{text goal} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   491
    @{text goal} & = & @{command "have"}~@{text "name: props proof"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   492
    & @{text "|"} & @{command "show"}~@{text "name: props proof"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   493
  \end{tabular}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   494
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   495
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   496
  Simultaneous propositions or facts may be separated by the
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   497
  @{keyword "and"} keyword.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   498
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   499
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   500
  The syntax for terms and propositions is inherited from
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   501
  Pure (and the object-logic).  A @{text "pattern"} is a @{text
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   502
  "term"} with schematic variables, to be bound by higher-order
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   503
  matching.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   504
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   505
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   506
  Facts may be referenced by name or proposition.  For
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   507
  example, the result of ``@{command have}~@{text "a: A \<langle>proof\<rangle>"}''
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   508
  becomes available both as @{text "a"} and
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   509
  \isacharbackquoteopen@{text "A"}\isacharbackquoteclose.  Moreover,
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   510
  fact expressions may involve attributes that modify either the
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   511
  theorem or the background context.  For example, the expression
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   512
  ``@{text "a [OF b]"}'' refers to the composition of two facts
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   513
  according to the @{inference resolution} inference of
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   514
  \secref{sec:framework-resolution}, while ``@{text "a [intro]"}''
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   515
  declares a fact as introduction rule in the context.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   516
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   517
  The special fact called ``@{fact this}'' always refers to the last
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   518
  result, as produced by @{command note}, @{command assume}, @{command
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   519
  have}, or @{command show}.  Since @{command note} occurs
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   520
  frequently together with @{command then} we provide some
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   521
  abbreviations:
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   522
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   523
  \<^medskip>
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   524
  \begin{tabular}{rcl}
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   525
    @{command from}~@{text a} & @{text "\<equiv>"} & @{command note}~@{text a}~@{command then} \\
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   526
    @{command with}~@{text a} & @{text "\<equiv>"} & @{command from}~@{text "a \<AND> this"} \\
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   527
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   528
  \<^medskip>
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   529
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   530
  The @{text "method"} category is essentially a parameter and may be
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   531
  populated later.  Methods use the facts indicated by @{command
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   532
  "then"} or @{command using}, and then operate on the goal state.
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   533
  Some basic methods are predefined: ``@{method "-"}'' leaves the goal
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   534
  unchanged, ``@{method this}'' applies the facts as rules to the
42626
6ac8c55c657e eliminated some duplicate "def" positions;
wenzelm
parents: 40964
diff changeset
   535
  goal, ``@{method (Pure) "rule"}'' applies the facts to another rule and the
6ac8c55c657e eliminated some duplicate "def" positions;
wenzelm
parents: 40964
diff changeset
   536
  result to the goal (both ``@{method this}'' and ``@{method (Pure) rule}''
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   537
  refer to @{inference resolution} of
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   538
  \secref{sec:framework-resolution}).  The secondary arguments to
42626
6ac8c55c657e eliminated some duplicate "def" positions;
wenzelm
parents: 40964
diff changeset
   539
  ``@{method (Pure) rule}'' may be specified explicitly as in ``@{text "(rule
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   540
  a)"}'', or picked from the context.  In the latter case, the system
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   541
  first tries rules declared as @{attribute (Pure) elim} or
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   542
  @{attribute (Pure) dest}, followed by those declared as @{attribute
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   543
  (Pure) intro}.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   544
60618
4c79543cc376 renamed "default" to "standard", to make semantically clear what it is;
wenzelm
parents: 58999
diff changeset
   545
  The default method for @{command proof} is ``@{method standard}''
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   546
  (arguments picked from the context), for @{command qed} it is
60618
4c79543cc376 renamed "default" to "standard", to make semantically clear what it is;
wenzelm
parents: 58999
diff changeset
   547
  ``@{method "succeed"}''.  Further abbreviations for terminal proof steps
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   548
  are ``@{command "by"}~@{text "method\<^sub>1 method\<^sub>2"}'' for
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   549
  ``@{command proof}~@{text "method\<^sub>1"}~@{command qed}~@{text
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   550
  "method\<^sub>2"}'', and ``@{command ".."}'' for ``@{command
60618
4c79543cc376 renamed "default" to "standard", to make semantically clear what it is;
wenzelm
parents: 58999
diff changeset
   551
  "by"}~@{method standard}, and ``@{command "."}'' for ``@{command
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   552
  "by"}~@{method this}''.  The @{command unfolding} element operates
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   553
  directly on the current facts and goal by applying equalities.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   554
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   555
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   556
  Block structure can be indicated explicitly by ``@{command
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   557
  "{"}~@{text "\<dots>"}~@{command "}"}'', although the body of a sub-proof
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   558
  already involves implicit nesting.  In any case, @{command next}
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   559
  jumps into the next section of a block, i.e.\ it acts like closing
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   560
  an implicit block scope and opening another one; there is no direct
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   561
  correspondence to subgoals here.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   562
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   563
  The remaining elements @{command fix} and @{command assume} build up
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   564
  a local context (see \secref{sec:framework-context}), while
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   565
  @{command show} refines a pending sub-goal by the rule resulting
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   566
  from a nested sub-proof (see \secref{sec:framework-subproof}).
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   567
  Further derived concepts will support calculational reasoning (see
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   568
  \secref{sec:framework-calc}).
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   569
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   570
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   571
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   572
subsection \<open>Context elements \label{sec:framework-context}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   573
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   574
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   575
  In judgments @{text "\<Gamma> \<turnstile> \<phi>"} of the primitive framework, @{text "\<Gamma>"}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   576
  essentially acts like a proof context.  Isar elaborates this idea
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   577
  towards a higher-level notion, with additional information for
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   578
  type-inference, term abbreviations, local facts, hypotheses etc.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   579
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   580
  The element @{command fix}~@{text "x :: \<alpha>"} declares a local
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   581
  parameter, i.e.\ an arbitrary-but-fixed entity of a given type; in
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   582
  results exported from the context, @{text "x"} may become anything.
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   583
  The @{command assume}~@{text "\<guillemotleft>inference\<guillemotright>"} element provides a
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   584
  general interface to hypotheses: ``@{command assume}~@{text
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   585
  "\<guillemotleft>inference\<guillemotright> A"}'' produces @{text "A \<turnstile> A"} locally, while the
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   586
  included inference tells how to discharge @{text A} from results
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   587
  @{text "A \<turnstile> B"} later on.  There is no user-syntax for @{text
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   588
  "\<guillemotleft>inference\<guillemotright>"}, i.e.\ it may only occur internally when derived
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   589
  commands are defined in ML.
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   590
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   591
  At the user-level, the default inference for @{command assume} is
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   592
  @{inference discharge} as given below.  The additional variants
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   593
  @{command presume} and @{command def} are defined as follows:
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   594
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   595
  \<^medskip>
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   596
  \begin{tabular}{rcl}
42666
fee67c099d03 use existing \<hyphen>;
wenzelm
parents: 42651
diff changeset
   597
    @{command presume}~@{text A} & @{text "\<equiv>"} & @{command assume}~@{text "\<guillemotleft>weak\<hyphen>discharge\<guillemotright> A"} \\
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   598
    @{command def}~@{text "x \<equiv> a"} & @{text "\<equiv>"} & @{command fix}~@{text x}~@{command assume}~@{text "\<guillemotleft>expansion\<guillemotright> x \<equiv> a"} \\
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   599
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   600
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   601
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   602
  \[
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   603
  \infer[(@{inference_def discharge})]{@{text "\<strut>\<Gamma> - A \<turnstile> #A \<Longrightarrow> B"}}{@{text "\<strut>\<Gamma> \<turnstile> B"}}
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   604
  \]
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   605
  \[
42666
fee67c099d03 use existing \<hyphen>;
wenzelm
parents: 42651
diff changeset
   606
  \infer[(@{inference_def "weak\<hyphen>discharge"})]{@{text "\<strut>\<Gamma> - A \<turnstile> A \<Longrightarrow> B"}}{@{text "\<strut>\<Gamma> \<turnstile> B"}}
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   607
  \]
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   608
  \[
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   609
  \infer[(@{inference_def expansion})]{@{text "\<strut>\<Gamma> - (x \<equiv> a) \<turnstile> B a"}}{@{text "\<strut>\<Gamma> \<turnstile> B x"}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   610
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   611
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   612
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   613
  Note that @{inference discharge} and @{inference
42666
fee67c099d03 use existing \<hyphen>;
wenzelm
parents: 42651
diff changeset
   614
  "weak\<hyphen>discharge"} differ in the marker for @{prop A}, which is
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   615
  relevant when the result of a @{command fix}-@{command
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   616
  assume}-@{command show} outline is composed with a pending goal,
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   617
  cf.\ \secref{sec:framework-subproof}.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   618
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   619
  The most interesting derived context element in Isar is @{command
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   620
  obtain} @{cite \<open>\S5.3\<close> "Wenzel-PhD"}, which supports generalized
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   621
  elimination steps in a purely forward manner.  The @{command obtain}
29739
wenzelm
parents: 29738
diff changeset
   622
  command takes a specification of parameters @{text "\<^vec>x"} and
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   623
  assumptions @{text "\<^vec>A"} to be added to the context, together
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   624
  with a proof of a case rule stating that this extension is
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   625
  conservative (i.e.\ may be removed from closed results later on):
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   626
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   627
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   628
  \begin{tabular}{l}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   629
  @{text "\<langle>facts\<rangle>"}~~@{command obtain}~@{text "\<^vec>x \<WHERE> \<^vec>A \<^vec>x  \<langle>proof\<rangle> \<equiv>"} \\[0.5ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   630
  \quad @{command have}~@{text "case: \<And>thesis. (\<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis) \<Longrightarrow> thesis\<rangle>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   631
  \quad @{command proof}~@{method "-"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   632
  \qquad @{command fix}~@{text thesis} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   633
  \qquad @{command assume}~@{text "[intro]: \<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis"} \\
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   634
  \qquad @{command show}~@{text thesis}~@{command using}~@{text "\<langle>facts\<rangle> \<langle>proof\<rangle>"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   635
  \quad @{command qed} \\
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   636
  \quad @{command fix}~@{text "\<^vec>x"}~@{command assume}~@{text "\<guillemotleft>elimination case\<guillemotright> \<^vec>A \<^vec>x"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   637
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   638
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   639
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   640
  \[
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   641
  \infer[(@{inference elimination})]{@{text "\<Gamma> \<turnstile> B"}}{
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   642
    \begin{tabular}{rl}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   643
    @{text "case:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   644
    @{text "\<Gamma> \<turnstile> \<And>thesis. (\<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis) \<Longrightarrow> thesis"} \\[0.2ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   645
    @{text "result:"} &
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   646
    @{text "\<Gamma> \<union> \<^vec>A \<^vec>y \<turnstile> B"} \\[0.2ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   647
    \end{tabular}}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   648
  \]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   649
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   650
  Here the name ``@{text thesis}'' is a specific convention
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   651
  for an arbitrary-but-fixed proposition; in the primitive natural
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   652
  deduction rules shown before we have occasionally used @{text C}.
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   653
  The whole statement of ``@{command obtain}~@{text x}~@{keyword
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   654
  "where"}~@{text "A x"}'' may be read as a claim that @{text "A x"}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   655
  may be assumed for some arbitrary-but-fixed @{text "x"}.  Also note
29737
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   656
  that ``@{command obtain}~@{text "A \<AND> B"}'' without parameters
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   657
  is similar to ``@{command have}~@{text "A \<AND> B"}'', but the
866841668584 replaced 'assm' by 'assume' -- regular 'assume' is default, if inference is omitted;
wenzelm
parents: 29735
diff changeset
   658
  latter involves multiple sub-goals.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   659
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   660
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   661
  The subsequent Isar proof texts explain all context
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   662
  elements introduced above using the formal proof language itself.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   663
  After finishing a local proof within a block, we indicate the
29739
wenzelm
parents: 29738
diff changeset
   664
  exported result via @{command note}.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   665
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   666
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   667
(*<*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   668
theorem True
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   669
proof
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   670
(*>*)
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   671
  text_raw \<open>\begin{minipage}[t]{0.45\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   672
  {
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   673
    fix x
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   674
    have "B x" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   675
  }
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   676
  note \<open>\<And>x. B x\<close>
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   677
  text_raw \<open>\end{minipage}\quad\begin{minipage}[t]{0.45\textwidth}\<close>(*<*)next(*>*)
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   678
  {
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   679
    assume A
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   680
    have B sorry %noproof
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   681
  }
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   682
  note \<open>A \<Longrightarrow> B\<close>
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   683
  text_raw \<open>\end{minipage}\\[3ex]\begin{minipage}[t]{0.45\textwidth}\<close>(*<*)next(*>*)
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   684
  {
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   685
    def x \<equiv> a
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   686
    have "B x" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   687
  }
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   688
  note \<open>B a\<close>
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   689
  text_raw \<open>\end{minipage}\quad\begin{minipage}[t]{0.45\textwidth}\<close>(*<*)next(*>*)
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   690
  {
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   691
    obtain x where "A x" sorry %noproof
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   692
    have B sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   693
  }
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   694
  note \<open>B\<close>
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   695
  text_raw \<open>\end{minipage}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   696
(*<*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   697
qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   698
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   699
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   700
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   701
  \<^bigskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   702
  This illustrates the meaning of Isar context
29739
wenzelm
parents: 29738
diff changeset
   703
  elements without goals getting in between.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   704
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   705
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   706
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   707
subsection \<open>Structured statements \label{sec:framework-stmt}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   708
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   709
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   710
  The category @{text "statement"} of top-level theorem specifications
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   711
  is defined as follows:
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   712
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   713
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   714
  \begin{tabular}{rcl}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   715
  @{text "statement"} & @{text "\<equiv>"} & @{text "name: props \<AND> \<dots>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   716
  & @{text "|"} & @{text "context\<^sup>* conclusion"} \\[0.5ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   717
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   718
  @{text "context"} & @{text "\<equiv>"} & @{text "\<FIXES> vars \<AND> \<dots>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   719
  & @{text "|"} & @{text "\<ASSUMES> name: props \<AND> \<dots>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   720
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   721
  @{text "conclusion"} & @{text "\<equiv>"} & @{text "\<SHOWS> name: props \<AND> \<dots>"} \\
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   722
  & @{text "|"} & @{text "\<OBTAINS> vars \<AND> \<dots> \<WHERE> name: props \<AND> \<dots>"} \\
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   723
  & & \quad @{text "\<BBAR> \<dots>"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   724
  \end{tabular}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   725
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   726
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   727
  A simple @{text "statement"} consists of named
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   728
  propositions.  The full form admits local context elements followed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   729
  by the actual conclusions, such as ``@{keyword "fixes"}~@{text
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   730
  x}~@{keyword "assumes"}~@{text "A x"}~@{keyword "shows"}~@{text "B
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   731
  x"}''.  The final result emerges as a Pure rule after discharging
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   732
  the context: @{prop "\<And>x. A x \<Longrightarrow> B x"}.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   733
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   734
  The @{keyword "obtains"} variant is another abbreviation defined
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   735
  below; unlike @{command obtain} (cf.\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   736
  \secref{sec:framework-context}) there may be several ``cases''
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   737
  separated by ``@{text "\<BBAR>"}'', each consisting of several
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   738
  parameters (@{text "vars"}) and several premises (@{text "props"}).
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   739
  This specifies multi-branch elimination rules.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   740
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   741
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   742
  \begin{tabular}{l}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   743
  @{text "\<OBTAINS> \<^vec>x \<WHERE> \<^vec>A \<^vec>x   \<BBAR>   \<dots>   \<equiv>"} \\[0.5ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   744
  \quad @{text "\<FIXES> thesis"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   745
  \quad @{text "\<ASSUMES> [intro]: \<And>\<^vec>x. \<^vec>A \<^vec>x \<Longrightarrow> thesis  \<AND>  \<dots>"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   746
  \quad @{text "\<SHOWS> thesis"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   747
  \end{tabular}
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   748
  \<^medskip>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   749
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   750
  Presenting structured statements in such an ``open'' format usually
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   751
  simplifies the subsequent proof, because the outer structure of the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   752
  problem is already laid out directly.  E.g.\ consider the following
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   753
  canonical patterns for @{text "\<SHOWS>"} and @{text "\<OBTAINS>"},
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   754
  respectively:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   755
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   756
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   757
text_raw \<open>\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   758
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   759
theorem
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   760
  fixes x and y
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   761
  assumes "A x" and "B y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   762
  shows "C x y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   763
proof -
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   764
  from \<open>A x\<close> and \<open>B y\<close>
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   765
  show "C x y" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   766
qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   767
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   768
text_raw \<open>\end{minipage}\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   769
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   770
theorem
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   771
  obtains x and y
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   772
  where "A x" and "B y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   773
proof -
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   774
  have "A a" and "B b" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   775
  then show thesis ..
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   776
qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   777
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   778
text_raw \<open>\end{minipage}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   779
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   780
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   781
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   782
  Here local facts \isacharbackquoteopen@{text "A
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   783
  x"}\isacharbackquoteclose\ and \isacharbackquoteopen@{text "B
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   784
  y"}\isacharbackquoteclose\ are referenced immediately; there is no
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   785
  need to decompose the logical rule structure again.  In the second
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   786
  proof the final ``@{command then}~@{command show}~@{text
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   787
  thesis}~@{command ".."}''  involves the local rule case @{text "\<And>x
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   788
  y. A x \<Longrightarrow> B y \<Longrightarrow> thesis"} for the particular instance of terms @{text
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   789
  "a"} and @{text "b"} produced in the body.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   790
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   791
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   792
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   793
subsection \<open>Structured proof refinement \label{sec:framework-subproof}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   794
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   795
text \<open>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   796
  By breaking up the grammar for the Isar proof language, we may
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   797
  understand a proof text as a linear sequence of individual proof
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   798
  commands.  These are interpreted as transitions of the Isar virtual
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   799
  machine (Isar/VM), which operates on a block-structured
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   800
  configuration in single steps.  This allows users to write proof
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   801
  texts in an incremental manner, and inspect intermediate
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   802
  configurations for debugging.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   803
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   804
  The basic idea is analogous to evaluating algebraic expressions on a
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   805
  stack machine: @{text "(a + b) \<cdot> c"} then corresponds to a sequence
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   806
  of single transitions for each symbol @{text "(, a, +, b, ), \<cdot>, c"}.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   807
  In Isar the algebraic values are facts or goals, and the operations
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   808
  are inferences.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   809
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   810
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   811
  The Isar/VM state maintains a stack of nodes, each node
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   812
  contains the local proof context, the linguistic mode, and a pending
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   813
  goal (optional).  The mode determines the type of transition that
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   814
  may be performed next, it essentially alternates between forward and
29738
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   815
  backward reasoning, with an intermediate stage for chained facts
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   816
  (see \figref{fig:isar-vm}).
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   817
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   818
  \begin{figure}[htb]
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   819
  \begin{center}
48958
12afbf6eb7f9 more standard document preparation within session context;
wenzelm
parents: 48279
diff changeset
   820
  \includegraphics[width=0.8\textwidth]{isar-vm}
29738
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   821
  \end{center}
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   822
  \caption{Isar/VM modes}\label{fig:isar-vm}
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   823
  \end{figure}
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   824
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   825
  For example, in @{text "state"} mode Isar acts like a mathematical
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   826
  scratch-pad, accepting declarations like @{command fix}, @{command
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   827
  assume}, and claims like @{command have}, @{command show}.  A goal
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   828
  statement changes the mode to @{text "prove"}, which means that we
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   829
  may now refine the problem via @{command unfolding} or @{command
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   830
  proof}.  Then we are again in @{text "state"} mode of a proof body,
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   831
  which may issue @{command show} statements to solve pending
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   832
  sub-goals.  A concluding @{command qed} will return to the original
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   833
  @{text "state"} mode one level upwards.  The subsequent Isar/VM
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   834
  trace indicates block structure, linguistic mode, goal state, and
05d5615e12d3 added Isar/VM mode transition diagram;
wenzelm
parents: 29737
diff changeset
   835
  inferences:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   836
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   837
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   838
text_raw \<open>\begingroup\footnotesize\<close>
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   839
(*<*)notepad begin
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   840
(*>*)
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   841
  text_raw \<open>\begin{minipage}[t]{0.18\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   842
  have "A \<longrightarrow> B"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   843
  proof
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   844
    assume A
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   845
    show B
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   846
      sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   847
  qed
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   848
  text_raw \<open>\end{minipage}\quad
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   849
\begin{minipage}[t]{0.06\textwidth}
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   850
@{text "begin"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   851
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   852
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   853
@{text "begin"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   854
@{text "end"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   855
@{text "end"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   856
\end{minipage}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   857
\begin{minipage}[t]{0.08\textwidth}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   858
@{text "prove"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   859
@{text "state"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   860
@{text "state"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   861
@{text "prove"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   862
@{text "state"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   863
@{text "state"} \\
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   864
\end{minipage}\begin{minipage}[t]{0.35\textwidth}
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   865
@{text "(A \<longrightarrow> B) \<Longrightarrow> #(A \<longrightarrow> B)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   866
@{text "(A \<Longrightarrow> B) \<Longrightarrow> #(A \<longrightarrow> B)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   867
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   868
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   869
@{text "#(A \<longrightarrow> B)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   870
@{text "A \<longrightarrow> B"} \\
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   871
\end{minipage}\begin{minipage}[t]{0.4\textwidth}
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   872
@{text "(init)"} \\
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   873
@{text "(resolution impI)"} \\
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   874
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   875
\\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   876
@{text "(refinement #A \<Longrightarrow> B)"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   877
@{text "(finish)"} \\
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   878
\end{minipage}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   879
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   880
end
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   881
(*>*)
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   882
text_raw \<open>\endgroup\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   883
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   884
text \<open>
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   885
  Here the @{inference refinement} inference from
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   886
  \secref{sec:framework-resolution} mediates composition of Isar
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   887
  sub-proofs nicely.  Observe that this principle incorporates some
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   888
  degree of freedom in proof composition.  In particular, the proof
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   889
  body allows parameters and assumptions to be re-ordered, or commuted
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   890
  according to Hereditary Harrop Form.  Moreover, context elements
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   891
  that are not used in a sub-proof may be omitted altogether.  For
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   892
  example:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   893
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   894
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   895
text_raw \<open>\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   896
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   897
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   898
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   899
begin
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   900
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   901
  have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   902
  proof -
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   903
    fix x and y
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   904
    assume "A x" and "B y"
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   905
    show "C x y" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   906
  qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   907
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   908
text_raw \<open>\end{minipage}\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   909
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   910
(*<*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   911
next
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   912
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   913
  have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   914
  proof -
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   915
    fix x assume "A x"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   916
    fix y assume "B y"
29733
f38ccabb2edc improved sorry/noproof markup;
wenzelm
parents: 29732
diff changeset
   917
    show "C x y" sorry %noproof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   918
  qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   919
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   920
text_raw \<open>\end{minipage}\\[3ex]\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   921
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   922
(*<*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   923
next
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   924
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   925
  have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   926
  proof -
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   927
    fix y assume "B y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   928
    fix x assume "A x"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   929
    show "C x y" sorry
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   930
  qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   931
58999
ed09ae4ea2d8 uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents: 58618
diff changeset
   932
text_raw \<open>\end{minipage}\begin{minipage}{0.5\textwidth}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   933
(*<*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   934
next
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   935
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   936
  have "\<And>x y. A x \<Longrightarrow> B y \<Longrightarrow> C x y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   937
  proof -
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   938
    fix y assume "B y"
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   939
    fix x
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   940
    show "C x y" sorry
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   941
  qed
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   942
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
   943
end
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   944
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   945
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   946
text_raw \<open>\end{minipage}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   947
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   948
text \<open>
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   949
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   950
  Such ``peephole optimizations'' of Isar texts are
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   951
  practically important to improve readability, by rearranging
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   952
  contexts elements according to the natural flow of reasoning in the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   953
  body, while still observing the overall scoping rules.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   954
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   955
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
   956
  This illustrates the basic idea of structured proof
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   957
  processing in Isar.  The main mechanisms are based on natural
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   958
  deduction rule composition within the Pure framework.  In
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   959
  particular, there are no direct operations on goal states within the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   960
  proof body.  Moreover, there is no hidden automated reasoning
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   961
  involved, just plain unification.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   962
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   963
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   964
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   965
subsection \<open>Calculational reasoning \label{sec:framework-calc}\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   966
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
   967
text \<open>
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   968
  The existing Isar infrastructure is sufficiently flexible to support
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   969
  calculational reasoning (chains of transitivity steps) as derived
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   970
  concept.  The generic proof elements introduced below depend on
29732
wenzelm
parents: 29729
diff changeset
   971
  rules declared as @{attribute trans} in the context.  It is left to
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   972
  the object-logic to provide a suitable rule collection for mixed
29732
wenzelm
parents: 29729
diff changeset
   973
  relations of @{text "="}, @{text "<"}, @{text "\<le>"}, @{text "\<subset>"},
wenzelm
parents: 29729
diff changeset
   974
  @{text "\<subseteq>"} etc.  Due to the flexibility of rule composition
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   975
  (\secref{sec:framework-resolution}), substitution of equals by
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   976
  equals is covered as well, even substitution of inequalities
58552
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   977
  involving monotonicity conditions; see also @{cite \<open>\S6\<close> "Wenzel-PhD"}
66fed99e874f prefer @{cite} antiquotation;
wenzelm
parents: 56594
diff changeset
   978
  and @{cite "Bauer-Wenzel:2001"}.
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   979
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   980
  The generic calculational mechanism is based on the observation that
29735
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   981
  rules such as @{text "trans:"}~@{prop "x = y \<Longrightarrow> y = z \<Longrightarrow> x = z"}
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   982
  proceed from the premises towards the conclusion in a deterministic
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   983
  fashion.  Thus we may reason in forward mode, feeding intermediate
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   984
  results into rules selected from the context.  The course of
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   985
  reasoning is organized by maintaining a secondary fact called
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   986
  ``@{fact calculation}'', apart from the primary ``@{fact this}''
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   987
  already provided by the Isar primitives.  In the definitions below,
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   988
  @{attribute OF} refers to @{inference resolution}
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   989
  (\secref{sec:framework-resolution}) with multiple rule arguments,
1da96affdefe misc tuning;
wenzelm
parents: 29733
diff changeset
   990
  and @{text "trans"} represents to a suitable rule from the context:
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   991
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   992
  \begin{matharray}{rcl}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   993
    @{command "also"}@{text "\<^sub>0"} & \equiv & @{command "note"}~@{text "calculation = this"} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   994
    @{command "also"}@{text "\<^sub>n\<^sub>+\<^sub>1"} & \equiv & @{command "note"}~@{text "calculation = trans [OF calculation this]"} \\[0.5ex]
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   995
    @{command "finally"} & \equiv & @{command "also"}~@{command "from"}~@{text calculation} \\
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   996
  \end{matharray}
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   997
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
   998
  The start of a calculation is determined implicitly in the
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
   999
  text: here @{command also} sets @{fact calculation} to the current
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1000
  result; any subsequent occurrence will update @{fact calculation} by
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1001
  combination with the next result and a transitivity rule.  The
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1002
  calculational sequence is concluded via @{command finally}, where
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1003
  the final result is exposed for use in a concluding claim.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1004
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1005
  Here is a canonical proof pattern, using @{command have} to
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1006
  establish the intermediate results:
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
  1007
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1008
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1009
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
  1010
notepad
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
  1011
begin
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1012
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1013
  have "a = b" sorry
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1014
  also have "\<dots> = c" sorry
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1015
  also have "\<dots> = d" sorry
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1016
  finally have "a = d" .
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1017
(*<*)
40964
482a8334ee9e prefer 'notepad' over 'example_proof';
wenzelm
parents: 40476
diff changeset
  1018
end
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1019
(*>*)
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1020
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
  1021
text \<open>
61420
ee42cba50933 redundant due to \parindent 0pt;
wenzelm
parents: 60618
diff changeset
  1022
  The term ``@{text "\<dots>"}'' above is a special abbreviation
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1023
  provided by the Isabelle/Isar syntax layer: it statically refers to
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1024
  the right-hand side argument of the previous statement given in the
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1025
  text.  Thus it happens to coincide with relevant sub-expressions in
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1026
  the calculational chain, but the exact correspondence is dependent
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1027
  on the transitivity rules being involved.
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1028
61421
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
  1029
  \<^medskip>
e0825405d398 more symbols;
wenzelm
parents: 61420
diff changeset
  1030
  Symmetry rules such as @{prop "x = y \<Longrightarrow> y = x"} are like
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1031
  transitivities with only one premise.  Isar maintains a separate
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1032
  rule collection declared via the @{attribute sym} attribute, to be
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1033
  used in fact expressions ``@{text "a [symmetric]"}'', or single-step
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1034
  proofs ``@{command assume}~@{text "x = y"}~@{command then}~@{command
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1035
  have}~@{text "y = x"}~@{command ".."}''.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58552
diff changeset
  1036
\<close>
29729
c2e926455fcc more on Isar framework -- mostly from Trybulec Festschrift;
wenzelm
parents: 29721
diff changeset
  1037
29742
8edd5198dedb tuned spacing;
wenzelm
parents: 29739
diff changeset
  1038
end