2084
+ − 1
(* Title: HOL/Quotient_Examples/FSet.thy
+ − 2
Author: Cezary Kaliszyk, TU Munich
+ − 3
Author: Christian Urban, TU Munich
1823
+ − 4
2084
+ − 5
A reasoning infrastructure for the type of finite sets.
1823
+ − 6
*)
2084
+ − 7
1518
+ − 8
theory FSet
2238
8ddf1330f2ed
completed proof and started section about respectfulness and preservation
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
imports Quotient_List Quotient_Product
1518
+ − 10
begin
+ − 11
1909
+ − 12
text {* Definiton of List relation and the quotient type *}
+ − 13
1518
+ − 14
fun
+ − 15
list_eq :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" (infix "\<approx>" 50)
+ − 16
where
+ − 17
"list_eq xs ys = (\<forall>x. x \<in> set xs \<longleftrightarrow> x \<in> set ys)"
+ − 18
+ − 19
lemma list_eq_equivp:
+ − 20
shows "equivp list_eq"
1909
+ − 21
unfolding equivp_reflp_symp_transp
1889
+ − 22
unfolding reflp_def symp_def transp_def
+ − 23
by auto
+ − 24
1909
+ − 25
quotient_type
+ − 26
'a fset = "'a list" / "list_eq"
+ − 27
by (rule list_eq_equivp)
+ − 28
2372
+ − 29
text {* Raw definitions of membership, sublist, cardinality,
+ − 30
intersection
+ − 31
*}
1909
+ − 32
1889
+ − 33
definition
+ − 34
memb :: "'a \<Rightarrow> 'a list \<Rightarrow> bool"
+ − 35
where
+ − 36
"memb x xs \<equiv> x \<in> set xs"
+ − 37
+ − 38
definition
+ − 39
sub_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
+ − 40
where
+ − 41
"sub_list xs ys \<equiv> (\<forall>x. x \<in> set xs \<longrightarrow> x \<in> set ys)"
+ − 42
1909
+ − 43
fun
+ − 44
fcard_raw :: "'a list \<Rightarrow> nat"
+ − 45
where
+ − 46
fcard_raw_nil: "fcard_raw [] = 0"
2372
+ − 47
| fcard_raw_cons: "fcard_raw (x # xs) =
+ − 48
(if memb x xs then fcard_raw xs else Suc (fcard_raw xs))"
1518
+ − 49
1909
+ − 50
primrec
+ − 51
finter_raw :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"
+ − 52
where
+ − 53
"finter_raw [] l = []"
+ − 54
| "finter_raw (h # t) l =
2372
+ − 55
(if memb h l then h # (finter_raw t l) else finter_raw t l)"
1893
+ − 56
2084
+ − 57
primrec
1909
+ − 58
delete_raw :: "'a list \<Rightarrow> 'a \<Rightarrow> 'a list"
+ − 59
where
+ − 60
"delete_raw [] x = []"
2372
+ − 61
| "delete_raw (a # xs) x =
+ − 62
(if (a = x) then delete_raw xs x else a # (delete_raw xs x))"
2084
+ − 63
+ − 64
primrec
+ − 65
fminus_raw :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"
+ − 66
where
+ − 67
"fminus_raw l [] = l"
+ − 68
| "fminus_raw l (h # t) = fminus_raw (delete_raw l h) t"
1909
+ − 69
+ − 70
definition
+ − 71
rsp_fold
+ − 72
where
+ − 73
"rsp_fold f = (\<forall>u v w. (f u (f v w) = f v (f u w)))"
1893
+ − 74
1909
+ − 75
primrec
+ − 76
ffold_raw :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a list \<Rightarrow> 'b"
+ − 77
where
+ − 78
"ffold_raw f z [] = z"
2084
+ − 79
| "ffold_raw f z (a # xs) =
1909
+ − 80
(if (rsp_fold f) then
2084
+ − 81
if memb a xs then ffold_raw f z xs
+ − 82
else f a (ffold_raw f z xs)
1909
+ − 83
else z)"
+ − 84
1935
+ − 85
text {* Composition Quotient *}
+ − 86
2326
+ − 87
lemma list_all2_refl1:
+ − 88
shows "(list_all2 op \<approx>) r r"
+ − 89
by (rule list_all2_refl) (metis equivp_def fset_equivp)
1938
+ − 90
1935
+ − 91
lemma compose_list_refl:
2326
+ − 92
shows "(list_all2 op \<approx> OOO op \<approx>) r r"
1935
+ − 93
proof
2084
+ − 94
have *: "r \<approx> r" by (rule equivp_reflp[OF fset_equivp])
2326
+ − 95
show "list_all2 op \<approx> r r" by (rule list_all2_refl1)
+ − 96
with * show "(op \<approx> OO list_all2 op \<approx>) r r" ..
1935
+ − 97
qed
+ − 98
+ − 99
lemma Quotient_fset_list:
2326
+ − 100
shows "Quotient (list_all2 op \<approx>) (map abs_fset) (map rep_fset)"
1935
+ − 101
by (fact list_quotient[OF Quotient_fset])
+ − 102
2084
+ − 103
lemma set_in_eq: "(\<forall>e. ((e \<in> xs) \<longleftrightarrow> (e \<in> ys))) \<equiv> xs = ys"
1935
+ − 104
by (rule eq_reflection) auto
+ − 105
+ − 106
lemma map_rel_cong: "b \<approx> ba \<Longrightarrow> map f b \<approx> map f ba"
+ − 107
unfolding list_eq.simps
+ − 108
by (simp only: set_map set_in_eq)
+ − 109
+ − 110
lemma quotient_compose_list[quot_thm]:
2326
+ − 111
shows "Quotient ((list_all2 op \<approx>) OOO (op \<approx>))
1935
+ − 112
(abs_fset \<circ> (map abs_fset)) ((map rep_fset) \<circ> rep_fset)"
+ − 113
unfolding Quotient_def comp_def
+ − 114
proof (intro conjI allI)
+ − 115
fix a r s
+ − 116
show "abs_fset (map abs_fset (map rep_fset (rep_fset a))) = a"
+ − 117
by (simp add: abs_o_rep[OF Quotient_fset] Quotient_abs_rep[OF Quotient_fset] map_id)
2326
+ − 118
have b: "list_all2 op \<approx> (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))"
+ − 119
by (rule list_all2_refl1)
+ − 120
have c: "(op \<approx> OO list_all2 op \<approx>) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))"
1935
+ − 121
by (rule, rule equivp_reflp[OF fset_equivp]) (rule b)
2326
+ − 122
show "(list_all2 op \<approx> OOO op \<approx>) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))"
+ − 123
by (rule, rule list_all2_refl1) (rule c)
+ − 124
show "(list_all2 op \<approx> OOO op \<approx>) r s = ((list_all2 op \<approx> OOO op \<approx>) r r \<and>
+ − 125
(list_all2 op \<approx> OOO op \<approx>) s s \<and> abs_fset (map abs_fset r) = abs_fset (map abs_fset s))"
1935
+ − 126
proof (intro iffI conjI)
2326
+ − 127
show "(list_all2 op \<approx> OOO op \<approx>) r r" by (rule compose_list_refl)
+ − 128
show "(list_all2 op \<approx> OOO op \<approx>) s s" by (rule compose_list_refl)
1935
+ − 129
next
2326
+ − 130
assume a: "(list_all2 op \<approx> OOO op \<approx>) r s"
2084
+ − 131
then have b: "map abs_fset r \<approx> map abs_fset s"
+ − 132
proof (elim pred_compE)
1935
+ − 133
fix b ba
2326
+ − 134
assume c: "list_all2 op \<approx> r b"
1935
+ − 135
assume d: "b \<approx> ba"
2326
+ − 136
assume e: "list_all2 op \<approx> ba s"
1935
+ − 137
have f: "map abs_fset r = map abs_fset b"
1938
+ − 138
using Quotient_rel[OF Quotient_fset_list] c by blast
+ − 139
have "map abs_fset ba = map abs_fset s"
+ − 140
using Quotient_rel[OF Quotient_fset_list] e by blast
+ − 141
then have g: "map abs_fset s = map abs_fset ba" by simp
+ − 142
then show "map abs_fset r \<approx> map abs_fset s" using d f map_rel_cong by simp
1935
+ − 143
qed
+ − 144
then show "abs_fset (map abs_fset r) = abs_fset (map abs_fset s)"
1938
+ − 145
using Quotient_rel[OF Quotient_fset] by blast
1935
+ − 146
next
2326
+ − 147
assume a: "(list_all2 op \<approx> OOO op \<approx>) r r \<and> (list_all2 op \<approx> OOO op \<approx>) s s
1935
+ − 148
\<and> abs_fset (map abs_fset r) = abs_fset (map abs_fset s)"
2326
+ − 149
then have s: "(list_all2 op \<approx> OOO op \<approx>) s s" by simp
1935
+ − 150
have d: "map abs_fset r \<approx> map abs_fset s"
+ − 151
by (subst Quotient_rel[OF Quotient_fset]) (simp add: a)
+ − 152
have b: "map rep_fset (map abs_fset r) \<approx> map rep_fset (map abs_fset s)"
+ − 153
by (rule map_rel_cong[OF d])
2326
+ − 154
have y: "list_all2 op \<approx> (map rep_fset (map abs_fset s)) s"
+ − 155
by (fact rep_abs_rsp_left[OF Quotient_fset_list, OF list_all2_refl1[of s]])
+ − 156
have c: "(op \<approx> OO list_all2 op \<approx>) (map rep_fset (map abs_fset r)) s"
1935
+ − 157
by (rule pred_compI) (rule b, rule y)
2326
+ − 158
have z: "list_all2 op \<approx> r (map rep_fset (map abs_fset r))"
+ − 159
by (fact rep_abs_rsp[OF Quotient_fset_list, OF list_all2_refl1[of r]])
+ − 160
then show "(list_all2 op \<approx> OOO op \<approx>) r s"
1935
+ − 161
using a c pred_compI by simp
+ − 162
qed
+ − 163
qed
+ − 164
1909
+ − 165
text {* Respectfullness *}
1893
+ − 166
2187
+ − 167
lemma append_rsp[quot_respect]:
1895
+ − 168
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) op @ op @"
2278
+ − 169
apply(simp del: list_eq.simps)
2368
+ − 170
by auto
1895
+ − 171
2190
+ − 172
lemma append_rsp_unfolded:
+ − 173
"\<lbrakk>x \<approx> y; v \<approx> w\<rbrakk> \<Longrightarrow> x @ v \<approx> y @ w"
+ − 174
by auto
+ − 175
1909
+ − 176
lemma [quot_respect]:
+ − 177
shows "(op \<approx> ===> op \<approx> ===> op =) sub_list sub_list"
+ − 178
by (auto simp add: sub_list_def)
+ − 179
+ − 180
lemma memb_rsp[quot_respect]:
+ − 181
shows "(op = ===> op \<approx> ===> op =) memb memb"
+ − 182
by (auto simp add: memb_def)
+ − 183
+ − 184
lemma nil_rsp[quot_respect]:
+ − 185
shows "[] \<approx> []"
+ − 186
by simp
+ − 187
+ − 188
lemma cons_rsp[quot_respect]:
+ − 189
shows "(op = ===> op \<approx> ===> op \<approx>) op # op #"
+ − 190
by simp
+ − 191
+ − 192
lemma map_rsp[quot_respect]:
+ − 193
shows "(op = ===> op \<approx> ===> op \<approx>) map map"
+ − 194
by auto
+ − 195
+ − 196
lemma set_rsp[quot_respect]:
+ − 197
"(op \<approx> ===> op =) set set"
+ − 198
by auto
+ − 199
+ − 200
lemma list_equiv_rsp[quot_respect]:
+ − 201
shows "(op \<approx> ===> op \<approx> ===> op =) op \<approx> op \<approx>"
+ − 202
by auto
+ − 203
+ − 204
lemma not_memb_nil:
+ − 205
shows "\<not> memb x []"
+ − 206
by (simp add: memb_def)
+ − 207
+ − 208
lemma memb_cons_iff:
+ − 209
shows "memb x (y # xs) = (x = y \<or> memb x xs)"
+ − 210
by (induct xs) (auto simp add: memb_def)
+ − 211
+ − 212
lemma memb_finter_raw:
+ − 213
"memb x (finter_raw xs ys) \<longleftrightarrow> memb x xs \<and> memb x ys"
+ − 214
by (induct xs) (auto simp add: not_memb_nil memb_cons_iff)
+ − 215
+ − 216
lemma [quot_respect]:
+ − 217
"(op \<approx> ===> op \<approx> ===> op \<approx>) finter_raw finter_raw"
+ − 218
by (simp add: memb_def[symmetric] memb_finter_raw)
+ − 219
+ − 220
lemma memb_delete_raw:
+ − 221
"memb x (delete_raw xs y) = (memb x xs \<and> x \<noteq> y)"
+ − 222
by (induct xs arbitrary: x y) (auto simp add: memb_def)
+ − 223
+ − 224
lemma [quot_respect]:
+ − 225
"(op \<approx> ===> op = ===> op \<approx>) delete_raw delete_raw"
+ − 226
by (simp add: memb_def[symmetric] memb_delete_raw)
+ − 227
2084
+ − 228
lemma fminus_raw_memb: "memb x (fminus_raw xs ys) = (memb x xs \<and> \<not> memb x ys)"
+ − 229
by (induct ys arbitrary: xs)
+ − 230
(simp_all add: not_memb_nil memb_delete_raw memb_cons_iff)
+ − 231
+ − 232
lemma [quot_respect]:
+ − 233
"(op \<approx> ===> op \<approx> ===> op \<approx>) fminus_raw fminus_raw"
+ − 234
by (simp add: memb_def[symmetric] fminus_raw_memb)
+ − 235
1909
+ − 236
lemma fcard_raw_gt_0:
+ − 237
assumes a: "x \<in> set xs"
+ − 238
shows "0 < fcard_raw xs"
+ − 239
using a by (induct xs) (auto simp add: memb_def)
+ − 240
+ − 241
lemma fcard_raw_delete_one:
+ − 242
shows "fcard_raw ([x \<leftarrow> xs. x \<noteq> y]) = (if memb y xs then fcard_raw xs - 1 else fcard_raw xs)"
+ − 243
by (induct xs) (auto dest: fcard_raw_gt_0 simp add: memb_def)
+ − 244
+ − 245
lemma fcard_raw_rsp_aux:
+ − 246
assumes a: "xs \<approx> ys"
+ − 247
shows "fcard_raw xs = fcard_raw ys"
+ − 248
using a
2084
+ − 249
proof (induct xs arbitrary: ys)
+ − 250
case Nil
+ − 251
show ?case using Nil.prems by simp
+ − 252
next
+ − 253
case (Cons a xs)
+ − 254
have a: "a # xs \<approx> ys" by fact
+ − 255
have b: "\<And>ys. xs \<approx> ys \<Longrightarrow> fcard_raw xs = fcard_raw ys" by fact
+ − 256
show ?case proof (cases "a \<in> set xs")
+ − 257
assume c: "a \<in> set xs"
+ − 258
have "\<forall>x. (x \<in> set xs) = (x \<in> set ys)"
+ − 259
proof (intro allI iffI)
+ − 260
fix x
+ − 261
assume "x \<in> set xs"
+ − 262
then show "x \<in> set ys" using a by auto
+ − 263
next
+ − 264
fix x
+ − 265
assume d: "x \<in> set ys"
+ − 266
have e: "(x \<in> set (a # xs)) = (x \<in> set ys)" using a by simp
+ − 267
show "x \<in> set xs" using c d e unfolding list_eq.simps by simp blast
+ − 268
qed
+ − 269
then show ?thesis using b c by (simp add: memb_def)
+ − 270
next
+ − 271
assume c: "a \<notin> set xs"
+ − 272
have d: "xs \<approx> [x\<leftarrow>ys . x \<noteq> a] \<Longrightarrow> fcard_raw xs = fcard_raw [x\<leftarrow>ys . x \<noteq> a]" using b by simp
+ − 273
have "Suc (fcard_raw xs) = fcard_raw ys"
+ − 274
proof (cases "a \<in> set ys")
+ − 275
assume e: "a \<in> set ys"
+ − 276
have f: "\<forall>x. (x \<in> set xs) = (x \<in> set ys \<and> x \<noteq> a)" using a c
+ − 277
by (auto simp add: fcard_raw_delete_one)
+ − 278
have "fcard_raw ys = Suc (fcard_raw ys - 1)" by (rule Suc_pred'[OF fcard_raw_gt_0]) (rule e)
+ − 279
then show ?thesis using d e f by (simp_all add: fcard_raw_delete_one memb_def)
+ − 280
next
+ − 281
case False then show ?thesis using a c d by auto
+ − 282
qed
+ − 283
then show ?thesis using a c d by (simp add: memb_def)
+ − 284
qed
+ − 285
qed
1909
+ − 286
+ − 287
lemma fcard_raw_rsp[quot_respect]:
+ − 288
shows "(op \<approx> ===> op =) fcard_raw fcard_raw"
+ − 289
by (simp add: fcard_raw_rsp_aux)
+ − 290
+ − 291
lemma memb_absorb:
+ − 292
shows "memb x xs \<Longrightarrow> x # xs \<approx> xs"
+ − 293
by (induct xs) (auto simp add: memb_def)
+ − 294
+ − 295
lemma none_memb_nil:
+ − 296
"(\<forall>x. \<not> memb x xs) = (xs \<approx> [])"
+ − 297
by (simp add: memb_def)
+ − 298
+ − 299
lemma not_memb_delete_raw_ident:
+ − 300
shows "\<not> memb x xs \<Longrightarrow> delete_raw xs x = xs"
+ − 301
by (induct xs) (auto simp add: memb_def)
+ − 302
+ − 303
lemma memb_commute_ffold_raw:
+ − 304
"rsp_fold f \<Longrightarrow> memb h b \<Longrightarrow> ffold_raw f z b = f h (ffold_raw f z (delete_raw b h))"
+ − 305
apply (induct b)
+ − 306
apply (simp_all add: not_memb_nil)
+ − 307
apply (auto)
1938
+ − 308
apply (simp_all add: memb_delete_raw not_memb_delete_raw_ident rsp_fold_def memb_cons_iff)
1909
+ − 309
done
+ − 310
+ − 311
lemma ffold_raw_rsp_pre:
+ − 312
"\<forall>e. memb e a = memb e b \<Longrightarrow> ffold_raw f z a = ffold_raw f z b"
+ − 313
apply (induct a arbitrary: b)
+ − 314
apply (simp add: memb_absorb memb_def none_memb_nil)
+ − 315
apply (simp)
+ − 316
apply (rule conjI)
+ − 317
apply (rule_tac [!] impI)
+ − 318
apply (rule_tac [!] conjI)
+ − 319
apply (rule_tac [!] impI)
+ − 320
apply (subgoal_tac "\<forall>e. memb e a2 = memb e b")
+ − 321
apply (simp)
+ − 322
apply (simp add: memb_cons_iff memb_def)
+ − 323
apply (auto)[1]
+ − 324
apply (drule_tac x="e" in spec)
+ − 325
apply (blast)
+ − 326
apply (case_tac b)
+ − 327
apply (simp_all)
+ − 328
apply (subgoal_tac "ffold_raw f z b = f a1 (ffold_raw f z (delete_raw b a1))")
+ − 329
apply (simp only:)
+ − 330
apply (rule_tac f="f a1" in arg_cong)
+ − 331
apply (subgoal_tac "\<forall>e. memb e a2 = memb e (delete_raw b a1)")
+ − 332
apply (simp)
+ − 333
apply (simp add: memb_delete_raw)
+ − 334
apply (auto simp add: memb_cons_iff)[1]
+ − 335
apply (erule memb_commute_ffold_raw)
+ − 336
apply (drule_tac x="a1" in spec)
+ − 337
apply (simp add: memb_cons_iff)
+ − 338
apply (simp add: memb_cons_iff)
+ − 339
apply (case_tac b)
+ − 340
apply (simp_all)
+ − 341
done
+ − 342
+ − 343
lemma [quot_respect]:
+ − 344
"(op = ===> op = ===> op \<approx> ===> op =) ffold_raw ffold_raw"
+ − 345
by (simp add: memb_def[symmetric] ffold_raw_rsp_pre)
+ − 346
1935
+ − 347
lemma concat_rsp_pre:
2326
+ − 348
assumes a: "list_all2 op \<approx> x x'"
1935
+ − 349
and b: "x' \<approx> y'"
2326
+ − 350
and c: "list_all2 op \<approx> y' y"
1935
+ − 351
and d: "\<exists>x\<in>set x. xa \<in> set x"
+ − 352
shows "\<exists>x\<in>set y. xa \<in> set x"
+ − 353
proof -
+ − 354
obtain xb where e: "xb \<in> set x" and f: "xa \<in> set xb" using d by auto
2326
+ − 355
have "\<exists>y. y \<in> set x' \<and> xb \<approx> y" by (rule list_all2_find_element[OF e a])
1935
+ − 356
then obtain ya where h: "ya \<in> set x'" and i: "xb \<approx> ya" by auto
2084
+ − 357
have "ya \<in> set y'" using b h by simp
2326
+ − 358
then have "\<exists>yb. yb \<in> set y \<and> ya \<approx> yb" using c by (rule list_all2_find_element)
1935
+ − 359
then show ?thesis using f i by auto
+ − 360
qed
+ − 361
2187
+ − 362
lemma concat_rsp[quot_respect]:
2326
+ − 363
shows "(list_all2 op \<approx> OOO op \<approx> ===> op \<approx>) concat concat"
1935
+ − 364
proof (rule fun_relI, elim pred_compE)
+ − 365
fix a b ba bb
2326
+ − 366
assume a: "list_all2 op \<approx> a ba"
1935
+ − 367
assume b: "ba \<approx> bb"
2326
+ − 368
assume c: "list_all2 op \<approx> bb b"
1935
+ − 369
have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
+ − 370
fix x
+ − 371
show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
+ − 372
assume d: "\<exists>xa\<in>set a. x \<in> set xa"
+ − 373
show "\<exists>xa\<in>set b. x \<in> set xa" by (rule concat_rsp_pre[OF a b c d])
+ − 374
next
+ − 375
assume e: "\<exists>xa\<in>set b. x \<in> set xa"
2326
+ − 376
have a': "list_all2 op \<approx> ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a])
1935
+ − 377
have b': "bb \<approx> ba" by (rule equivp_symp[OF list_eq_equivp, OF b])
2326
+ − 378
have c': "list_all2 op \<approx> b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c])
1935
+ − 379
show "\<exists>xa\<in>set a. x \<in> set xa" by (rule concat_rsp_pre[OF c' b' a' e])
+ − 380
qed
+ − 381
qed
+ − 382
then show "concat a \<approx> concat b" by simp
+ − 383
qed
+ − 384
2190
+ − 385
+ − 386
+ − 387
lemma concat_rsp_unfolded:
2326
+ − 388
"\<lbrakk>list_all2 op \<approx> a ba; ba \<approx> bb; list_all2 op \<approx> bb b\<rbrakk> \<Longrightarrow> concat a \<approx> concat b"
2190
+ − 389
proof -
+ − 390
fix a b ba bb
2326
+ − 391
assume a: "list_all2 op \<approx> a ba"
2190
+ − 392
assume b: "ba \<approx> bb"
2326
+ − 393
assume c: "list_all2 op \<approx> bb b"
2190
+ − 394
have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
+ − 395
fix x
+ − 396
show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
+ − 397
assume d: "\<exists>xa\<in>set a. x \<in> set xa"
+ − 398
show "\<exists>xa\<in>set b. x \<in> set xa" by (rule concat_rsp_pre[OF a b c d])
+ − 399
next
+ − 400
assume e: "\<exists>xa\<in>set b. x \<in> set xa"
2326
+ − 401
have a': "list_all2 op \<approx> ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a])
2190
+ − 402
have b': "bb \<approx> ba" by (rule equivp_symp[OF list_eq_equivp, OF b])
2326
+ − 403
have c': "list_all2 op \<approx> b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c])
2190
+ − 404
show "\<exists>xa\<in>set a. x \<in> set xa" by (rule concat_rsp_pre[OF c' b' a' e])
+ − 405
qed
+ − 406
qed
+ − 407
then show "concat a \<approx> concat b" by simp
+ − 408
qed
+ − 409
2084
+ − 410
lemma [quot_respect]:
+ − 411
"((op =) ===> op \<approx> ===> op \<approx>) filter filter"
+ − 412
by auto
+ − 413
1909
+ − 414
text {* Distributive lattice with bot *}
+ − 415
1893
+ − 416
lemma sub_list_not_eq:
+ − 417
"(sub_list x y \<and> \<not> list_eq x y) = (sub_list x y \<and> \<not> sub_list y x)"
+ − 418
by (auto simp add: sub_list_def)
+ − 419
+ − 420
lemma sub_list_refl:
+ − 421
"sub_list x x"
+ − 422
by (simp add: sub_list_def)
+ − 423
+ − 424
lemma sub_list_trans:
+ − 425
"sub_list x y \<Longrightarrow> sub_list y z \<Longrightarrow> sub_list x z"
+ − 426
by (simp add: sub_list_def)
+ − 427
+ − 428
lemma sub_list_empty:
+ − 429
"sub_list [] x"
+ − 430
by (simp add: sub_list_def)
+ − 431
1905
+ − 432
lemma sub_list_append_left:
+ − 433
"sub_list x (x @ y)"
+ − 434
by (simp add: sub_list_def)
+ − 435
+ − 436
lemma sub_list_append_right:
+ − 437
"sub_list y (x @ y)"
+ − 438
by (simp add: sub_list_def)
+ − 439
+ − 440
lemma sub_list_inter_left:
+ − 441
shows "sub_list (finter_raw x y) x"
+ − 442
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw)
+ − 443
+ − 444
lemma sub_list_inter_right:
+ − 445
shows "sub_list (finter_raw x y) y"
+ − 446
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw)
+ − 447
+ − 448
lemma sub_list_list_eq:
+ − 449
"sub_list x y \<Longrightarrow> sub_list y x \<Longrightarrow> list_eq x y"
+ − 450
unfolding sub_list_def list_eq.simps by blast
+ − 451
+ − 452
lemma sub_list_append:
+ − 453
"sub_list y x \<Longrightarrow> sub_list z x \<Longrightarrow> sub_list (y @ z) x"
+ − 454
unfolding sub_list_def by auto
+ − 455
+ − 456
lemma sub_list_inter:
+ − 457
"sub_list x y \<Longrightarrow> sub_list x z \<Longrightarrow> sub_list x (finter_raw y z)"
+ − 458
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw)
+ − 459
+ − 460
lemma append_inter_distrib:
+ − 461
"x @ (finter_raw y z) \<approx> finter_raw (x @ y) (x @ z)"
+ − 462
apply (induct x)
+ − 463
apply (simp_all add: memb_def)
+ − 464
apply (simp add: memb_def[symmetric] memb_finter_raw)
2084
+ − 465
apply (auto simp add: memb_def)
+ − 466
done
1905
+ − 467
2084
+ − 468
instantiation fset :: (type) "{bounded_lattice_bot,distrib_lattice,minus}"
1893
+ − 469
begin
+ − 470
+ − 471
quotient_definition
+ − 472
"bot :: 'a fset" is "[] :: 'a list"
+ − 473
+ − 474
abbreviation
+ − 475
fempty ("{||}")
+ − 476
where
+ − 477
"{||} \<equiv> bot :: 'a fset"
+ − 478
+ − 479
quotient_definition
+ − 480
"less_eq_fset \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> bool)"
+ − 481
is
+ − 482
"sub_list \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> bool)"
+ − 483
+ − 484
abbreviation
+ − 485
f_subset_eq :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subseteq>|" 50)
+ − 486
where
+ − 487
"xs |\<subseteq>| ys \<equiv> xs \<le> ys"
+ − 488
+ − 489
definition
+ − 490
less_fset:
+ − 491
"(xs :: 'a fset) < ys \<equiv> xs \<le> ys \<and> xs \<noteq> ys"
+ − 492
+ − 493
abbreviation
+ − 494
f_subset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subset>|" 50)
+ − 495
where
+ − 496
"xs |\<subset>| ys \<equiv> xs < ys"
+ − 497
1895
+ − 498
quotient_definition
+ − 499
"sup \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset)"
+ − 500
is
+ − 501
"(op @) \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> 'a list)"
+ − 502
+ − 503
abbreviation
2084
+ − 504
funion (infixl "|\<union>|" 65)
1895
+ − 505
where
+ − 506
"xs |\<union>| ys \<equiv> sup (xs :: 'a fset) ys"
+ − 507
1905
+ − 508
quotient_definition
2084
+ − 509
"inf \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset)"
1905
+ − 510
is
+ − 511
"finter_raw \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> 'a list)"
+ − 512
+ − 513
abbreviation
+ − 514
finter (infixl "|\<inter>|" 65)
+ − 515
where
+ − 516
"xs |\<inter>| ys \<equiv> inf (xs :: 'a fset) ys"
+ − 517
2084
+ − 518
quotient_definition
+ − 519
"minus \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset)"
+ − 520
is
+ − 521
"fminus_raw \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> 'a list)"
+ − 522
1895
+ − 523
instance
+ − 524
proof
1905
+ − 525
fix x y z :: "'a fset"
+ − 526
show "(x |\<subset>| y) = (x |\<subseteq>| y \<and> \<not> y |\<subseteq>| x)"
+ − 527
unfolding less_fset by (lifting sub_list_not_eq)
+ − 528
show "x |\<subseteq>| x" by (lifting sub_list_refl)
+ − 529
show "{||} |\<subseteq>| x" by (lifting sub_list_empty)
1895
+ − 530
show "x |\<subseteq>| x |\<union>| y" by (lifting sub_list_append_left)
+ − 531
show "y |\<subseteq>| x |\<union>| y" by (lifting sub_list_append_right)
1905
+ − 532
show "x |\<inter>| y |\<subseteq>| x" by (lifting sub_list_inter_left)
+ − 533
show "x |\<inter>| y |\<subseteq>| y" by (lifting sub_list_inter_right)
+ − 534
show "x |\<union>| (y |\<inter>| z) = x |\<union>| y |\<inter>| (x |\<union>| z)" by (lifting append_inter_distrib)
+ − 535
next
+ − 536
fix x y z :: "'a fset"
+ − 537
assume a: "x |\<subseteq>| y"
+ − 538
assume b: "y |\<subseteq>| z"
+ − 539
show "x |\<subseteq>| z" using a b by (lifting sub_list_trans)
1895
+ − 540
next
+ − 541
fix x y :: "'a fset"
+ − 542
assume a: "x |\<subseteq>| y"
+ − 543
assume b: "y |\<subseteq>| x"
+ − 544
show "x = y" using a b by (lifting sub_list_list_eq)
+ − 545
next
+ − 546
fix x y z :: "'a fset"
+ − 547
assume a: "y |\<subseteq>| x"
+ − 548
assume b: "z |\<subseteq>| x"
+ − 549
show "y |\<union>| z |\<subseteq>| x" using a b by (lifting sub_list_append)
1905
+ − 550
next
+ − 551
fix x y z :: "'a fset"
+ − 552
assume a: "x |\<subseteq>| y"
+ − 553
assume b: "x |\<subseteq>| z"
+ − 554
show "x |\<subseteq>| y |\<inter>| z" using a b by (lifting sub_list_inter)
1895
+ − 555
qed
1905
+ − 556
1893
+ − 557
end
+ − 558
1909
+ − 559
section {* Finsert and Membership *}
1518
+ − 560
+ − 561
quotient_definition
1893
+ − 562
"finsert :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
1518
+ − 563
is "op #"
+ − 564
+ − 565
syntax
+ − 566
"@Finset" :: "args => 'a fset" ("{|(_)|}")
+ − 567
+ − 568
translations
+ − 569
"{|x, xs|}" == "CONST finsert x {|xs|}"
+ − 570
"{|x|}" == "CONST finsert x {||}"
+ − 571
+ − 572
quotient_definition
1938
+ − 573
fin (infix "|\<in>|" 50)
1518
+ − 574
where
1816
+ − 575
"fin :: 'a \<Rightarrow> 'a fset \<Rightarrow> bool" is "memb"
1518
+ − 576
+ − 577
abbreviation
1938
+ − 578
fnotin :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<notin>|" 50)
1518
+ − 579
where
1860
+ − 580
"x |\<notin>| S \<equiv> \<not> (x |\<in>| S)"
1518
+ − 581
2084
+ − 582
section {* Other constants on the Quotient Type *}
1935
+ − 583
+ − 584
quotient_definition
2084
+ − 585
"fcard :: 'a fset \<Rightarrow> nat"
1935
+ − 586
is
+ − 587
"fcard_raw"
+ − 588
+ − 589
quotient_definition
+ − 590
"fmap :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset"
+ − 591
is
+ − 592
"map"
+ − 593
+ − 594
quotient_definition
2084
+ − 595
"fdelete :: 'a fset \<Rightarrow> 'a \<Rightarrow> 'a fset"
1935
+ − 596
is "delete_raw"
+ − 597
+ − 598
quotient_definition
2084
+ − 599
"fset_to_set :: 'a fset \<Rightarrow> 'a set"
1935
+ − 600
is "set"
+ − 601
+ − 602
quotient_definition
+ − 603
"ffold :: ('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a fset \<Rightarrow> 'b"
+ − 604
is "ffold_raw"
+ − 605
+ − 606
quotient_definition
+ − 607
"fconcat :: ('a fset) fset \<Rightarrow> 'a fset"
+ − 608
is
+ − 609
"concat"
+ − 610
2084
+ − 611
quotient_definition
+ − 612
"ffilter :: ('a \<Rightarrow> bool) \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
+ − 613
is
+ − 614
"filter"
+ − 615
1935
+ − 616
text {* Compositional Respectfullness and Preservation *}
+ − 617
2326
+ − 618
lemma [quot_respect]: "(list_all2 op \<approx> OOO op \<approx>) [] []"
1938
+ − 619
by (fact compose_list_refl)
1935
+ − 620
+ − 621
lemma [quot_preserve]: "(abs_fset \<circ> map f) [] = abs_fset []"
+ − 622
by simp
+ − 623
+ − 624
lemma [quot_respect]:
2326
+ − 625
"(op \<approx> ===> list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx>) op # op #"
1935
+ − 626
apply auto
+ − 627
apply (simp add: set_in_eq)
+ − 628
apply (rule_tac b="x # b" in pred_compI)
+ − 629
apply auto
+ − 630
apply (rule_tac b="x # ba" in pred_compI)
+ − 631
apply auto
+ − 632
done
+ − 633
2196
+ − 634
lemma insert_preserve2:
+ − 635
shows "((rep_fset ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) op #) =
+ − 636
(id ---> rep_fset ---> abs_fset) op #"
2479
+ − 637
by (simp add: fun_eq_iff abs_o_rep[OF Quotient_fset] map_id Quotient_abs_rep[OF Quotient_fset])
2196
+ − 638
1935
+ − 639
lemma [quot_preserve]:
+ − 640
"(rep_fset ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) op # = finsert"
2479
+ − 641
by (simp add: fun_eq_iff Quotient_abs_rep[OF Quotient_fset]
1935
+ − 642
abs_o_rep[OF Quotient_fset] map_id finsert_def)
+ − 643
+ − 644
lemma [quot_preserve]:
1938
+ − 645
"((map rep_fset \<circ> rep_fset) ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) op @ = funion"
2479
+ − 646
by (simp add: fun_eq_iff Quotient_abs_rep[OF Quotient_fset]
1935
+ − 647
abs_o_rep[OF Quotient_fset] map_id sup_fset_def)
+ − 648
2326
+ − 649
lemma list_all2_app_l:
1935
+ − 650
assumes a: "reflp R"
2326
+ − 651
and b: "list_all2 R l r"
+ − 652
shows "list_all2 R (z @ l) (z @ r)"
1938
+ − 653
by (induct z) (simp_all add: b rev_iffD1[OF a meta_eq_to_obj_eq[OF reflp_def]])
1935
+ − 654
+ − 655
lemma append_rsp2_pre0:
2326
+ − 656
assumes a:"list_all2 op \<approx> x x'"
+ − 657
shows "list_all2 op \<approx> (x @ z) (x' @ z)"
1935
+ − 658
using a apply (induct x x' rule: list_induct2')
2326
+ − 659
by simp_all (rule list_all2_refl1)
1935
+ − 660
+ − 661
lemma append_rsp2_pre1:
2326
+ − 662
assumes a:"list_all2 op \<approx> x x'"
+ − 663
shows "list_all2 op \<approx> (z @ x) (z @ x')"
1935
+ − 664
using a apply (induct x x' arbitrary: z rule: list_induct2')
2326
+ − 665
apply (rule list_all2_refl1)
1935
+ − 666
apply (simp_all del: list_eq.simps)
2326
+ − 667
apply (rule list_all2_app_l)
1935
+ − 668
apply (simp_all add: reflp_def)
+ − 669
done
+ − 670
+ − 671
lemma append_rsp2_pre:
2326
+ − 672
assumes a:"list_all2 op \<approx> x x'"
+ − 673
and b: "list_all2 op \<approx> z z'"
+ − 674
shows "list_all2 op \<approx> (x @ z) (x' @ z')"
+ − 675
apply (rule list_all2_transp[OF fset_equivp])
1935
+ − 676
apply (rule append_rsp2_pre0)
+ − 677
apply (rule a)
+ − 678
using b apply (induct z z' rule: list_induct2')
+ − 679
apply (simp_all only: append_Nil2)
2326
+ − 680
apply (rule list_all2_refl1)
1935
+ − 681
apply simp_all
+ − 682
apply (rule append_rsp2_pre1)
+ − 683
apply simp
+ − 684
done
+ − 685
+ − 686
lemma [quot_respect]:
2326
+ − 687
"(list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx>) op @ op @"
1935
+ − 688
proof (intro fun_relI, elim pred_compE)
+ − 689
fix x y z w x' z' y' w' :: "'a list list"
2326
+ − 690
assume a:"list_all2 op \<approx> x x'"
1935
+ − 691
and b: "x' \<approx> y'"
2326
+ − 692
and c: "list_all2 op \<approx> y' y"
+ − 693
assume aa: "list_all2 op \<approx> z z'"
1935
+ − 694
and bb: "z' \<approx> w'"
2326
+ − 695
and cc: "list_all2 op \<approx> w' w"
+ − 696
have a': "list_all2 op \<approx> (x @ z) (x' @ z')" using a aa append_rsp2_pre by auto
1935
+ − 697
have b': "x' @ z' \<approx> y' @ w'" using b bb by simp
2326
+ − 698
have c': "list_all2 op \<approx> (y' @ w') (y @ w)" using c cc append_rsp2_pre by auto
+ − 699
have d': "(op \<approx> OO list_all2 op \<approx>) (x' @ z') (y @ w)"
1935
+ − 700
by (rule pred_compI) (rule b', rule c')
2326
+ − 701
show "(list_all2 op \<approx> OOO op \<approx>) (x @ z) (y @ w)"
1935
+ − 702
by (rule pred_compI) (rule a', rule d')
+ − 703
qed
+ − 704
+ − 705
text {* Raw theorems. Finsert, memb, singleron, sub_list *}
1518
+ − 706
1892
+ − 707
lemma nil_not_cons:
+ − 708
shows "\<not> ([] \<approx> x # xs)"
+ − 709
and "\<not> (x # xs \<approx> [])"
+ − 710
by auto
+ − 711
1878
+ − 712
lemma no_memb_nil:
+ − 713
"(\<forall>x. \<not> memb x xs) = (xs = [])"
+ − 714
by (simp add: memb_def)
+ − 715
1518
+ − 716
lemma memb_consI1:
+ − 717
shows "memb x (x # xs)"
+ − 718
by (simp add: memb_def)
+ − 719
+ − 720
lemma memb_consI2:
+ − 721
shows "memb x xs \<Longrightarrow> memb x (y # xs)"
+ − 722
by (simp add: memb_def)
+ − 723
+ − 724
lemma singleton_list_eq:
+ − 725
shows "[x] \<approx> [y] \<longleftrightarrow> x = y"
2378
+ − 726
by (simp add:) auto
1518
+ − 727
1892
+ − 728
lemma sub_list_cons:
+ − 729
"sub_list (x # xs) ys = (memb x ys \<and> sub_list xs ys)"
+ − 730
by (auto simp add: memb_def sub_list_def)
+ − 731
2084
+ − 732
lemma fminus_raw_red: "fminus_raw (x # xs) ys = (if memb x ys then fminus_raw xs ys else x # (fminus_raw xs ys))"
+ − 733
by (induct ys arbitrary: xs x)
+ − 734
(simp_all add: not_memb_nil memb_delete_raw memb_cons_iff)
+ − 735
1935
+ − 736
text {* Cardinality of finite sets *}
1518
+ − 737
1813
+ − 738
lemma fcard_raw_0:
1860
+ − 739
shows "fcard_raw xs = 0 \<longleftrightarrow> xs \<approx> []"
1821
+ − 740
by (induct xs) (auto simp add: memb_def)
1813
+ − 741
+ − 742
lemma fcard_raw_not_memb:
1860
+ − 743
shows "\<not> memb x xs \<longleftrightarrow> fcard_raw (x # xs) = Suc (fcard_raw xs)"
1813
+ − 744
by auto
+ − 745
+ − 746
lemma fcard_raw_suc:
1860
+ − 747
assumes a: "fcard_raw xs = Suc n"
+ − 748
shows "\<exists>x ys. \<not> (memb x ys) \<and> xs \<approx> (x # ys) \<and> fcard_raw ys = n"
+ − 749
using a
2378
+ − 750
by (induct xs) (auto simp add: memb_def split_ifs)
1819
+ − 751
1935
+ − 752
lemma singleton_fcard_1:
1860
+ − 753
shows "set xs = {x} \<Longrightarrow> fcard_raw xs = 1"
+ − 754
by (induct xs) (auto simp add: memb_def subset_insert)
1819
+ − 755
+ − 756
lemma fcard_raw_1:
1823
+ − 757
shows "fcard_raw xs = 1 \<longleftrightarrow> (\<exists>x. xs \<approx> [x])"
+ − 758
apply (auto dest!: fcard_raw_suc)
1819
+ − 759
apply (simp add: fcard_raw_0)
1821
+ − 760
apply (rule_tac x="x" in exI)
1819
+ − 761
apply simp
1821
+ − 762
apply (subgoal_tac "set xs = {x}")
1860
+ − 763
apply (drule singleton_fcard_1)
1819
+ − 764
apply auto
1813
+ − 765
done
+ − 766
1878
+ − 767
lemma fcard_raw_suc_memb:
+ − 768
assumes a: "fcard_raw A = Suc n"
+ − 769
shows "\<exists>a. memb a A"
+ − 770
using a
1938
+ − 771
by (induct A) (auto simp add: memb_def)
1878
+ − 772
1884
+ − 773
lemma memb_card_not_0:
1878
+ − 774
assumes a: "memb a A"
+ − 775
shows "\<not>(fcard_raw A = 0)"
1883
+ − 776
proof -
+ − 777
have "\<not>(\<forall>x. \<not> memb x A)" using a by auto
+ − 778
then have "\<not>A \<approx> []" using none_memb_nil[of A] by simp
+ − 779
then show ?thesis using fcard_raw_0[of A] by simp
+ − 780
qed
1878
+ − 781
1935
+ − 782
text {* fmap *}
1518
+ − 783
1813
+ − 784
lemma map_append:
1821
+ − 785
"map f (xs @ ys) \<approx> (map f xs) @ (map f ys)"
1813
+ − 786
by simp
+ − 787
1819
+ − 788
lemma memb_append:
1823
+ − 789
"memb x (xs @ ys) \<longleftrightarrow> memb x xs \<or> memb x ys"
1821
+ − 790
by (induct xs) (simp_all add: not_memb_nil memb_cons_iff)
1819
+ − 791
1518
+ − 792
lemma cons_left_comm:
1821
+ − 793
"x # y # xs \<approx> y # x # xs"
+ − 794
by auto
1518
+ − 795
+ − 796
lemma cons_left_idem:
1821
+ − 797
"x # x # xs \<approx> x # xs"
+ − 798
by auto
1518
+ − 799
1819
+ − 800
lemma fset_raw_strong_cases:
2084
+ − 801
obtains "xs = []"
+ − 802
| x ys where "\<not> memb x ys" and "xs \<approx> x # ys"
+ − 803
proof (induct xs arbitrary: x ys)
+ − 804
case Nil
+ − 805
then show thesis by simp
+ − 806
next
+ − 807
case (Cons a xs)
+ − 808
have a: "\<lbrakk>xs = [] \<Longrightarrow> thesis; \<And>x ys. \<lbrakk>\<not> memb x ys; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis" by fact
+ − 809
have b: "\<And>x' ys'. \<lbrakk>\<not> memb x' ys'; a # xs \<approx> x' # ys'\<rbrakk> \<Longrightarrow> thesis" by fact
+ − 810
have c: "xs = [] \<Longrightarrow> thesis" by (metis no_memb_nil singleton_list_eq b)
+ − 811
have "\<And>x ys. \<lbrakk>\<not> memb x ys; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis"
+ − 812
proof -
+ − 813
fix x :: 'a
+ − 814
fix ys :: "'a list"
+ − 815
assume d:"\<not> memb x ys"
+ − 816
assume e:"xs \<approx> x # ys"
+ − 817
show thesis
+ − 818
proof (cases "x = a")
+ − 819
assume h: "x = a"
+ − 820
then have f: "\<not> memb a ys" using d by simp
+ − 821
have g: "a # xs \<approx> a # ys" using e h by auto
+ − 822
show thesis using b f g by simp
+ − 823
next
+ − 824
assume h: "x \<noteq> a"
+ − 825
then have f: "\<not> memb x (a # ys)" using d unfolding memb_def by auto
+ − 826
have g: "a # xs \<approx> x # (a # ys)" using e h by auto
+ − 827
show thesis using b f g by simp
+ − 828
qed
+ − 829
qed
+ − 830
then show thesis using a c by blast
+ − 831
qed
1518
+ − 832
1860
+ − 833
section {* deletion *}
+ − 834
1819
+ − 835
lemma memb_delete_raw_ident:
1860
+ − 836
shows "\<not> memb x (delete_raw xs x)"
1821
+ − 837
by (induct xs) (auto simp add: memb_def)
1518
+ − 838
1819
+ − 839
lemma fset_raw_delete_raw_cases:
1821
+ − 840
"xs = [] \<or> (\<exists>x. memb x xs \<and> xs \<approx> x # delete_raw xs x)"
+ − 841
by (induct xs) (auto simp add: memb_def)
1518
+ − 842
1819
+ − 843
lemma fdelete_raw_filter:
+ − 844
"delete_raw xs y = [x \<leftarrow> xs. x \<noteq> y]"
+ − 845
by (induct xs) simp_all
1518
+ − 846
1819
+ − 847
lemma fcard_raw_delete:
+ − 848
"fcard_raw (delete_raw xs y) = (if memb y xs then fcard_raw xs - 1 else fcard_raw xs)"
+ − 849
by (simp add: fdelete_raw_filter fcard_raw_delete_one)
1518
+ − 850
1819
+ − 851
lemma finter_raw_empty:
+ − 852
"finter_raw l [] = []"
+ − 853
by (induct l) (simp_all add: not_memb_nil)
+ − 854
2084
+ − 855
lemma set_cong:
+ − 856
shows "(x \<approx> y) = (set x = set y)"
1821
+ − 857
by auto
1533
+ − 858
+ − 859
lemma inj_map_eq_iff:
+ − 860
"inj f \<Longrightarrow> (map f l \<approx> map f m) = (l \<approx> m)"
2479
+ − 861
by (simp add: set_eq_iff[symmetric] inj_image_eq_iff)
1533
+ − 862
1888
+ − 863
text {* alternate formulation with a different decomposition principle
+ − 864
and a proof of equivalence *}
+ − 865
+ − 866
inductive
+ − 867
list_eq2
+ − 868
where
+ − 869
"list_eq2 (a # b # xs) (b # a # xs)"
+ − 870
| "list_eq2 [] []"
+ − 871
| "list_eq2 xs ys \<Longrightarrow> list_eq2 ys xs"
+ − 872
| "list_eq2 (a # a # xs) (a # xs)"
+ − 873
| "list_eq2 xs ys \<Longrightarrow> list_eq2 (a # xs) (a # ys)"
+ − 874
| "\<lbrakk>list_eq2 xs1 xs2; list_eq2 xs2 xs3\<rbrakk> \<Longrightarrow> list_eq2 xs1 xs3"
+ − 875
+ − 876
lemma list_eq2_refl:
+ − 877
shows "list_eq2 xs xs"
+ − 878
by (induct xs) (auto intro: list_eq2.intros)
+ − 879
+ − 880
lemma cons_delete_list_eq2:
+ − 881
shows "list_eq2 (a # (delete_raw A a)) (if memb a A then A else a # A)"
+ − 882
apply (induct A)
+ − 883
apply (simp add: memb_def list_eq2_refl)
+ − 884
apply (case_tac "memb a (aa # A)")
+ − 885
apply (simp_all only: memb_cons_iff)
+ − 886
apply (case_tac [!] "a = aa")
1909
+ − 887
apply (simp_all)
1888
+ − 888
apply (case_tac "memb a A")
+ − 889
apply (auto simp add: memb_def)[2]
+ − 890
apply (metis list_eq2.intros(3) list_eq2.intros(4) list_eq2.intros(5) list_eq2.intros(6))
1895
+ − 891
apply (metis list_eq2.intros(1) list_eq2.intros(5) list_eq2.intros(6))
1888
+ − 892
apply (auto simp add: list_eq2_refl not_memb_delete_raw_ident)
+ − 893
done
+ − 894
+ − 895
lemma memb_delete_list_eq2:
+ − 896
assumes a: "memb e r"
+ − 897
shows "list_eq2 (e # delete_raw r e) r"
+ − 898
using a cons_delete_list_eq2[of e r]
+ − 899
by simp
+ − 900
1909
+ − 901
lemma delete_raw_rsp:
+ − 902
"xs \<approx> ys \<Longrightarrow> delete_raw xs x \<approx> delete_raw ys x"
+ − 903
by (simp add: memb_def[symmetric] memb_delete_raw)
+ − 904
1888
+ − 905
lemma list_eq2_equiv:
+ − 906
"(l \<approx> r) \<longleftrightarrow> (list_eq2 l r)"
+ − 907
proof
+ − 908
show "list_eq2 l r \<Longrightarrow> l \<approx> r" by (induct rule: list_eq2.induct) auto
1938
+ − 909
next
+ − 910
{
+ − 911
fix n
+ − 912
assume a: "fcard_raw l = n" and b: "l \<approx> r"
+ − 913
have "list_eq2 l r"
+ − 914
using a b
+ − 915
proof (induct n arbitrary: l r)
+ − 916
case 0
+ − 917
have "fcard_raw l = 0" by fact
+ − 918
then have "\<forall>x. \<not> memb x l" using memb_card_not_0[of _ l] by auto
+ − 919
then have z: "l = []" using no_memb_nil by auto
+ − 920
then have "r = []" using `l \<approx> r` by simp
+ − 921
then show ?case using z list_eq2_refl by simp
+ − 922
next
+ − 923
case (Suc m)
+ − 924
have b: "l \<approx> r" by fact
+ − 925
have d: "fcard_raw l = Suc m" by fact
2084
+ − 926
then have "\<exists>a. memb a l" by (rule fcard_raw_suc_memb)
1938
+ − 927
then obtain a where e: "memb a l" by auto
+ − 928
then have e': "memb a r" using list_eq.simps[simplified memb_def[symmetric], of l r] b by auto
+ − 929
have f: "fcard_raw (delete_raw l a) = m" using fcard_raw_delete[of l a] e d by simp
+ − 930
have g: "delete_raw l a \<approx> delete_raw r a" using delete_raw_rsp[OF b] by simp
2084
+ − 931
have "list_eq2 (delete_raw l a) (delete_raw r a)" by (rule Suc.hyps[OF f g])
+ − 932
then have h: "list_eq2 (a # delete_raw l a) (a # delete_raw r a)" by (rule list_eq2.intros(5))
1938
+ − 933
have i: "list_eq2 l (a # delete_raw l a)"
+ − 934
by (rule list_eq2.intros(3)[OF memb_delete_list_eq2[OF e]])
+ − 935
have "list_eq2 l (a # delete_raw r a)" by (rule list_eq2.intros(6)[OF i h])
+ − 936
then show ?case using list_eq2.intros(6)[OF _ memb_delete_list_eq2[OF e']] by simp
+ − 937
qed
+ − 938
}
+ − 939
then show "l \<approx> r \<Longrightarrow> list_eq2 l r" by blast
1888
+ − 940
qed
+ − 941
2084
+ − 942
text {* Set *}
+ − 943
+ − 944
lemma sub_list_set: "sub_list xs ys = (set xs \<subseteq> set ys)"
+ − 945
by (metis rev_append set_append set_cong set_rev sub_list_append sub_list_append_left sub_list_def sub_list_not_eq subset_Un_eq)
+ − 946
+ − 947
lemma sub_list_neq_set: "(sub_list xs ys \<and> \<not> list_eq xs ys) = (set xs \<subset> set ys)"
+ − 948
by (auto simp add: sub_list_set)
+ − 949
+ − 950
lemma fcard_raw_set: "fcard_raw xs = card (set xs)"
2378
+ − 951
by (induct xs) (auto simp add: insert_absorb memb_def card_insert_disjoint)
2084
+ − 952
+ − 953
lemma memb_set: "memb x xs = (x \<in> set xs)"
+ − 954
by (simp only: memb_def)
+ − 955
+ − 956
lemma filter_set: "set (filter P xs) = P \<inter> (set xs)"
+ − 957
by (induct xs, simp)
+ − 958
(metis Int_insert_right_if0 Int_insert_right_if1 List.set.simps(2) filter.simps(2) mem_def)
+ − 959
+ − 960
lemma delete_raw_set: "set (delete_raw xs x) = set xs - {x}"
+ − 961
by (induct xs) auto
+ − 962
+ − 963
lemma inter_raw_set: "set (finter_raw xs ys) = set xs \<inter> set ys"
+ − 964
by (induct xs) (simp_all add: memb_def)
+ − 965
+ − 966
lemma fminus_raw_set: "set (fminus_raw xs ys) = set xs - set ys"
+ − 967
by (induct ys arbitrary: xs)
2378
+ − 968
(simp_all add: delete_raw_set, blast)
2084
+ − 969
+ − 970
text {* Raw theorems of ffilter *}
+ − 971
+ − 972
lemma sub_list_filter: "sub_list (filter P xs) (filter Q xs) = (\<forall> x. memb x xs \<longrightarrow> P x \<longrightarrow> Q x)"
+ − 973
unfolding sub_list_def memb_def by auto
+ − 974
+ − 975
lemma list_eq_filter: "list_eq (filter P xs) (filter Q xs) = (\<forall>x. memb x xs \<longrightarrow> P x = Q x)"
+ − 976
unfolding memb_def by auto
+ − 977
1935
+ − 978
text {* Lifted theorems *}
1518
+ − 979
1819
+ − 980
lemma not_fin_fnil: "x |\<notin>| {||}"
+ − 981
by (lifting not_memb_nil)
1518
+ − 982
+ − 983
lemma fin_finsert_iff[simp]:
+ − 984
"x |\<in>| finsert y S = (x = y \<or> x |\<in>| S)"
+ − 985
by (lifting memb_cons_iff)
+ − 986
+ − 987
lemma
+ − 988
shows finsertI1: "x |\<in>| finsert x S"
+ − 989
and finsertI2: "x |\<in>| S \<Longrightarrow> x |\<in>| finsert y S"
+ − 990
by (lifting memb_consI1, lifting memb_consI2)
+ − 991
+ − 992
lemma finsert_absorb[simp]:
+ − 993
shows "x |\<in>| S \<Longrightarrow> finsert x S = S"
+ − 994
by (lifting memb_absorb)
+ − 995
+ − 996
lemma fempty_not_finsert[simp]:
1533
+ − 997
"{||} \<noteq> finsert x S"
+ − 998
"finsert x S \<noteq> {||}"
1518
+ − 999
by (lifting nil_not_cons)
+ − 1000
+ − 1001
lemma finsert_left_comm:
1822
+ − 1002
"finsert x (finsert y S) = finsert y (finsert x S)"
1518
+ − 1003
by (lifting cons_left_comm)
+ − 1004
+ − 1005
lemma finsert_left_idem:
1822
+ − 1006
"finsert x (finsert x S) = finsert x S"
1518
+ − 1007
by (lifting cons_left_idem)
+ − 1008
+ − 1009
lemma fsingleton_eq[simp]:
+ − 1010
shows "{|x|} = {|y|} \<longleftrightarrow> x = y"
+ − 1011
by (lifting singleton_list_eq)
+ − 1012
+ − 1013
text {* fset_to_set *}
+ − 1014
1533
+ − 1015
lemma fset_to_set_simps[simp]:
1819
+ − 1016
"fset_to_set {||} = ({} :: 'a set)"
+ − 1017
"fset_to_set (finsert (h :: 'a) t) = insert h (fset_to_set t)"
+ − 1018
by (lifting set.simps)
1518
+ − 1019
+ − 1020
lemma in_fset_to_set:
1822
+ − 1021
"x \<in> fset_to_set S \<equiv> x |\<in>| S"
1518
+ − 1022
by (lifting memb_def[symmetric])
+ − 1023
1819
+ − 1024
lemma none_fin_fempty:
1824
+ − 1025
"(\<forall>x. x |\<notin>| S) = (S = {||})"
+ − 1026
by (lifting none_memb_nil)
1518
+ − 1027
1533
+ − 1028
lemma fset_cong:
2084
+ − 1029
"(S = T) = (fset_to_set S = fset_to_set T)"
1533
+ − 1030
by (lifting set_cong)
+ − 1031
1518
+ − 1032
text {* fcard *}
+ − 1033
+ − 1034
lemma fcard_fempty [simp]:
+ − 1035
shows "fcard {||} = 0"
+ − 1036
by (lifting fcard_raw_nil)
+ − 1037
+ − 1038
lemma fcard_finsert_if [simp]:
+ − 1039
shows "fcard (finsert x S) = (if x |\<in>| S then fcard S else Suc (fcard S))"
+ − 1040
by (lifting fcard_raw_cons)
+ − 1041
1822
+ − 1042
lemma fcard_0: "(fcard S = 0) = (S = {||})"
1813
+ − 1043
by (lifting fcard_raw_0)
+ − 1044
1821
+ − 1045
lemma fcard_1:
1822
+ − 1046
shows "(fcard S = 1) = (\<exists>x. S = {|x|})"
1819
+ − 1047
by (lifting fcard_raw_1)
+ − 1048
2084
+ − 1049
lemma fcard_gt_0:
1860
+ − 1050
shows "x \<in> fset_to_set S \<Longrightarrow> 0 < fcard S"
1518
+ − 1051
by (lifting fcard_raw_gt_0)
+ − 1052
2084
+ − 1053
lemma fcard_not_fin:
1860
+ − 1054
shows "(x |\<notin>| S) = (fcard (finsert x S) = Suc (fcard S))"
1813
+ − 1055
by (lifting fcard_raw_not_memb)
+ − 1056
1822
+ − 1057
lemma fcard_suc: "fcard S = Suc n \<Longrightarrow> \<exists>x T. x |\<notin>| T \<and> S = finsert x T \<and> fcard T = n"
1813
+ − 1058
by (lifting fcard_raw_suc)
+ − 1059
1819
+ − 1060
lemma fcard_delete:
1822
+ − 1061
"fcard (fdelete S y) = (if y |\<in>| S then fcard S - 1 else fcard S)"
1819
+ − 1062
by (lifting fcard_raw_delete)
+ − 1063
1878
+ − 1064
lemma fcard_suc_memb: "fcard A = Suc n \<Longrightarrow> \<exists>a. a |\<in>| A"
+ − 1065
by (lifting fcard_raw_suc_memb)
+ − 1066
+ − 1067
lemma fin_fcard_not_0: "a |\<in>| A \<Longrightarrow> fcard A \<noteq> 0"
1887
+ − 1068
by (lifting memb_card_not_0)
1878
+ − 1069
1518
+ − 1070
text {* funion *}
+ − 1071
2084
+ − 1072
lemmas [simp] =
+ − 1073
sup_bot_left[where 'a="'a fset", standard]
+ − 1074
sup_bot_right[where 'a="'a fset", standard]
1518
+ − 1075
2084
+ − 1076
lemma funion_finsert[simp]:
+ − 1077
shows "finsert x S |\<union>| T = finsert x (S |\<union>| T)"
+ − 1078
by (lifting append.simps(2))
1887
+ − 1079
+ − 1080
lemma singleton_union_left:
+ − 1081
"{|a|} |\<union>| S = finsert a S"
+ − 1082
by simp
+ − 1083
+ − 1084
lemma singleton_union_right:
+ − 1085
"S |\<union>| {|a|} = finsert a S"
1907
+ − 1086
by (subst sup.commute) simp
1887
+ − 1087
1518
+ − 1088
section {* Induction and Cases rules for finite sets *}
+ − 1089
+ − 1090
lemma fset_strong_cases:
2084
+ − 1091
obtains "xs = {||}"
+ − 1092
| x ys where "x |\<notin>| ys" and "xs = finsert x ys"
1819
+ − 1093
by (lifting fset_raw_strong_cases)
1518
+ − 1094
+ − 1095
lemma fset_exhaust[case_names fempty finsert, cases type: fset]:
+ − 1096
shows "\<lbrakk>S = {||} \<Longrightarrow> P; \<And>x S'. S = finsert x S' \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P"
+ − 1097
by (lifting list.exhaust)
+ − 1098
1533
+ − 1099
lemma fset_induct_weak[case_names fempty finsert]:
1518
+ − 1100
shows "\<lbrakk>P {||}; \<And>x S. P S \<Longrightarrow> P (finsert x S)\<rbrakk> \<Longrightarrow> P S"
+ − 1101
by (lifting list.induct)
+ − 1102
1533
+ − 1103
lemma fset_induct[case_names fempty finsert, induct type: fset]:
2084
+ − 1104
assumes prem1: "P {||}"
1518
+ − 1105
and prem2: "\<And>x S. \<lbrakk>x |\<notin>| S; P S\<rbrakk> \<Longrightarrow> P (finsert x S)"
+ − 1106
shows "P S"
1533
+ − 1107
proof(induct S rule: fset_induct_weak)
1518
+ − 1108
case fempty
+ − 1109
show "P {||}" by (rule prem1)
+ − 1110
next
+ − 1111
case (finsert x S)
+ − 1112
have asm: "P S" by fact
+ − 1113
show "P (finsert x S)"
1938
+ − 1114
by (cases "x |\<in>| S") (simp_all add: asm prem2)
1518
+ − 1115
qed
+ − 1116
1533
+ − 1117
lemma fset_induct2:
+ − 1118
"P {||} {||} \<Longrightarrow>
+ − 1119
(\<And>x xs. x |\<notin>| xs \<Longrightarrow> P (finsert x xs) {||}) \<Longrightarrow>
+ − 1120
(\<And>y ys. y |\<notin>| ys \<Longrightarrow> P {||} (finsert y ys)) \<Longrightarrow>
+ − 1121
(\<And>x xs y ys. \<lbrakk>P xs ys; x |\<notin>| xs; y |\<notin>| ys\<rbrakk> \<Longrightarrow> P (finsert x xs) (finsert y ys)) \<Longrightarrow>
+ − 1122
P xsa ysa"
+ − 1123
apply (induct xsa arbitrary: ysa)
+ − 1124
apply (induct_tac x rule: fset_induct)
+ − 1125
apply simp_all
+ − 1126
apply (induct_tac xa rule: fset_induct)
+ − 1127
apply simp_all
+ − 1128
done
1518
+ − 1129
2084
+ − 1130
lemma fset_fcard_induct:
+ − 1131
assumes a: "P {||}"
+ − 1132
and b: "\<And>xs ys. Suc (fcard xs) = (fcard ys) \<Longrightarrow> P xs \<Longrightarrow> P ys"
+ − 1133
shows "P zs"
+ − 1134
proof (induct zs)
+ − 1135
show "P {||}" by (rule a)
+ − 1136
next
+ − 1137
fix x :: 'a and zs :: "'a fset"
+ − 1138
assume h: "P zs"
+ − 1139
assume "x |\<notin>| zs"
+ − 1140
then have H1: "Suc (fcard zs) = fcard (finsert x zs)" using fcard_suc by auto
+ − 1141
then show "P (finsert x zs)" using b h by simp
+ − 1142
qed
+ − 1143
1819
+ − 1144
text {* fmap *}
+ − 1145
1533
+ − 1146
lemma fmap_simps[simp]:
+ − 1147
"fmap (f :: 'a \<Rightarrow> 'b) {||} = {||}"
1822
+ − 1148
"fmap f (finsert x S) = finsert (f x) (fmap f S)"
1533
+ − 1149
by (lifting map.simps)
+ − 1150
+ − 1151
lemma fmap_set_image:
1822
+ − 1152
"fset_to_set (fmap f S) = f ` (fset_to_set S)"
2084
+ − 1153
by (induct S) simp_all
1533
+ − 1154
+ − 1155
lemma inj_fmap_eq_iff:
1822
+ − 1156
"inj f \<Longrightarrow> (fmap f S = fmap f T) = (S = T)"
1533
+ − 1157
by (lifting inj_map_eq_iff)
+ − 1158
1822
+ − 1159
lemma fmap_funion: "fmap f (S |\<union>| T) = fmap f S |\<union>| fmap f T"
1813
+ − 1160
by (lifting map_append)
+ − 1161
1819
+ − 1162
lemma fin_funion:
1822
+ − 1163
"x |\<in>| S |\<union>| T \<longleftrightarrow> x |\<in>| S \<or> x |\<in>| T"
1819
+ − 1164
by (lifting memb_append)
+ − 1165
2084
+ − 1166
text {* to_set *}
+ − 1167
+ − 1168
lemma fin_set: "(x |\<in>| xs) = (x \<in> fset_to_set xs)"
+ − 1169
by (lifting memb_set)
+ − 1170
+ − 1171
lemma fnotin_set: "(x |\<notin>| xs) = (x \<notin> fset_to_set xs)"
+ − 1172
by (simp add: fin_set)
+ − 1173
+ − 1174
lemma fcard_set: "fcard xs = card (fset_to_set xs)"
+ − 1175
by (lifting fcard_raw_set)
+ − 1176
+ − 1177
lemma fsubseteq_set: "(xs |\<subseteq>| ys) = (fset_to_set xs \<subseteq> fset_to_set ys)"
+ − 1178
by (lifting sub_list_set)
+ − 1179
+ − 1180
lemma fsubset_set: "(xs |\<subset>| ys) = (fset_to_set xs \<subset> fset_to_set ys)"
+ − 1181
unfolding less_fset by (lifting sub_list_neq_set)
+ − 1182
+ − 1183
lemma ffilter_set: "fset_to_set (ffilter P xs) = P \<inter> fset_to_set xs"
+ − 1184
by (lifting filter_set)
+ − 1185
+ − 1186
lemma fdelete_set: "fset_to_set (fdelete xs x) = fset_to_set xs - {x}"
+ − 1187
by (lifting delete_raw_set)
+ − 1188
+ − 1189
lemma inter_set: "fset_to_set (xs |\<inter>| ys) = fset_to_set xs \<inter> fset_to_set ys"
+ − 1190
by (lifting inter_raw_set)
+ − 1191
+ − 1192
lemma union_set: "fset_to_set (xs |\<union>| ys) = fset_to_set xs \<union> fset_to_set ys"
+ − 1193
by (lifting set_append)
+ − 1194
+ − 1195
lemma fminus_set: "fset_to_set (xs - ys) = fset_to_set xs - fset_to_set ys"
+ − 1196
by (lifting fminus_raw_set)
+ − 1197
+ − 1198
lemmas fset_to_set_trans =
+ − 1199
fin_set fnotin_set fcard_set fsubseteq_set fsubset_set
+ − 1200
inter_set union_set ffilter_set fset_to_set_simps
+ − 1201
fset_cong fdelete_set fmap_set_image fminus_set
+ − 1202
+ − 1203
1819
+ − 1204
text {* ffold *}
+ − 1205
+ − 1206
lemma ffold_nil: "ffold f z {||} = z"
+ − 1207
by (lifting ffold_raw.simps(1)[where 'a="'b" and 'b="'a"])
+ − 1208
+ − 1209
lemma ffold_finsert: "ffold f z (finsert a A) =
+ − 1210
(if rsp_fold f then if a |\<in>| A then ffold f z A else f a (ffold f z A) else z)"
+ − 1211
by (lifting ffold_raw.simps(2)[where 'a="'b" and 'b="'a"])
+ − 1212
+ − 1213
lemma fin_commute_ffold:
+ − 1214
"\<lbrakk>rsp_fold f; h |\<in>| b\<rbrakk> \<Longrightarrow> ffold f z b = f h (ffold f z (fdelete b h))"
+ − 1215
by (lifting memb_commute_ffold_raw)
+ − 1216
+ − 1217
text {* fdelete *}
+ − 1218
2084
+ − 1219
lemma fin_fdelete:
1822
+ − 1220
shows "x |\<in>| fdelete S y \<longleftrightarrow> x |\<in>| S \<and> x \<noteq> y"
1819
+ − 1221
by (lifting memb_delete_raw)
+ − 1222
2084
+ − 1223
lemma fin_fdelete_ident:
1822
+ − 1224
shows "x |\<notin>| fdelete S x"
1819
+ − 1225
by (lifting memb_delete_raw_ident)
+ − 1226
2084
+ − 1227
lemma not_memb_fdelete_ident:
1822
+ − 1228
shows "x |\<notin>| S \<Longrightarrow> fdelete S x = S"
1819
+ − 1229
by (lifting not_memb_delete_raw_ident)
+ − 1230
+ − 1231
lemma fset_fdelete_cases:
1822
+ − 1232
shows "S = {||} \<or> (\<exists>x. x |\<in>| S \<and> S = finsert x (fdelete S x))"
1819
+ − 1233
by (lifting fset_raw_delete_raw_cases)
+ − 1234
+ − 1235
text {* inter *}
+ − 1236
1822
+ − 1237
lemma finter_empty_l: "({||} |\<inter>| S) = {||}"
1819
+ − 1238
by (lifting finter_raw.simps(1))
+ − 1239
1822
+ − 1240
lemma finter_empty_r: "(S |\<inter>| {||}) = {||}"
1819
+ − 1241
by (lifting finter_raw_empty)
+ − 1242
+ − 1243
lemma finter_finsert:
1822
+ − 1244
"finsert x S |\<inter>| T = (if x |\<in>| T then finsert x (S |\<inter>| T) else S |\<inter>| T)"
1819
+ − 1245
by (lifting finter_raw.simps(2))
+ − 1246
+ − 1247
lemma fin_finter:
1822
+ − 1248
"x |\<in>| (S |\<inter>| T) \<longleftrightarrow> x |\<in>| S \<and> x |\<in>| T"
1819
+ − 1249
by (lifting memb_finter_raw)
+ − 1250
1893
+ − 1251
lemma fsubset_finsert:
+ − 1252
"(finsert x xs |\<subseteq>| ys) = (x |\<in>| ys \<and> xs |\<subseteq>| ys)"
+ − 1253
by (lifting sub_list_cons)
+ − 1254
1936
+ − 1255
lemma "xs |\<subseteq>| ys \<equiv> \<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys"
+ − 1256
by (lifting sub_list_def[simplified memb_def[symmetric]])
1893
+ − 1257
+ − 1258
lemma fsubset_fin: "xs |\<subseteq>| ys = (\<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys)"
+ − 1259
by (rule meta_eq_to_obj_eq)
+ − 1260
(lifting sub_list_def[simplified memb_def[symmetric]])
+ − 1261
2084
+ − 1262
lemma fminus_fin: "(x |\<in>| xs - ys) = (x |\<in>| xs \<and> x |\<notin>| ys)"
+ − 1263
by (lifting fminus_raw_memb)
+ − 1264
+ − 1265
lemma fminus_red: "finsert x xs - ys = (if x |\<in>| ys then xs - ys else finsert x (xs - ys))"
+ − 1266
by (lifting fminus_raw_red)
+ − 1267
+ − 1268
lemma fminus_red_fin[simp]: "x |\<in>| ys \<Longrightarrow> finsert x xs - ys = xs - ys"
+ − 1269
by (simp add: fminus_red)
+ − 1270
+ − 1271
lemma fminus_red_fnotin[simp]: "x |\<notin>| ys \<Longrightarrow> finsert x xs - ys = finsert x (xs - ys)"
+ − 1272
by (simp add: fminus_red)
+ − 1273
2479
+ − 1274
lemma fset_eq_iff:
1822
+ − 1275
"(S = T) = (\<forall>x. (x |\<in>| S) = (x |\<in>| T))"
1820
+ − 1276
by (lifting list_eq.simps[simplified memb_def[symmetric]])
+ − 1277
1888
+ − 1278
(* We cannot write it as "assumes .. shows" since Isabelle changes
+ − 1279
the quantifiers to schematic variables and reintroduces them in
+ − 1280
a different order *)
+ − 1281
lemma fset_eq_cases:
+ − 1282
"\<lbrakk>a1 = a2;
+ − 1283
\<And>a b xs. \<lbrakk>a1 = finsert a (finsert b xs); a2 = finsert b (finsert a xs)\<rbrakk> \<Longrightarrow> P;
+ − 1284
\<lbrakk>a1 = {||}; a2 = {||}\<rbrakk> \<Longrightarrow> P; \<And>xs ys. \<lbrakk>a1 = ys; a2 = xs; xs = ys\<rbrakk> \<Longrightarrow> P;
+ − 1285
\<And>a xs. \<lbrakk>a1 = finsert a (finsert a xs); a2 = finsert a xs\<rbrakk> \<Longrightarrow> P;
+ − 1286
\<And>xs ys a. \<lbrakk>a1 = finsert a xs; a2 = finsert a ys; xs = ys\<rbrakk> \<Longrightarrow> P;
+ − 1287
\<And>xs1 xs2 xs3. \<lbrakk>a1 = xs1; a2 = xs3; xs1 = xs2; xs2 = xs3\<rbrakk> \<Longrightarrow> P\<rbrakk>
+ − 1288
\<Longrightarrow> P"
+ − 1289
by (lifting list_eq2.cases[simplified list_eq2_equiv[symmetric]])
+ − 1290
+ − 1291
lemma fset_eq_induct:
+ − 1292
assumes "x1 = x2"
+ − 1293
and "\<And>a b xs. P (finsert a (finsert b xs)) (finsert b (finsert a xs))"
+ − 1294
and "P {||} {||}"
+ − 1295
and "\<And>xs ys. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P ys xs"
+ − 1296
and "\<And>a xs. P (finsert a (finsert a xs)) (finsert a xs)"
+ − 1297
and "\<And>xs ys a. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P (finsert a xs) (finsert a ys)"
+ − 1298
and "\<And>xs1 xs2 xs3. \<lbrakk>xs1 = xs2; P xs1 xs2; xs2 = xs3; P xs2 xs3\<rbrakk> \<Longrightarrow> P xs1 xs3"
+ − 1299
shows "P x1 x2"
+ − 1300
using assms
+ − 1301
by (lifting list_eq2.induct[simplified list_eq2_equiv[symmetric]])
1820
+ − 1302
1935
+ − 1303
text {* concat *}
+ − 1304
+ − 1305
lemma fconcat_empty:
+ − 1306
shows "fconcat {||} = {||}"
+ − 1307
by (lifting concat.simps(1))
+ − 1308
+ − 1309
lemma fconcat_insert:
+ − 1310
shows "fconcat (finsert x S) = x |\<union>| fconcat S"
+ − 1311
by (lifting concat.simps(2))
+ − 1312
2084
+ − 1313
text {* ffilter *}
+ − 1314
+ − 1315
lemma subseteq_filter: "ffilter P xs <= ffilter Q xs = (\<forall> x. x |\<in>| xs \<longrightarrow> P x \<longrightarrow> Q x)"
+ − 1316
by (lifting sub_list_filter)
+ − 1317
+ − 1318
lemma eq_ffilter: "(ffilter P xs = ffilter Q xs) = (\<forall>x. x |\<in>| xs \<longrightarrow> P x = Q x)"
+ − 1319
by (lifting list_eq_filter)
+ − 1320
2378
+ − 1321
lemma subset_ffilter:
+ − 1322
"(\<And>x. x |\<in>| xs \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> (x |\<in>| xs & \<not> P x & Q x) \<Longrightarrow> ffilter P xs < ffilter Q xs"
2084
+ − 1323
unfolding less_fset by (auto simp add: subseteq_filter eq_ffilter)
+ − 1324
+ − 1325
section {* lemmas transferred from Finite_Set theory *}
+ − 1326
+ − 1327
text {* finiteness for finite sets holds *}
+ − 1328
lemma finite_fset: "finite (fset_to_set S)"
+ − 1329
by (induct S) auto
+ − 1330
+ − 1331
lemma fset_choice: "\<forall>x. x |\<in>| A \<longrightarrow> (\<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. x |\<in>| A \<longrightarrow> P x (f x)"
+ − 1332
unfolding fset_to_set_trans
+ − 1333
by (rule finite_set_choice[simplified Ball_def, OF finite_fset])
+ − 1334
+ − 1335
lemma fsubseteq_fnil: "xs |\<subseteq>| {||} = (xs = {||})"
+ − 1336
unfolding fset_to_set_trans
+ − 1337
by (rule subset_empty)
+ − 1338
+ − 1339
lemma not_fsubset_fnil: "\<not> xs |\<subset>| {||}"
+ − 1340
unfolding fset_to_set_trans
+ − 1341
by (rule not_psubset_empty)
+ − 1342
+ − 1343
lemma fcard_mono: "xs |\<subseteq>| ys \<Longrightarrow> fcard xs \<le> fcard ys"
+ − 1344
unfolding fset_to_set_trans
+ − 1345
by (rule card_mono[OF finite_fset])
+ − 1346
+ − 1347
lemma fcard_fseteq: "xs |\<subseteq>| ys \<Longrightarrow> fcard ys \<le> fcard xs \<Longrightarrow> xs = ys"
+ − 1348
unfolding fset_to_set_trans
+ − 1349
by (rule card_seteq[OF finite_fset])
+ − 1350
+ − 1351
lemma psubset_fcard_mono: "xs |\<subset>| ys \<Longrightarrow> fcard xs < fcard ys"
+ − 1352
unfolding fset_to_set_trans
+ − 1353
by (rule psubset_card_mono[OF finite_fset])
+ − 1354
+ − 1355
lemma fcard_funion_finter: "fcard xs + fcard ys = fcard (xs |\<union>| ys) + fcard (xs |\<inter>| ys)"
+ − 1356
unfolding fset_to_set_trans
+ − 1357
by (rule card_Un_Int[OF finite_fset finite_fset])
+ − 1358
+ − 1359
lemma fcard_funion_disjoint: "xs |\<inter>| ys = {||} \<Longrightarrow> fcard (xs |\<union>| ys) = fcard xs + fcard ys"
+ − 1360
unfolding fset_to_set_trans
+ − 1361
by (rule card_Un_disjoint[OF finite_fset finite_fset])
+ − 1362
+ − 1363
lemma fcard_delete1_less: "x |\<in>| xs \<Longrightarrow> fcard (fdelete xs x) < fcard xs"
+ − 1364
unfolding fset_to_set_trans
+ − 1365
by (rule card_Diff1_less[OF finite_fset])
+ − 1366
+ − 1367
lemma fcard_delete2_less: "x |\<in>| xs \<Longrightarrow> y |\<in>| xs \<Longrightarrow> fcard (fdelete (fdelete xs x) y) < fcard xs"
+ − 1368
unfolding fset_to_set_trans
+ − 1369
by (rule card_Diff2_less[OF finite_fset])
+ − 1370
+ − 1371
lemma fcard_delete1_le: "fcard (fdelete xs x) <= fcard xs"
+ − 1372
unfolding fset_to_set_trans
+ − 1373
by (rule card_Diff1_le[OF finite_fset])
+ − 1374
+ − 1375
lemma fcard_psubset: "ys |\<subseteq>| xs \<Longrightarrow> fcard ys < fcard xs \<Longrightarrow> ys |\<subset>| xs"
+ − 1376
unfolding fset_to_set_trans
+ − 1377
by (rule card_psubset[OF finite_fset])
+ − 1378
+ − 1379
lemma fcard_fmap_le: "fcard (fmap f xs) \<le> fcard xs"
+ − 1380
unfolding fset_to_set_trans
+ − 1381
by (rule card_image_le[OF finite_fset])
+ − 1382
+ − 1383
lemma fin_fminus_fnotin: "x |\<in>| F - S \<Longrightarrow> x |\<notin>| S"
+ − 1384
unfolding fset_to_set_trans
+ − 1385
by blast
+ − 1386
+ − 1387
lemma fin_fnotin_fminus: "x |\<in>| S \<Longrightarrow> x |\<notin>| F - S"
+ − 1388
unfolding fset_to_set_trans
+ − 1389
by blast
+ − 1390
+ − 1391
lemma fin_mdef: "x |\<in>| F = ((x |\<notin>| (F - {|x|})) & (F = finsert x (F - {|x|})))"
+ − 1392
unfolding fset_to_set_trans
+ − 1393
by blast
+ − 1394
+ − 1395
lemma fcard_fminus_finsert[simp]:
+ − 1396
assumes "a |\<in>| A" and "a |\<notin>| B"
+ − 1397
shows "fcard(A - finsert a B) = fcard(A - B) - 1"
+ − 1398
using assms unfolding fset_to_set_trans
+ − 1399
by (rule card_Diff_insert[OF finite_fset])
+ − 1400
+ − 1401
lemma fcard_fminus_fsubset:
+ − 1402
assumes "B |\<subseteq>| A"
+ − 1403
shows "fcard (A - B) = fcard A - fcard B"
+ − 1404
using assms unfolding fset_to_set_trans
+ − 1405
by (rule card_Diff_subset[OF finite_fset])
+ − 1406
+ − 1407
lemma fcard_fminus_subset_finter:
+ − 1408
"fcard (A - B) = fcard A - fcard (A |\<inter>| B)"
+ − 1409
unfolding fset_to_set_trans
+ − 1410
by (rule card_Diff_subset_Int) (fold inter_set, rule finite_fset)
+ − 1411
2249
+ − 1412
lemma ball_reg_right_unfolded: "(\<forall>x. R x \<longrightarrow> P x \<longrightarrow> Q x) \<longrightarrow> (All P \<longrightarrow> Ball R Q)"
+ − 1413
apply rule
+ − 1414
apply (rule ball_reg_right)
+ − 1415
apply auto
+ − 1416
done
2234
+ − 1417
2326
+ − 1418
lemma list_all2_refl:
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1419
assumes q: "equivp R"
2326
+ − 1420
shows "(list_all2 R) r r"
2378
+ − 1421
by (rule list_all2_refl) (metis equivp_def q)
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1422
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1423
lemma compose_list_refl2:
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1424
assumes q: "equivp R"
2326
+ − 1425
shows "(list_all2 R OOO op \<approx>) r r"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1426
proof
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1427
have *: "r \<approx> r" by (rule equivp_reflp[OF fset_equivp])
2326
+ − 1428
show "list_all2 R r r" by (rule list_all2_refl[OF q])
+ − 1429
with * show "(op \<approx> OO list_all2 R) r r" ..
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1430
qed
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1431
2285
+ − 1432
lemma quotient_compose_list_g:
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1433
assumes q: "Quotient R Abs Rep"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1434
and e: "equivp R"
2326
+ − 1435
shows "Quotient ((list_all2 R) OOO (op \<approx>))
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1436
(abs_fset \<circ> (map Abs)) ((map Rep) \<circ> rep_fset)"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1437
unfolding Quotient_def comp_def
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1438
proof (intro conjI allI)
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1439
fix a r s
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1440
show "abs_fset (map Abs (map Rep (rep_fset a))) = a"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1441
by (simp add: abs_o_rep[OF q] Quotient_abs_rep[OF Quotient_fset] map_id)
2326
+ − 1442
have b: "list_all2 R (map Rep (rep_fset a)) (map Rep (rep_fset a))"
+ − 1443
by (rule list_all2_refl[OF e])
+ − 1444
have c: "(op \<approx> OO list_all2 R) (map Rep (rep_fset a)) (map Rep (rep_fset a))"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1445
by (rule, rule equivp_reflp[OF fset_equivp]) (rule b)
2326
+ − 1446
show "(list_all2 R OOO op \<approx>) (map Rep (rep_fset a)) (map Rep (rep_fset a))"
+ − 1447
by (rule, rule list_all2_refl[OF e]) (rule c)
+ − 1448
show "(list_all2 R OOO op \<approx>) r s = ((list_all2 R OOO op \<approx>) r r \<and>
+ − 1449
(list_all2 R OOO op \<approx>) s s \<and> abs_fset (map Abs r) = abs_fset (map Abs s))"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1450
proof (intro iffI conjI)
2326
+ − 1451
show "(list_all2 R OOO op \<approx>) r r" by (rule compose_list_refl2[OF e])
+ − 1452
show "(list_all2 R OOO op \<approx>) s s" by (rule compose_list_refl2[OF e])
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1453
next
2326
+ − 1454
assume a: "(list_all2 R OOO op \<approx>) r s"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1455
then have b: "map Abs r \<approx> map Abs s"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1456
proof (elim pred_compE)
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1457
fix b ba
2326
+ − 1458
assume c: "list_all2 R r b"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1459
assume d: "b \<approx> ba"
2326
+ − 1460
assume e: "list_all2 R ba s"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1461
have f: "map Abs r = map Abs b"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1462
using Quotient_rel[OF list_quotient[OF q]] c by blast
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1463
have "map Abs ba = map Abs s"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1464
using Quotient_rel[OF list_quotient[OF q]] e by blast
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1465
then have g: "map Abs s = map Abs ba" by simp
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1466
then show "map Abs r \<approx> map Abs s" using d f map_rel_cong by simp
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1467
qed
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1468
then show "abs_fset (map Abs r) = abs_fset (map Abs s)"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1469
using Quotient_rel[OF Quotient_fset] by blast
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1470
next
2326
+ − 1471
assume a: "(list_all2 R OOO op \<approx>) r r \<and> (list_all2 R OOO op \<approx>) s s
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1472
\<and> abs_fset (map Abs r) = abs_fset (map Abs s)"
2326
+ − 1473
then have s: "(list_all2 R OOO op \<approx>) s s" by simp
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1474
have d: "map Abs r \<approx> map Abs s"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1475
by (subst Quotient_rel[OF Quotient_fset]) (simp add: a)
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1476
have b: "map Rep (map Abs r) \<approx> map Rep (map Abs s)"
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1477
by (rule map_rel_cong[OF d])
2326
+ − 1478
have y: "list_all2 R (map Rep (map Abs s)) s"
+ − 1479
by (fact rep_abs_rsp_left[OF list_quotient[OF q], OF list_all2_refl[OF e, of s]])
+ − 1480
have c: "(op \<approx> OO list_all2 R) (map Rep (map Abs r)) s"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1481
by (rule pred_compI) (rule b, rule y)
2326
+ − 1482
have z: "list_all2 R r (map Rep (map Abs r))"
+ − 1483
by (fact rep_abs_rsp[OF list_quotient[OF q], OF list_all2_refl[OF e, of r]])
+ − 1484
then show "(list_all2 R OOO op \<approx>) r s"
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1485
using a c pred_compI by simp
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1486
qed
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1487
qed
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1488
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1489
no_notation
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1490
list_eq (infix "\<approx>" 50)
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1491
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 1492
2234
+ − 1493
end