1+ signature BINDER_SUGAR = sig
2+
3+ type binder_sugar = {
4+ map_simps: thm list,
5+ set_simpss: thm list list,
6+ permute_simps: thm list,
7+ map_permute: thm,
8+ subst_simps: thm list option,
9+ IImsupp_permute_commutes: thm list option,
10+ IImsupp_Diffs: thm list option,
11+ bsetss: term option list list,
12+ bset_bounds: thm list,
13+ mrbnf: MRBNF_Def.mrbnf,
14+ strong_induct: thm option,
15+ distinct: thm list,
16+ inject: thm list,
17+ ctors: (term * thm) list
18+ };
19+
20+ val morph_binder_sugar: morphism -> binder_sugar -> binder_sugar;
21+
22+
23+ val binder_sugar_of: local_theory -> string -> binder_sugar option
24+ val register_binder_sugar: string -> binder_sugar -> local_theory -> local_theory
25+
26+ end
27+
28+ structure Binder_Sugar : BINDER_SUGAR = struct
29+
30+ type binder_sugar = {
31+ map_simps: thm list,
32+ set_simpss: thm list list,
33+ permute_simps: thm list,
34+ map_permute: thm,
35+ subst_simps: thm list option,
36+ IImsupp_permute_commutes: thm list option,
37+ IImsupp_Diffs: thm list option,
38+ bsetss: term option list list,
39+ bset_bounds: thm list,
40+ mrbnf: MRBNF_Def.mrbnf,
41+ strong_induct: thm option,
42+ distinct: thm list,
43+ inject: thm list,
44+ ctors: (term * thm) list
45+ };
46+
47+ fun morph_binder_sugar phi { map_simps, permute_simps, map_permute, set_simpss, subst_simps, mrbnf,
48+ strong_induct, distinct, inject, ctors, bsetss, bset_bounds, IImsupp_permute_commutes, IImsupp_Diffs } = {
49+ map_simps = map (Morphism.thm phi) map_simps,
50+ permute_simps = map (Morphism.thm phi) permute_simps,
51+ map_permute = Morphism.thm phi map_permute,
52+ set_simpss = map (map (Morphism.thm phi)) set_simpss,
53+ subst_simps = Option.map (map (Morphism.thm phi)) subst_simps,
54+ IImsupp_permute_commutes = Option.map (map (Morphism.thm phi)) IImsupp_permute_commutes,
55+ IImsupp_Diffs = Option.map (map (Morphism.thm phi)) IImsupp_Diffs,
56+ bsetss = map (map (Option.map (Morphism.term phi))) bsetss,
57+ bset_bounds = map (Morphism.thm phi) bset_bounds,
58+ mrbnf = MRBNF_Def.morph_mrbnf phi mrbnf,
59+ strong_induct = Option.map (Morphism.thm phi) strong_induct,
60+ distinct = map (Morphism.thm phi) distinct,
61+ inject = map (Morphism.thm phi) inject,
62+ ctors = map (MRBNF_Util.map_prod (Morphism.term phi) (Morphism.thm phi)) ctors
63+ } : binder_sugar;
64+
65+ structure Data = Generic_Data (
66+ type T = binder_sugar Symtab.table;
67+ val empty = Symtab.empty;
68+ fun merge data : T = Symtab.merge (K true ) data;
69+ );
70+
71+ fun register_binder_sugar name sugar =
72+ Local_Theory.declaration {syntax = false , pervasive = true , pos = Position.none}
73+ (fn phi => Data.map (Symtab.update (name, morph_binder_sugar phi sugar)));
74+
75+ fun binder_sugar_of_generic context =
76+ Option.map (morph_binder_sugar (Morphism.transfer_morphism (Context.theory_of context)))
77+ o Symtab.lookup (Data.get context);
78+
79+ val binder_sugar_of = binder_sugar_of_generic o Context.Proof;
80+
81+ end
0 commit comments