src/HOL/Tools/Function/size.ML
changeset 56375 32e0da92c786
parent 56239 17df7145a871
child 56639 c9d6b581bd3b
equal deleted inserted replaced
56374:dfc7a46c2900 56375:32e0da92c786
   218   end;
   218   end;
   219 
   219 
   220 fun add_size_thms config (new_type_names as name :: _) thy =
   220 fun add_size_thms config (new_type_names as name :: _) thy =
   221   let
   221   let
   222     val info as {descr, ...} = Datatype_Data.the_info thy name;
   222     val info as {descr, ...} = Datatype_Data.the_info thy name;
   223     val prefix =
   223     val prefix = space_implode "_" (map Long_Name.base_name new_type_names);
   224       Long_Name.map_base_name (K (space_implode "_" (map Long_Name.base_name new_type_names))) name;
       
   225     val no_size = exists (fn (_, (_, _, constrs)) => exists (fn (_, cargs) => exists (fn dt =>
   224     val no_size = exists (fn (_, (_, _, constrs)) => exists (fn (_, cargs) => exists (fn dt =>
   226       Datatype_Aux.is_rec_type dt andalso
   225       Datatype_Aux.is_rec_type dt andalso
   227         not (null (fst (Datatype_Aux.strip_dtyp dt)))) cargs) constrs) descr
   226         not (null (fst (Datatype_Aux.strip_dtyp dt)))) cargs) constrs) descr
   228   in
   227   in
   229     if no_size then thy
   228     if no_size then thy
   230     else
   229     else
   231       thy
   230       thy
   232       |> Sign.root_path
       
   233       |> Sign.add_path prefix
   231       |> Sign.add_path prefix
   234       |> prove_size_thms info new_type_names
   232       |> prove_size_thms info new_type_names
   235       |> Sign.restore_naming thy
   233       |> Sign.restore_naming thy
   236   end;
   234   end;
   237 
   235