src/HOL/Tools/BNF/bnf_fp_rec_sugar_util.ML
changeset 59281 1b4dc8a9f7d9
parent 59275 77cd4992edcd
child 59314 91649ea1b32c
equal deleted inserted replaced
59280:2949ace404c3 59281:1b4dc8a9f7d9
    19      funs: term list,
    19      funs: term list,
    20      fun_defs: thm list,
    20      fun_defs: thm list,
    21      fpTs: typ list}
    21      fpTs: typ list}
    22 
    22 
    23   val morph_fp_rec_sugar: morphism -> fp_rec_sugar -> fp_rec_sugar
    23   val morph_fp_rec_sugar: morphism -> fp_rec_sugar -> fp_rec_sugar
       
    24   val transfer_fp_rec_sugar: theory -> fp_rec_sugar -> fp_rec_sugar
    24 
    25 
    25   val flat_rec_arg_args: 'a list list -> 'a list
    26   val flat_rec_arg_args: 'a list list -> 'a list
    26 
    27 
    27   val indexed: 'a list -> int -> int list * int
    28   val indexed: 'a list -> int -> int list * int
    28   val indexedd: 'a list list -> int -> int list list * int
    29   val indexedd: 'a list list -> int -> int list list * int
    64 type fp_rec_sugar =
    65 type fp_rec_sugar =
    65   {transfers: bool list,
    66   {transfers: bool list,
    66    fun_names: string list,
    67    fun_names: string list,
    67    funs: term list,
    68    funs: term list,
    68    fun_defs: thm list,
    69    fun_defs: thm list,
    69    fpTs: typ list}
    70    fpTs: typ list};
    70 
    71 
    71 fun morph_fp_rec_sugar phi {transfers, fun_names, funs, fun_defs, fpTs} =
    72 fun morph_fp_rec_sugar phi {transfers, fun_names, funs, fun_defs, fpTs} =
    72   {transfers = transfers,
    73   {transfers = transfers,
    73    fun_names = fun_names,
    74    fun_names = fun_names,
    74    funs = map (Morphism.term phi) funs,
    75    funs = map (Morphism.term phi) funs,
    75    fun_defs = map (Morphism.thm phi) fun_defs,
    76    fun_defs = map (Morphism.thm phi) fun_defs,
    76    fpTs = map (Morphism.typ phi) fpTs};
    77    fpTs = map (Morphism.typ phi) fpTs};
    77 
    78 
       
    79 val transfer_fp_rec_sugar = morph_fp_rec_sugar o Morphism.transfer_morphism;
       
    80 
    78 fun flat_rec_arg_args xss =
    81 fun flat_rec_arg_args xss =
    79   (* FIXME (once the old datatype package is phased out): The first line below gives the preferred
    82   (* FIXME (once the old datatype package is completely phased out): The first line below gives the
    80      order. The second line is for compatibility with the old datatype package. *)
    83      preferred order. The second line is for compatibility with the old datatype package. *)
    81   (* flat xss *)
    84   (* flat xss *)
    82   map hd xss @ maps tl xss;
    85   map hd xss @ maps tl xss;
    83 
    86 
    84 fun indexe _ h = (h, h + 1);
    87 fun indexe _ h = (h, h + 1);
    85 fun indexed xs = fold_map indexe xs;
    88 fun indexed xs = fold_map indexe xs;