src/HOL/Tools/BNF/bnf_fp_util.ML
changeset 63837 fdf90aa59868
parent 63826 9321b3d50abd
child 63851 1a1fd3f3a24c
equal deleted inserted replaced
63836:2f9ee7d85d85 63837:fdf90aa59868
   955     val (dead_phantoms, live_phantoms) = List.partition (member (op =) Ds0) missing;
   955     val (dead_phantoms, live_phantoms) = List.partition (member (op =) Ds0) missing;
   956     val resBs' = resBs |> fold (subtract (op =)) [dead_phantoms, Ds];
   956     val resBs' = resBs |> fold (subtract (op =)) [dead_phantoms, Ds];
   957 
   957 
   958     val timer = time (timer "Construction of BNFs");
   958     val timer = time (timer "Construction of BNFs");
   959 
   959 
   960     val ((kill_poss, _), (bnfs', ((comp_cache', unfold_set'), lthy''))) =
   960     val ((kill_posss, _), (bnfs', ((comp_cache', unfold_set'), lthy''))) =
   961       normalize_bnfs norm_qualify Ass Ds (K (resBs' @ Xs)) bnfs (comp_cache_unfold_set, lthy');
   961       normalize_bnfs norm_qualify Ass Ds (K (resBs' @ Xs)) bnfs (comp_cache_unfold_set, lthy');
   962 
   962 
   963     val Dss = @{map 3} (uncurry append oo curry swap oo map o nth) livess kill_poss deadss;
   963     val Dss = @{map 3} (fn lives => fn kill_posss => fn deads => deads @ map (nth lives) kill_posss)
       
   964       livess kill_posss deadss;
       
   965     val all_Dss = Dss |> force_out_of_line ? map (fn Ds' => union (op =) Ds' (map TFree Ds0));
   964 
   966 
   965     fun pre_qualify b =
   967     fun pre_qualify b =
   966       Binding.qualify false (Binding.name_of b)
   968       Binding.qualify false (Binding.name_of b)
   967       #> extra_qualify
   969       #> extra_qualify
   968       #> not (Config.get lthy'' bnf_internals) ? Binding.concealed;
   970       #> not (Config.get lthy'' bnf_internals) ? Binding.concealed;
   969 
   971 
   970     val ((pre_bnfs, (deadss, absT_infos)), lthy''') = lthy''
   972     val ((pre_bnfs, (deadss, absT_infos)), lthy''') = lthy''
   971       |> @{fold_map 4} (fn b => seal_bnf (pre_qualify b) unfold_set' (Binding.prefix_name preN b))
   973       |> @{fold_map 5} (fn b => seal_bnf (pre_qualify b) unfold_set' (Binding.prefix_name preN b))
   972         bs (replicate (length rhsXs) (force_out_of_line orelse not (null live_phantoms))) Dss bnfs'
   974         bs (replicate (length rhsXs) (force_out_of_line orelse not (null live_phantoms))) Dss
       
   975         all_Dss bnfs'
   973       |>> split_list
   976       |>> split_list
   974       |>> apsnd split_list;
   977       |>> apsnd split_list;
   975 
   978 
   976     val timer = time (timer "Normalization & sealing of BNFs");
   979     val timer = time (timer "Normalization & sealing of BNFs");
   977 
   980