src/HOL/BNF/Tools/bnf_fp_util.ML
changeset 53566 5ff3a2d112d7
parent 53264 1973b821168c
child 53694 7b453b619b5f
equal deleted inserted replaced
53565:1e5314b99009 53566:5ff3a2d112d7
   585     fun raw_qualify base_b =
   585     fun raw_qualify base_b =
   586       let val (_, qs, n) = Binding.dest base_b;
   586       let val (_, qs, n) = Binding.dest base_b;
   587       in
   587       in
   588         Binding.prefix_name rawN
   588         Binding.prefix_name rawN
   589         #> fold_rev (fn (s, mand) => Binding.qualify mand s) (qs @ [(n, true)])
   589         #> fold_rev (fn (s, mand) => Binding.qualify mand s) (qs @ [(n, true)])
       
   590         #> Binding.conceal
   590       end;
   591       end;
   591 
   592 
   592     val ((bnfs, (deadss, livess)), (unfold_set, lthy)) = apfst (apsnd split_list o split_list)
   593     val ((bnfs, (deadss, livess)), (unfold_set, lthy)) = apfst (apsnd split_list o split_list)
   593       (fold_map2 (fn b => bnf_of_typ Smart_Inline (raw_qualify b) fp_sort Xs) bs rhsXs
   594       (fold_map2 (fn b => bnf_of_typ Smart_Inline (raw_qualify b) fp_sort Xs) bs rhsXs
   594         (empty_unfolds, lthy));
   595         (empty_unfolds, lthy));
   595 
   596 
   596     fun norm_qualify i = Binding.qualify true (Binding.name_of (nth bs (Int.max (0, i - 1))));
   597     fun norm_qualify i = Binding.qualify true (Binding.name_of (nth bs (Int.max (0, i - 1))))
       
   598       #> Binding.conceal;
   597 
   599 
   598     val Ass = map (map dest_TFree) livess;
   600     val Ass = map (map dest_TFree) livess;
   599     val resDs = fold (subtract (op =)) Ass resBs;
   601     val resDs = fold (subtract (op =)) Ass resBs;
   600     val Ds = fold (fold Term.add_tfreesT) deadss [];
   602     val Ds = fold (fold Term.add_tfreesT) deadss [];
   601 
   603 
   604     val ((kill_poss, _), (bnfs', (unfold_set', lthy'))) =
   606     val ((kill_poss, _), (bnfs', (unfold_set', lthy'))) =
   605       normalize_bnfs norm_qualify Ass Ds fp_sort bnfs unfold_set lthy;
   607       normalize_bnfs norm_qualify Ass Ds fp_sort bnfs unfold_set lthy;
   606 
   608 
   607     val Dss = map3 (append oo map o nth) livess kill_poss deadss;
   609     val Dss = map3 (append oo map o nth) livess kill_poss deadss;
   608 
   610 
   609     val pre_qualify = Binding.qualify false o Binding.name_of;
   611     fun pre_qualify b = Binding.qualify false (Binding.name_of b)
       
   612       #> Config.get lthy' bnf_note_all = false ? Binding.conceal;
   610 
   613 
   611     val ((pre_bnfs, deadss), lthy'') =
   614     val ((pre_bnfs, deadss), lthy'') =
   612       fold_map3 (fn b => seal_bnf (pre_qualify b) unfold_set' (Binding.prefix_name preN b))
   615       fold_map3 (fn b => seal_bnf (pre_qualify b) unfold_set' (Binding.prefix_name preN b))
   613         bs Dss bnfs' lthy'
   616         bs Dss bnfs' lthy'
   614       |>> split_list;
   617       |>> split_list;