src/Doc/Isar_Ref/Quick_Reference.thy
author wenzelm
Wed Mar 25 11:39:52 2015 +0100 (2015-03-25)
changeset 59809 87641097d0f3
parent 58618 782f0b662cae
child 60618 4c79543cc376
permissions -rw-r--r--
tuned signature;
wenzelm@26779
     1
theory Quick_Reference
wenzelm@42651
     2
imports Base Main
wenzelm@26779
     3
begin
wenzelm@26779
     4
wenzelm@58618
     5
chapter \<open>Isabelle/Isar quick reference \label{ap:refcard}\<close>
wenzelm@26779
     6
wenzelm@58618
     7
section \<open>Proof commands\<close>
wenzelm@26779
     8
wenzelm@58618
     9
subsection \<open>Primitives and basic syntax\<close>
wenzelm@26779
    10
wenzelm@58618
    11
text \<open>
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@40535
    25
    @{command "write"}~@{text "c  (mx)"} & declare local mixfix syntax \\
wenzelm@26779
    26
  \end{tabular}
wenzelm@26779
    27
wenzelm@26852
    28
  \medskip
wenzelm@26852
    29
wenzelm@26852
    30
  \begin{tabular}{rcl}
wenzelm@29724
    31
    @{text "proof"} & = & @{text "prfx\<^sup>*"}~@{command "proof"}~@{text "method\<^sup>? stmt\<^sup>*"}~@{command "qed"}~@{text "method\<^sup>?"} \\
wenzelm@42667
    32
    & @{text "|"} & @{text "prfx\<^sup>*"}~@{command "done"} \\
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@40535
    40
    & @{text "|"} & @{command "write"}~@{text "name (mixfix)"} \\
wenzelm@26852
    41
    & @{text "|"} & @{command "fix"}~@{text "var\<^sup>+"} \\
wenzelm@26852
    42
    & @{text "|"} & @{command "assume"}~@{text "name: props"} \\
wenzelm@26852
    43
    & @{text "|"} & @{command "then"}@{text "\<^sup>?"}~@{text goal} \\
wenzelm@26780
    44
    @{text goal} & = & @{command "have"}~@{text "name: props proof"} \\
wenzelm@26852
    45
    & @{text "|"} & @{command "show"}~@{text "name: props proof"} \\
wenzelm@26852
    46
  \end{tabular}
wenzelm@58618
    47
\<close>
wenzelm@26779
    48
wenzelm@26779
    49
wenzelm@58618
    50
subsection \<open>Abbreviations and synonyms\<close>
wenzelm@26779
    51
wenzelm@58618
    52
text \<open>
wenzelm@26852
    53
  \begin{tabular}{rcl}
wenzelm@26852
    54
    @{command "by"}~@{text "m\<^sub>1 m\<^sub>2"} & @{text "\<equiv>"} &
wenzelm@26852
    55
      @{command "proof"}~@{text "m\<^sub>1"}~@{command "qed"}~@{text "m\<^sub>2"} \\
wenzelm@26852
    56
    @{command ".."} & @{text "\<equiv>"} & @{command "by"}~@{text rule} \\
wenzelm@26852
    57
    @{command "."} & @{text "\<equiv>"} & @{command "by"}~@{text this} \\
wenzelm@26852
    58
    @{command "hence"} & @{text "\<equiv>"} & @{command "then"}~@{command "have"} \\
wenzelm@26852
    59
    @{command "thus"} & @{text "\<equiv>"} & @{command "then"}~@{command "show"} \\
wenzelm@26852
    60
    @{command "from"}~@{text a} & @{text "\<equiv>"} & @{command "note"}~@{text a}~@{command "then"} \\
wenzelm@42667
    61
    @{command "with"}~@{text a} & @{text "\<equiv>"} & @{command "from"}~@{text "a \<AND> this"} \\
wenzelm@26852
    62
    @{command "from"}~@{text this} & @{text "\<equiv>"} & @{command "then"} \\
wenzelm@26852
    63
    @{command "from"}~@{text this}~@{command "have"} & @{text "\<equiv>"} & @{command "hence"} \\
wenzelm@26852
    64
    @{command "from"}~@{text this}~@{command "show"} & @{text "\<equiv>"} & @{command "thus"} \\
wenzelm@26852
    65
  \end{tabular}
wenzelm@58618
    66
\<close>
wenzelm@26779
    67
wenzelm@26779
    68
wenzelm@58618
    69
subsection \<open>Derived elements\<close>
wenzelm@26779
    70
wenzelm@58618
    71
text \<open>
wenzelm@26852
    72
  \begin{tabular}{rcl}
wenzelm@26852
    73
    @{command "also"}@{text "\<^sub>0"} & @{text "\<approx>"} &
