6 *) |
6 *) |
7 |
7 |
8 signature TRANSFER = |
8 signature TRANSFER = |
9 sig |
9 sig |
10 type pred_data |
10 type pred_data |
|
11 val mk_pred_data: thm -> thm -> thm list -> pred_data |
11 val rel_eq_onp: pred_data -> thm |
12 val rel_eq_onp: pred_data -> thm |
12 val rel_eq_onp_with_tops: pred_data -> thm |
13 val rel_eq_onp_with_tops: pred_data -> thm |
13 val pred_def: pred_data -> thm |
14 val pred_def: pred_data -> thm |
|
15 val pred_simps: pred_data -> thm list |
|
16 val update_pred_simps: thm list -> pred_data -> pred_data |
14 |
17 |
15 val bottom_rewr_conv: thm list -> conv |
18 val bottom_rewr_conv: thm list -> conv |
16 val top_rewr_conv: thm list -> conv |
19 val top_rewr_conv: thm list -> conv |
17 val top_sweep_rewr_conv: thm list -> conv |
20 val top_sweep_rewr_conv: thm list -> conv |
18 |
21 |
57 |
60 |
58 val compound_xhs_empty_net = Item_Net.init (Thm.eq_thm_prop o apply2 snd) (single o fst); |
61 val compound_xhs_empty_net = Item_Net.init (Thm.eq_thm_prop o apply2 snd) (single o fst); |
59 val rewr_rules = Item_Net.init Thm.eq_thm_prop (single o fst o HOLogic.dest_eq |
62 val rewr_rules = Item_Net.init Thm.eq_thm_prop (single o fst o HOLogic.dest_eq |
60 o HOLogic.dest_Trueprop o Thm.concl_of); |
63 o HOLogic.dest_Trueprop o Thm.concl_of); |
61 |
64 |
62 type pred_data = {pred_def:thm, rel_eq_onp: thm} |
65 datatype pred_data = PRED_DATA of {pred_def:thm, rel_eq_onp: thm, pred_simps: thm list} |
63 |
66 |
64 val rel_eq_onp: pred_data -> thm = #rel_eq_onp |
67 fun mk_pred_data pred_def rel_eq_onp pred_simps = PRED_DATA {pred_def = pred_def, |
65 val rel_eq_onp_with_tops: pred_data -> thm = (Conv.fconv_rule (HOLogic.Trueprop_conv (Conv.arg1_conv |
68 rel_eq_onp = rel_eq_onp, pred_simps = pred_simps} |
|
69 |
|
70 fun map_pred_data' f1 f2 f3 (PRED_DATA {pred_def, rel_eq_onp, pred_simps}) = |
|
71 PRED_DATA {pred_def = f1 pred_def, rel_eq_onp = f2 rel_eq_onp, pred_simps = f3 pred_simps} |
|
72 |
|
73 fun rep_pred_data (PRED_DATA p) = p |
|
74 val rel_eq_onp = #rel_eq_onp o rep_pred_data |
|
75 val rel_eq_onp_with_tops = (Conv.fconv_rule (HOLogic.Trueprop_conv (Conv.arg1_conv |
66 (top_sweep_rewr_conv @{thms eq_onp_top_eq_eq[symmetric, THEN eq_reflection]})))) |
76 (top_sweep_rewr_conv @{thms eq_onp_top_eq_eq[symmetric, THEN eq_reflection]})))) |
67 o #rel_eq_onp |
77 o #rel_eq_onp o rep_pred_data |
68 val pred_def: pred_data -> thm = #pred_def |
78 val pred_def = #pred_def o rep_pred_data |
|
79 val pred_simps = #pred_simps o rep_pred_data |
|
80 fun update_pred_simps new_pred_data = map_pred_data' I I (K new_pred_data) |
|
81 |
69 |
82 |
70 structure Data = Generic_Data |
83 structure Data = Generic_Data |
71 ( |
84 ( |
72 type T = |
85 type T = |
73 { transfer_raw : thm Item_Net.T, |
86 { transfer_raw : thm Item_Net.T, |
794 Attrib.thms >> transferred_attribute |
807 Attrib.thms >> transferred_attribute |
795 |
808 |
796 val untransferred_attribute_parser = |
809 val untransferred_attribute_parser = |
797 Attrib.thms >> untransferred_attribute |
810 Attrib.thms >> untransferred_attribute |
798 |
811 |
799 fun morph_pred_data phi {pred_def, rel_eq_onp} = |
812 fun morph_pred_data phi = |
800 {pred_def = Morphism.thm phi pred_def, |
813 let |
801 rel_eq_onp = Morphism.thm phi rel_eq_onp} |
814 val morph_thm = Morphism.thm phi |
|
815 in |
|
816 map_pred_data' morph_thm morph_thm (map morph_thm) |
|
817 end |
802 |
818 |
803 fun lookup_pred_data ctxt type_name = Symtab.lookup (get_pred_data ctxt) type_name |
819 fun lookup_pred_data ctxt type_name = Symtab.lookup (get_pred_data ctxt) type_name |
804 |> Option.map (morph_pred_data (Morphism.transfer_morphism (Proof_Context.theory_of ctxt))) |
820 |> Option.map (morph_pred_data (Morphism.transfer_morphism (Proof_Context.theory_of ctxt))) |
805 |
821 |
806 fun update_pred_data type_name qinfo ctxt = |
822 fun update_pred_data type_name qinfo ctxt = |