src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML
changeset 59058 a78612c67ec0
parent 58998 6237574c705b
child 59266 776964a0589f
equal deleted inserted replaced
59057:5b649fb2f2e1 59058:a78612c67ec0
   547               map (fn b => find_index (curry Binding.eq_name b) uniq_sel_bindings) all_sel_bindings;
   547               map (fn b => find_index (curry Binding.eq_name b) uniq_sel_bindings) all_sel_bindings;
   548 
   548 
   549           val all_proto_sels = flat (@{map 3} (fn k => fn xs => map (pair k o pair xs)) ks xss xss);
   549           val all_proto_sels = flat (@{map 3} (fn k => fn xs => map (pair k o pair xs)) ks xss xss);
   550           val sel_infos =
   550           val sel_infos =
   551             AList.group (op =) (sel_binding_index ~~ all_proto_sels)
   551             AList.group (op =) (sel_binding_index ~~ all_proto_sels)
   552             |> sort (int_ord o pairself fst)
   552             |> sort (int_ord o apply2 fst)
   553             |> map snd |> curry (op ~~) uniq_sel_bindings;
   553             |> map snd |> curry (op ~~) uniq_sel_bindings;
   554           val sel_bindings = map fst sel_infos;
   554           val sel_bindings = map fst sel_infos;
   555 
   555 
   556           val sel_defaults =
   556           val sel_defaults =
   557             if null sel_default_eqs then
   557             if null sel_default_eqs then
   664 
   664 
   665     fun after_qed ([exhaust_thm] :: thmss) lthy =
   665     fun after_qed ([exhaust_thm] :: thmss) lthy =
   666       let
   666       let
   667         val ((inject_thms, inject_thmss), half_distinct_thmss) = chop n thmss |>> `flat;
   667         val ((inject_thms, inject_thmss), half_distinct_thmss) = chop n thmss |>> `flat;
   668 
   668 
   669         val rho_As = map (pairself (certifyT lthy)) (map Logic.varifyT_global As ~~ As);
   669         val rho_As = map (apply2 (certifyT lthy)) (map Logic.varifyT_global As ~~ As);
   670 
   670 
   671         fun inst_thm t thm =
   671         fun inst_thm t thm =
   672           Drule.instantiate' [] [SOME (certify lthy t)]
   672           Drule.instantiate' [] [SOME (certify lthy t)]
   673             (Thm.instantiate (rho_As, []) (Drule.zero_var_indexes thm));
   673             (Thm.instantiate (rho_As, []) (Drule.zero_var_indexes thm));
   674 
   674 
   715                  mk_Trueprop_eq (eta_ufcase, eta_vgcase));
   715                  mk_Trueprop_eq (eta_ufcase, eta_vgcase));
   716             val weak_goal = Logic.mk_implies (uv_eq, mk_Trueprop_eq (ufcase, vfcase));
   716             val weak_goal = Logic.mk_implies (uv_eq, mk_Trueprop_eq (ufcase, vfcase));
   717           in
   717           in
   718             (Goal.prove_sorry lthy [] [] goal (fn _ => mk_case_cong_tac lthy uexhaust_thm case_thms),
   718             (Goal.prove_sorry lthy [] [] goal (fn _ => mk_case_cong_tac lthy uexhaust_thm case_thms),
   719              Goal.prove_sorry lthy [] [] weak_goal (K (etac arg_cong 1)))
   719              Goal.prove_sorry lthy [] [] weak_goal (K (etac arg_cong 1)))
   720             |> pairself (singleton (Proof_Context.export names_lthy lthy) #>
   720             |> apply2 (singleton (Proof_Context.export names_lthy lthy) #>
   721               Thm.close_derivation)
   721               Thm.close_derivation)
   722           end;
   722           end;
   723 
   723 
   724         val split_lhs = q $ ufcase;
   724         val split_lhs = q $ ufcase;
   725 
   725