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
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 37
quotient_def
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 38
EMPTY :: "'a fset"
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 39
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 40
"EMPTY \<equiv> ([]::'a list)"
163
+ − 41
+ − 42
term Nil
+ − 43
term EMPTY
+ − 44
thm EMPTY_def
+ − 45
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 46
quotient_def
254
+ − 47
INSERT :: "'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 48
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 49
"INSERT \<equiv> op #"
163
+ − 50
+ − 51
term Cons
+ − 52
term INSERT
+ − 53
thm INSERT_def
+ − 54
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 55
quotient_def
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 56
FUNION :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 57
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 58
"FUNION \<equiv> (op @)"
163
+ − 59
+ − 60
term append
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 61
term FUNION
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 62
thm FUNION_def
163
+ − 63
+ − 64
thm QUOTIENT_fset
+ − 65
+ − 66
thm QUOT_TYPE_I_fset.thm11
+ − 67
+ − 68
+ − 69
fun
+ − 70
membship :: "'a \<Rightarrow> 'a list \<Rightarrow> bool" (infix "memb" 100)
+ − 71
where
+ − 72
m1: "(x memb []) = False"
+ − 73
| m2: "(x memb (y#xs)) = ((x=y) \<or> (x memb xs))"
+ − 74
+ − 75
fun
+ − 76
card1 :: "'a list \<Rightarrow> nat"
+ − 77
where
+ − 78
card1_nil: "(card1 []) = 0"
+ − 79
| card1_cons: "(card1 (x # xs)) = (if (x memb xs) then (card1 xs) else (Suc (card1 xs)))"
+ − 80
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 81
quotient_def
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 82
CARD :: "'a fset \<Rightarrow> nat"
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 83
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 84
"CARD \<equiv> card1"
163
+ − 85
+ − 86
term card1
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 87
term CARD
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 88
thm CARD_def
163
+ − 89
+ − 90
(* text {*
+ − 91
Maybe make_const_def should require a theorem that says that the particular lifted function
+ − 92
respects the relation. With it such a definition would be impossible:
+ − 93
make_const_def @{binding CARD} @{term "length"} NoSyn @{typ "'a list"} @{typ "'a fset"} #> snd
+ − 94
*}*)
+ − 95
+ − 96
lemma card1_0:
+ − 97
fixes a :: "'a list"
+ − 98
shows "(card1 a = 0) = (a = [])"
214
+ − 99
by (induct a) auto
163
+ − 100
+ − 101
lemma not_mem_card1:
+ − 102
fixes x :: "'a"
+ − 103
fixes xs :: "'a list"
309
+ − 104
shows "(~(x memb xs)) = (card1 (x # xs) = Suc (card1 xs))"
+ − 105
by auto
163
+ − 106
+ − 107
lemma mem_cons:
+ − 108
fixes x :: "'a"
+ − 109
fixes xs :: "'a list"
+ − 110
assumes a : "x memb xs"
+ − 111
shows "x # xs \<approx> xs"
214
+ − 112
using a by (induct xs) (auto intro: list_eq.intros )
163
+ − 113
+ − 114
lemma card1_suc:
+ − 115
fixes xs :: "'a list"
+ − 116
fixes n :: "nat"
+ − 117
assumes c: "card1 xs = Suc n"
+ − 118
shows "\<exists>a ys. ~(a memb ys) \<and> xs \<approx> (a # ys)"
+ − 119
using c
+ − 120
apply(induct xs)
+ − 121
apply (metis Suc_neq_Zero card1_0)
+ − 122
apply (metis QUOT_TYPE_I_fset.R_trans card1_cons list_eq_refl mem_cons)
+ − 123
done
+ − 124
294
+ − 125
definition
+ − 126
rsp_fold
+ − 127
where
+ − 128
"rsp_fold f = ((!u v. (f u v = f v u)) \<and> (!u v w. ((f u (f v w) = f (f u v) w))))"
+ − 129
163
+ − 130
primrec
+ − 131
fold1
+ − 132
where
+ − 133
"fold1 f (g :: 'a \<Rightarrow> 'b) (z :: 'b) [] = z"
+ − 134
| "fold1 f g z (a # A) =
294
+ − 135
(if rsp_fold f
163
+ − 136
then (
+ − 137
if (a memb A) then (fold1 f g z A) else (f (g a) (fold1 f g z A))
+ − 138
) else z)"
+ − 139
+ − 140
(* fold1_def is not usable, but: *)
+ − 141
thm fold1.simps
+ − 142
+ − 143
lemma fs1_strong_cases:
+ − 144
fixes X :: "'a list"
+ − 145
shows "(X = []) \<or> (\<exists>a. \<exists> Y. (~(a memb Y) \<and> (X \<approx> a # Y)))"
+ − 146
apply (induct X)
+ − 147
apply (simp)
+ − 148
apply (metis QUOT_TYPE_I_fset.thm11 list_eq_refl mem_cons m1)
+ − 149
done
+ − 150
296
+ − 151
quotient_def
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 152
IN :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool"
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 153
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 154
"IN \<equiv> membship"
163
+ − 155
+ − 156
term membship
+ − 157
term IN
+ − 158
thm IN_def
+ − 159
274
+ − 160
term fold1
+ − 161
quotient_def
+ − 162
FOLD :: "('a \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b fset \<Rightarrow> 'a"
231
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 163
where
c643938b846a
updated some definitions; had to give sometimes different names; somewhere I introduced a bug, since not everything is working anymore (needs fixing!)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 164
"FOLD \<equiv> fold1"
194
+ − 165
+ − 166
term fold1
+ − 167
term fold
+ − 168
thm fold_def
+ − 169
268
4d58c02289ca
simplified the quotient_def code; type of the defined constant must now be given; for-part eliminated
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 170
quotient_def
254
+ − 171
fmap::"('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset"
225
+ − 172
where
254
+ − 173
"fmap \<equiv> map"
194
+ − 174
+ − 175
term map
+ − 176
term fmap
+ − 177
thm fmap_def
+ − 178
290
a0be84b0c707
removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 179
ML {* prop_of @{thm fmap_def} *}
a0be84b0c707
removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 180
274
+ − 181
ML {* val defs = @{thms EMPTY_def IN_def FUNION_def CARD_def INSERT_def fmap_def FOLD_def} *}
163
+ − 182
164
+ − 183
lemma memb_rsp:
163
+ − 184
fixes z
+ − 185
assumes a: "list_eq x y"
+ − 186
shows "(z memb x) = (z memb y)"
+ − 187
using a by induct auto
+ − 188
164
+ − 189
lemma ho_memb_rsp:
+ − 190
"(op = ===> (op \<approx> ===> op =)) (op memb) (op memb)"
214
+ − 191
by (simp add: memb_rsp)
164
+ − 192
163
+ − 193
lemma card1_rsp:
+ − 194
fixes a b :: "'a list"
+ − 195
assumes e: "a \<approx> b"
+ − 196
shows "card1 a = card1 b"
214
+ − 197
using e by induct (simp_all add:memb_rsp)
163
+ − 198
228
+ − 199
lemma ho_card1_rsp: "(op \<approx> ===> op =) card1 card1"
214
+ − 200
by (simp add: card1_rsp)
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 201
164
+ − 202
lemma cons_rsp:
163
+ − 203
fixes z
+ − 204
assumes a: "xs \<approx> ys"
+ − 205
shows "(z # xs) \<approx> (z # ys)"
+ − 206
using a by (rule list_eq.intros(5))
+ − 207
164
+ − 208
lemma ho_cons_rsp:
228
+ − 209
"(op = ===> op \<approx> ===> op \<approx>) op # op #"
214
+ − 210
by (simp add: cons_rsp)
164
+ − 211
175
+ − 212
lemma append_rsp_fst:
163
+ − 213
assumes a : "list_eq l1 l2"
214
+ − 214
shows "(l1 @ s) \<approx> (l2 @ s)"
163
+ − 215
using a
214
+ − 216
by (induct) (auto intro: list_eq.intros list_eq_refl)
+ − 217
+ − 218
lemma append_end:
+ − 219
shows "(e # l) \<approx> (l @ [e])"
+ − 220
apply (induct l)
+ − 221
apply (auto intro: list_eq.intros list_eq_refl)
+ − 222
done
+ − 223
+ − 224
lemma rev_rsp:
+ − 225
shows "a \<approx> rev a"
+ − 226
apply (induct a)
+ − 227
apply simp
+ − 228
apply (rule list_eq_refl)
+ − 229
apply simp_all
+ − 230
apply (rule list_eq.intros(6))
+ − 231
prefer 2
+ − 232
apply (rule append_rsp_fst)
+ − 233
apply assumption
+ − 234
apply (rule append_end)
+ − 235
done
163
+ − 236
214
+ − 237
lemma append_sym_rsp:
+ − 238
shows "(a @ b) \<approx> (b @ a)"
+ − 239
apply (rule list_eq.intros(6))
+ − 240
apply (rule append_rsp_fst)
+ − 241
apply (rule rev_rsp)
+ − 242
apply (rule list_eq.intros(6))
+ − 243
apply (rule rev_rsp)
+ − 244
apply (simp)
+ − 245
apply (rule append_rsp_fst)
+ − 246
apply (rule list_eq.intros(3))
+ − 247
apply (rule rev_rsp)
+ − 248
done
+ − 249
+ − 250
lemma append_rsp:
+ − 251
assumes a : "list_eq l1 r1"
+ − 252
assumes b : "list_eq l2 r2 "
+ − 253
shows "(l1 @ l2) \<approx> (r1 @ r2)"
+ − 254
apply (rule list_eq.intros(6))
+ − 255
apply (rule append_rsp_fst)
+ − 256
using a apply (assumption)
+ − 257
apply (rule list_eq.intros(6))
+ − 258
apply (rule append_sym_rsp)
+ − 259
apply (rule list_eq.intros(6))
+ − 260
apply (rule append_rsp_fst)
+ − 261
using b apply (assumption)
+ − 262
apply (rule append_sym_rsp)
+ − 263
done
175
+ − 264
194
+ − 265
lemma ho_append_rsp:
228
+ − 266
"(op \<approx> ===> op \<approx> ===> op \<approx>) op @ op @"
214
+ − 267
by (simp add: append_rsp)
175
+ − 268
194
+ − 269
lemma map_rsp:
+ − 270
assumes a: "a \<approx> b"
+ − 271
shows "map f a \<approx> map f b"
+ − 272
using a
+ − 273
apply (induct)
+ − 274
apply(auto intro: list_eq.intros)
+ − 275
done
+ − 276
+ − 277
lemma ho_map_rsp:
294
+ − 278
"(op = ===> op \<approx> ===> op \<approx>) map map"
+ − 279
by (simp add: map_rsp)
194
+ − 280
294
+ − 281
lemma map_append:
258
+ − 282
"(map f (a @ b)) \<approx>
+ − 283
(map f a) @ (map f b)"
215
+ − 284
by simp (rule list_eq_refl)
194
+ − 285
273
+ − 286
lemma ho_fold_rsp:
294
+ − 287
"(op = ===> op = ===> op = ===> op \<approx> ===> op =) fold1 fold1"
292
+ − 288
apply (auto simp add: FUN_REL_EQ)
294
+ − 289
apply (case_tac "rsp_fold x")
+ − 290
prefer 2
+ − 291
apply (erule_tac list_eq.induct)
+ − 292
apply (simp_all)
+ − 293
apply (erule_tac list_eq.induct)
+ − 294
apply (simp_all)
+ − 295
apply (auto simp add: memb_rsp rsp_fold_def)
+ − 296
done
241
60acf3d3a4a0
Finding applications and duplicates filtered out in abstractions
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 297
254
+ − 298
print_quotients
+ − 299
+ − 300
226
+ − 301
ML {* val qty = @{typ "'a fset"} *}
+ − 302
ML {* val rsp_thms =
273
+ − 303
@{thms ho_memb_rsp ho_cons_rsp ho_card1_rsp ho_map_rsp ho_append_rsp ho_fold_rsp}
226
+ − 304
@ @{thms ho_all_prs ho_ex_prs} *}
206
+ − 305
239
+ − 306
ML {* fun lift_thm_fset lthy t = lift_thm lthy qty "fset" rsp_thms defs t *}
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 307
314
+ − 308
thm m2
+ − 309
+ − 310
thm append_assoc
248
6ed87b3d358c
Finally merged the code of the versions of regularize and tested examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 311
(* ML {* lift_thm_fset @{context} @{thm neq_Nil_conv} *} *)
226
+ − 312
ML {* lift_thm_fset @{context} @{thm m1} *}
+ − 313
ML {* lift_thm_fset @{context} @{thm m2} *}
+ − 314
ML {* lift_thm_fset @{context} @{thm list_eq.intros(4)} *}
+ − 315
ML {* lift_thm_fset @{context} @{thm list_eq.intros(5)} *}
+ − 316
ML {* lift_thm_fset @{context} @{thm card1_suc} *}
289
7e8617f20b59
Remaining fixes for polymorphic types. map_append now lifts properly with 'a list and 'b list.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 317
ML {* lift_thm_fset @{context} @{thm map_append} *}
251
+ − 318
ML {* lift_thm_fset @{context} @{thm append_assoc} *}
267
3764566c1151
Automatic FORALL_PRS. 'list.induct' lifts automatically. Faster ALLEX_RSP
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 319
ML {* lift_thm_fset @{context} @{thm list.induct} *}
273
+ − 320
ML {* lift_thm_fset @{context} @{thm fold1.simps(2)} *}
309
+ − 321
ML {* lift_thm_fset @{context} @{thm not_mem_card1} *}
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 322
273
+ − 323
quotient_def
276
+ − 324
fset_rec::"'a \<Rightarrow> ('b \<Rightarrow> 'b fset \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> 'b fset \<Rightarrow> 'a"
273
+ − 325
where
+ − 326
"fset_rec \<equiv> list_rec"
+ − 327
292
+ − 328
quotient_def
+ − 329
fset_case::"'a \<Rightarrow> ('b \<Rightarrow> 'b fset \<Rightarrow> 'a) \<Rightarrow> 'b fset \<Rightarrow> 'a"
+ − 330
where
+ − 331
"fset_case \<equiv> list_case"
+ − 332
296
+ − 333
(* Probably not true without additional assumptions about the function *)
292
+ − 334
lemma list_rec_rsp:
+ − 335
"(op = ===> (op = ===> op \<approx> ===> op =) ===> op \<approx> ===> op =) list_rec list_rec"
+ − 336
apply (auto simp add: FUN_REL_EQ)
296
+ − 337
apply (erule_tac list_eq.induct)
+ − 338
apply (simp_all)
292
+ − 339
sorry
289
7e8617f20b59
Remaining fixes for polymorphic types. map_append now lifts properly with 'a list and 'b list.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 340
292
+ − 341
lemma list_case_rsp:
+ − 342
"(op = ===> (op = ===> op \<approx> ===> op =) ===> op \<approx> ===> op =) list_case list_case"
+ − 343
apply (auto simp add: FUN_REL_EQ)
+ − 344
sorry
+ − 345
+ − 346
+ − 347
ML {* val rsp_thms = @{thms list_rec_rsp list_case_rsp} @ rsp_thms *}
+ − 348
ML {* val defs = @{thms fset_rec_def fset_case_def} @ defs *}
+ − 349
+ − 350
ML {* fun lift_thm_fset lthy t = lift_thm lthy qty "fset" rsp_thms defs t *}
+ − 351
300
+ − 352
292
+ − 353
ML {* map (lift_thm_fset @{context}) @{thms list.recs} *}
+ − 354
ML {* map (lift_thm_fset @{context}) @{thms list.cases} *}
248
6ed87b3d358c
Finally merged the code of the versions of regularize and tested examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 355
304
+ − 356
lemma list_induct_part:
+ − 357
assumes a: "P (x :: 'a list) ([] :: 'a list)"
+ − 358
assumes b: "\<And>e t. P x t \<Longrightarrow> P x (e # t)"
+ − 359
shows "P x l"
+ − 360
apply (rule_tac P="P x" in list.induct)
+ − 361
apply (rule a)
+ − 362
apply (rule b)
+ − 363
apply (assumption)
+ − 364
done
273
+ − 365
292
+ − 366
+ − 367
(* Construction site starts here *)
+ − 368
+ − 369
273
+ − 370
ML {* val consts = lookup_quot_consts defs *}
+ − 371
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *}
+ − 372
ML {* val (trans2, reps_same, absrep, quot) = lookup_quot_thms @{context} "fset" *}
+ − 373
296
+ − 374
thm list.recs(2)
304
+ − 375
ML {* val t_a = atomize_thm @{thm list_induct_part} *}
285
+ − 376
(* prove {* build_regularize_goal t_a rty rel @{context} *}
+ − 377
ML_prf {* fun tac ctxt = FIRST' [
251
+ − 378
rtac rel_refl,
+ − 379
atac,
285
+ − 380
rtac @{thm universal_twice},
+ − 381
(rtac @{thm impI} THEN' atac),
+ − 382
rtac @{thm implication_twice},
+ − 383
(*rtac @{thm equality_twice},*)
+ − 384
EqSubst.eqsubst_tac ctxt [0]
239
+ − 385
[(@{thm equiv_res_forall} OF [rel_eqv]),
285
+ − 386
(@{thm equiv_res_exists} OF [rel_eqv])],
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 387
(rtac @{thm impI} THEN' (asm_full_simp_tac (Simplifier.context ctxt HOL_ss)) THEN' rtac rel_refl),
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 388
(rtac @{thm RIGHT_RES_FORALL_REGULAR})
285
+ − 389
]; *}
252
e30997c88050
Regularize for equalities and a better tactic. "alpha.cases" now lifts.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 390
apply (atomize(full))
285
+ − 391
apply (tactic {* REPEAT_ALL_NEW (tac @{context}) 1 *})
+ − 392
done*)
305
+ − 393
ML {* val t_r = regularize t_a rty rel rel_eqv rel_refl @{context} *}
273
+ − 394
ML {*
285
+ − 395
val rt = build_repabs_term @{context} t_r consts rty qty
+ − 396
val rg = Logic.mk_equals ((Thm.prop_of t_r), rt);
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 397
*}
300
+ − 398
prove {* Syntax.check_term @{context} rg *}
309
+ − 399
ML_prf {* fun r_mk_comb_tac_fset lthy = r_mk_comb_tac lthy rty quot rel_refl trans2 rsp_thms *}
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 400
apply(atomize(full))
309
+ − 401
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 402
apply (rule FUN_QUOTIENT)
+ − 403
apply (rule FUN_QUOTIENT)
+ − 404
apply (rule QUOTIENT_fset)
+ − 405
apply (rule FUN_QUOTIENT)
+ − 406
apply (rule QUOTIENT_fset)
+ − 407
apply (rule IDENTITY_QUOTIENT)
+ − 408
apply (rule IDENTITY_QUOTIENT)
+ − 409
apply (rule IDENTITY_QUOTIENT)
+ − 410
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
194
+ − 411
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
273
+ − 412
done
305
+ − 413
ML {*
+ − 414
val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms
172
da38ce2711a6
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 415
*}
241
60acf3d3a4a0
Finding applications and duplicates filtered out in abstractions
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 416
292
+ − 417
ML {* val abs = findabs rty (prop_of (t_a)) *}
+ − 418
ML {* val aps = findaps rty (prop_of (t_a)) *}
285
+ − 419
ML {* val lam_prs_thms = map (make_simp_prs_thm @{context} quot @{thm LAMBDA_PRS}) abs *}
+ − 420
ML {* val app_prs_thms = map (applic_prs @{context} rty qty absrep) aps *}
289
7e8617f20b59
Remaining fixes for polymorphic types. map_append now lifts properly with 'a list and 'b list.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 421
ML {* val lam_prs_thms = map Thm.varifyT lam_prs_thms *}
292
+ − 422
ML {* t_t *}
289
7e8617f20b59
Remaining fixes for polymorphic types. map_append now lifts properly with 'a list and 'b list.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 423
ML {* val (alls, exs) = findallex @{context} rty qty (prop_of t_a); *}
285
+ − 424
ML {* val allthms = map (make_allex_prs_thm @{context} quot @{thm FORALL_PRS}) alls *}
304
+ − 425
ML {* val t_l0 = repeat_eqsubst_thm @{context} (app_prs_thms) t_t *}
+ − 426
ML app_prs_thms
296
+ − 427
ML {* val t_l = repeat_eqsubst_thm @{context} (lam_prs_thms) t_l0 *}
304
+ − 428
ML lam_prs_thms
+ − 429
ML {* val t_id = simp_ids @{context} t_l *}
+ − 430
thm INSERT_def
292
+ − 431
ML {* val defs_sym = flat (map (add_lower_defs @{context}) defs) *}
+ − 432
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_id *}
304
+ − 433
ML allthms
+ − 434
thm FORALL_PRS
309
+ − 435
ML {* val t_al = MetaSimplifier.rewrite_rule (allthms) t_d *}
+ − 436
ML {* val t_s = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same} t_al *}
304
+ − 437
ML {* ObjectLogic.rulify t_s *}
+ − 438
+ − 439
ML {* Type.freeze *}
296
+ − 440
304
+ − 441
ML {* val gl = @{term "P (x :: 'a list) (EMPTY :: 'a fset) \<Longrightarrow> (\<And>e t. P x t \<Longrightarrow> P x (INSERT e t)) \<Longrightarrow> P x l"} *}
+ − 442
ML {* val vars = map Free (Term.add_frees gl []) *}
+ − 443
ML {* fun lambda_all (var as Free(_, T)) trm = (Term.all T) $ lambda var trm *}
+ − 444
ML {* val gla = fold lambda_all vars gl *}
+ − 445
ML {* val glf = Type.freeze gla *}
+ − 446
ML {* val glac = (snd o Thm.dest_equals o cprop_of) (ObjectLogic.atomize (cterm_of @{theory} glf)) *}
309
+ − 447
+ − 448
ML {*
+ − 449
fun apply_subt2 f trm trm2 =
+ − 450
case (trm, trm2) of
+ − 451
(Abs (x, T, t), Abs (x2, T2, t2)) =>
+ − 452
let
+ − 453
val (x', t') = Term.dest_abs (x, T, t);
+ − 454
val (x2', t2') = Term.dest_abs (x2, T2, t2)
+ − 455
val (s1, s2) = f t' t2';
+ − 456
in
+ − 457
(Term.absfree (x', T, s1),
+ − 458
Term.absfree (x2', T2, s2))
+ − 459
end
+ − 460
| _ => f trm trm2
+ − 461
*}
+ − 462
+ − 463
ML {*
+ − 464
fun tyRel2 lthy ty gty =
+ − 465
if ty = gty then HOLogic.eq_const ty else
+ − 466
+ − 467
case find_first (fn x => Sign.typ_instance (ProofContext.theory_of lthy) (gty, (#qtyp x))) (quotdata_lookup lthy) of
+ − 468
SOME quotdata =>
+ − 469
if Sign.typ_instance (ProofContext.theory_of lthy) (ty, #rtyp quotdata) then
+ − 470
case #rel quotdata of
+ − 471
Const(s, _) => Const(s, dummyT)
+ − 472
| _ => error "tyRel2 fail: relation is not a constant"
+ − 473
else error "tyRel2 fail: a non-lifted type lifted to a lifted type"
+ − 474
| NONE => (case (ty, gty) of
+ − 475
(Type (s, tys), Type (s2, tys2)) =>
+ − 476
if s = s2 andalso length tys = length tys2 then
+ − 477
let
+ − 478
val tys_rel = map (fn ty => ty --> ty --> @{typ bool}) tys;
+ − 479
val ty_out = ty --> ty --> @{typ bool};
+ − 480
val tys_out = tys_rel ---> ty_out;
+ − 481
in
+ − 482
(case (maps_lookup (ProofContext.theory_of lthy) s) of
+ − 483
SOME (info) => list_comb (Const (#relfun info, tys_out),
+ − 484
map2 (tyRel2 lthy) tys tys2)
+ − 485
| NONE => HOLogic.eq_const ty
+ − 486
)
+ − 487
end
+ − 488
else error "tyRel2 fail: different type structures"
+ − 489
| _ => HOLogic.eq_const ty)
+ − 490
*}
+ − 491
+ − 492
ML {*
+ − 493
fun my_reg2 lthy trm gtrm =
+ − 494
case (trm, gtrm) of
+ − 495
(Abs (x, T, t), Abs (x2, T2, t2)) =>
+ − 496
if not (T = T2) then
+ − 497
let
+ − 498
val rrel = tyRel2 lthy T T2;
+ − 499
val (s1, s2) = apply_subt2 (my_reg2 lthy) trm gtrm
+ − 500
in
+ − 501
(((mk_babs (fastype_of trm) T) $ (mk_resp T $ rrel) $ s1),
+ − 502
((mk_babs (fastype_of gtrm) T2) $ (mk_resp T2 $ (HOLogic.eq_const dummyT)) $ s2))
+ − 503
end
+ − 504
else
+ − 505
let
+ − 506
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 507
in
+ − 508
(Abs(x, T, s1), Abs(x2, T2, s2))
+ − 509
end
+ − 510
| (Const (@{const_name "All"}, ty) $ (t as Abs (_, T, _)),
+ − 511
Const (@{const_name "All"}, ty') $ (t2 as Abs (_, T2, _))) =>
+ − 512
if not (T = T2) then
+ − 513
let
+ − 514
val ty1 = domain_type ty;
+ − 515
val ty2 = domain_type ty1;
+ − 516
val ty'1 = domain_type ty';
+ − 517
val ty'2 = domain_type ty'1;
+ − 518
val rrel = tyRel2 lthy T T2;
+ − 519
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2;
+ − 520
in
+ − 521
(((mk_ball ty1) $ (mk_resp ty2 $ rrel) $ s1),
+ − 522
((mk_ball ty'1) $ (mk_resp ty'2 $ (HOLogic.eq_const dummyT)) $ s2))
+ − 523
end
+ − 524
else
+ − 525
let
+ − 526
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 527
in
+ − 528
((Const (@{const_name "All"}, ty) $ s1),
+ − 529
(Const (@{const_name "All"}, ty') $ s2))
+ − 530
end
+ − 531
| (Const (@{const_name "Ex"}, ty) $ (t as Abs (_, T, _)),
+ − 532
Const (@{const_name "Ex"}, ty') $ (t2 as Abs (_, T2, _))) =>
+ − 533
if not (T = T2) then
+ − 534
let
+ − 535
val ty1 = domain_type ty
+ − 536
val ty2 = domain_type ty1
+ − 537
val ty'1 = domain_type ty'
+ − 538
val ty'2 = domain_type ty'1
+ − 539
val rrel = tyRel2 lthy T T2
+ − 540
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 541
in
+ − 542
(((mk_bex ty1) $ (mk_resp ty2 $ rrel) $ s1),
+ − 543
((mk_bex ty'1) $ (mk_resp ty'2 $ (HOLogic.eq_const dummyT)) $ s2))
+ − 544
end
+ − 545
else
+ − 546
let
+ − 547
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 548
in
+ − 549
((Const (@{const_name "Ex"}, ty) $ s1),
+ − 550
(Const (@{const_name "Ex"}, ty') $ s2))
+ − 551
end
+ − 552
| (Const (@{const_name "op ="}, T) $ t, (Const (@{const_name "op ="}, T2) $ t2)) =>
+ − 553
let
+ − 554
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 555
val rhs = Const (@{const_name "op ="}, T2) $ s2
+ − 556
in
+ − 557
if not (T = T2) then
+ − 558
((tyRel2 lthy T T2) $ s1, rhs)
+ − 559
else
+ − 560
(Const (@{const_name "op ="}, T) $ s1, rhs)
+ − 561
end
+ − 562
| (t $ t', t2 $ t2') =>
+ − 563
let
+ − 564
val (s1, s2) = apply_subt2 (my_reg2 lthy) t t2
+ − 565
val (s1', s2') = apply_subt2 (my_reg2 lthy) t' t2'
+ − 566
in
+ − 567
(s1 $ s1', s2 $ s2')
+ − 568
end
+ − 569
| (Const c1, Const c2) => (Const c1, Const c2) (* c2 may be lifted *)
+ − 570
| (Bound i, Bound j) => (* Bounds are replaced, so should never happen? *)
+ − 571
if i = j then (Bound i, Bound j) else error "my_reg2: different Bounds"
+ − 572
| (Free (n, T), Free(n2, T2)) => if n = n2 then (Free (n, T), Free (n2, T2))
+ − 573
else error ("my_ref2: different variables: " ^ n ^ ", " ^ n2)
+ − 574
| _ => error "my_reg2: terms don't agree"
+ − 575
*}
+ − 576
+ − 577
+ − 578
ML {* prop_of t_a *}
+ − 579
ML {* term_of glac *}
+ − 580
ML {* val (tta, ttb) = (my_reg2 @{context} (prop_of t_a) (term_of glac)) *}
+ − 581
ML {* val tt = Syntax.check_term @{context} tta *}
+ − 582
+ − 583
prove t_r: {* Logic.mk_implies
+ − 584
((prop_of t_a), tt) *}
+ − 585
ML_prf {* fun tac ctxt = FIRST' [
+ − 586
rtac rel_refl,
+ − 587
atac,
+ − 588
rtac @{thm universal_twice},
+ − 589
(rtac @{thm impI} THEN' atac),
+ − 590
rtac @{thm implication_twice},
+ − 591
(*rtac @{thm equality_twice},*)
+ − 592
EqSubst.eqsubst_tac ctxt [0]
+ − 593
[(@{thm equiv_res_forall} OF [rel_eqv]),
+ − 594
(@{thm equiv_res_exists} OF [rel_eqv])],
+ − 595
(rtac @{thm impI} THEN' (asm_full_simp_tac (Simplifier.context ctxt HOL_ss)) THEN' rtac rel_refl),
+ − 596
(rtac @{thm RIGHT_RES_FORALL_REGULAR})
+ − 597
]; *}
+ − 598
+ − 599
apply (atomize(full))
+ − 600
apply (tactic {* REPEAT_ALL_NEW (tac @{context}) 1 *})
+ − 601
done
+ − 602
+ − 603
ML {* val t_r = @{thm t_r} OF [t_a] *}
+ − 604
+ − 605
ML {* val ttg = Syntax.check_term @{context} ttb *}
+ − 606
+ − 607
ML {*
+ − 608
fun is_lifted_const h gh = is_Const h andalso is_Const gh andalso not (h = gh)
+ − 609
+ − 610
fun mkrepabs lthy ty gty t =
+ − 611
let
+ − 612
val qenv = distinct (op=) (diff (gty, ty) [])
+ − 613
(* val _ = sanity_chk qenv lthy *)
+ − 614
val ty = fastype_of t
+ − 615
val abs = get_fun absF qenv lthy gty $ t
+ − 616
val rep = get_fun repF qenv lthy gty $ abs
+ − 617
in
+ − 618
Syntax.check_term lthy rep
+ − 619
end
+ − 620
*}
+ − 621
+ − 622
ML {*
+ − 623
cterm_of @{theory} (mkrepabs @{context} @{typ "'a list \<Rightarrow> bool"} @{typ "'a fset \<Rightarrow> bool"} @{term "f :: ('a list \<Rightarrow> bool)"})
+ − 624
*}
+ − 625
+ − 626
+ − 627
+ − 628
ML {*
+ − 629
fun build_repabs_term lthy trm gtrm =
+ − 630
case (trm, gtrm) of
+ − 631
(Abs (a as (_, T, _)), Abs (a2 as (_, T2, _))) =>
+ − 632
let
+ − 633
val (vs, t) = Term.dest_abs a;
+ − 634
val (_, g) = Term.dest_abs a2;
+ − 635
val v = Free(vs, T);
+ − 636
val t' = lambda v (build_repabs_term lthy t g);
+ − 637
val ty = fastype_of trm;
+ − 638
val gty = fastype_of gtrm;
+ − 639
in
+ − 640
if (ty = gty) then t' else
+ − 641
mkrepabs lthy ty gty (
+ − 642
if (T = T2) then t' else
+ − 643
lambda v (t' $ (mkrepabs lthy T T2 v))
+ − 644
)
+ − 645
end
+ − 646
| _ =>
+ − 647
case (Term.strip_comb trm, Term.strip_comb gtrm) of
+ − 648
((Const(@{const_name Respects}, _), _), _) => trm
+ − 649
| ((h, tms), (gh, gtms)) =>
+ − 650
let
+ − 651
val ty = fastype_of trm;
+ − 652
val gty = fastype_of gtrm;
+ − 653
val tms' = map2 (build_repabs_term lthy) tms gtms
+ − 654
val t' = list_comb(h, tms')
+ − 655
in
+ − 656
if ty = gty then t' else
+ − 657
if is_lifted_const h gh then mkrepabs lthy ty gty t' else
+ − 658
if (Term.is_Free h) andalso (length tms > 0) then mkrepabs lthy ty gty t' else t'
+ − 659
end
+ − 660
*}
+ − 661
+ − 662
ML {* val ttt = build_repabs_term @{context} tt ttg *}
+ − 663
ML {* val si = simp_ids_trm (cterm_of @{theory} ttt) *}
+ − 664
prove t_t: {* Logic.mk_equals ((Thm.prop_of t_r), term_of si) *}
+ − 665
ML_prf {* fun r_mk_comb_tac_fset lthy = r_mk_comb_tac lthy rty quot rel_refl trans2 rsp_thms *}
+ − 666
apply(atomize(full))
+ − 667
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 668
apply (rule FUN_QUOTIENT)
+ − 669
apply (rule FUN_QUOTIENT)
+ − 670
apply (rule IDENTITY_QUOTIENT)
+ − 671
apply (rule FUN_QUOTIENT)
+ − 672
apply (rule QUOTIENT_fset)
+ − 673
apply (rule IDENTITY_QUOTIENT)
+ − 674
apply (rule IDENTITY_QUOTIENT)
+ − 675
apply (rule IDENTITY_QUOTIENT)
+ − 676
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 677
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 678
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 679
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 680
apply (rule IDENTITY_QUOTIENT)
+ − 681
apply (rule IDENTITY_QUOTIENT)
+ − 682
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 683
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 684
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 685
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 686
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 687
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 688
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 689
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 690
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 691
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 692
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 693
apply (rule IDENTITY_QUOTIENT)
+ − 694
apply (rule FUN_QUOTIENT)
+ − 695
apply (rule QUOTIENT_fset)
+ − 696
apply (rule IDENTITY_QUOTIENT)
+ − 697
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 698
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 699
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 700
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 701
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 702
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 703
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 704
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 705
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 706
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 707
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 708
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 709
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 710
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 711
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 712
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 713
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 714
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 715
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 716
apply (rule QUOTIENT_fset)
+ − 717
apply (rule IDENTITY_QUOTIENT)
+ − 718
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 719
apply (rule IDENTITY_QUOTIENT)
+ − 720
apply (rule FUN_QUOTIENT)
+ − 721
apply (rule QUOTIENT_fset)
+ − 722
apply (rule IDENTITY_QUOTIENT)
+ − 723
+ − 724
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 725
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 726
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 727
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 728
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 729
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 730
apply (rule QUOTIENT_fset)
+ − 731
apply (rule IDENTITY_QUOTIENT)
+ − 732
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 733
apply (rule IDENTITY_QUOTIENT)
+ − 734
apply (rule FUN_QUOTIENT)
+ − 735
apply (rule QUOTIENT_fset)
+ − 736
apply (rule IDENTITY_QUOTIENT)
+ − 737
+ − 738
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 739
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 740
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 741
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 742
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_fset @{context}) 1 *})
+ − 743
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 744
apply (tactic {* (APPLY_RSP_TAC rty @{context}) 1 *})
+ − 745
apply (rule IDENTITY_QUOTIENT)
+ − 746
apply (rule FUN_QUOTIENT)
+ − 747
apply (rule QUOTIENT_fset)
+ − 748
apply (rule IDENTITY_QUOTIENT)
+ − 749
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 750
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 751
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 752
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 753
apply (tactic {* (r_mk_comb_tac_fset @{context}) 1 *})
+ − 754
done
+ − 755
+ − 756
thm t_t
+ − 757
ML {* val t_t = @{thm Pure.equal_elim_rule1} OF [@{thm t_t}, t_r] *}
+ − 758
ML {* val t_l = repeat_eqsubst_thm @{context} (lam_prs_thms) t_t *}
+ − 759
ML {* val t_d = repeat_eqsubst_thm @{context} defs_sym t_l *}
+ − 760
ML {* val t_al = MetaSimplifier.rewrite_rule (allthms) t_d *}
+ − 761
ML {* val t_s = MetaSimplifier.rewrite_rule @{thms QUOT_TYPE_I_fset.REPS_same} t_al *}
+ − 762
178
945786a68ec6
Finally lifted induction, with some manually added simplification lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 763
163
+ − 764
ML {*
226
+ − 765
fun lift_thm_fset_note name thm lthy =
163
+ − 766
let
226
+ − 767
val lifted_thm = lift_thm_fset lthy thm;
163
+ − 768
val (_, lthy2) = note (name, lifted_thm) lthy;
+ − 769
in
+ − 770
lthy2
+ − 771
end;
+ − 772
*}
+ − 773
226
+ − 774
local_setup {*
+ − 775
lift_thm_fset_note @{binding "m1l"} @{thm m1} #>
+ − 776
lift_thm_fset_note @{binding "m2l"} @{thm m2} #>
+ − 777
lift_thm_fset_note @{binding "leqi4l"} @{thm list_eq.intros(4)} #>
+ − 778
lift_thm_fset_note @{binding "leqi5l"} @{thm list_eq.intros(5)}
163
+ − 779
*}
226
+ − 780
thm m1l
+ − 781
thm m2l
+ − 782
thm leqi4l
+ − 783
thm leqi5l
163
+ − 784
+ − 785
end