src/Doc/Isar_Ref/ML_Tactic.thy
changeset 58618 782f0b662cae
parent 58552 66fed99e874f
child 59498 50b60f501b05
equal deleted inserted replaced
58617:4f169d2cf6f3 58618:782f0b662cae
     1 theory ML_Tactic
     1 theory ML_Tactic
     2 imports Base Main
     2 imports Base Main
     3 begin
     3 begin
     4 
     4 
     5 chapter {* ML tactic expressions *}
     5 chapter \<open>ML tactic expressions\<close>
     6 
     6 
     7 text {*
     7 text \<open>
     8   Isar Proof methods closely resemble traditional tactics, when used
     8   Isar Proof methods closely resemble traditional tactics, when used
     9   in unstructured sequences of @{command "apply"} commands.
     9   in unstructured sequences of @{command "apply"} commands.
    10   Isabelle/Isar provides emulations for all major ML tactics of
    10   Isabelle/Isar provides emulations for all major ML tactics of
    11   classic Isabelle --- mostly for the sake of easy porting of existing
    11   classic Isabelle --- mostly for the sake of easy porting of existing
    12   developments, as actual Isar proof texts would demand much less
    12   developments, as actual Isar proof texts would demand much less
    20   method with separate options to tune the behavior.  For example,
    20   method with separate options to tune the behavior.  For example,
    21   method @{method simp} replaces all of @{ML simp_tac}~/ @{ML
    21   method @{method simp} replaces all of @{ML simp_tac}~/ @{ML
    22   asm_simp_tac}~/ @{ML full_simp_tac}~/ @{ML asm_full_simp_tac}, there
    22   asm_simp_tac}~/ @{ML full_simp_tac}~/ @{ML asm_full_simp_tac}, there
    23   is also concrete syntax for augmenting the Simplifier context (the
    23   is also concrete syntax for augmenting the Simplifier context (the
    24   current ``simpset'') in a convenient way.
    24   current ``simpset'') in a convenient way.
    25 *}
    25 \<close>
    26 
    26 
    27 
    27 
    28 section {* Resolution tactics *}
    28 section \<open>Resolution tactics\<close>
    29 
    29 
    30 text {*
    30 text \<open>
    31   Classic Isabelle provides several variant forms of tactics for
    31   Classic Isabelle provides several variant forms of tactics for
    32   single-step rule applications (based on higher-order resolution).
    32   single-step rule applications (based on higher-order resolution).
    33   The space of resolution tactics has the following main dimensions.
    33   The space of resolution tactics has the following main dimensions.
    34 
    34 
    35   \begin{enumerate}
    35   \begin{enumerate}
    73   \medskip
    73   \medskip
    74 
    74 
    75   Note that explicit goal addressing may be usually avoided by
    75   Note that explicit goal addressing may be usually avoided by
    76   changing the order of subgoals with @{command "defer"} or @{command
    76   changing the order of subgoals with @{command "defer"} or @{command
    77   "prefer"} (see \secref{sec:tactic-commands}).
    77   "prefer"} (see \secref{sec:tactic-commands}).
    78 *}
    78 \<close>
    79 
    79 
    80 
    80 
    81 section {* Simplifier tactics *}
    81 section \<open>Simplifier tactics\<close>
    82 
    82 
    83 text {* The main Simplifier tactics @{ML simp_tac} and variants are
    83 text \<open>The main Simplifier tactics @{ML simp_tac} and variants are
    84   all covered by the @{method simp} and @{method simp_all} methods
    84   all covered by the @{method simp} and @{method simp_all} methods
    85   (see \secref{sec:simplifier}).  Note that there is no individual
    85   (see \secref{sec:simplifier}).  Note that there is no individual
    86   goal addressing available, simplification acts either on the first
    86   goal addressing available, simplification acts either on the first
    87   goal (@{method simp}) or all goals (@{method simp_all}).
    87   goal (@{method simp}) or all goals (@{method simp_all}).
    88 
    88 
    94     @{ML asm_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(no_asm_simp)"} \\
    94     @{ML asm_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(no_asm_simp)"} \\
    95     @{ML full_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(no_asm_use)"} \\
    95     @{ML full_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(no_asm_use)"} \\
    96     @{ML asm_lr_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(asm_lr)"} \\
    96     @{ML asm_lr_simp_tac}~@{text "@{context} 1"} & & @{method simp}~@{text "(asm_lr)"} \\
    97   \end{tabular}
    97   \end{tabular}
    98   \medskip
    98   \medskip
    99 *}
    99 \<close>
   100 
   100 
   101 
   101 
   102 section {* Classical Reasoner tactics *}
   102 section \<open>Classical Reasoner tactics\<close>
   103 
   103 
   104 text {* The Classical Reasoner provides a rather large number of
   104 text \<open>The Classical Reasoner provides a rather large number of
   105   variations of automated tactics, such as @{ML blast_tac}, @{ML
   105   variations of automated tactics, such as @{ML blast_tac}, @{ML
   106   fast_tac}, @{ML clarify_tac} etc.  The corresponding Isar methods
   106   fast_tac}, @{ML clarify_tac} etc.  The corresponding Isar methods
   107   usually share the same base name, such as @{method blast}, @{method
   107   usually share the same base name, such as @{method blast}, @{method
   108   fast}, @{method clarify} etc.\ (see \secref{sec:classical}).  *}
   108   fast}, @{method clarify} etc.\ (see \secref{sec:classical}).\<close>
   109 
   109 
   110 
   110 
   111 section {* Miscellaneous tactics *}
   111 section \<open>Miscellaneous tactics\<close>
   112 
   112 
   113 text {*
   113 text \<open>
   114   There are a few additional tactics defined in various theories of
   114   There are a few additional tactics defined in various theories of
   115   Isabelle/HOL, some of these also in Isabelle/FOL or Isabelle/ZF.
   115   Isabelle/HOL, some of these also in Isabelle/FOL or Isabelle/ZF.
   116   The most common ones of these may be ported to Isar as follows.
   116   The most common ones of these may be ported to Isar as follows.
   117 
   117 
   118   \medskip
   118   \medskip
   121     @{ML hyp_subst_tac}~@{text 1} & & @{text hypsubst} \\
   121     @{ML hyp_subst_tac}~@{text 1} & & @{text hypsubst} \\
   122     @{ML split_all_tac}~@{text 1} & & @{text "simp (no_asm_simp) only: split_tupled_all"} \\
   122     @{ML split_all_tac}~@{text 1} & & @{text "simp (no_asm_simp) only: split_tupled_all"} \\
   123       & @{text "\<approx>"} & @{text "simp only: split_tupled_all"} \\
   123       & @{text "\<approx>"} & @{text "simp only: split_tupled_all"} \\
   124       & @{text "\<lless>"} & @{text "clarify"} \\
   124       & @{text "\<lless>"} & @{text "clarify"} \\
   125   \end{tabular}
   125   \end{tabular}
   126 *}
   126 \<close>
   127 
   127 
   128 
   128 
   129 section {* Tacticals *}
   129 section \<open>Tacticals\<close>
   130 
   130 
   131 text {*
   131 text \<open>
   132   Classic Isabelle provides a huge amount of tacticals for combination
   132   Classic Isabelle provides a huge amount of tacticals for combination
   133   and modification of existing tactics.  This has been greatly reduced
   133   and modification of existing tactics.  This has been greatly reduced
   134   in Isar, providing the bare minimum of combinators only: ``@{text
   134   in Isar, providing the bare minimum of combinators only: ``@{text
   135   ","}'' (sequential composition), ``@{text "|"}'' (alternative
   135   ","}'' (sequential composition), ``@{text "|"}'' (alternative
   136   choices), ``@{text "?"}'' (try), ``@{text "+"}'' (repeat at least
   136   choices), ``@{text "?"}'' (try), ``@{text "+"}'' (repeat at least
   170 
   170 
   171   \medskip Iterated resolution, such as
   171   \medskip Iterated resolution, such as
   172   @{ML_text "REPEAT (FIRSTGOAL (resolve_tac ...))"}, is usually better
   172   @{ML_text "REPEAT (FIRSTGOAL (resolve_tac ...))"}, is usually better
   173   expressed using the @{method intro} and @{method elim} methods of
   173   expressed using the @{method intro} and @{method elim} methods of
   174   Isar (see \secref{sec:classical}).
   174   Isar (see \secref{sec:classical}).
   175 *}
   175 \<close>
   176 
   176 
   177 end
   177 end