53 theory -> take_induct_info * theory |
53 theory -> take_induct_info * theory |
54 |
54 |
55 val map_of_typ : |
55 val map_of_typ : |
56 theory -> (typ * term) list -> typ -> term |
56 theory -> (typ * term) list -> typ -> term |
57 |
57 |
58 val add_map_function : |
58 val add_map_function : (string * string) -> theory -> theory |
59 (string * string * thm) -> theory -> theory |
|
60 |
|
61 val get_map_tab : theory -> string Symtab.table |
59 val get_map_tab : theory -> string Symtab.table |
|
60 val add_deflation_thm : thm -> theory -> theory |
62 val get_deflation_thms : theory -> thm list |
61 val get_deflation_thms : theory -> thm list |
|
62 val setup : theory -> theory |
63 end; |
63 end; |
64 |
64 |
65 structure Domain_Take_Proofs : DOMAIN_TAKE_PROOFS = |
65 structure Domain_Take_Proofs : DOMAIN_TAKE_PROOFS = |
66 struct |
66 struct |
67 |
67 |
124 val empty = Symtab.empty; |
124 val empty = Symtab.empty; |
125 val extend = I; |
125 val extend = I; |
126 fun merge data = Symtab.merge (K true) data; |
126 fun merge data = Symtab.merge (K true) data; |
127 ); |
127 ); |
128 |
128 |
129 structure DeflMapData = Theory_Data |
129 structure DeflMapData = Named_Thms |
130 ( |
130 ( |
131 (* theorems like "deflation a ==> deflation (foo_map$a)" *) |
131 val name = "domain_deflation" |
132 type T = thm list; |
132 val description = "theorems like deflation a ==> deflation (foo_map$a)" |
133 val empty = []; |
|
134 val extend = I; |
|
135 val merge = Thm.merge_thms; |
|
136 ); |
133 ); |
137 |
134 |
138 fun add_map_function (tname, map_name, deflation_map_thm) = |
135 fun add_map_function (tname, map_name) = |
139 MapData.map (Symtab.insert (K true) (tname, map_name)) |
136 MapData.map (Symtab.insert (K true) (tname, map_name)); |
140 #> DeflMapData.map (Thm.add_thm deflation_map_thm); |
137 |
|
138 fun add_deflation_thm thm = |
|
139 Context.theory_map (DeflMapData.add_thm thm); |
141 |
140 |
142 val get_map_tab = MapData.get; |
141 val get_map_tab = MapData.get; |
143 val get_deflation_thms = DeflMapData.get; |
142 fun get_deflation_thms thy = DeflMapData.get (ProofContext.init_global thy); |
|
143 |
|
144 val setup = DeflMapData.setup; |
144 |
145 |
145 (******************************************************************************) |
146 (******************************************************************************) |
146 (************************** building types and terms **************************) |
147 (************************** building types and terms **************************) |
147 (******************************************************************************) |
148 (******************************************************************************) |
148 |
149 |
342 val bottom_rules = |
343 val bottom_rules = |
343 take_0_thms @ @{thms deflation_UU simp_thms}; |
344 take_0_thms @ @{thms deflation_UU simp_thms}; |
344 val deflation_rules = |
345 val deflation_rules = |
345 @{thms conjI deflation_ID} |
346 @{thms conjI deflation_ID} |
346 @ deflation_abs_rep_thms |
347 @ deflation_abs_rep_thms |
347 @ DeflMapData.get thy; |
348 @ get_deflation_thms thy; |
348 in |
349 in |
349 Goal.prove_global thy [] [] goal (fn _ => |
350 Goal.prove_global thy [] [] goal (fn _ => |
350 EVERY |
351 EVERY |
351 [rtac @{thm nat.induct} 1, |
352 [rtac @{thm nat.induct} 1, |
352 simp_tac (HOL_basic_ss addsimps bottom_rules) 1, |
353 simp_tac (HOL_basic_ss addsimps bottom_rules) 1, |