doc-src/IsarRef/Thy/Quick_Reference.thy
author wenzelm
Thu, 08 May 2008 22:05:15 +0200
changeset 26852 a31203f58b20
parent 26780 de781c5c48c1
child 30050 48634259d410
child 30240 5b25fee0362c
permissions -rw-r--r--
misc tuning;
wenzelm@26779
     1
(* $Id$ *)
wenzelm@26779
     2
wenzelm@26779
     3
theory Quick_Reference
wenzelm@26779
     4
imports Main
wenzelm@26779
     5
begin
wenzelm@26779
     6
wenzelm@26779
     7
chapter {* Isabelle/Isar quick reference \label{ap:refcard} *}
wenzelm@26779
     8
wenzelm@26779
     9
section {* Proof commands *}
wenzelm@26779
    10
wenzelm@26779
    11
subsection {* Primitives and basic syntax *}
wenzelm@26779
    12
wenzelm@26779
    13
text {*
wenzelm@26779
    14
  \begin{tabular}{ll}
wenzelm@26779
    15
    @{command "fix"}~@{text x} & augment context by @{text "\<And>x. \<box>"} \\
wenzelm@26779
    16
    @{command "assume"}~@{text "a: \<phi>"} & augment context by @{text "\<phi> \<Longrightarrow> \<box>"} \\
wenzelm@26779
    17
    @{command "then"} & indicate forward chaining of facts \\
wenzelm@26779
    18
    @{command "have"}~@{text "a: \<phi>"} & prove local result \\
wenzelm@26779
    19
    @{command "show"}~@{text "a: \<phi>"} & prove local result, refining some goal \\
wenzelm@26779
    20
    @{command "using"}~@{text a} & indicate use of additional facts \\
wenzelm@26779
    21
    @{command "unfolding"}~@{text a} & unfold definitional equations \\
wenzelm@26779
    22
    @{command "proof"}~@{text "m\<^sub>1"}~\dots~@{command "qed"}~@{text "m\<^sub>2"} & indicate proof structure and refinements \\
wenzelm@26852
    23
    @{command "{"}~@{text "\<dots>"}~@{command "}"} & indicate explicit blocks \\
wenzelm@26779
    24
    @{command "next"} & switch blocks \\
wenzelm@26779
    25
    @{command "note"}~@{text "a = b"} & reconsider facts \\
wenzelm@26779
    26
    @{command "let"}~@{text "p = t"} & abbreviate terms by higher-order matching \\
wenzelm@26779
    27
  \end{tabular}
wenzelm@26779
    28
wenzelm@26852
    29
  \medskip
wenzelm@26852
    30
wenzelm@26852
    31
  \begin{tabular}{rcl}
wenzelm@26852
    32
    @{text "theory\<dash>stmt"} & = & @{command "theorem"}~@{text "name: props proof  |"}~~@{command "definition"}~@{text "\<dots>  |  \<dots>"} \\[1ex]
wenzelm@26779
    33
    @{text "proof"} & = & @{text "prfx\<^sup>*"}~@{command "proof"}~@{text "method stmt\<^sup>*"}~@{command "qed"}~@{text method} \\
wenzelm@26852
    34
    & @{text "|"} & @{text "prfx\<^sup>*"}~@{command "done"} \\[1ex]
wenzelm@26779
    35
    @{text prfx} & = & @{command "apply"}~@{text method} \\
wenzelm@26852
    36
    & @{text "|"} & @{command "using"}~@{text "facts"} \\
wenzelm@26852
    37
    & @{text "|"} & @{command "unfolding"}~@{text "facts"} \\
wenzelm@26779
    38
    @{text stmt} & = & @{command "{"}~@{text "stmt\<^sup>*"}~@{command "}"} \\
wenzelm@26852
    39
    & @{text "|"} & @{command "next"} \\
wenzelm@26852
    40
    & @{text "|"} & @{command "note"}~@{text "name = facts"} \\
wenzelm@26852
    41
    & @{text "|"} & @{command "let"}~@{text "term = term"} \\
wenzelm@26852
    42
    & @{text "|"} & @{command "fix"}~@{text "var\<^sup>+"} \\
wenzelm@26852
    43
    & @{text "|"} & @{command "assume"}~@{text "name: props"} \\
wenzelm@26852
    44
    & @{text "|"} & @{command "then"}@{text "\<^sup>?"}~@{text goal} \\
wenzelm@26780
    45
    @{text goal} & = & @{command "have"}~@{text "name: props proof"} \\
wenzelm@26852
    46
    & @{text "|"} & @{command "show"}~@{text "name: props proof"} \\
wenzelm@26852
    47
  \end{tabular}
wenzelm@26779
    48
*}
wenzelm@26779
    49
