src/HOL/Tools/function_package/induction_scheme.ML
changeset 30493 b8570ea1ce25
parent 29183 f1648e009dc1
child 30510 4120fc59dd85
equal deleted inserted replaced
30492:cb7e886e4b10 30493:b8570ea1ce25
     1 (*  Title:      HOL/Tools/function_package/induction_scheme.ML
     1 (*  Title:      HOL/Tools/function_package/induction_scheme.ML
     2     ID:         $Id$
       
     3     Author:     Alexander Krauss, TU Muenchen
     2     Author:     Alexander Krauss, TU Muenchen
     4 
     3 
     5 A method to prove induction schemes.
     4 A method to prove induction schemes.
     6 *)
     5 *)
     7 
     6 
     8 signature INDUCTION_SCHEME =
     7 signature INDUCTION_SCHEME =
     9 sig
     8 sig
    10   val mk_ind_tac : (int -> tactic) -> (int -> tactic) -> (int -> tactic)
     9   val mk_ind_tac : (int -> tactic) -> (int -> tactic) -> (int -> tactic)
    11                    -> Proof.context -> thm list -> tactic  
    10                    -> Proof.context -> thm list -> tactic
       
    11   val induct_scheme_tac : Proof.context -> thm list -> tactic
    12   val setup : theory -> theory
    12   val setup : theory -> theory
    13 end
    13 end
    14 
    14 
    15 
    15 
    16 structure InductionScheme : INDUCTION_SCHEME =
    16 structure InductionScheme : INDUCTION_SCHEME =
   393     THEN (EVERY (map (TRY o pres_tac) ((i + nbranches + npres - 1) downto (i + nbranches))))
   393     THEN (EVERY (map (TRY o pres_tac) ((i + nbranches + npres - 1) downto (i + nbranches))))
   394     THEN (EVERY (map (TRY o comp_tac) ((i + nbranches - 1) downto i)))
   394     THEN (EVERY (map (TRY o comp_tac) ((i + nbranches - 1) downto i)))
   395   end))
   395   end))
   396 
   396 
   397 
   397 
       
   398 fun induct_scheme_tac ctxt =
       
   399   mk_ind_tac (K all_tac) (assume_tac APPEND' Goal.assume_rule_tac ctxt) (K all_tac) ctxt;
       
   400 
   398 val setup = Method.add_methods
   401 val setup = Method.add_methods
   399   [("induct_scheme", Method.ctxt_args (Method.RAW_METHOD o (fn ctxt => mk_ind_tac (K all_tac) (assume_tac APPEND' Goal.assume_rule_tac ctxt) (K all_tac) ctxt)),
   402   [("induct_scheme", Method.ctxt_args (Method.RAW_METHOD o induct_scheme_tac),
   400     "proves an induction principle")]
   403     "proves an induction principle")]
   401 
   404 
   402 end
   405 end