163
|
1 |
theory FSet
|
|
2 |
imports QuotMain
|
|
3 |
begin
|
|
4 |
|
|
5 |
inductive
|
|
6 |
list_eq (infix "\<approx>" 50)
|
|
7 |
where
|
|
8 |
"a#b#xs \<approx> b#a#xs"
|
|
9 |
| "[] \<approx> []"
|
|
10 |
| "xs \<approx> ys \<Longrightarrow> ys \<approx> xs"
|
|
11 |
| "a#a#xs \<approx> a#xs"
|
|
12 |
| "xs \<approx> ys \<Longrightarrow> a#xs \<approx> a#ys"
|
|
13 |
| "\<lbrakk>xs1 \<approx> xs2; xs2 \<approx> xs3\<rbrakk> \<Longrightarrow> xs1 \<approx> xs3"
|
|
14 |
|
|
15 |
lemma list_eq_refl:
|
|
16 |
shows "xs \<approx> xs"
|
|
17 |
apply (induct xs)
|
|
18 |
apply (auto intro: list_eq.intros)
|
|
19 |
done
|
|
20 |
|
|
21 |
lemma equiv_list_eq:
|
|
22 |
shows "EQUIV list_eq"
|
|
23 |
unfolding EQUIV_REFL_SYM_TRANS REFL_def SYM_def TRANS_def
|
|
24 |
apply(auto intro: list_eq.intros list_eq_refl)
|
|
25 |
done
|
|
26 |
|
|
27 |
quotient fset = "'a list" / "list_eq"
|
|
28 |
apply(rule equiv_list_eq)
|
|
29 |
done
|
|
30 |
|
|
31 |
print_theorems
|
|
32 |
|
|
33 |
typ "'a fset"
|
|
34 |
thm "Rep_fset"
|
|
35 |
thm "ABS_fset_def"
|
|
36 |
|
|
37 |
ML {* @{term "Abs_fset"} *}
|
|
38 |
local_setup {*
|
|
39 |
make_const_def @{binding EMPTY} @{term "[]"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
40 |
*}
|
|
41 |
|
|
42 |
term Nil
|
|
43 |
term EMPTY
|
|
44 |
thm EMPTY_def
|
|
45 |
|
|
46 |
|
|
47 |
local_setup {*
|
|
48 |
make_const_def @{binding INSERT} @{term "op #"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
49 |
*}
|
|
50 |
|
|
51 |
term Cons
|
|
52 |
term INSERT
|
|
53 |
thm INSERT_def
|
|
54 |
|
|
55 |
local_setup {*
|
|
56 |
make_const_def @{binding UNION} @{term "op @"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
57 |
*}
|
|
58 |
|
|
59 |
term append
|
|
60 |
term UNION
|
|
61 |
thm UNION_def
|
|
62 |
|
|
63 |
thm QUOTIENT_fset
|
|
64 |
|
|
65 |
thm QUOT_TYPE_I_fset.thm11
|
|
66 |
|
|
67 |
|
|
68 |
fun
|
|
69 |
membship :: "'a \<Rightarrow> 'a list \<Rightarrow> bool" (infix "memb" 100)
|
|
70 |
where
|
|
71 |
m1: "(x memb []) = False"
|
|
72 |
| m2: "(x memb (y#xs)) = ((x=y) \<or> (x memb xs))"
|
|
73 |
|
|
74 |
fun
|
|
75 |
card1 :: "'a list \<Rightarrow> nat"
|
|
76 |
where
|
|
77 |
card1_nil: "(card1 []) = 0"
|
|
78 |
| card1_cons: "(card1 (x # xs)) = (if (x memb xs) then (card1 xs) else (Suc (card1 xs)))"
|
|
79 |
|
|
80 |
local_setup {*
|
|
81 |
make_const_def @{binding card} @{term "card1"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
82 |
*}
|
|
83 |
|
|
84 |
term card1
|
|
85 |
term card
|
|
86 |
thm card_def
|
|
87 |
|
|
88 |
(* text {*
|
|
89 |
Maybe make_const_def should require a theorem that says that the particular lifted function
|
|
90 |
respects the relation. With it such a definition would be impossible:
|
|
91 |
make_const_def @{binding CARD} @{term "length"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
92 |
*}*)
|
|
93 |
|
|
94 |
lemma card1_0:
|
|
95 |
fixes a :: "'a list"
|
|
96 |
shows "(card1 a = 0) = (a = [])"
|
|
97 |
apply (induct a)
|
|
98 |
apply (simp)
|
|
99 |
apply (simp_all)
|
|
100 |
apply meson
|
|
101 |
apply (simp_all)
|
|
102 |
done
|
|
103 |
|
|
104 |
lemma not_mem_card1:
|
|
105 |
fixes x :: "'a"
|
|
106 |
fixes xs :: "'a list"
|
|
107 |
shows "~(x memb xs) \<Longrightarrow> card1 (x # xs) = Suc (card1 xs)"
|
|
108 |
by simp
|
|
109 |
|
|
110 |
|
|
111 |
lemma mem_cons:
|
|
112 |
fixes x :: "'a"
|
|
113 |
fixes xs :: "'a list"
|
|
114 |
assumes a : "x memb xs"
|
|
115 |
shows "x # xs \<approx> xs"
|
|
116 |
using a
|
|
117 |
apply (induct xs)
|
|
118 |
apply (auto intro: list_eq.intros)
|
|
119 |
done
|
|
120 |
|
|
121 |
lemma card1_suc:
|
|
122 |
fixes xs :: "'a list"
|
|
123 |
fixes n :: "nat"
|
|
124 |
assumes c: "card1 xs = Suc n"
|
|
125 |
shows "\<exists>a ys. ~(a memb ys) \<and> xs \<approx> (a # ys)"
|
|
126 |
using c
|
|
127 |
apply(induct xs)
|
|
128 |
apply (metis Suc_neq_Zero card1_0)
|
|
129 |
apply (metis QUOT_TYPE_I_fset.R_trans card1_cons list_eq_refl mem_cons)
|
|
130 |
done
|
|
131 |
|
|
132 |
primrec
|
|
133 |
fold1
|
|
134 |
where
|
|
135 |
"fold1 f (g :: 'a \<Rightarrow> 'b) (z :: 'b) [] = z"
|
|
136 |
| "fold1 f g z (a # A) =
|
|
137 |
(if ((!u v. (f u v = f v u))
|
|
138 |
\<and> (!u v w. ((f u (f v w) = f (f u v) w))))
|
|
139 |
then (
|
|
140 |
if (a memb A) then (fold1 f g z A) else (f (g a) (fold1 f g z A))
|
|
141 |
) else z)"
|
|
142 |
|
|
143 |
(* fold1_def is not usable, but: *)
|
|
144 |
thm fold1.simps
|
|
145 |
|
|
146 |
lemma fs1_strong_cases:
|
|
147 |
fixes X :: "'a list"
|
|
148 |
shows "(X = []) \<or> (\<exists>a. \<exists> Y. (~(a memb Y) \<and> (X \<approx> a # Y)))"
|
|
149 |
apply (induct X)
|
|
150 |
apply (simp)
|
|
151 |
apply (metis QUOT_TYPE_I_fset.thm11 list_eq_refl mem_cons m1)
|
|
152 |
done
|
|
153 |
|
|
154 |
local_setup {*
|
|
155 |
make_const_def @{binding IN} @{term "membship"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
156 |
*}
|
|
157 |
|
|
158 |
term membship
|
|
159 |
term IN
|
|
160 |
thm IN_def
|
|
161 |
|
194
|
162 |
local_setup {*
|
|
163 |
make_const_def @{binding fold} @{term "fold1::('b \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a list \<Rightarrow> 'b"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
|
|
164 |
*}
|
|
165 |
|
|
166 |
term fold1
|
|
167 |
term fold
|
|
168 |
thm fold_def
|
|
169 |
|
|
170 |
local_setup {*
|
212
|
171 |
make_const_def @{binding fmap} @{term "map::('a \<Rightarrow> 'a) \<Rightarrow> 'a list \<Rightarrow> 'a list"} NoSyn
|
|
172 |
@{typ "'a list"} @{typ "'a fset"} #> snd
|
194
|
173 |
*}
|
|
174 |
|
|
175 |
term map
|
|
176 |
term fmap
|
|
177 |
thm fmap_def
|
|
178 |
|
|
179 |
|
212
|
180 |
|
|
181 |
|
163
|
182 |
ML {*
|
|
183 |
val consts = [@{const_name "Nil"}, @{const_name "Cons"},
|
|
184 |
@{const_name "membship"}, @{const_name "card1"},
|
194
|
185 |
@{const_name "append"}, @{const_name "fold1"},
|
|
186 |
@{const_name "map"}];
|
163
|
187 |
*}
|
|
188 |
|
194
|
189 |
ML {* val fset_defs = @{thms EMPTY_def IN_def UNION_def card_def INSERT_def fmap_def fold_def} *}
|
190
ca1a24aa822e
Finished the code for adding lower defs, and more things moved to QuotMain
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
190 |
ML {* val fset_defs_sym = add_lower_defs @{context} fset_defs *}
|
163
|
191 |
|
164
|
192 |
lemma memb_rsp:
|
163
|
193 |
fixes z
|
|
194 |
assumes a: "list_eq x y"
|
|
195 |
shows "(z memb x) = (z memb y)"
|
|
196 |
using a by induct auto
|
|
197 |
|
164
|
198 |
lemma ho_memb_rsp:
|
|
199 |
"(op = ===> (op \<approx> ===> op =)) (op memb) (op memb)"
|
|
200 |
apply (simp add: FUN_REL.simps)
|
|
201 |
apply (metis memb_rsp)
|
|
202 |
done
|
|
203 |
|
163
|
204 |
lemma card1_rsp:
|
|
205 |
fixes a b :: "'a list"
|
|
206 |
assumes e: "a \<approx> b"
|
|
207 |
shows "card1 a = card1 b"
|
|
208 |
using e apply induct
|
164
|
209 |
apply (simp_all add:memb_rsp)
|
163
|
210 |
done
|
|
211 |
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
212 |
lemma ho_card1_rsp: "op \<approx> ===> op = card1 card1"
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
213 |
apply (simp add: FUN_REL.simps)
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
214 |
apply (metis card1_rsp)
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
215 |
done
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
216 |
|
164
|
217 |
lemma cons_rsp:
|
163
|
218 |
fixes z
|
|
219 |
assumes a: "xs \<approx> ys"
|
|
220 |
shows "(z # xs) \<approx> (z # ys)"
|
|
221 |
using a by (rule list_eq.intros(5))
|
|
222 |
|
164
|
223 |
lemma ho_cons_rsp:
|
|
224 |
"op = ===> op \<approx> ===> op \<approx> op # op #"
|
|
225 |
apply (simp add: FUN_REL.simps)
|
|
226 |
apply (metis cons_rsp)
|
|
227 |
done
|
|
228 |
|
175
|
229 |
lemma append_rsp_fst:
|
163
|
230 |
assumes a : "list_eq l1 l2"
|
|
231 |
shows "list_eq (l1 @ s) (l2 @ s)"
|
|
232 |
using a
|
|
233 |
apply(induct)
|
|
234 |
apply(auto intro: list_eq.intros)
|
175
|
235 |
apply(rule list_eq_refl)
|
163
|
236 |
done
|
|
237 |
|
187
|
238 |
(* Need stronger induction... *)
|
175
|
239 |
lemma "(a @ b) \<approx> (b @ a)"
|
187
|
240 |
apply(induct a)
|
|
241 |
sorry
|
175
|
242 |
|
194
|
243 |
lemma ho_append_rsp:
|
175
|
244 |
"op \<approx> ===> op \<approx> ===> op \<approx> op @ op @"
|
|
245 |
sorry
|
|
246 |
|
194
|
247 |
lemma map_rsp:
|
|
248 |
assumes a: "a \<approx> b"
|
|
249 |
shows "map f a \<approx> map f b"
|
|
250 |
using a
|
|
251 |
apply (induct)
|
|
252 |
apply(auto intro: list_eq.intros)
|
|
253 |
done
|
|
254 |
|
|
255 |
lemma ho_map_rsp:
|
|
256 |
"op = ===> op = ===> op \<approx> ===> op \<approx> map map"
|
|
257 |
apply (simp add: FUN_REL.simps)
|
|
258 |
apply (rule allI)
|
|
259 |
apply (rule allI)
|
|
260 |
apply (rule impI)
|
|
261 |
apply (rule allI)
|
|
262 |
apply (rule allI)
|
|
263 |
apply (rule impI)
|
|
264 |
sorry (* apply (auto simp add: map_rsp[of "xa" "ya"]) *)
|
|
265 |
|
|
266 |
lemma map_append :
|
|
267 |
"(map f ((a::'a list) @ b)) \<approx>
|
|
268 |
((map f a) ::'a list) @ (map f b)"
|
|
269 |
apply simp
|
|
270 |
apply (rule list_eq_refl)
|
|
271 |
done
|
|
272 |
|
163
|
273 |
thm list.induct
|
|
274 |
lemma list_induct_hol4:
|
|
275 |
fixes P :: "'a list \<Rightarrow> bool"
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
276 |
assumes a: "((P []) \<and> (\<forall>t. (P t) \<longrightarrow> (\<forall>h. (P (h # t)))))"
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
277 |
shows "\<forall>l. (P l)"
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
278 |
using a
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
279 |
apply (rule_tac allI)
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
280 |
apply (induct_tac "l")
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
281 |
apply (simp)
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
282 |
apply (metis)
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
283 |
done
|
163
|
284 |
|
|
285 |
prove list_induct_r: {*
|
|
286 |
build_regularize_goal (atomize_thm @{thm list_induct_hol4}) @{typ "'a List.list"} @{term "op \<approx>"} @{context} *}
|
|
287 |
apply (simp only: equiv_res_forall[OF equiv_list_eq])
|
|
288 |
thm RIGHT_RES_FORALL_REGULAR
|
|
289 |
apply (rule RIGHT_RES_FORALL_REGULAR)
|
|
290 |
prefer 2
|
|
291 |
apply (assumption)
|
|
292 |
apply (metis)
|
|
293 |
done
|
|
294 |
|
187
|
295 |
(* The all_prs and ex_prs should be proved for the instance... *)
|
163
|
296 |
ML {*
|
|
297 |
fun r_mk_comb_tac_fset ctxt =
|
187
|
298 |
r_mk_comb_tac ctxt @{thm QUOTIENT_fset} @{thm list_eq_refl} @{thm QUOT_TYPE_I_fset.R_trans2}
|
194
|
299 |
(@{thms ho_memb_rsp ho_cons_rsp ho_card1_rsp ho_map_rsp ho_append_rsp} @ @{thms ho_all_prs ho_ex_prs})
|
163
|
300 |
*}
|
|
301 |
|
|
302 |
|
|
303 |
ML {* val thm = @{thm list_induct_r} OF [atomize_thm @{thm list_induct_hol4}] *}
|
|
304 |
ML {* val trm_r = build_repabs_goal @{context} thm consts @{typ "'a list"} @{typ "'a fset"} *}
|
|
305 |
ML {* val trm = build_repabs_term @{context} thm consts @{typ "'a list"} @{typ "'a fset"} *}
|
|
306 |
|
166
|
307 |
ML {* trm_r *}
|
163
|
308 |
prove list_induct_tr: trm_r
|
|
309 |
apply (atomize(full))
|
|
310 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
|
|
311 |
done
|
|
312 |
|
|
313 |
prove list_induct_t: trm
|
|
314 |
apply (simp only: list_induct_tr[symmetric])
|
|
315 |
apply (tactic {* rtac thm 1 *})
|
|
316 |
done
|
|
317 |
|
|
318 |
thm m2
|
|
319 |
ML {* atomize_thm @{thm m2} *}
|
|
320 |
|
|
321 |
prove m2_r_p: {*
|
|
322 |
build_regularize_goal (atomize_thm @{thm m2}) @{typ "'a List.list"} @{term "op \<approx>"} @{context} *}
|
|
323 |
apply (simp add: equiv_res_forall[OF equiv_list_eq])
|
|
324 |
done
|
|
325 |
|
|
326 |
ML {* val m2_r = @{thm m2_r_p} OF [atomize_thm @{thm m2}] *}
|
|
327 |
ML {* val m2_t_g = build_repabs_goal @{context} m2_r consts @{typ "'a list"} @{typ "'a fset"} *}
|
|
328 |
ML {* val m2_t = build_repabs_term @{context} m2_r consts @{typ "'a list"} @{typ "'a fset"} *}
|
|
329 |
prove m2_t_p: m2_t_g
|
|
330 |
apply (atomize(full))
|
|
331 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
|
|
332 |
done
|
|
333 |
|
|
334 |
prove m2_t: m2_t
|
|
335 |
apply (simp only: m2_t_p[symmetric])
|
|
336 |
apply (tactic {* rtac m2_r 1 *})
|
|
337 |
done
|
|
338 |
|
|
339 |
lemma id_apply2 [simp]: "id x \<equiv> x"
|
|
340 |
by (simp add: id_def)
|
|
341 |
|
|
342 |
ML {*
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
343 |
val lpis = @{thm LAMBDA_PRS} OF [@{thm QUOTIENT_fset}, @{thm IDENTITY_QUOTIENT}];
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
344 |
val lpist = @{thm "HOL.sym"} OF [lpis];
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
345 |
val lam_prs = MetaSimplifier.rewrite_rule [@{thm id_apply2}] lpist
|
163
|
346 |
*}
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
347 |
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
348 |
text {* the proper way to do it *}
|
163
|
349 |
ML {*
|
175
|
350 |
fun findabs rty tm =
|
|
351 |
case tm of
|
|
352 |
Abs(_, T, b) =>
|
|
353 |
let
|
|
354 |
val b' = subst_bound ((Free ("x", T)), b);
|
|
355 |
val tys = findabs rty b'
|
|
356 |
val ty = fastype_of tm
|
|
357 |
in if needs_lift rty ty then (ty :: tys) else tys
|
|
358 |
end
|
|
359 |
| f $ a => (findabs rty f) @ (findabs rty a)
|
|
360 |
| _ => []
|
|
361 |
*}
|
|
362 |
|
202
|
363 |
ML {* val quot = @{thm QUOTIENT_fset} *}
|
|
364 |
ML {* val abs = findabs @{typ "'a list"} (prop_of (atomize_thm @{thm list_induct_hol4})) *}
|
|
365 |
ML {* val simp_lam_prs_thms = map (make_simp_lam_prs_thm @{context} quot) abs *}
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
366 |
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
367 |
ML {*
|
175
|
368 |
fun simp_lam_prs lthy thm =
|
202
|
369 |
simp_lam_prs lthy (eqsubst_thm lthy simp_lam_prs_thms thm)
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
370 |
handle _ => thm
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
371 |
*}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
372 |
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
373 |
ML {* val m2_t' = eqsubst_thm @{context} [lam_prs] @{thm m2_t} *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
374 |
|
202
|
375 |
ML {* val ithm = simp_allex_prs @{context} quot m2_t' *}
|
189
|
376 |
ML fset_defs_sym
|
|
377 |
|
164
|
378 |
ML {* val rthm = MetaSimplifier.rewrite_rule fset_defs_sym ithm *}
|
|
379 |
ML {* ObjectLogic.rulify rthm *}
|
163
|
380 |
|
|
381 |
|
190
ca1a24aa822e
Finished the code for adding lower defs, and more things moved to QuotMain
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
382 |
ML {* val card1_suc_a = atomize_thm @{thm card1_suc} *}
|
163
|
383 |
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
384 |
prove card1_suc_r_p: {*
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
385 |
build_regularize_goal (atomize_thm @{thm card1_suc}) @{typ "'a List.list"} @{term "op \<approx>"} @{context} *}
|
163
|
386 |
apply (simp add: equiv_res_forall[OF equiv_list_eq] equiv_res_exists[OF equiv_list_eq])
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
387 |
done
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
388 |
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
389 |
ML {* val card1_suc_r = @{thm card1_suc_r_p} OF [atomize_thm @{thm card1_suc}] *}
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
390 |
ML {* val card1_suc_t_g = build_repabs_goal @{context} card1_suc_r consts @{typ "'a list"} @{typ "'a fset"} *}
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
391 |
ML {* val card1_suc_t = build_repabs_term @{context} card1_suc_r consts @{typ "'a list"} @{typ "'a fset"} *}
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
392 |
prove card1_suc_t_p: card1_suc_t_g
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
393 |
apply (atomize(full))
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
394 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
395 |
done
|
163
|
396 |
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
397 |
prove card1_suc_t: card1_suc_t
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
398 |
apply (simp only: card1_suc_t_p[symmetric])
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
399 |
apply (tactic {* rtac card1_suc_r 1 *})
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
400 |
done
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
401 |
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
402 |
ML {* val card1_suc_t_n = @{thm card1_suc_t} *}
|
202
|
403 |
ML {* val card1_suc_t' = simp_lam_prs @{context} @{thm card1_suc_t} *}
|
|
404 |
ML {* val ithm = simp_allex_prs @{context} quot card1_suc_t' *}
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
405 |
ML {* val rthm = MetaSimplifier.rewrite_rule fset_defs_sym ithm *}
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
406 |
ML {* val qthm = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same} rthm *}
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
407 |
ML {* ObjectLogic.rulify qthm *}
|
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
408 |
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
409 |
thm fold1.simps(2)
|
173
7cf227756e2a
Finally completely lift the previously lifted theorems + clean some old stuff
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
410 |
thm list.recs(2)
|
163
|
411 |
|
194
|
412 |
ML {* val ind_r_a = atomize_thm @{thm map_append} *}
|
175
|
413 |
(* prove {* build_regularize_goal ind_r_a @{typ "'a List.list"} @{term "op \<approx>"} @{context} *}
|
|
414 |
ML_prf {* fun tac ctxt =
|
|
415 |
(asm_full_simp_tac ((Simplifier.context ctxt HOL_ss) addsimps
|
|
416 |
[(@{thm equiv_res_forall} OF [@{thm equiv_list_eq}]),
|
|
417 |
(@{thm equiv_res_exists} OF [@{thm equiv_list_eq}])])) THEN_ALL_NEW
|
|
418 |
(((rtac @{thm RIGHT_RES_FORALL_REGULAR}) THEN' (RANGE [fn _ => all_tac, atac]) THEN'
|
|
419 |
(MetisTools.metis_tac ctxt [])) ORELSE' (MetisTools.metis_tac ctxt [])); *}
|
|
420 |
apply (tactic {* tac @{context} 1 *}) *)
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
421 |
ML {* val ind_r_r = regularize ind_r_a @{typ "'a List.list"} @{term "op \<approx>"} @{thm equiv_list_eq} @{context} *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
422 |
ML {*
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
423 |
val rt = build_repabs_term @{context} ind_r_r consts @{typ "'a list"} @{typ "'a fset"}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
424 |
val rg = Logic.mk_equals ((Thm.prop_of ind_r_r), rt);
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
425 |
*}
|
194
|
426 |
prove rg
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
427 |
apply(atomize(full))
|
194
|
428 |
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
|
|
429 |
apply (auto)
|
|
430 |
done
|
|
431 |
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
432 |
ML {* val (g, thm, othm) =
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
433 |
Toplevel.program (fn () =>
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
434 |
repabs_eq @{context} ind_r_r consts @{typ "'a list"} @{typ "'a fset"}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
435 |
@{thm QUOTIENT_fset} @{thm list_eq_refl} @{thm QUOT_TYPE_I_fset.R_trans2}
|
202
|
436 |
(@{thms ho_memb_rsp ho_cons_rsp ho_card1_rsp ho_map_rsp ho_append_rsp} @ @{thms ho_all_prs ho_ex_prs})
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
437 |
)
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
438 |
*}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
439 |
ML {*
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
440 |
fun tac2 ctxt =
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
441 |
(simp_tac ((Simplifier.context ctxt empty_ss) addsimps [symmetric thm]))
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
442 |
THEN' (rtac othm); *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
443 |
(* ML {* val cthm = Goal.prove @{context} [] [] g (fn x => tac2 (#context x) 1);
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
444 |
*} *)
|
163
|
445 |
|
|
446 |
ML {*
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
447 |
val ind_r_t2 =
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
448 |
Toplevel.program (fn () =>
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
449 |
repabs_eq2 @{context} (g, thm, othm)
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
450 |
)
|
163
|
451 |
*}
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
452 |
ML {* val ind_r_l = simp_lam_prs @{context} ind_r_t2 *}
|
175
|
453 |
lemma app_prs_for_induct: "(ABS_fset ---> id) f (REP_fset T1) = f T1"
|
|
454 |
apply (simp add: fun_map.simps QUOT_TYPE_I_fset.thm10)
|
|
455 |
done
|
163
|
456 |
|
178
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
457 |
ML {* val ind_r_l1 = eqsubst_thm @{context} @{thms app_prs_for_induct} ind_r_l *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
458 |
ML {* val ind_r_l2 = eqsubst_thm @{context} @{thms app_prs_for_induct} ind_r_l1 *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
459 |
ML {* val ind_r_l3 = eqsubst_thm @{context} @{thms app_prs_for_induct} ind_r_l2 *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
460 |
ML {* val ind_r_l4 = eqsubst_thm @{context} @{thms app_prs_for_induct} ind_r_l3 *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
461 |
ML {* val ind_r_a = simp_allex_prs @{context} ind_r_l4 *}
|
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
462 |
ML {* val thm = @{thm FORALL_PRS[OF FUN_QUOTIENT[OF QUOTIENT_fset IDENTITY_QUOTIENT], symmetric]} *}
|
178
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
463 |
ML {* val ind_r_a1 = eqsubst_thm @{context} [thm] ind_r_a *}
|
187
|
464 |
|
189
|
465 |
|
|
466 |
ML {* hd fset_defs_sym *}
|
178
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
467 |
ML {* val ind_r_d = MetaSimplifier.rewrite_rule fset_defs_sym ind_r_a1 *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
468 |
ML {* val ind_r_s = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same} ind_r_d *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
469 |
ML {* ObjectLogic.rulify ind_r_s *}
|
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
470 |
|
163
|
471 |
ML {*
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
472 |
fun lift thm =
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
473 |
let
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
474 |
val ind_r_a = atomize_thm thm;
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
475 |
val ind_r_r = regularize ind_r_a @{typ "'a List.list"} @{term "op \<approx>"} @{thm equiv_list_eq} @{context};
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
476 |
val (g, t, ot) =
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
477 |
repabs_eq @{context} ind_r_r consts @{typ "'a list"} @{typ "'a fset"}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
478 |
@{thm QUOTIENT_fset} @{thm list_eq_refl} @{thm QUOT_TYPE_I_fset.R_trans2}
|
187
|
479 |
(@{thms ho_memb_rsp ho_cons_rsp ho_card1_rsp} @ @{thms ho_all_prs ho_ex_prs});
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
480 |
val ind_r_t = repabs_eq2 @{context} (g, t, ot);
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
481 |
val ind_r_l = simp_lam_prs @{context} ind_r_t;
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
482 |
val ind_r_a = simp_allex_prs @{context} ind_r_l;
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
483 |
val ind_r_d = MetaSimplifier.rewrite_rule fset_defs_sym ind_r_a;
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
484 |
val ind_r_s = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same} ind_r_d
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
485 |
in
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
486 |
ObjectLogic.rulify ind_r_s
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
487 |
end
|
163
|
488 |
*}
|
187
|
489 |
ML fset_defs
|
|
490 |
|
163
|
491 |
|
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
492 |
ML {* lift @{thm m2} *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
493 |
ML {* lift @{thm m1} *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
494 |
ML {* lift @{thm list_eq.intros(4)} *}
|
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
|
495 |
ML {* lift @{thm list_eq.intros(5)} *}
|
175
|
496 |
ML {* lift @{thm card1_suc} *}
|
|
497 |
(* ML {* lift @{thm append_assoc} *} *)
|
163
|
498 |
|
194
|
499 |
thm
|
|
500 |
|
|
501 |
|
163
|
502 |
(*notation ( output) "prop" ("#_" [1000] 1000) *)
|
|
503 |
notation ( output) "Trueprop" ("#_" [1000] 1000)
|
|
504 |
|
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
505 |
(*
|
163
|
506 |
ML {*
|
|
507 |
fun lift_theorem_fset_aux thm lthy =
|
|
508 |
let
|
|
509 |
val ((_, [novars]), lthy2) = Variable.import true [thm] lthy;
|
|
510 |
val goal = build_repabs_goal @{context} novars consts @{typ "'a list"} @{typ "'a fset"};
|
|
511 |
val cgoal = cterm_of @{theory} goal;
|
|
512 |
val cgoal2 = Thm.rhs_of (MetaSimplifier.rewrite true fset_defs_sym cgoal);
|
|
513 |
val tac = transconv_fset_tac' @{context};
|
|
514 |
val cthm = Goal.prove_internal [] cgoal2 (fn _ => tac);
|
|
515 |
val nthm = MetaSimplifier.rewrite_rule [symmetric cthm] (snd (no_vars (Context.Theory @{theory}, thm)))
|
|
516 |
val nthm2 = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same QUOT_TYPE_I_fset.thm10} nthm;
|
|
517 |
val [nthm3] = ProofContext.export lthy2 lthy [nthm2]
|
|
518 |
in
|
|
519 |
nthm3
|
|
520 |
end
|
|
521 |
*}
|
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
522 |
*)
|
163
|
523 |
|
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
524 |
(*
|
163
|
525 |
ML {* lift_theorem_fset_aux @{thm m1} @{context} *}
|
|
526 |
ML {*
|
|
527 |
fun lift_theorem_fset name thm lthy =
|
|
528 |
let
|
|
529 |
val lifted_thm = lift_theorem_fset_aux thm lthy;
|
|
530 |
val (_, lthy2) = note (name, lifted_thm) lthy;
|
|
531 |
in
|
|
532 |
lthy2
|
|
533 |
end;
|
|
534 |
*}
|
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
535 |
*)
|
163
|
536 |
|
|
537 |
(* These do not work without proper definitions to rewrite back *)
|
|
538 |
local_setup {* lift_theorem_fset @{binding "m1_lift"} @{thm m1} *}
|
|
539 |
local_setup {* lift_theorem_fset @{binding "leqi4_lift"} @{thm list_eq.intros(4)} *}
|
|
540 |
local_setup {* lift_theorem_fset @{binding "leqi5_lift"} @{thm list_eq.intros(5)} *}
|
|
541 |
local_setup {* lift_theorem_fset @{binding "m2_lift"} @{thm m2} *}
|
|
542 |
thm m1_lift
|
|
543 |
thm leqi4_lift
|
|
544 |
thm leqi5_lift
|
|
545 |
thm m2_lift
|
|
546 |
ML {* @{thm card1_suc_r} OF [card1_suc_f] *}
|
|
547 |
(*ML {* Toplevel.program (fn () => lift_theorem_fset @{binding "card_suc"}
|
|
548 |
(@{thm card1_suc_r} OF [card1_suc_f]) @{context}) *}*)
|
|
549 |
(*local_setup {* lift_theorem_fset @{binding "card_suc"} @{thm card1_suc} *}*)
|
|
550 |
|
|
551 |
thm leqi4_lift
|
|
552 |
ML {*
|
|
553 |
val (nam, typ) = hd (Term.add_vars (prop_of @{thm leqi4_lift}) [])
|
|
554 |
val (_, l) = dest_Type typ
|
|
555 |
val t = Type ("FSet.fset", l)
|
|
556 |
val v = Var (nam, t)
|
|
557 |
val cv = cterm_of @{theory} ((term_of @{cpat "REP_fset"}) $ v)
|
|
558 |
*}
|
|
559 |
|
|
560 |
ML {*
|
|
561 |
Toplevel.program (fn () =>
|
|
562 |
MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.thm10} (
|
|
563 |
Drule.instantiate' [] [NONE, SOME (cv)] @{thm leqi4_lift}
|
|
564 |
)
|
|
565 |
)
|
|
566 |
*}
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
(*prove aaa: {* (Thm.term_of cgoal2) *}
|
|
571 |
apply (tactic {* LocalDefs.unfold_tac @{context} fset_defs *} )
|
|
572 |
apply (atomize(full))
|
|
573 |
apply (tactic {* transconv_fset_tac' @{context} 1 *})
|
|
574 |
done*)
|
|
575 |
|
|
576 |
(*
|
|
577 |
datatype obj1 =
|
|
578 |
OVAR1 "string"
|
|
579 |
| OBJ1 "(string * (string \<Rightarrow> obj1)) list"
|
|
580 |
| INVOKE1 "obj1 \<Rightarrow> string"
|
|
581 |
| UPDATE1 "obj1 \<Rightarrow> string \<Rightarrow> (string \<Rightarrow> obj1)"
|
|
582 |
*)
|
|
583 |
|
|
584 |
end
|