src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML
changeset 45822 843dc212f69e
parent 45701 615da8b8d758
child 45879 71b8d0d170b1
equal deleted inserted replaced
45821:c2f6c50e3d42 45822:843dc212f69e
   901 (*** this should be part of the datatype package ***)
   901 (*** this should be part of the datatype package ***)
   902 
   902 
   903 fun datatype_names_of_case_name thy case_name =
   903 fun datatype_names_of_case_name thy case_name =
   904   map (#1 o #2) (#descr (the (Datatype_Data.info_of_case thy case_name)))
   904   map (#1 o #2) (#descr (the (Datatype_Data.info_of_case thy case_name)))
   905 
   905 
   906 fun make_case_distribs new_type_names descr sorts thy =
   906 fun make_case_distribs new_type_names descr thy =
   907   let
   907   let
   908     val case_combs = Datatype_Prop.make_case_combs new_type_names descr sorts thy "f";
   908     val case_combs = Datatype_Prop.make_case_combs new_type_names descr thy "f";
   909     fun make comb =
   909     fun make comb =
   910       let
   910       let
   911         val Type ("fun", [T, T']) = fastype_of comb;
   911         val Type ("fun", [T, T']) = fastype_of comb;
   912         val (Const (case_name, _), fs) = strip_comb comb
   912         val (Const (case_name, _), fs) = strip_comb comb
   913         val used = Term.add_tfree_names comb []
   913         val used = Term.add_tfree_names comb []
   930     map make case_combs
   930     map make case_combs
   931   end
   931   end
   932 
   932 
   933 fun case_rewrites thy Tcon =
   933 fun case_rewrites thy Tcon =
   934   let
   934   let
   935     val {descr, sorts, ...} = Datatype.the_info thy Tcon
   935     val {descr, ...} = Datatype.the_info thy Tcon
   936   in
   936   in
   937     map (Drule.export_without_context o Skip_Proof.make_thm thy o HOLogic.mk_Trueprop)
   937     map (Drule.export_without_context o Skip_Proof.make_thm thy o HOLogic.mk_Trueprop)
   938       (make_case_distribs [Tcon] [descr] sorts thy)
   938       (make_case_distribs [Tcon] [descr] thy)
   939   end
   939   end
   940 
   940 
   941 fun instantiated_case_rewrites thy Tcon =
   941 fun instantiated_case_rewrites thy Tcon =
   942   let
   942   let
   943     val rew_ths = case_rewrites thy Tcon
   943     val rew_ths = case_rewrites thy Tcon