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