equal
deleted
inserted
replaced
69 val rewrite_comp_comp = case_fp fp @{thm rewriteL_comp_comp} @{thm rewriteR_comp_comp}; |
69 val rewrite_comp_comp = case_fp fp @{thm rewriteL_comp_comp} @{thm rewriteR_comp_comp}; |
70 |
70 |
71 val fp_absT_infos = map #absT_info fp_sugars; |
71 val fp_absT_infos = map #absT_info fp_sugars; |
72 val fp_bnfs = of_fp_res #bnfs; |
72 val fp_bnfs = of_fp_res #bnfs; |
73 val pre_bnfs = map #pre_bnf fp_sugars; |
73 val pre_bnfs = map #pre_bnf fp_sugars; |
74 val nesty_bnfss = map (fn sugar => #nested_bnfs sugar @ #nesting_bnfs sugar) fp_sugars; |
74 val nesting_bnfss = |
75 val fp_nesty_bnfss = fp_bnfs :: nesty_bnfss; |
75 map (fn sugar => #fp_nesting_bnfs sugar @ #live_nesting_bnfs sugar) fp_sugars; |
76 val fp_nesty_bnfs = distinct (op = o pairself T_of_bnf) (flat fp_nesty_bnfss); |
76 val fp_or_nesting_bnfss = fp_bnfs :: nesting_bnfss; |
|
77 val fp_or_nesting_bnfs = distinct (op = o pairself T_of_bnf) (flat fp_or_nesting_bnfss); |
77 |
78 |
78 val fp_absTs = map #absT fp_absT_infos; |
79 val fp_absTs = map #absT fp_absT_infos; |
79 val fp_repTs = map #repT fp_absT_infos; |
80 val fp_repTs = map #repT fp_absT_infos; |
80 val fp_abss = map #abs fp_absT_infos; |
81 val fp_abss = map #abs fp_absT_infos; |
81 val fp_reps = map #rep fp_absT_infos; |
82 val fp_reps = map #rep fp_absT_infos; |
135 ||>> mk_Frees "x" xTs |
136 ||>> mk_Frees "x" xTs |
136 ||>> mk_Frees "y" yTs; |
137 ||>> mk_Frees "y" yTs; |
137 |
138 |
138 val rels = |
139 val rels = |
139 let |
140 let |
140 fun find_rel T As Bs = fp_nesty_bnfss |
141 fun find_rel T As Bs = fp_or_nesting_bnfss |
141 |> map (filter_out (curry (op = o pairself name_of_bnf) BNF_Comp.DEADID_bnf)) |
142 |> map (filter_out (curry (op = o pairself name_of_bnf) BNF_Comp.DEADID_bnf)) |
142 |> get_first (find_first (fn bnf => Type.could_unify (T_of_bnf bnf, T))) |
143 |> get_first (find_first (fn bnf => Type.could_unify (T_of_bnf bnf, T))) |
143 |> Option.map (fn bnf => |
144 |> Option.map (fn bnf => |
144 let val live = live_of_bnf bnf; |
145 let val live = live_of_bnf bnf; |
145 in (mk_rel live As Bs (rel_of_bnf bnf), live) end) |
146 in (mk_rel live As Bs (rel_of_bnf bnf), live) end) |
184 val rel_xtor_co_induct_thm = |
185 val rel_xtor_co_induct_thm = |
185 mk_rel_xtor_co_induct_thm fp (map3 cast castAs castBs pre_rels) pre_phis rels phis xs ys xtors |
186 mk_rel_xtor_co_induct_thm fp (map3 cast castAs castBs pre_rels) pre_phis rels phis xs ys xtors |
186 xtor's (mk_rel_xtor_co_induct_tactic fp abs_inverses rel_xtor_co_inducts rel_defs rel_monos) |
187 xtor's (mk_rel_xtor_co_induct_tactic fp abs_inverses rel_xtor_co_inducts rel_defs rel_monos) |
187 lthy; |
188 lthy; |
188 |
189 |
189 val rel_eqs = no_refl (map rel_eq_of_bnf fp_nesty_bnfs); |
190 val rel_eqs = no_refl (map rel_eq_of_bnf fp_or_nesting_bnfs); |
190 val map_id0s = no_refl (map map_id0_of_bnf bnfs); |
191 val map_id0s = no_refl (map map_id0_of_bnf bnfs); |
191 |
192 |
192 val xtor_co_induct_thm = |
193 val xtor_co_induct_thm = |
193 (case fp of |
194 (case fp of |
194 Least_FP => |
195 Least_FP => |
417 |
418 |
418 val eq_thm_prop_untyped = Term.aconv_untyped o pairself Thm.full_prop_of; |
419 val eq_thm_prop_untyped = Term.aconv_untyped o pairself Thm.full_prop_of; |
419 |
420 |
420 val map_thms = no_refl (maps (fn bnf => |
421 val map_thms = no_refl (maps (fn bnf => |
421 let val map_comp0 = map_comp0_of_bnf bnf RS sym |
422 let val map_comp0 = map_comp0_of_bnf bnf RS sym |
422 in [map_comp0, map_comp0 RS rewrite_comp_comp, map_id0_of_bnf bnf] end) fp_nesty_bnfs) @ |
423 in [map_comp0, map_comp0 RS rewrite_comp_comp, map_id0_of_bnf bnf] end) |
|
424 fp_or_nesting_bnfs) @ |
423 remove eq_thm_prop_untyped (case_fp fp @{thm comp_assoc[symmetric]} @{thm comp_assoc}) |
425 remove eq_thm_prop_untyped (case_fp fp @{thm comp_assoc[symmetric]} @{thm comp_assoc}) |
424 (map2 (fn thm => fn bnf => |
426 (map2 (fn thm => fn bnf => |
425 @{thm type_copy_map_comp0_undo} OF |
427 @{thm type_copy_map_comp0_undo} OF |
426 (replicate 3 thm @ unfold_map [map_comp0_of_bnf bnf]) RS |
428 (replicate 3 thm @ unfold_map [map_comp0_of_bnf bnf]) RS |
427 rewrite_comp_comp) |
429 rewrite_comp_comp) |