wenzelm@26779
    50
wenzelm@26779
    51
subsection {* Abbreviations and synonyms *}
wenzelm@26779
    52
wenzelm@26779
    53
text {*
wenzelm@26852
    54
  \begin{tabular}{rcl}
wenzelm@26852
    55
    @{command "by"}~@{text "m\<^sub>1 m\<^sub>2"} & @{text "\<equiv>"} &
wenzelm@26852
    56
      @{command "proof"}~@{text "m\<^sub>1"}~@{command "qed"}~@{text "m\<^sub>2"} \\
wenzelm@26852
    57
    @{command ".."} & @{text "\<equiv>"} & @{command "by"}~@{text rule} \\
wenzelm@26852
    58
    @{command "."} & @{text "\<equiv>"} & @{command "by"}~@{text this} \\
wenzelm@26852
    59
    @{command "hence"} & @{text "\<equiv>"} & @{command "then"}~@{command "have"} \\
wenzelm@26852
    60
    @{command "thus"} & @{text "\<equiv>"} & @{command "then"}~@{command "show"} \\
wenzelm@26852
    61
    @{command "from"}~@{text a} & @{text "\<equiv>"} & @{command "note"}~@{text a}~@{command "then"} \\
wenzelm@26852
    62
    @{command "with"}~@{text a} & @{text "\<equiv>"} & @{command "from"}~@{text "a \<AND> this"} \\[1ex]
wenzelm@26852
    63
    @{command "from"}~@{text this} & @{text "\<equiv>"} & @{command "then"} \\
wenzelm@26852
    64
    @{command "from"}~@{text this}~@{command "have"} & @{text "\<equiv>"} & @{command "hence"} \\
wenzelm@26852
    65
    @{command "from"}~@{text this}~@{command "show"} & @{text "\<equiv>"} & @{command "thus"} \\
wenzelm@26852
    66
  \end{tabular}
wenzelm@26779
    67
*}
wenzelm@26779
    68
wenzelm@26779
    69
wenzelm@26779
    70
subsection {* Derived elements *}
wenzelm@26779
    71
wenzelm@26779
    72
