src/HOL/Tools/TFL/thry.ML
changeset 58111 82db9ad610b9
parent 41589 bbd861837ebc
child 58112 8081087096ad
equal deleted inserted replaced
58110:019c0211ed1f 58111:82db9ad610b9
    56 (*---------------------------------------------------------------------------
    56 (*---------------------------------------------------------------------------
    57  * Get information about datatypes
    57  * Get information about datatypes
    58  *---------------------------------------------------------------------------*)
    58  *---------------------------------------------------------------------------*)
    59 
    59 
    60 fun match_info thy dtco =
    60 fun match_info thy dtco =
    61   case (Datatype.get_info thy dtco,
    61   case (Datatype_Data.get_info thy dtco,
    62          Datatype.get_constrs thy dtco) of
    62          Datatype_Data.get_constrs thy dtco) of
    63       (SOME { case_name, ... }, SOME constructors) =>
    63       (SOME { case_name, ... }, SOME constructors) =>
    64         SOME {case_const = Const (case_name, Sign.the_const_type thy case_name), constructors = map Const constructors}
    64         SOME {case_const = Const (case_name, Sign.the_const_type thy case_name), constructors = map Const constructors}
    65     | _ => NONE;
    65     | _ => NONE;
    66 
    66 
    67 fun induct_info thy dtco = case Datatype.get_info thy dtco of
    67 fun induct_info thy dtco = case Datatype_Data.get_info thy dtco of
    68         NONE => NONE
    68         NONE => NONE
    69       | SOME {nchotomy, ...} =>
    69       | SOME {nchotomy, ...} =>
    70           SOME {nchotomy = nchotomy,
    70           SOME {nchotomy = nchotomy,
    71                 constructors = (map Const o the o Datatype.get_constrs thy) dtco};
    71                 constructors = (map Const o the o Datatype_Data.get_constrs thy) dtco};
    72 
    72 
    73 fun extract_info thy =
    73 fun extract_info thy =
    74  let val infos = map snd (Symtab.dest (Datatype.get_all thy))
    74  let val infos = map snd (Symtab.dest (Datatype_Data.get_all thy))
    75  in {case_congs = map (mk_meta_eq o #case_cong) infos,
    75  in {case_congs = map (mk_meta_eq o #case_cong) infos,
    76      case_rewrites = maps (map mk_meta_eq o #case_rewrites) infos}
    76      case_rewrites = maps (map mk_meta_eq o #case_rewrites) infos}
    77  end;
    77  end;
    78 
    78 
    79 
    79