src/Tools/induct.ML
changeset 25959 9ad285dbc7a4
parent 25109 dfa8001e6264
child 25985 8d69087f6a4b
equal deleted inserted replaced
25958:bcedde463850 25959:9ad285dbc7a4
   306 (* make_cases *)
   306 (* make_cases *)
   307 
   307 
   308 fun make_cases is_open rule =
   308 fun make_cases is_open rule =
   309   RuleCases.make_common is_open (Thm.theory_of_thm rule, Thm.prop_of rule);
   309   RuleCases.make_common is_open (Thm.theory_of_thm rule, Thm.prop_of rule);
   310 
   310 
   311 fun warn_open ctxt true =
   311 fun warn_open true =
   312       legacy_feature ("open rule cases in proof method" ^ ContextPosition.str_of ctxt)
   312       legacy_feature ("open rule cases in proof method" ^ Position.str_of (Position.thread_data ()))
   313   | warn_open _ false = ();
   313   | warn_open false = ();
   314 
   314 
   315 
   315 
   316 
   316 
   317 (** cases method **)
   317 (** cases method **)
   318 
   318 
   334 
   334 
   335 in
   335 in
   336 
   336 
   337 fun cases_tac ctxt is_open insts opt_rule facts =
   337 fun cases_tac ctxt is_open insts opt_rule facts =
   338   let
   338   let
   339     val _ = warn_open ctxt is_open;
   339     val _ = warn_open is_open;
   340     val thy = ProofContext.theory_of ctxt;
   340     val thy = ProofContext.theory_of ctxt;
   341     val cert = Thm.cterm_of thy;
   341     val cert = Thm.cterm_of thy;
   342 
   342 
   343     fun inst_rule r =
   343     fun inst_rule r =
   344       if null insts then `RuleCases.get r
   344       if null insts then `RuleCases.get r
   573 
   573 
   574 in
   574 in
   575 
   575 
   576 fun induct_tac ctxt is_open def_insts arbitrary taking opt_rule facts =
   576 fun induct_tac ctxt is_open def_insts arbitrary taking opt_rule facts =
   577   let
   577   let
   578     val _ = warn_open ctxt is_open;
   578     val _ = warn_open is_open;
   579     val thy = ProofContext.theory_of ctxt;
   579     val thy = ProofContext.theory_of ctxt;
   580     val cert = Thm.cterm_of thy;
   580     val cert = Thm.cterm_of thy;
   581 
   581 
   582     val ((insts, defs), defs_ctxt) = fold_map add_defs def_insts ctxt |>> split_list;
   582     val ((insts, defs), defs_ctxt) = fold_map add_defs def_insts ctxt |>> split_list;
   583     val atomized_defs = map (map (Conv.fconv_rule ObjectLogic.atomize)) defs;
   583     val atomized_defs = map (map (Conv.fconv_rule ObjectLogic.atomize)) defs;
   649 
   649 
   650 in
   650 in
   651 
   651 
   652 fun coinduct_tac ctxt is_open inst taking opt_rule facts =
   652 fun coinduct_tac ctxt is_open inst taking opt_rule facts =
   653   let
   653   let
   654     val _ = warn_open ctxt is_open;
   654     val _ = warn_open is_open;
   655     val thy = ProofContext.theory_of ctxt;
   655     val thy = ProofContext.theory_of ctxt;
   656     val cert = Thm.cterm_of thy;
   656     val cert = Thm.cterm_of thy;
   657 
   657 
   658     fun inst_rule r =
   658     fun inst_rule r =
   659       if null inst then `RuleCases.get r
   659       if null inst then `RuleCases.get r