src/HOL/Tools/datatype_abs_proofs.ML
changeset 30240 5b25fee0362c
parent 29927 ae8f42c245b2
child 30280 eb98b49ef835
equal deleted inserted replaced
30239:179ff9cb160b 30240:5b25fee0362c
    94     val big_name = space_implode "_" new_type_names;
    94     val big_name = space_implode "_" new_type_names;
    95     val thy0 = add_path flat_names big_name thy;
    95     val thy0 = add_path flat_names big_name thy;
    96 
    96 
    97     val descr' = List.concat descr;
    97     val descr' = List.concat descr;
    98     val recTs = get_rec_types descr' sorts;
    98     val recTs = get_rec_types descr' sorts;
    99     val used = foldr OldTerm.add_typ_tfree_names [] recTs;
    99     val used = List.foldr OldTerm.add_typ_tfree_names [] recTs;
   100     val newTs = Library.take (length (hd descr), recTs);
   100     val newTs = Library.take (length (hd descr), recTs);
   101 
   101 
   102     val induct_Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of induct)));
   102     val induct_Ps = map head_of (HOLogic.dest_conj (HOLogic.dest_Trueprop (concl_of induct)));
   103 
   103 
   104     val big_rec_name' = big_name ^ "_rec_set";
   104     val big_rec_name' = big_name ^ "_rec_set";
   138                end
   138                end
   139            | _ => (j + 1, k, prems, free1::t1s, t2s))
   139            | _ => (j + 1, k, prems, free1::t1s, t2s))
   140           end;
   140           end;
   141 
   141 
   142         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   142         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   143         val (_, _, prems, t1s, t2s) = foldr mk_prem (1, 1, [], [], []) (cargs ~~ Ts)
   143         val (_, _, prems, t1s, t2s) = List.foldr mk_prem (1, 1, [], [], []) (cargs ~~ Ts)
   144 
   144 
   145       in (rec_intr_ts @ [Logic.list_implies (prems, HOLogic.mk_Trueprop
   145       in (rec_intr_ts @ [Logic.list_implies (prems, HOLogic.mk_Trueprop
   146         (rec_set $ list_comb (Const (cname, Ts ---> T), t1s) $
   146         (rec_set $ list_comb (Const (cname, Ts ---> T), t1s) $
   147           list_comb (List.nth (rec_fns, l), t1s @ t2s)))], l + 1)
   147           list_comb (List.nth (rec_fns, l), t1s @ t2s)))], l + 1)
   148       end;
   148       end;
   278 
   278 
   279     val thy1 = add_path flat_names (space_implode "_" new_type_names) thy;
   279     val thy1 = add_path flat_names (space_implode "_" new_type_names) thy;
   280 
   280 
   281     val descr' = List.concat descr;
   281     val descr' = List.concat descr;
   282     val recTs = get_rec_types descr' sorts;
   282     val recTs = get_rec_types descr' sorts;
   283     val used = foldr OldTerm.add_typ_tfree_names [] recTs;
   283     val used = List.foldr OldTerm.add_typ_tfree_names [] recTs;
   284     val newTs = Library.take (length (hd descr), recTs);
   284     val newTs = Library.take (length (hd descr), recTs);
   285     val T' = TFree (Name.variant used "'t", HOLogic.typeS);
   285     val T' = TFree (Name.variant used "'t", HOLogic.typeS);
   286 
   286 
   287     fun mk_dummyT dt = binder_types (typ_of_dtyp descr' sorts dt) ---> T';
   287     fun mk_dummyT dt = binder_types (typ_of_dtyp descr' sorts dt) ---> T';
   288 
   288