text {*
wenzelm@26852
    73
  \begin{tabular}{rcl}
wenzelm@26852
    74
    @{command "also"}@{text "\<^sub>0"} & @{text "\<approx>"} &
wenzelm@26852
    75
      @{command "note"}~@{text "calculation = this"} \\
wenzelm@26852
    76
    @{command "also"}@{text "\<^sub>n\<^sub>+\<^sub>1"} & @{text "\<approx>"} &
wenzelm@26852
    77
      @{command "note"}~@{text "calculation = trans [OF calculation this]"} \\
wenzelm@26852
    78
    @{command "finally"} & @{text "\<approx>"} &
wenzelm@26852
    79
      @{command "also"}~@{command "from"}~@{text calculation} \\[0.5ex]
wenzelm@26852
    80
    @{command "moreover"} & @{text "\<approx>"} &
wenzelm@26852
    81
      @{command "note"}~@{text "calculation = calculation this"} \\
wenzelm@26852
    82
    @{command "ultimately"} & @{text "\<approx>"} &
wenzelm@26852
    83
      @{command "moreover"}~@{command "from"}~@{text calculation} \\[0.5ex]
wenzelm@26852
    84
    @{command "presume"}~@{text "a: \<phi>"} & @{text "\<approx>"} &
wenzelm@26852
    85
      @{command "assume"}~@{text "a: \<phi>"} \\
wenzelm@26852
    86
    @{command "def"}~@{text "a: x \<equiv> t"} & @{text "\<approx>"} &
wenzelm@26852
    87
      @{command "fix"}~@{text x}~@{command "assume"}~@{text "a: x \<equiv> t"} \\
wenzelm@26852
    88
    @{command "obtain"}~@{text "x \<WHERE> a: \<phi>"} & @{text "\<approx>"} &
wenzelm@26852
    89
      @{text "\<dots>"}~@{command "fix"}~@{text x}~@{command "assume"}~@{text "a: \<phi>"} \\
wenzelm@26852
    90
    @{command "case"}~@{text c} & @{text "\<approx>"} &
wenzelm@26852
    91
      @{command "fix"}~@{text x}~@{command "assume"}~@{text "c: \<phi>"} \\
wenzelm@26852
    92
    @{command "sorry"} & @{text "\<approx>"} &
wenzelm@26852
    93
      @{command "by"}~@{text cheating} \\
wenzelm@26852
    94
  \end{tabular}
wenzelm@26779
    95
*}
wenzelm@26779
    96
wenzelm@26779
    97
wenzelm@26779
    98
subsection {* Diagnostic commands *}
wenzelm@26779
    99
wenzelm@26779
   100
text {*
wenzelm@26779
   101
  \begin{tabular}{ll}
wenzelm@26779
   102
    @{command "pr"} & print current state \\
wenzelm@26779
   103
    @{command "thm"}~@{text a} & print fact \\
wenzelm@26779
   104
    @{command "term"}~@{text t} & print term \\
wenzelm@26779
   105
    @{command "prop"}~@{text \<phi>} & print meta-level proposition \\
wenzelm@26779
   106
    @{command "typ"}~@{text \<tau>} & print meta-level type \\
wenzelm@26779
   107
  \end{tabular}
wenzelm@26779
   108
*}
wenzelm@26779
   109
wenzelm@26779
   110
wenzelm@26779
   111
section {* Proof methods *}
wenzelm@26779
   112
wenzelm@26779
   113
text {*
wenzelm@26779
   114
  \begin{tabular}{ll}
wenzelm@26779
   115
    \multicolumn{2}{l}{\textbf{Single steps (forward-chaining facts)}} \\[0.5ex]
wenzelm@26779
   116
    @{method assumption} & apply some assumption \\
wenzelm@26779
   117
    @{method this} & apply current facts \\
wenzelm@26779
   118
    @{method rule}~@{text a} & apply some rule  \\
wenzelm@26779
   119
    @{method rule} & apply standard rule (default for @{command "proof"}) \\
wenzelm@26779
   120
    @{method contradiction} & apply @{text "\<not>"} elimination rule (any order) \\
wenzelm@26779
   121
    @{method cases}~@{text t} & case analysis (provides cases) \\
wenzelm@26779
   122
    @{method induct}~@{text x} & proof by induction (provides cases) \\[2ex]
wenzelm@26779
   123
wenzelm@26779
   124
    \multicolumn{2}{l}{\textbf{Repeated steps (inserting facts)}} \\[0.5ex]
wenzelm@26779
   125
    @{method "-"} & no rules \\
wenzelm@26779
   126
    @{method intro}~@{text a} & introduction rules \\
wenzelm@26779
   127
    @{method intro_classes} & class introduction rules \\
wenzelm@26779
   128
    @{method elim}~@{text a} & elimination rules \\
wenzelm@26779
   129
    @{method unfold}~@{text a} & definitional rewrite rules \\[2ex]
wenzelm@26779
   130
wenzelm@26779
   131
    \multicolumn{2}{l}{\textbf{Automated proof tools (inserting facts)}} \\[0.5ex]
wenzelm@26779
   132
    @{method iprover} & intuitionistic proof search \\
wenzelm@26779
   133
    @{method blast}, @{method fast} & Classical Reasoner \\
wenzelm@26779
   134
    @{method simp}, @{method simp_all} & Simplifier (+ Splitter) \\
wenzelm@26779
   135
    @{method auto}, @{method force} & Simplifier + Classical Reasoner \\
wenzelm@26779
   136
    @{method arith} & Arithmetic procedures \\
wenzelm@26779
   137
  \end{tabular}
wenzelm@26779
   138
*}
wenzelm@26779
   139
