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