wenzelm@26852
    74
      @{command "note"}~@{text "calculation = this"} \\
wenzelm@26852
    75
    @{command "also"}@{text "\<^sub>n\<^sub>+\<^sub>1"} & @{text "\<approx>"} &
wenzelm@26852
    76
      @{command "note"}~@{text "calculation = trans [OF calculation this]"} \\
wenzelm@26852
    77
    @{command "finally"} & @{text "\<approx>"} &
wenzelm@26852
    78
      @{command "also"}~@{command "from"}~@{text calculation} \\[0.5ex]
wenzelm@26852
    79
    @{command "moreover"} & @{text "\<approx>"} &
wenzelm@26852
    80
      @{command "note"}~@{text "calculation = calculation this"} \\
wenzelm@26852
    81
    @{command "ultimately"} & @{text "\<approx>"} &
wenzelm@26852
    82
      @{command "moreover"}~@{command "from"}~@{text calculation} \\[0.5ex]
wenzelm@26852
    83
    @{command "presume"}~@{text "a: \<phi>"} & @{text "\<approx>"} &
wenzelm@26852
    84
      @{command "assume"}~@{text "a: \<phi>"} \\
wenzelm@26852
    85
    @{command "def"}~@{text "a: x \<equiv> t"} & @{text "\<approx>"} &
wenzelm@26852
    86
      @{command "fix"}~@{text x}~@{command "assume"}~@{text "a: x \<equiv> t"} \\
wenzelm@26852
    87
    @{command "obtain"}~@{text "x \<WHERE> a: \<phi>"} & @{text "\<approx>"} &
wenzelm@26852
    88
      @{text "\<dots>"}~@{command "fix"}~@{text x}~@{command "assume"}~@{text "a: \<phi>"} \\
wenzelm@26852
    89
    @{command "case"}~@{text c} & @{text "\<approx>"} &
wenzelm@26852
    90
      @{command "fix"}~@{text x}~@{command "assume"}~@{text "c: \<phi>"} \\
wenzelm@26852
    91
    @{command "sorry"} & @{text "\<approx>"} &
wenzelm@26852
    92
      @{command "by"}~@{text cheating} \\
wenzelm@26852
    93
  \end{tabular}
wenzelm@58618
    94
\<close>
wenzelm@26779
    95
wenzelm@26779
    96
wenzelm@58618
    97
subsection \<open>Diagnostic commands\<close>
wenzelm@26779
    98
wenzelm@58618
    99
text \<open>
wenzelm@26779
   100
  \begin{tabular}{ll}
wenzelm@57479
   101
    @{command "print_state"} & print proof state \\
wenzelm@57479
   102
    @{command "print_statement"} & print fact in long statement form \\
wenzelm@26779
   103
    @{command "thm"}~@{text a} & print fact \\
wenzelm@40536
   104
    @{command "prop"}~@{text \<phi>} & print proposition \\
wenzelm@26779
   105
    @{command "term"}~@{text t} & print term \\
wenzelm@40536
   106
    @{command "typ"}~@{text \<tau>} & print type \\
wenzelm@26779
   107
  \end{tabular}
wenzelm@58618
   108
\<close>
wenzelm@26779
   109
wenzelm@26779
   110
wenzelm@58618
   111
section \<open>Proof methods\<close>
wenzelm@26779
   112
wenzelm@58618
   113
text \<open>
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@58618
   138
\<close>
wenzelm@26779
   139
wenzelm@26779
   140
wenzelm@58618
   141
section \<open>Attributes\<close>
wenzelm@26779
   142
wenzelm@58618
   143
text \<open>
wenzelm@26779
   144
  \begin{tabular}{ll}
wenzelm@42667
   145
    \multicolumn{2}{l}{\textbf{Rules}} \\[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@58618
   162
\<close>
wenzelm@26779
   163
wenzelm@26779
   164
wenzelm@58618
   165
section \<open>Rule declarations and methods\<close>
wenzelm@26779
   166
wenzelm@58618
   167
text \<open>
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@58618
   193
\<close>
wenzelm@26779
   194
wenzelm@26779
   195
wenzelm@58618
   196
section \<open>Emulating tactic scripts\<close>
wenzelm@26779
   197
wenzelm@58618
   198
subsection \<open>Commands\<close>
wenzelm@26779
   199
wenzelm@58618
   200
text \<open>
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@58618
   209
\<close>
wenzelm@26779
   210
wenzelm@26779
   211
wenzelm@58618
   212
subsection \<open>Methods\<close>
wenzelm@26779
   213
wenzelm@58618
   214
text \<open>
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@58618
   230
\<close>
wenzelm@26779
   231
wenzelm@26779
   232
end