src/HOL/Tools/Datatype/datatype_abs_proofs.ML
changeset 33317 b4534348b8fd
parent 33278 ba9f52f56356
child 33338 de76079f973a
equal deleted inserted replaced
33316:6a72af4e84b8 33317:b4534348b8fd
   290     fun mk_dummyT dt = binder_types (typ_of_dtyp descr' sorts dt) ---> T';
   290     fun mk_dummyT dt = binder_types (typ_of_dtyp descr' sorts dt) ---> T';
   291 
   291 
   292     val case_dummy_fns = map (fn (_, (_, _, constrs)) => map (fn (_, cargs) =>
   292     val case_dummy_fns = map (fn (_, (_, _, constrs)) => map (fn (_, cargs) =>
   293       let
   293       let
   294         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   294         val Ts = map (typ_of_dtyp descr' sorts) cargs;
   295         val Ts' = map mk_dummyT (List.filter is_rec_type cargs)
   295         val Ts' = map mk_dummyT (filter is_rec_type cargs)
   296       in Const (@{const_name undefined}, Ts @ Ts' ---> T')
   296       in Const (@{const_name undefined}, Ts @ Ts' ---> T')
   297       end) constrs) descr';
   297       end) constrs) descr';
   298 
   298 
   299     val case_names = map (fn s => Sign.full_bname thy1 (s ^ "_case")) new_type_names;
   299     val case_names = map (fn s => Sign.full_bname thy1 (s ^ "_case")) new_type_names;
   300 
   300 
   303     val (case_defs, thy2) = fold (fn ((((i, (_, _, constrs)), T), name), recname) => fn (defs, thy) =>
   303     val (case_defs, thy2) = fold (fn ((((i, (_, _, constrs)), T), name), recname) => fn (defs, thy) =>
   304         let
   304         let
   305           val (fns1, fns2) = split_list (map (fn ((_, cargs), j) =>
   305           val (fns1, fns2) = split_list (map (fn ((_, cargs), j) =>
   306             let
   306             let
   307               val Ts = map (typ_of_dtyp descr' sorts) cargs;
   307               val Ts = map (typ_of_dtyp descr' sorts) cargs;
   308               val Ts' = Ts @ map mk_dummyT (List.filter is_rec_type cargs);
   308               val Ts' = Ts @ map mk_dummyT (filter is_rec_type cargs);
   309               val frees' = map (uncurry (mk_Free "x")) (Ts' ~~ (1 upto length Ts'));
   309               val frees' = map (uncurry (mk_Free "x")) (Ts' ~~ (1 upto length Ts'));
   310               val frees = Library.take (length cargs, frees');
   310               val frees = Library.take (length cargs, frees');
   311               val free = mk_Free "f" (Ts ---> T') j
   311               val free = mk_Free "f" (Ts ---> T') j
   312             in
   312             in
   313              (free, list_abs_free (map dest_Free frees',
   313              (free, list_abs_free (map dest_Free frees',