wenzelm@26779
   140
wenzelm@26779
   141
section {* Attributes *}
wenzelm@26779
   142
wenzelm@26779
   143
text {*
wenzelm@26779
   144
  \begin{tabular}{ll}
wenzelm@26779
   145
    \multicolumn{2}{l}{\textbf{Operations}} \\[0.5ex]
wenzelm@26779
   146
    @{attribute OF}~@{text a} & rule resolved with facts (skipping ``@{text _}'') \\
wenzelm@26779
   147
    @{attribute of}~@{text t} & rule instantiated with terms (skipping ``@{text _}'') \\
wenzelm@26779
   148
    @{attribute "where"}~@{text "x = t"} & rule instantiated with terms, by variable name \\
wenzelm@26779
   149
    @{attribute symmetric} & resolution with symmetry rule \\
wenzelm@26779
   150
    @{attribute THEN}~@{text b} & resolution with another rule \\
wenzelm@26779
   151
    @{attribute rule_format} & result put into standard rule format \\
wenzelm@26779
   152
    @{attribute elim_format} & destruct rule turned into elimination rule format \\[1ex]
wenzelm@26779
   153
wenzelm@26779
   154
    \multicolumn{2}{l}{\textbf{Declarations}} \\[0.5ex]
wenzelm@26779
   155
    @{attribute simp} & Simplifier rule \\
wenzelm@26779
   156
    @{attribute intro}, @{attribute elim}, @{attribute dest} & Pure or Classical Reasoner rule \\
wenzelm@26779
   157
    @{attribute iff} & Simplifier + Classical Reasoner rule \\
wenzelm@26779
   158
    @{attribute split} & case split rule \\
wenzelm@26779
   159
    @{attribute trans} & transitivity rule \\
wenzelm@26779
   160
    @{attribute sym} & symmetry rule \\
wenzelm@26779
   161
  \end{tabular}
wenzelm@26779
   162
*}
wenzelm@26779
   163
wenzelm@26779
   164
wenzelm@26779
   165
section {* Rule declarations and methods *}
wenzelm@26779
   166
wenzelm@26779
   167
text {*
wenzelm@26779
   168
  \begin{tabular}{l|lllll}
wenzelm@26779
   169
      & @{method rule} & @{method iprover} & @{method blast} & @{method simp} & @{method auto} \\
wenzelm@26779
   170
      &                &                   & @{method fast} & @{method simp_all} & @{method force} \\
wenzelm@26779
   171
    \hline
wenzelm@26779
   172
    @{attribute Pure.elim}@{text "!"} @{attribute Pure.intro}@{text "!"}
wenzelm@26779
   173
      & @{text "\<times>"}    & @{text "\<times>"} \\
wenzelm@26779
   174
    @{attribute Pure.elim} @{attribute Pure.intro}
wenzelm@26779
   175
      & @{text "\<times>"}    & @{text "\<times>"} \\
wenzelm@26779
   176
    @{attribute elim}@{text "!"} @{attribute intro}@{text "!"}
wenzelm@26779
   177
      & @{text "\<times>"}    &                    & @{text "\<times>"}          &                     & @{text "\<times>"} \\
wenzelm@26779
   178
    @{attribute elim} @{attribute intro}
wenzelm@26779
   179
      & @{text "\<times>"}    &                    & @{text "\<times>"}          &                     & @{text "\<times>"} \\
wenzelm@26779
   180
    @{attribute iff}
wenzelm@26779
   181
      & @{text "\<times>"}    &                    & @{text "\<times>"}          & @{text "\<times>"}         & @{text "\<times>"} \\
wenzelm@26779
   182
    @{attribute iff}@{text "?"}
wenzelm@26779
   183
      & @{text "\<times>"} \\
wenzelm@26779
   184
    @{attribute elim}@{text "?"} @{attribute intro}@{text "?"}
wenzelm@26779
   185
      & @{text "\<times>"} \\
wenzelm@26779
   186
    @{attribute simp}
wenzelm@26779
   187
      &                &                    &                      & @{text "\<times>"}         & @{text "\<times>"} \\
wenzelm@26779
   188
    @{attribute cong}
wenzelm@26779
   189
      &                &                    &                      & @{text "\<times>"}         & @{text "\<times>"} \\
wenzelm@26779
   190
    @{attribute split}
wenzelm@26779
   191
      &                &                    &                      & @{text "\<times>"}         & @{text "\<times>"} \\
wenzelm@26779
   192
  \end{tabular}
wenzelm@26779
   193
*}
wenzelm@26779
   194
