src/HOL/datatype.ML
changeset 3292 8b143c196d42
parent 3282 c31e6239d4c9
child 3308 da002cef7090
equal deleted inserted replaced
3291:cf322b5c59aa 3292:8b143c196d42
     3    Author:      Max Breitling, Carsten Clasohm, Tobias Nipkow, Norbert Voelker,
     3    Author:      Max Breitling, Carsten Clasohm, Tobias Nipkow, Norbert Voelker,
     4                 Konrad Slind
     4                 Konrad Slind
     5    Copyright 1995 TU Muenchen
     5    Copyright 1995 TU Muenchen
     6 *)
     6 *)
     7 
     7 
       
     8 (* should go into Pure *)
       
     9 fun ALLNEWSUBGOALS tac tacf i =
       
    10   STATE (fn state0 => tac i THEN
       
    11   STATE (fn state1 => let val d = nprems_of state1 - nprems_of state0
       
    12                       in EVERY(map tacf ((i+d) downto i)) end));
     8 
    13 
     9 (*used for constructor parameters*)
    14 (*used for constructor parameters*)
    10 datatype dt_type = dtVar of string |
    15 datatype dt_type = dtVar of string |
    11   dtTyp of dt_type list * string |
    16   dtTyp of dt_type list * string |
    12   dtRek of dt_type list * string;
    17   dtRek of dt_type list * string;
   856      fun const s = Const(s, the(Sign.const_type sign s))
   861      fun const s = Const(s, the(Sign.const_type sign s))
   857      val case_rewrites = map (fn c => get_fact thy (ty^"_case_"^c)) cl
   862      val case_rewrites = map (fn c => get_fact thy (ty^"_case_"^c)) cl
   858      val {nchotomy,case_cong} = case_thms sign case_rewrites itac
   863      val {nchotomy,case_cong} = case_thms sign case_rewrites itac
   859      val exhaustion = mk_exhaust nchotomy
   864      val exhaustion = mk_exhaust nchotomy
   860      val exh_var = exhaust_var exhaustion;
   865      val exh_var = exhaust_var exhaustion;
   861      fun exhaust_tac a = res_inst_tac [(exh_var,a)] exhaustion;
   866      fun exhaust_tac a =
       
   867            ALLNEWSUBGOALS (res_inst_tac [(exh_var,a)] exhaustion)
       
   868                           (rotate_tac ~1);
   862      fun induct_tac a i =
   869      fun induct_tac a i =
   863            STATE(fn st =>
   870            STATE(fn st =>
   864              (if Datatype.occs_in_prems a i st
   871              (if Datatype.occs_in_prems a i st
   865               then warning "Induction variable occurs also among premises!"
   872               then warning "Induction variable occurs also among premises!"
   866               else ();
   873               else ();