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