wenzelm@26779
   195
wenzelm@26779
   196
section {* Emulating tactic scripts *}
wenzelm@26779
   197
wenzelm@26779
   198
subsection {* Commands *}
wenzelm@26779
   199
wenzelm@26779
   200
text {*
wenzelm@26779
   201
  \begin{tabular}{ll}
wenzelm@26779
   202
    @{command "apply"}~@{text m} & apply proof method at initial position \\
wenzelm@26779
   203
    @{command "apply_end"}~@{text m} & apply proof method near terminal position \\
wenzelm@26779
   204
    @{command "done"} & complete proof \\
wenzelm@26779
   205
    @{command "defer"}~@{text n} & move subgoal to end \\
wenzelm@26779
   206
    @{command "prefer"}~@{text n} & move subgoal to beginning \\
wenzelm@26779
   207
    @{command "back"} & backtrack last command \\
wenzelm@26779
   208
  \end{tabular}
wenzelm@26779
   209
*}
wenzelm@26779
   210
wenzelm@26779
   211
wenzelm@26779
   212
subsection {* Methods *}
wenzelm@26779
   213
wenzelm@26779
   214
text {*
wenzelm@26779
   215
  \begin{tabular}{ll}
wenzelm@26779
   216
    @{method rule_tac}~@{text insts} & resolution (with instantiation) \\
wenzelm@26779
   217
    @{method erule_tac}~@{text insts} & elim-resolution (with instantiation) \\
wenzelm@26779
   218
    @{method drule_tac}~@{text insts} & destruct-resolution (with instantiation) \\
wenzelm@26779
   219
    @{method frule_tac}~@{text insts} & forward-resolution (with instantiation) \\
wenzelm@26779
   220
    @{method cut_tac}~@{text insts} & insert facts (with instantiation) \\
wenzelm@26779
   221
    @{method thin_tac}~@{text \<phi>} & delete assumptions \\
wenzelm@26779
   222
    @{method subgoal_tac}~@{text \<phi>} & new claims \\
wenzelm@26779
   223
    @{method rename_tac}~@{text x} & rename innermost goal parameters \\
wenzelm@26779
   224
    @{method rotate_tac}~@{text n} & rotate assumptions of goal \\
wenzelm@26779
   225
    @{method tactic}~@{text "text"} & arbitrary ML tactic \\
wenzelm@26779
   226
    @{method case_tac}~@{text t} & exhaustion (datatypes) \\
wenzelm@26779
   227
    @{method induct_tac}~@{text x} & induction (datatypes) \\
wenzelm@26779
   228
    @{method ind_cases}~@{text t} & exhaustion + simplification (inductive predicates) \\
wenzelm@26779
   229
  \end{tabular}
wenzelm@26779
   230
*}
wenzelm@26779
   231
wenzelm@26779
   232
end