| author | wenzelm | 
| Tue, 05 Mar 2024 20:58:41 +0100 | |
| changeset 79793 | 6f08aef43dc5 | 
| parent 74224 | e04ec2b9ed97 | 
| child 80695 | 3b6d84c32bfd | 
| permissions | -rw-r--r-- | 
| 
63920
 
003622e08379
resolve the name clash of HOL/Library/FSet and HOL/Quotient_Examples/FSet
 
kuncar 
parents: 
63167 
diff
changeset
 | 
1  | 
(* Title: HOL/Quotient_Examples/Quotient_FSet.thy  | 
| 36465 | 2  | 
Author: Cezary Kaliszyk, TU Munich  | 
3  | 
Author: Christian Urban, TU Munich  | 
|
| 36280 | 4  | 
|
| 41467 | 5  | 
Type of finite sets.  | 
| 36280 | 6  | 
*)  | 
| 36465 | 7  | 
|
| 
54336
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
8  | 
(********************************************************************  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
9  | 
WARNING: There is a formalization of 'a fset as a subtype of sets in  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
10  | 
HOL/Library/FSet.thy using Lifting/Transfer. The user should use  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
11  | 
that file rather than this file unless there are some very specific  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
12  | 
reasons.  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
13  | 
*********************************************************************)  | 
| 
 
9a21e5c6e5d9
declare Quotient_Examples/FSet.thy as almost obsolete
 
kuncar 
parents: 
53374 
diff
changeset
 | 
14  | 
|
| 
63920
 
003622e08379
resolve the name clash of HOL/Library/FSet and HOL/Quotient_Examples/FSet
 
kuncar 
parents: 
63167 
diff
changeset
 | 
15  | 
theory Quotient_FSet  | 
| 
66453
 
cc19f7ca2ed6
session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
 
wenzelm 
parents: 
63920 
diff
changeset
 | 
16  | 
imports "HOL-Library.Multiset" "HOL-Library.Quotient_List"  | 
| 36280 | 17  | 
begin  | 
18  | 
||
| 63167 | 19  | 
text \<open>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
20  | 
The type of finite sets is created by a quotient construction  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
21  | 
over lists. The definition of the equivalence:  | 
| 63167 | 22  | 
\<close>  | 
| 36280 | 23  | 
|
| 
40467
 
dc0439fdd7c5
more appropriate specification packages; fun_rel_def is no simp rule by default
 
haftmann 
parents: 
40034 
diff
changeset
 | 
24  | 
definition  | 
| 36280 | 25  | 
list_eq :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" (infix "\<approx>" 50)  | 
26  | 
where  | 
|
| 40952 | 27  | 
[simp]: "xs \<approx> ys \<longleftrightarrow> set xs = set ys"  | 
| 36280 | 28  | 
|
| 40822 | 29  | 
lemma list_eq_reflp:  | 
30  | 
"reflp list_eq"  | 
|
31  | 
by (auto intro: reflpI)  | 
|
32  | 
||
33  | 
lemma list_eq_symp:  | 
|
34  | 
"symp list_eq"  | 
|
35  | 
by (auto intro: sympI)  | 
|
36  | 
||
37  | 
lemma list_eq_transp:  | 
|
38  | 
"transp list_eq"  | 
|
39  | 
by (auto intro: transpI)  | 
|
40  | 
||
| 36280 | 41  | 
lemma list_eq_equivp:  | 
| 40822 | 42  | 
"equivp list_eq"  | 
43  | 
by (auto intro: equivpI list_eq_reflp list_eq_symp list_eq_transp)  | 
|
| 36280 | 44  | 
|
| 63167 | 45  | 
text \<open>The \<open>fset\<close> type\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
46  | 
|
| 36280 | 47  | 
quotient_type  | 
48  | 
'a fset = "'a list" / "list_eq"  | 
|
49  | 
by (rule list_eq_equivp)  | 
|
50  | 
||
| 63167 | 51  | 
text \<open>  | 
| 40953 | 52  | 
Definitions for sublist, cardinality,  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
53  | 
intersection, difference and respectful fold over  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
54  | 
lists.  | 
| 63167 | 55  | 
\<close>  | 
| 36280 | 56  | 
|
| 40953 | 57  | 
declare List.member_def [simp]  | 
| 36280 | 58  | 
|
| 40034 | 59  | 
definition  | 
| 36280 | 60  | 
sub_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
61  | 
where  | 
| 40034 | 62  | 
[simp]: "sub_list xs ys \<longleftrightarrow> set xs \<subseteq> set ys"  | 
| 36280 | 63  | 
|
| 40034 | 64  | 
definition  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
65  | 
card_list :: "'a list \<Rightarrow> nat"  | 
| 36280 | 66  | 
where  | 
| 40034 | 67  | 
[simp]: "card_list xs = card (set xs)"  | 
| 
36675
 
806ea6e282e4
fminus and some more theorems ported from Finite_Set.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36646 
diff
changeset
 | 
68  | 
|
| 40034 | 69  | 
definition  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
70  | 
inter_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"  | 
| 
36675
 
806ea6e282e4
fminus and some more theorems ported from Finite_Set.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36646 
diff
changeset
 | 
71  | 
where  | 
| 68386 | 72  | 
[simp]: "inter_list xs ys = [x \<leftarrow> xs. x \<in> set xs \<and> x \<in> set ys]"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
73  | 
|
| 40034 | 74  | 
definition  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
75  | 
diff_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
76  | 
where  | 
| 68386 | 77  | 
[simp]: "diff_list xs ys = [x \<leftarrow> xs. x \<notin> set ys]"  | 
| 36280 | 78  | 
|
79  | 
definition  | 
|
| 
40954
 
ecca598474dd
conventional point-free characterization of rsp_fold
 
haftmann 
parents: 
40953 
diff
changeset
 | 
80  | 
  rsp_fold :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> bool"
 | 
| 36280 | 81  | 
where  | 
| 
40954
 
ecca598474dd
conventional point-free characterization of rsp_fold
 
haftmann 
parents: 
40953 
diff
changeset
 | 
82  | 
"rsp_fold f \<longleftrightarrow> (\<forall>u v. f u \<circ> f v = f v \<circ> f u)"  | 
| 36280 | 83  | 
|
| 40961 | 84  | 
lemma rsp_foldI:  | 
85  | 
"(\<And>u v. f u \<circ> f v = f v \<circ> f u) \<Longrightarrow> rsp_fold f"  | 
|
86  | 
by (simp add: rsp_fold_def)  | 
|
87  | 
||
88  | 
lemma rsp_foldE:  | 
|
89  | 
assumes "rsp_fold f"  | 
|
90  | 
obtains "f u \<circ> f v = f v \<circ> f u"  | 
|
91  | 
using assms by (simp add: rsp_fold_def)  | 
|
92  | 
||
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
93  | 
definition  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
94  | 
  fold_once :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'a list \<Rightarrow> 'b \<Rightarrow> 'b"
 | 
| 36280 | 95  | 
where  | 
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
96  | 
"fold_once f xs = (if rsp_fold f then fold f (remdups xs) else id)"  | 
| 36280 | 97  | 
|
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
98  | 
lemma fold_once_default [simp]:  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
99  | 
"\<not> rsp_fold f \<Longrightarrow> fold_once f xs = id"  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
100  | 
by (simp add: fold_once_def)  | 
| 40961 | 101  | 
|
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
102  | 
lemma fold_once_fold_remdups:  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
103  | 
"rsp_fold f \<Longrightarrow> fold_once f xs = fold f (remdups xs)"  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
104  | 
by (simp add: fold_once_def)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
105  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
106  | 
|
| 63167 | 107  | 
section \<open>Quotient composition lemmas\<close>  | 
| 36280 | 108  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
109  | 
lemma list_all2_refl':  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
110  | 
assumes q: "equivp R"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
111  | 
shows "(list_all2 R) r r"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
112  | 
by (rule list_all2_refl) (metis equivp_def q)  | 
| 36280 | 113  | 
|
114  | 
lemma compose_list_refl:  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
115  | 
assumes q: "equivp R"  | 
| 67399 | 116  | 
shows "(list_all2 R OOO (\<approx>)) r r"  | 
| 36280 | 117  | 
proof  | 
| 36465 | 118  | 
have *: "r \<approx> r" by (rule equivp_reflp[OF fset_equivp])  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
119  | 
show "list_all2 R r r" by (rule list_all2_refl'[OF q])  | 
| 67399 | 120  | 
with * show "((\<approx>) OO list_all2 R) r r" ..  | 
| 36280 | 121  | 
qed  | 
122  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
123  | 
lemma map_list_eq_cong: "b \<approx> ba \<Longrightarrow> map f b \<approx> map f ba"  | 
| 
40467
 
dc0439fdd7c5
more appropriate specification packages; fun_rel_def is no simp rule by default
 
haftmann 
parents: 
40034 
diff
changeset
 | 
124  | 
by (simp only: list_eq_def set_map)  | 
| 36280 | 125  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
126  | 
lemma quotient_compose_list_g:  | 
| 47308 | 127  | 
assumes q: "Quotient3 R Abs Rep"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
128  | 
and e: "equivp R"  | 
| 67399 | 129  | 
shows "Quotient3 ((list_all2 R) OOO (\<approx>))  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
130  | 
(abs_fset \<circ> (map Abs)) ((map Rep) \<circ> rep_fset)"  | 
| 47308 | 131  | 
unfolding Quotient3_def comp_def  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
132  | 
proof (intro conjI allI)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
133  | 
fix a r s  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
134  | 
show "abs_fset (map Abs (map Rep (rep_fset a))) = a"  | 
| 47308 | 135  | 
by (simp add: abs_o_rep[OF q] Quotient3_abs_rep[OF Quotient3_fset] List.map.id)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
136  | 
have b: "list_all2 R (map Rep (rep_fset a)) (map Rep (rep_fset a))"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
137  | 
by (rule list_all2_refl'[OF e])  | 
| 67399 | 138  | 
have c: "((\<approx>) OO list_all2 R) (map Rep (rep_fset a)) (map Rep (rep_fset a))"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
139  | 
by (rule, rule equivp_reflp[OF fset_equivp]) (rule b)  | 
| 67399 | 140  | 
show "(list_all2 R OOO (\<approx>)) (map Rep (rep_fset a)) (map Rep (rep_fset a))"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
141  | 
by (rule, rule list_all2_refl'[OF e]) (rule c)  | 
| 67399 | 142  | 
show "(list_all2 R OOO (\<approx>)) r s = ((list_all2 R OOO (\<approx>)) r r \<and>  | 
143  | 
(list_all2 R OOO (\<approx>)) s s \<and> abs_fset (map Abs r) = abs_fset (map Abs s))"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
144  | 
proof (intro iffI conjI)  | 
| 67399 | 145  | 
show "(list_all2 R OOO (\<approx>)) r r" by (rule compose_list_refl[OF e])  | 
146  | 
show "(list_all2 R OOO (\<approx>)) s s" by (rule compose_list_refl[OF e])  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
147  | 
next  | 
| 67399 | 148  | 
assume a: "(list_all2 R OOO (\<approx>)) r s"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
149  | 
then have b: "map Abs r \<approx> map Abs s"  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
150  | 
proof (elim relcomppE)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
151  | 
fix b ba  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
152  | 
assume c: "list_all2 R r b"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
153  | 
assume d: "b \<approx> ba"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
154  | 
assume e: "list_all2 R ba s"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
155  | 
have f: "map Abs r = map Abs b"  | 
| 47308 | 156  | 
using Quotient3_rel[OF list_quotient3[OF q]] c by blast  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
157  | 
have "map Abs ba = map Abs s"  | 
| 47308 | 158  | 
using Quotient3_rel[OF list_quotient3[OF q]] e by blast  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
159  | 
then have g: "map Abs s = map Abs ba" by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
160  | 
then show "map Abs r \<approx> map Abs s" using d f map_list_eq_cong by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
161  | 
qed  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
162  | 
then show "abs_fset (map Abs r) = abs_fset (map Abs s)"  | 
| 47308 | 163  | 
using Quotient3_rel[OF Quotient3_fset] by blast  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
164  | 
next  | 
| 67399 | 165  | 
assume a: "(list_all2 R OOO (\<approx>)) r r \<and> (list_all2 R OOO (\<approx>)) s s  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
166  | 
\<and> abs_fset (map Abs r) = abs_fset (map Abs s)"  | 
| 67399 | 167  | 
then have s: "(list_all2 R OOO (\<approx>)) s s" by simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
168  | 
have d: "map Abs r \<approx> map Abs s"  | 
| 47308 | 169  | 
by (subst Quotient3_rel [OF Quotient3_fset, symmetric]) (simp add: a)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
170  | 
have b: "map Rep (map Abs r) \<approx> map Rep (map Abs s)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
171  | 
by (rule map_list_eq_cong[OF d])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
172  | 
have y: "list_all2 R (map Rep (map Abs s)) s"  | 
| 47308 | 173  | 
by (fact rep_abs_rsp_left[OF list_quotient3[OF q], OF list_all2_refl'[OF e, of s]])  | 
| 67399 | 174  | 
have c: "((\<approx>) OO list_all2 R) (map Rep (map Abs r)) s"  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
175  | 
by (rule relcomppI) (rule b, rule y)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
176  | 
have z: "list_all2 R r (map Rep (map Abs r))"  | 
| 47308 | 177  | 
by (fact rep_abs_rsp[OF list_quotient3[OF q], OF list_all2_refl'[OF e, of r]])  | 
| 67399 | 178  | 
then show "(list_all2 R OOO (\<approx>)) r s"  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
179  | 
using a c relcomppI by simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
180  | 
qed  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
181  | 
qed  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
182  | 
|
| 36280 | 183  | 
lemma quotient_compose_list[quot_thm]:  | 
| 67399 | 184  | 
shows "Quotient3 ((list_all2 (\<approx>)) OOO (\<approx>))  | 
| 36280 | 185  | 
(abs_fset \<circ> (map abs_fset)) ((map rep_fset) \<circ> rep_fset)"  | 
| 47308 | 186  | 
by (rule quotient_compose_list_g, rule Quotient3_fset, rule list_eq_equivp)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
187  | 
|
| 36280 | 188  | 
|
| 63167 | 189  | 
section \<open>Quotient definitions for fsets\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
190  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
191  | 
|
| 63167 | 192  | 
subsection \<open>Finite sets are a bounded, distributive lattice with minus\<close>  | 
| 36280 | 193  | 
|
| 
37634
 
2116425cebc8
cleaned by using descending instead of lifting
 
Christian Urban <urbanc@in.tum.de> 
parents: 
37492 
diff
changeset
 | 
194  | 
instantiation fset :: (type) "{bounded_lattice_bot, distrib_lattice, minus}"
 | 
| 36280 | 195  | 
begin  | 
196  | 
||
197  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
198  | 
"bot :: 'a fset"  | 
| 47092 | 199  | 
is "Nil :: 'a list" done  | 
| 36280 | 200  | 
|
201  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
202  | 
  empty_fset  ("{||}")
 | 
| 36280 | 203  | 
where  | 
204  | 
  "{||} \<equiv> bot :: 'a fset"
 | 
|
205  | 
||
206  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
207  | 
  "less_eq_fset :: ('a fset \<Rightarrow> 'a fset \<Rightarrow> bool)"
 | 
| 47092 | 208  | 
  is "sub_list :: ('a list \<Rightarrow> 'a list \<Rightarrow> bool)" by simp
 | 
| 36280 | 209  | 
|
210  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
211  | 
subset_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subseteq>|" 50)  | 
| 36280 | 212  | 
where  | 
213  | 
"xs |\<subseteq>| ys \<equiv> xs \<le> ys"  | 
|
214  | 
||
215  | 
definition  | 
|
| 39995 | 216  | 
less_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool"  | 
217  | 
where  | 
|
218  | 
"xs < ys \<equiv> xs \<le> ys \<and> xs \<noteq> (ys::'a fset)"  | 
|
| 36280 | 219  | 
|
220  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
221  | 
psubset_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subset>|" 50)  | 
| 36280 | 222  | 
where  | 
223  | 
"xs |\<subset>| ys \<equiv> xs < ys"  | 
|
224  | 
||
225  | 
quotient_definition  | 
|
| 39995 | 226  | 
"sup :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset"  | 
| 47092 | 227  | 
is "append :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" by simp  | 
| 36280 | 228  | 
|
229  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
230  | 
union_fset (infixl "|\<union>|" 65)  | 
| 36280 | 231  | 
where  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
232  | 
"xs |\<union>| ys \<equiv> sup xs (ys::'a fset)"  | 
| 36280 | 233  | 
|
234  | 
quotient_definition  | 
|
| 39995 | 235  | 
"inf :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset"  | 
| 47092 | 236  | 
is "inter_list :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" by simp  | 
| 36280 | 237  | 
|
238  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
239  | 
inter_fset (infixl "|\<inter>|" 65)  | 
| 36280 | 240  | 
where  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
241  | 
"xs |\<inter>| ys \<equiv> inf xs (ys::'a fset)"  | 
| 36280 | 242  | 
|
| 
36675
 
806ea6e282e4
fminus and some more theorems ported from Finite_Set.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36646 
diff
changeset
 | 
243  | 
quotient_definition  | 
| 
37634
 
2116425cebc8
cleaned by using descending instead of lifting
 
Christian Urban <urbanc@in.tum.de> 
parents: 
37492 
diff
changeset
 | 
244  | 
"minus :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset"  | 
| 47092 | 245  | 
is "diff_list :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" by fastforce  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
246  | 
|
| 36280 | 247  | 
instance  | 
248  | 
proof  | 
|
249  | 
fix x y z :: "'a fset"  | 
|
| 
37634
 
2116425cebc8
cleaned by using descending instead of lifting
 
Christian Urban <urbanc@in.tum.de> 
parents: 
37492 
diff
changeset
 | 
250  | 
show "x |\<subset>| y \<longleftrightarrow> x |\<subseteq>| y \<and> \<not> y |\<subseteq>| x"  | 
| 
40467
 
dc0439fdd7c5
more appropriate specification packages; fun_rel_def is no simp rule by default
 
haftmann 
parents: 
40034 
diff
changeset
 | 
251  | 
by (unfold less_fset_def, descending) auto  | 
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
252  | 
show "x |\<subseteq>| x" by (descending) (simp)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
253  | 
  show "{||} |\<subseteq>| x" by (descending) (simp)
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
254  | 
show "x |\<subseteq>| x |\<union>| y" by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
255  | 
show "y |\<subseteq>| x |\<union>| y" by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
256  | 
show "x |\<inter>| y |\<subseteq>| x" by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
257  | 
show "x |\<inter>| y |\<subseteq>| y" by (descending) (auto)  | 
| 
37634
 
2116425cebc8
cleaned by using descending instead of lifting
 
Christian Urban <urbanc@in.tum.de> 
parents: 
37492 
diff
changeset
 | 
258  | 
show "x |\<union>| (y |\<inter>| z) = x |\<union>| y |\<inter>| (x |\<union>| z)"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
259  | 
by (descending) (auto)  | 
| 36280 | 260  | 
next  | 
261  | 
fix x y z :: "'a fset"  | 
|
262  | 
assume a: "x |\<subseteq>| y"  | 
|
263  | 
assume b: "y |\<subseteq>| z"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
264  | 
show "x |\<subseteq>| z" using a b by (descending) (simp)  | 
| 36280 | 265  | 
next  | 
266  | 
fix x y :: "'a fset"  | 
|
267  | 
assume a: "x |\<subseteq>| y"  | 
|
268  | 
assume b: "y |\<subseteq>| x"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
269  | 
show "x = y" using a b by (descending) (auto)  | 
| 36280 | 270  | 
next  | 
271  | 
fix x y z :: "'a fset"  | 
|
272  | 
assume a: "y |\<subseteq>| x"  | 
|
273  | 
assume b: "z |\<subseteq>| x"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
274  | 
show "y |\<union>| z |\<subseteq>| x" using a b by (descending) (simp)  | 
| 36280 | 275  | 
next  | 
276  | 
fix x y z :: "'a fset"  | 
|
277  | 
assume a: "x |\<subseteq>| y"  | 
|
278  | 
assume b: "x |\<subseteq>| z"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
279  | 
show "x |\<subseteq>| y |\<inter>| z" using a b by (descending) (auto)  | 
| 36280 | 280  | 
qed  | 
281  | 
||
282  | 
end  | 
|
283  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
284  | 
|
| 63167 | 285  | 
subsection \<open>Other constants for fsets\<close>  | 
| 36280 | 286  | 
|
287  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
288  | 
"insert_fset :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset"  | 
| 47092 | 289  | 
is "Cons" by auto  | 
| 36280 | 290  | 
|
291  | 
syntax  | 
|
| 45343 | 292  | 
  "_insert_fset"     :: "args => 'a fset"  ("{|(_)|}")
 | 
| 36280 | 293  | 
|
294  | 
translations  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
295  | 
  "{|x, xs|}" == "CONST insert_fset x {|xs|}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
296  | 
  "{|x|}"     == "CONST insert_fset x {||}"
 | 
| 36280 | 297  | 
|
298  | 
quotient_definition  | 
|
| 40953 | 299  | 
fset_member  | 
| 36280 | 300  | 
where  | 
| 47092 | 301  | 
"fset_member :: 'a fset \<Rightarrow> 'a \<Rightarrow> bool" is "List.member" by fastforce  | 
| 40953 | 302  | 
|
303  | 
abbreviation  | 
|
304  | 
in_fset :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<in>|" 50)  | 
|
305  | 
where  | 
|
306  | 
"x |\<in>| S \<equiv> fset_member S x"  | 
|
| 36280 | 307  | 
|
308  | 
abbreviation  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
309  | 
notin_fset :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<notin>|" 50)  | 
| 36280 | 310  | 
where  | 
311  | 
"x |\<notin>| S \<equiv> \<not> (x |\<in>| S)"  | 
|
312  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
313  | 
|
| 63167 | 314  | 
subsection \<open>Other constants on the Quotient Type\<close>  | 
| 36280 | 315  | 
|
316  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
317  | 
"card_fset :: 'a fset \<Rightarrow> nat"  | 
| 47092 | 318  | 
is card_list by simp  | 
| 36280 | 319  | 
|
320  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
321  | 
  "map_fset :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset"
 | 
| 47092 | 322  | 
is map by simp  | 
| 36280 | 323  | 
|
324  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
325  | 
"remove_fset :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset"  | 
| 47092 | 326  | 
is removeAll by simp  | 
| 36280 | 327  | 
|
328  | 
quotient_definition  | 
|
| 
39996
 
c02078ff8691
FSet: definition changes propagated from Nominal and more use of 'descending' tactic
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
39995 
diff
changeset
 | 
329  | 
"fset :: 'a fset \<Rightarrow> 'a set"  | 
| 47092 | 330  | 
is "set" by simp  | 
331  | 
||
332  | 
lemma fold_once_set_equiv:  | 
|
333  | 
assumes "xs \<approx> ys"  | 
|
334  | 
shows "fold_once f xs = fold_once f ys"  | 
|
335  | 
proof (cases "rsp_fold f")  | 
|
336  | 
case False then show ?thesis by simp  | 
|
337  | 
next  | 
|
338  | 
case True  | 
|
339  | 
then have "\<And>x y. x \<in> set (remdups xs) \<Longrightarrow> y \<in> set (remdups xs) \<Longrightarrow> f x \<circ> f y = f y \<circ> f x"  | 
|
340  | 
by (rule rsp_foldE)  | 
|
| 60515 | 341  | 
moreover from assms have "mset (remdups xs) = mset (remdups ys)"  | 
342  | 
by (simp add: set_eq_iff_mset_remdups_eq)  | 
|
| 47092 | 343  | 
ultimately have "fold f (remdups xs) = fold f (remdups ys)"  | 
344  | 
by (rule fold_multiset_equiv)  | 
|
345  | 
with True show ?thesis by (simp add: fold_once_fold_remdups)  | 
|
346  | 
qed  | 
|
| 36280 | 347  | 
|
348  | 
quotient_definition  | 
|
| 40961 | 349  | 
  "fold_fset :: ('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b \<Rightarrow> 'b"
 | 
| 47092 | 350  | 
is fold_once by (rule fold_once_set_equiv)  | 
351  | 
||
352  | 
lemma concat_rsp_pre:  | 
|
| 67399 | 353  | 
assumes a: "list_all2 (\<approx>) x x'"  | 
| 47092 | 354  | 
and b: "x' \<approx> y'"  | 
| 67399 | 355  | 
and c: "list_all2 (\<approx>) y' y"  | 
| 47092 | 356  | 
and d: "\<exists>x\<in>set x. xa \<in> set x"  | 
357  | 
shows "\<exists>x\<in>set y. xa \<in> set x"  | 
|
358  | 
proof -  | 
|
359  | 
obtain xb where e: "xb \<in> set x" and f: "xa \<in> set xb" using d by auto  | 
|
360  | 
have "\<exists>y. y \<in> set x' \<and> xb \<approx> y" by (rule list_all2_find_element[OF e a])  | 
|
361  | 
then obtain ya where h: "ya \<in> set x'" and i: "xb \<approx> ya" by auto  | 
|
362  | 
have "ya \<in> set y'" using b h by simp  | 
|
363  | 
then have "\<exists>yb. yb \<in> set y \<and> ya \<approx> yb" using c by (rule list_all2_find_element)  | 
|
364  | 
then show ?thesis using f i by auto  | 
|
365  | 
qed  | 
|
| 36280 | 366  | 
|
367  | 
quotient_definition  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
368  | 
  "concat_fset :: ('a fset) fset \<Rightarrow> 'a fset"
 | 
| 47092 | 369  | 
is concat  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
370  | 
proof (elim relcomppE)  | 
| 47092 | 371  | 
fix a b ba bb  | 
| 67399 | 372  | 
assume a: "list_all2 (\<approx>) a ba"  | 
373  | 
with list_symp [OF list_eq_symp] have a': "list_all2 (\<approx>) ba a" by (rule sympE)  | 
|
| 47092 | 374  | 
assume b: "ba \<approx> bb"  | 
375  | 
with list_eq_symp have b': "bb \<approx> ba" by (rule sympE)  | 
|
| 67399 | 376  | 
assume c: "list_all2 (\<approx>) bb b"  | 
377  | 
with list_symp [OF list_eq_symp] have c': "list_all2 (\<approx>) b bb" by (rule sympE)  | 
|
| 47092 | 378  | 
have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)"  | 
379  | 
proof  | 
|
380  | 
fix x  | 
|
381  | 
show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)"  | 
|
382  | 
proof  | 
|
383  | 
assume d: "\<exists>xa\<in>set a. x \<in> set xa"  | 
|
384  | 
show "\<exists>xa\<in>set b. x \<in> set xa" by (rule concat_rsp_pre[OF a b c d])  | 
|
385  | 
next  | 
|
386  | 
assume e: "\<exists>xa\<in>set b. x \<in> set xa"  | 
|
387  | 
show "\<exists>xa\<in>set a. x \<in> set xa" by (rule concat_rsp_pre[OF c' b' a' e])  | 
|
388  | 
qed  | 
|
389  | 
qed  | 
|
390  | 
then show "concat a \<approx> concat b" by auto  | 
|
391  | 
qed  | 
|
| 36280 | 392  | 
|
| 
36639
 
6243b49498ea
added function ffilter and some lemmas from Finite_Set to the FSet theory
 
bulwahn 
parents: 
36524 
diff
changeset
 | 
393  | 
quotient_definition  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
394  | 
  "filter_fset :: ('a \<Rightarrow> bool) \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
 | 
| 47092 | 395  | 
is filter by force  | 
| 
36639
 
6243b49498ea
added function ffilter and some lemmas from Finite_Set to the FSet theory
 
bulwahn 
parents: 
36524 
diff
changeset
 | 
396  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
397  | 
|
| 63167 | 398  | 
subsection \<open>Compositional respectfulness and preservation lemmas\<close>  | 
| 36280 | 399  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
400  | 
lemma Nil_rsp2 [quot_respect]:  | 
| 67399 | 401  | 
shows "(list_all2 (\<approx>) OOO (\<approx>)) Nil Nil"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
402  | 
by (rule compose_list_refl, rule list_eq_equivp)  | 
| 36280 | 403  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
404  | 
lemma Cons_rsp2 [quot_respect]:  | 
| 67399 | 405  | 
shows "((\<approx>) ===> list_all2 (\<approx>) OOO (\<approx>) ===> list_all2 (\<approx>) OOO (\<approx>)) Cons Cons"  | 
| 55945 | 406  | 
apply (auto intro!: rel_funI)  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
407  | 
apply (rule_tac b="x # b" in relcomppI)  | 
| 36280 | 408  | 
apply auto  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
409  | 
apply (rule_tac b="x # ba" in relcomppI)  | 
| 36280 | 410  | 
apply auto  | 
411  | 
done  | 
|
412  | 
||
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
413  | 
lemma Nil_prs2 [quot_preserve]:  | 
| 47308 | 414  | 
assumes "Quotient3 R Abs Rep"  | 
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
415  | 
shows "(Abs \<circ> map f) [] = Abs []"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
416  | 
by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
417  | 
|
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
418  | 
lemma Cons_prs2 [quot_preserve]:  | 
| 47308 | 419  | 
assumes q: "Quotient3 R1 Abs1 Rep1"  | 
420  | 
and r: "Quotient3 R2 Abs2 Rep2"  | 
|
| 67399 | 421  | 
shows "(Rep1 ---> (map Rep1 \<circ> Rep2) ---> (Abs2 \<circ> map Abs1)) (#) = (id ---> Rep2 ---> Abs2) (#)"  | 
| 47308 | 422  | 
by (auto simp add: fun_eq_iff comp_def Quotient3_abs_rep [OF q])  | 
| 36280 | 423  | 
|
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
424  | 
lemma append_prs2 [quot_preserve]:  | 
| 47308 | 425  | 
assumes q: "Quotient3 R1 Abs1 Rep1"  | 
426  | 
and r: "Quotient3 R2 Abs2 Rep2"  | 
|
| 67399 | 427  | 
shows "((map Rep1 \<circ> Rep2) ---> (map Rep1 \<circ> Rep2) ---> (Abs2 \<circ> map Abs1)) (@) =  | 
428  | 
(Rep2 ---> Rep2 ---> Abs2) (@)"  | 
|
| 46663 | 429  | 
by (simp add: fun_eq_iff abs_o_rep[OF q] List.map.id)  | 
| 36280 | 430  | 
|
| 
37492
 
ab36b1a50ca8
Replace 'list_rel' by 'list_all2'; they are equivalent.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36675 
diff
changeset
 | 
431  | 
lemma list_all2_app_l:  | 
| 36280 | 432  | 
assumes a: "reflp R"  | 
| 
37492
 
ab36b1a50ca8
Replace 'list_rel' by 'list_all2'; they are equivalent.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36675 
diff
changeset
 | 
433  | 
and b: "list_all2 R l r"  | 
| 
 
ab36b1a50ca8
Replace 'list_rel' by 'list_all2'; they are equivalent.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36675 
diff
changeset
 | 
434  | 
shows "list_all2 R (z @ l) (z @ r)"  | 
| 40822 | 435  | 
using a b by (induct z) (auto elim: reflpE)  | 
| 36280 | 436  | 
|
437  | 
lemma append_rsp2_pre0:  | 
|
| 67399 | 438  | 
assumes a:"list_all2 (\<approx>) x x'"  | 
439  | 
shows "list_all2 (\<approx>) (x @ z) (x' @ z)"  | 
|
| 36280 | 440  | 
using a apply (induct x x' rule: list_induct2')  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
441  | 
by simp_all (rule list_all2_refl'[OF list_eq_equivp])  | 
| 36280 | 442  | 
|
443  | 
lemma append_rsp2_pre1:  | 
|
| 67399 | 444  | 
assumes a:"list_all2 (\<approx>) x x'"  | 
445  | 
shows "list_all2 (\<approx>) (z @ x) (z @ x')"  | 
|
| 36280 | 446  | 
using a apply (induct x x' arbitrary: z rule: list_induct2')  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
447  | 
apply (rule list_all2_refl'[OF list_eq_equivp])  | 
| 
40467
 
dc0439fdd7c5
more appropriate specification packages; fun_rel_def is no simp rule by default
 
haftmann 
parents: 
40034 
diff
changeset
 | 
448  | 
apply (simp_all del: list_eq_def)  | 
| 
37492
 
ab36b1a50ca8
Replace 'list_rel' by 'list_all2'; they are equivalent.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36675 
diff
changeset
 | 
449  | 
apply (rule list_all2_app_l)  | 
| 40822 | 450  | 
apply (simp_all add: reflpI)  | 
| 36280 | 451  | 
done  | 
452  | 
||
453  | 
lemma append_rsp2_pre:  | 
|
| 67399 | 454  | 
assumes "list_all2 (\<approx>) x x'"  | 
455  | 
and "list_all2 (\<approx>) z z'"  | 
|
456  | 
shows "list_all2 (\<approx>) (x @ z) (x' @ z')"  | 
|
| 40822 | 457  | 
using assms by (rule list_all2_appendI)  | 
| 36280 | 458  | 
|
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
459  | 
lemma compositional_rsp3:  | 
| 
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
460  | 
assumes "(R1 ===> R2 ===> R3) C C" and "(R4 ===> R5 ===> R6) C C"  | 
| 
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
461  | 
shows "(R1 OOO R4 ===> R2 OOO R5 ===> R3 OOO R6) C C"  | 
| 55945 | 462  | 
by (auto intro!: rel_funI)  | 
463  | 
(metis (full_types) assms rel_funE relcomppI)  | 
|
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
464  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
465  | 
lemma append_rsp2 [quot_respect]:  | 
| 67399 | 466  | 
"(list_all2 (\<approx>) OOO (\<approx>) ===> list_all2 (\<approx>) OOO (\<approx>) ===> list_all2 (\<approx>) OOO (\<approx>)) append append"  | 
| 47092 | 467  | 
by (intro compositional_rsp3)  | 
| 55945 | 468  | 
(auto intro!: rel_funI simp add: append_rsp2_pre)  | 
| 36280 | 469  | 
|
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
470  | 
lemma map_rsp2 [quot_respect]:  | 
| 67399 | 471  | 
"(((\<approx>) ===> (\<approx>)) ===> list_all2 (\<approx>) OOO (\<approx>) ===> list_all2 (\<approx>) OOO (\<approx>)) map map"  | 
| 55945 | 472  | 
proof (auto intro!: rel_funI)  | 
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
473  | 
fix f f' :: "'a list \<Rightarrow> 'b list"  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
474  | 
fix xa ya x y :: "'a list list"  | 
| 67399 | 475  | 
assume fs: "((\<approx>) ===> (\<approx>)) f f'" and x: "list_all2 (\<approx>) xa x" and xy: "set x = set y" and y: "list_all2 (\<approx>) y ya"  | 
476  | 
have a: "(list_all2 (\<approx>)) (map f xa) (map f x)"  | 
|
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
477  | 
using x  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
478  | 
by (induct xa x rule: list_induct2')  | 
| 55945 | 479  | 
(simp_all, metis fs rel_funE list_eq_def)  | 
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
480  | 
have b: "set (map f x) = set (map f y)"  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
481  | 
using xy fs  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
482  | 
by (induct x y rule: list_induct2')  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
483  | 
(simp_all, metis image_insert)  | 
| 67399 | 484  | 
have c: "(list_all2 (\<approx>)) (map f y) (map f' ya)"  | 
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
485  | 
using y fs  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
486  | 
by (induct y ya rule: list_induct2')  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
487  | 
(simp_all, metis apply_rsp' list_eq_def)  | 
| 67399 | 488  | 
show "(list_all2 (\<approx>) OOO (\<approx>)) (map f xa) (map f' ya)"  | 
| 
47434
 
b75ce48a93ee
dropped abbreviation "pred_comp"; introduced infix notation "P OO Q" for "relcompp P Q"
 
griff 
parents: 
47198 
diff
changeset
 | 
489  | 
by (metis a b c list_eq_def relcomppI)  | 
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
490  | 
qed  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
491  | 
|
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
492  | 
lemma map_prs2 [quot_preserve]:  | 
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
493  | 
shows "((abs_fset ---> rep_fset) ---> (map rep_fset \<circ> rep_fset) ---> abs_fset \<circ> map abs_fset) map = (id ---> rep_fset ---> abs_fset) map"  | 
| 
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
494  | 
by (auto simp add: fun_eq_iff)  | 
| 47308 | 495  | 
(simp only: map_map[symmetric] map_prs_aux[OF Quotient3_fset Quotient3_fset])  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
496  | 
|
| 63167 | 497  | 
section \<open>Lifted theorems\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
498  | 
|
| 63167 | 499  | 
subsection \<open>fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
500  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
501  | 
lemma fset_simps [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
502  | 
  shows "fset {||} = {}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
503  | 
and "fset (insert_fset x S) = insert x (fset S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
504  | 
by (descending, simp)+  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
505  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
506  | 
lemma finite_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
507  | 
shows "finite (fset S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
508  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
509  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
510  | 
lemma fset_cong:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
511  | 
shows "fset S = fset T \<longleftrightarrow> S = T"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
512  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
513  | 
|
| 
44204
 
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
41467 
diff
changeset
 | 
514  | 
lemma filter_fset [simp]:  | 
| 
 
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
41467 
diff
changeset
 | 
515  | 
shows "fset (filter_fset P xs) = Collect P \<inter> fset xs"  | 
| 
 
3cdc4176638c
Quotient Package: make quotient_type work with separate set type
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
41467 
diff
changeset
 | 
516  | 
by (descending) (auto)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
517  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
518  | 
lemma remove_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
519  | 
  shows "fset (remove_fset x xs) = fset xs - {x}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
520  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
521  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
522  | 
lemma inter_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
523  | 
shows "fset (xs |\<inter>| ys) = fset xs \<inter> fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
524  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
525  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
526  | 
lemma union_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
527  | 
shows "fset (xs |\<union>| ys) = fset xs \<union> fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
528  | 
by (lifting set_append)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
529  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
530  | 
lemma minus_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
531  | 
shows "fset (xs - ys) = fset xs - fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
532  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
533  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
534  | 
|
| 63167 | 535  | 
subsection \<open>in_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
536  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
537  | 
lemma in_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
538  | 
shows "x |\<in>| S \<longleftrightarrow> x \<in> fset S"  | 
| 40953 | 539  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
540  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
541  | 
lemma notin_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
542  | 
shows "x |\<notin>| S \<longleftrightarrow> x \<notin> fset S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
543  | 
by (simp add: in_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
544  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
545  | 
lemma notin_empty_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
546  | 
  shows "x |\<notin>| {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
547  | 
by (simp add: in_fset)  | 
| 36280 | 548  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
549  | 
lemma fset_eq_iff:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
550  | 
shows "S = T \<longleftrightarrow> (\<forall>x. (x |\<in>| S) = (x |\<in>| T))"  | 
| 40953 | 551  | 
by descending auto  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
552  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
553  | 
lemma none_in_empty_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
554  | 
  shows "(\<forall>x. x |\<notin>| S) \<longleftrightarrow> S = {||}"
 | 
| 40953 | 555  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
556  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
557  | 
|
| 63167 | 558  | 
subsection \<open>insert_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
559  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
560  | 
lemma in_insert_fset_iff [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
561  | 
shows "x |\<in>| insert_fset y S \<longleftrightarrow> x = y \<or> x |\<in>| S"  | 
| 40953 | 562  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
563  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
564  | 
lemma  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
565  | 
shows insert_fsetI1: "x |\<in>| insert_fset x S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
566  | 
and insert_fsetI2: "x |\<in>| S \<Longrightarrow> x |\<in>| insert_fset y S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
567  | 
by simp_all  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
568  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
569  | 
lemma insert_absorb_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
570  | 
shows "x |\<in>| S \<Longrightarrow> insert_fset x S = S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
571  | 
by (descending) (auto)  | 
| 36280 | 572  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
573  | 
lemma empty_not_insert_fset[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
574  | 
  shows "{||} \<noteq> insert_fset x S"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
575  | 
  and   "insert_fset x S \<noteq> {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
576  | 
by (descending, simp)+  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
577  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
578  | 
lemma insert_fset_left_comm:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
579  | 
shows "insert_fset x (insert_fset y S) = insert_fset y (insert_fset x S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
580  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
581  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
582  | 
lemma insert_fset_left_idem:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
583  | 
shows "insert_fset x (insert_fset x S) = insert_fset x S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
584  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
585  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
586  | 
lemma singleton_fset_eq[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
587  | 
  shows "{|x|} = {|y|} \<longleftrightarrow> x = y"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
588  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
589  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
590  | 
lemma in_fset_mdef:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
591  | 
  shows "x |\<in>| F \<longleftrightarrow> x |\<notin>| (F - {|x|}) \<and> F = insert_fset x (F - {|x|})"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
592  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
593  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
594  | 
|
| 63167 | 595  | 
subsection \<open>union_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
596  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
597  | 
lemmas [simp] =  | 
| 45605 | 598  | 
sup_bot_left[where 'a="'a fset"]  | 
599  | 
sup_bot_right[where 'a="'a fset"]  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
600  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
601  | 
lemma union_insert_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
602  | 
shows "insert_fset x S |\<union>| T = insert_fset x (S |\<union>| T)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
603  | 
by (lifting append.simps(2))  | 
| 36280 | 604  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
605  | 
lemma singleton_union_fset_left:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
606  | 
  shows "{|a|} |\<union>| S = insert_fset a S"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
607  | 
by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
608  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
609  | 
lemma singleton_union_fset_right:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
610  | 
  shows "S |\<union>| {|a|} = insert_fset a S"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
611  | 
by (subst sup.commute) simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
612  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
613  | 
lemma in_union_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
614  | 
shows "x |\<in>| S |\<union>| T \<longleftrightarrow> x |\<in>| S \<or> x |\<in>| T"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
615  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
616  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
617  | 
|
| 63167 | 618  | 
subsection \<open>minus_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
619  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
620  | 
lemma minus_in_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
621  | 
shows "x |\<in>| (xs - ys) \<longleftrightarrow> x |\<in>| xs \<and> x |\<notin>| ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
622  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
623  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
624  | 
lemma minus_insert_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
625  | 
shows "insert_fset x xs - ys = (if x |\<in>| ys then xs - ys else insert_fset x (xs - ys))"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
626  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
627  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
628  | 
lemma minus_insert_in_fset[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
629  | 
shows "x |\<in>| ys \<Longrightarrow> insert_fset x xs - ys = xs - ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
630  | 
by (simp add: minus_insert_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
631  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
632  | 
lemma minus_insert_notin_fset[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
633  | 
shows "x |\<notin>| ys \<Longrightarrow> insert_fset x xs - ys = insert_fset x (xs - ys)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
634  | 
by (simp add: minus_insert_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
635  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
636  | 
lemma in_minus_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
637  | 
shows "x |\<in>| F - S \<Longrightarrow> x |\<notin>| S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
638  | 
unfolding in_fset minus_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
639  | 
by blast  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
640  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
641  | 
lemma notin_minus_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
642  | 
shows "x |\<in>| S \<Longrightarrow> x |\<notin>| F - S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
643  | 
unfolding in_fset minus_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
644  | 
by blast  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
645  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
646  | 
|
| 63167 | 647  | 
subsection \<open>remove_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
648  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
649  | 
lemma in_remove_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
650  | 
shows "x |\<in>| remove_fset y S \<longleftrightarrow> x |\<in>| S \<and> x \<noteq> y"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
651  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
652  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
653  | 
lemma notin_remove_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
654  | 
shows "x |\<notin>| remove_fset x S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
655  | 
by (descending) (simp)  | 
| 36280 | 656  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
657  | 
lemma notin_remove_ident_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
658  | 
shows "x |\<notin>| S \<Longrightarrow> remove_fset x S = S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
659  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
660  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
661  | 
lemma remove_fset_cases:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
662  | 
  shows "S = {||} \<or> (\<exists>x. x |\<in>| S \<and> S = insert_fset x (remove_fset x S))"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
663  | 
by (descending) (auto simp add: insert_absorb)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
664  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
665  | 
|
| 63167 | 666  | 
subsection \<open>inter_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
667  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
668  | 
lemma inter_empty_fset_l:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
669  | 
  shows "{||} |\<inter>| S = {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
670  | 
by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
671  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
672  | 
lemma inter_empty_fset_r:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
673  | 
  shows "S |\<inter>| {||} = {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
674  | 
by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
675  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
676  | 
lemma inter_insert_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
677  | 
shows "insert_fset x S |\<inter>| T = (if x |\<in>| T then insert_fset x (S |\<inter>| T) else S |\<inter>| T)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
678  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
679  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
680  | 
lemma in_inter_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
681  | 
shows "x |\<in>| (S |\<inter>| T) \<longleftrightarrow> x |\<in>| S \<and> x |\<in>| T"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
682  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
683  | 
|
| 36280 | 684  | 
|
| 63167 | 685  | 
subsection \<open>subset_fset and psubset_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
686  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
687  | 
lemma subset_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
688  | 
shows "xs |\<subseteq>| ys \<longleftrightarrow> fset xs \<subseteq> fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
689  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
690  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
691  | 
lemma psubset_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
692  | 
shows "xs |\<subset>| ys \<longleftrightarrow> fset xs \<subset> fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
693  | 
unfolding less_fset_def  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
694  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
695  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
696  | 
lemma subset_insert_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
697  | 
shows "(insert_fset x xs) |\<subseteq>| ys \<longleftrightarrow> x |\<in>| ys \<and> xs |\<subseteq>| ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
698  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
699  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
700  | 
lemma subset_in_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
701  | 
shows "xs |\<subseteq>| ys = (\<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
702  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
703  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
704  | 
lemma subset_empty_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
705  | 
  shows "xs |\<subseteq>| {||} \<longleftrightarrow> xs = {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
706  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
707  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
708  | 
lemma not_psubset_empty_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
709  | 
  shows "\<not> xs |\<subset>| {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
710  | 
by (metis fset_simps(1) psubset_fset not_psubset_empty)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
711  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
712  | 
|
| 63167 | 713  | 
subsection \<open>map_fset\<close>  | 
| 36280 | 714  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
715  | 
lemma map_fset_simps [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
716  | 
   shows "map_fset f {||} = {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
717  | 
and "map_fset f (insert_fset x S) = insert_fset (f x) (map_fset f S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
718  | 
by (descending, simp)+  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
719  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
720  | 
lemma map_fset_image [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
721  | 
shows "fset (map_fset f S) = f ` (fset S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
722  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
723  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
724  | 
lemma inj_map_fset_cong:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
725  | 
shows "inj f \<Longrightarrow> map_fset f S = map_fset f T \<longleftrightarrow> S = T"  | 
| 
40467
 
dc0439fdd7c5
more appropriate specification packages; fun_rel_def is no simp rule by default
 
haftmann 
parents: 
40034 
diff
changeset
 | 
726  | 
by (descending) (metis inj_vimage_image_eq list_eq_def set_map)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
727  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
728  | 
lemma map_union_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
729  | 
shows "map_fset f (S |\<union>| T) = map_fset f S |\<union>| map_fset f T"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
730  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
731  | 
|
| 51371 | 732  | 
lemma in_fset_map_fset[simp]: "a |\<in>| map_fset f X = (\<exists>b. b |\<in>| X \<and> a = f b)"  | 
733  | 
by descending auto  | 
|
734  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
735  | 
|
| 63167 | 736  | 
subsection \<open>card_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
737  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
738  | 
lemma card_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
739  | 
shows "card_fset xs = card (fset xs)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
740  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
741  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
742  | 
lemma card_insert_fset_iff [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
743  | 
shows "card_fset (insert_fset x S) = (if x |\<in>| S then card_fset S else Suc (card_fset S))"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
744  | 
by (descending) (simp add: insert_absorb)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
745  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
746  | 
lemma card_fset_0[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
747  | 
  shows "card_fset S = 0 \<longleftrightarrow> S = {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
748  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
749  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
750  | 
lemma card_empty_fset[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
751  | 
  shows "card_fset {||} = 0"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
752  | 
by (simp add: card_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
753  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
754  | 
lemma card_fset_1:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
755  | 
  shows "card_fset S = 1 \<longleftrightarrow> (\<exists>x. S = {|x|})"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
756  | 
by (descending) (auto simp add: card_Suc_eq)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
757  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
758  | 
lemma card_fset_gt_0:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
759  | 
shows "x \<in> fset S \<Longrightarrow> 0 < card_fset S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
760  | 
by (descending) (auto simp add: card_gt_0_iff)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
761  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
762  | 
lemma card_notin_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
763  | 
shows "(x |\<notin>| S) = (card_fset (insert_fset x S) = Suc (card_fset S))"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
764  | 
by simp  | 
| 36280 | 765  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
766  | 
lemma card_fset_Suc:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
767  | 
shows "card_fset S = Suc n \<Longrightarrow> \<exists>x T. x |\<notin>| T \<and> S = insert_fset x T \<and> card_fset T = n"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
768  | 
apply(descending)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
769  | 
apply(auto dest!: card_eq_SucD)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
770  | 
by (metis Diff_insert_absorb set_removeAll)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
771  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
772  | 
lemma card_remove_fset_iff [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
773  | 
shows "card_fset (remove_fset y S) = (if y |\<in>| S then card_fset S - 1 else card_fset S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
774  | 
by (descending) (simp)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
775  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
776  | 
lemma card_Suc_exists_in_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
777  | 
shows "card_fset S = Suc n \<Longrightarrow> \<exists>a. a |\<in>| S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
778  | 
by (drule card_fset_Suc) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
779  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
780  | 
lemma in_card_fset_not_0:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
781  | 
shows "a |\<in>| A \<Longrightarrow> card_fset A \<noteq> 0"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
782  | 
by (descending) (auto)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
783  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
784  | 
lemma card_fset_mono:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
785  | 
shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset xs \<le> card_fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
786  | 
unfolding card_fset psubset_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
787  | 
by (simp add: card_mono subset_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
788  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
789  | 
lemma card_subset_fset_eq:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
790  | 
shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset ys \<le> card_fset xs \<Longrightarrow> xs = ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
791  | 
unfolding card_fset subset_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
792  | 
by (auto dest: card_seteq[OF finite_fset] simp add: fset_cong)  | 
| 
36675
 
806ea6e282e4
fminus and some more theorems ported from Finite_Set.
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
36646 
diff
changeset
 | 
793  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
794  | 
lemma psubset_card_fset_mono:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
795  | 
shows "xs |\<subset>| ys \<Longrightarrow> card_fset xs < card_fset ys"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
796  | 
unfolding card_fset subset_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
797  | 
by (metis finite_fset psubset_fset psubset_card_mono)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
798  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
799  | 
lemma card_union_inter_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
800  | 
shows "card_fset xs + card_fset ys = card_fset (xs |\<union>| ys) + card_fset (xs |\<inter>| ys)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
801  | 
unfolding card_fset union_fset inter_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
802  | 
by (rule card_Un_Int[OF finite_fset finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
803  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
804  | 
lemma card_union_disjoint_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
805  | 
  shows "xs |\<inter>| ys = {||} \<Longrightarrow> card_fset (xs |\<union>| ys) = card_fset xs + card_fset ys"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
806  | 
unfolding card_fset union_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
807  | 
apply (rule card_Un_disjoint[OF finite_fset finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
808  | 
by (metis inter_fset fset_simps(1))  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
809  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
810  | 
lemma card_remove_fset_less1:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
811  | 
shows "x |\<in>| xs \<Longrightarrow> card_fset (remove_fset x xs) < card_fset xs"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
812  | 
unfolding card_fset in_fset remove_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
813  | 
by (rule card_Diff1_less[OF finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
814  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
815  | 
lemma card_remove_fset_less2:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
816  | 
shows "x |\<in>| xs \<Longrightarrow> y |\<in>| xs \<Longrightarrow> card_fset (remove_fset y (remove_fset x xs)) < card_fset xs"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
817  | 
unfolding card_fset remove_fset in_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
818  | 
by (rule card_Diff2_less[OF finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
819  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
820  | 
lemma card_remove_fset_le1:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
821  | 
shows "card_fset (remove_fset x xs) \<le> card_fset xs"  | 
| 
74224
 
e04ec2b9ed97
some fixes connected with card_Diff_singleton
 
paulson <lp15@cam.ac.uk> 
parents: 
69597 
diff
changeset
 | 
822  | 
by simp  | 
| 36280 | 823  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
824  | 
lemma card_psubset_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
825  | 
shows "ys |\<subseteq>| xs \<Longrightarrow> card_fset ys < card_fset xs \<Longrightarrow> ys |\<subset>| xs"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
826  | 
unfolding card_fset psubset_fset subset_fset  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
827  | 
by (rule card_psubset[OF finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
828  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
829  | 
lemma card_map_fset_le:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
830  | 
shows "card_fset (map_fset f xs) \<le> card_fset xs"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
831  | 
unfolding card_fset map_fset_image  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
832  | 
by (rule card_image_le[OF finite_fset])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
833  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
834  | 
lemma card_minus_insert_fset[simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
835  | 
assumes "a |\<in>| A" and "a |\<notin>| B"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
836  | 
shows "card_fset (A - insert_fset a B) = card_fset (A - B) - 1"  | 
| 
74224
 
e04ec2b9ed97
some fixes connected with card_Diff_singleton
 
paulson <lp15@cam.ac.uk> 
parents: 
69597 
diff
changeset
 | 
837  | 
using assms by (simp add: in_fset card_fset)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
838  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
839  | 
lemma card_minus_subset_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
840  | 
assumes "B |\<subseteq>| A"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
841  | 
shows "card_fset (A - B) = card_fset A - card_fset B"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
842  | 
using assms  | 
| 
74224
 
e04ec2b9ed97
some fixes connected with card_Diff_singleton
 
paulson <lp15@cam.ac.uk> 
parents: 
69597 
diff
changeset
 | 
843  | 
by (simp add: subset_fset card_fset card_Diff_subset)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
844  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
845  | 
lemma card_minus_fset:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
846  | 
shows "card_fset (A - B) = card_fset A - card_fset (A |\<inter>| B)"  | 
| 
74224
 
e04ec2b9ed97
some fixes connected with card_Diff_singleton
 
paulson <lp15@cam.ac.uk> 
parents: 
69597 
diff
changeset
 | 
847  | 
by (simp add: card_fset card_Diff_subset_Int)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
848  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
849  | 
|
| 63167 | 850  | 
subsection \<open>concat_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
851  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
852  | 
lemma concat_empty_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
853  | 
  shows "concat_fset {||} = {||}"
 | 
| 
46416
 
5f5665a0b973
Make automatic derivation of raw/quotient types more greedy to allow descending and quot_lifted for compound quotients.
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46404 
diff
changeset
 | 
854  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
855  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
856  | 
lemma concat_insert_fset [simp]:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
857  | 
shows "concat_fset (insert_fset x S) = x |\<union>| concat_fset S"  | 
| 
46416
 
5f5665a0b973
Make automatic derivation of raw/quotient types more greedy to allow descending and quot_lifted for compound quotients.
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46404 
diff
changeset
 | 
858  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
859  | 
|
| 
46441
 
992a1688303f
Generalize the compositional preservation theorems
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46416 
diff
changeset
 | 
860  | 
lemma concat_union_fset [simp]:  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
861  | 
shows "concat_fset (xs |\<union>| ys) = concat_fset xs |\<union>| concat_fset ys"  | 
| 
46416
 
5f5665a0b973
Make automatic derivation of raw/quotient types more greedy to allow descending and quot_lifted for compound quotients.
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46404 
diff
changeset
 | 
862  | 
by descending simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
863  | 
|
| 
46404
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
864  | 
lemma map_concat_fset:  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
865  | 
shows "map_fset f (concat_fset xs) = concat_fset (map_fset (map_fset f) xs)"  | 
| 
 
7736068b9f56
Quotient FSet: Add compositional respectfulness and preservation for map and lift map_concat
 
Cezary Kaliszyk <cezarykaliszyk@gmail.com> 
parents: 
46133 
diff
changeset
 | 
866  | 
by (lifting map_concat)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
867  | 
|
| 63167 | 868  | 
subsection \<open>filter_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
869  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
870  | 
lemma subset_filter_fset:  | 
| 40961 | 871  | 
"filter_fset P xs |\<subseteq>| filter_fset Q xs = (\<forall> x. x |\<in>| xs \<longrightarrow> P x \<longrightarrow> Q x)"  | 
872  | 
by descending auto  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
873  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
874  | 
lemma eq_filter_fset:  | 
| 40961 | 875  | 
"(filter_fset P xs = filter_fset Q xs) = (\<forall>x. x |\<in>| xs \<longrightarrow> P x = Q x)"  | 
876  | 
by descending auto  | 
|
| 36280 | 877  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
878  | 
lemma psubset_filter_fset:  | 
| 40961 | 879  | 
"(\<And>x. x |\<in>| xs \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> (x |\<in>| xs & \<not> P x & Q x) \<Longrightarrow>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
880  | 
filter_fset P xs |\<subset>| filter_fset Q xs"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
881  | 
unfolding less_fset_def by (auto simp add: subset_filter_fset eq_filter_fset)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
882  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
883  | 
|
| 63167 | 884  | 
subsection \<open>fold_fset\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
885  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
886  | 
lemma fold_empty_fset:  | 
| 40961 | 887  | 
  "fold_fset f {||} = id"
 | 
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
888  | 
by descending (simp add: fold_once_def)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
889  | 
|
| 40961 | 890  | 
lemma fold_insert_fset: "fold_fset f (insert_fset a A) =  | 
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
891  | 
(if rsp_fold f then if a |\<in>| A then fold_fset f A else fold_fset f A \<circ> f a else id)"  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
892  | 
by descending (simp add: fold_once_fold_remdups)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
893  | 
|
| 47092 | 894  | 
lemma remdups_removeAll:  | 
895  | 
"remdups (removeAll x xs) = remove1 x (remdups xs)"  | 
|
896  | 
by (induct xs) auto  | 
|
897  | 
||
898  | 
lemma member_commute_fold_once:  | 
|
899  | 
assumes "rsp_fold f"  | 
|
900  | 
and "x \<in> set xs"  | 
|
901  | 
shows "fold_once f xs = fold_once f (removeAll x xs) \<circ> f x"  | 
|
902  | 
proof -  | 
|
903  | 
from assms have "fold f (remdups xs) = fold f (remove1 x (remdups xs)) \<circ> f x"  | 
|
904  | 
by (auto intro!: fold_remove1_split elim: rsp_foldE)  | 
|
| 63167 | 905  | 
then show ?thesis using \<open>rsp_fold f\<close> by (simp add: fold_once_fold_remdups remdups_removeAll)  | 
| 47092 | 906  | 
qed  | 
907  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
908  | 
lemma in_commute_fold_fset:  | 
| 
40962
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
909  | 
"rsp_fold f \<Longrightarrow> h |\<in>| b \<Longrightarrow> fold_fset f b = fold_fset f (remove_fset h b) \<circ> f h"  | 
| 
 
069cd1c1f39b
more intimate definition of fold_list / fold_once in terms of fold
 
haftmann 
parents: 
40961 
diff
changeset
 | 
910  | 
by descending (simp add: member_commute_fold_once)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
911  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
912  | 
|
| 63167 | 913  | 
subsection \<open>Choice in fsets\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
914  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
915  | 
lemma fset_choice:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
916  | 
assumes a: "\<forall>x. x |\<in>| A \<longrightarrow> (\<exists>y. P x y)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
917  | 
shows "\<exists>f. \<forall>x. x |\<in>| A \<longrightarrow> P x (f x)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
918  | 
using a  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
919  | 
apply(descending)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
920  | 
using finite_set_choice  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
921  | 
by (auto simp add: Ball_def)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
922  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
923  | 
|
| 63167 | 924  | 
section \<open>Induction and Cases rules for fsets\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
925  | 
|
| 41070 | 926  | 
lemma fset_exhaust [case_names empty insert, cases type: fset]:  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
927  | 
  assumes empty_fset_case: "S = {||} \<Longrightarrow> P" 
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
928  | 
and insert_fset_case: "\<And>x S'. S = insert_fset x S' \<Longrightarrow> P"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
929  | 
shows "P"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
930  | 
using assms by (lifting list.exhaust)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
931  | 
|
| 41070 | 932  | 
lemma fset_induct [case_names empty insert]:  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
933  | 
  assumes empty_fset_case: "P {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
934  | 
and insert_fset_case: "\<And>x S. P S \<Longrightarrow> P (insert_fset x S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
935  | 
shows "P S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
936  | 
using assms  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
937  | 
by (descending) (blast intro: list.induct)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
938  | 
|
| 41070 | 939  | 
lemma fset_induct_stronger [case_names empty insert, induct type: fset]:  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
940  | 
  assumes empty_fset_case: "P {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
941  | 
and insert_fset_case: "\<And>x S. \<lbrakk>x |\<notin>| S; P S\<rbrakk> \<Longrightarrow> P (insert_fset x S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
942  | 
shows "P S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
943  | 
proof(induct S rule: fset_induct)  | 
| 41070 | 944  | 
case empty  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
945  | 
  show "P {||}" using empty_fset_case by simp
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
946  | 
next  | 
| 41070 | 947  | 
case (insert x S)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
948  | 
have "P S" by fact  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
949  | 
then show "P (insert_fset x S)" using insert_fset_case  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
950  | 
by (cases "x |\<in>| S") (simp_all)  | 
| 36280 | 951  | 
qed  | 
952  | 
||
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
953  | 
lemma fset_card_induct:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
954  | 
  assumes empty_fset_case: "P {||}"
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
955  | 
and card_fset_Suc_case: "\<And>S T. Suc (card_fset S) = (card_fset T) \<Longrightarrow> P S \<Longrightarrow> P T"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
956  | 
shows "P S"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
957  | 
proof (induct S)  | 
| 41070 | 958  | 
case empty  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
959  | 
  show "P {||}" by (rule empty_fset_case)
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
960  | 
next  | 
| 41070 | 961  | 
case (insert x S)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
962  | 
have h: "P S" by fact  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
963  | 
have "x |\<notin>| S" by fact  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
964  | 
then have "Suc (card_fset S) = card_fset (insert_fset x S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
965  | 
using card_fset_Suc by auto  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
966  | 
then show "P (insert_fset x S)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
967  | 
using h card_fset_Suc_case by simp  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
968  | 
qed  | 
| 36280 | 969  | 
|
970  | 
lemma fset_raw_strong_cases:  | 
|
| 36465 | 971  | 
obtains "xs = []"  | 
| 40953 | 972  | 
| ys x where "\<not> List.member ys x" and "xs \<approx> x # ys"  | 
| 
45129
 
1fce03e3e8ad
tuned proofs -- eliminated vacuous "induct arbitrary: ..." situations;
 
wenzelm 
parents: 
44512 
diff
changeset
 | 
973  | 
proof (induct xs)  | 
| 36465 | 974  | 
case Nil  | 
975  | 
then show thesis by simp  | 
|
976  | 
next  | 
|
977  | 
case (Cons a xs)  | 
|
| 40953 | 978  | 
have a: "\<lbrakk>xs = [] \<Longrightarrow> thesis; \<And>x ys. \<lbrakk>\<not> List.member ys x; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis"  | 
979  | 
by (rule Cons(1))  | 
|
980  | 
have b: "\<And>x' ys'. \<lbrakk>\<not> List.member ys' x'; a # xs \<approx> x' # ys'\<rbrakk> \<Longrightarrow> thesis" by fact  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
981  | 
have c: "xs = [] \<Longrightarrow> thesis" using b  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
982  | 
apply(simp)  | 
| 
57816
 
d8bbb97689d3
no need for 'set_simps' now that 'datatype_new' generates the desired 'set' property
 
blanchet 
parents: 
55945 
diff
changeset
 | 
983  | 
by (metis list.set(1) emptyE empty_subsetI)  | 
| 40953 | 984  | 
have "\<And>x ys. \<lbrakk>\<not> List.member ys x; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis"  | 
| 36465 | 985  | 
proof -  | 
986  | 
fix x :: 'a  | 
|
987  | 
fix ys :: "'a list"  | 
|
| 40953 | 988  | 
assume d:"\<not> List.member ys x"  | 
| 36465 | 989  | 
assume e:"xs \<approx> x # ys"  | 
990  | 
show thesis  | 
|
991  | 
proof (cases "x = a")  | 
|
992  | 
assume h: "x = a"  | 
|
| 40953 | 993  | 
then have f: "\<not> List.member ys a" using d by simp  | 
| 36465 | 994  | 
have g: "a # xs \<approx> a # ys" using e h by auto  | 
995  | 
show thesis using b f g by simp  | 
|
996  | 
next  | 
|
997  | 
assume h: "x \<noteq> a"  | 
|
| 40953 | 998  | 
then have f: "\<not> List.member (a # ys) x" using d by auto  | 
| 36465 | 999  | 
have g: "a # xs \<approx> x # (a # ys)" using e h by auto  | 
| 40953 | 1000  | 
show thesis using b f g by (simp del: List.member_def)  | 
| 36465 | 1001  | 
qed  | 
1002  | 
qed  | 
|
1003  | 
then show thesis using a c by blast  | 
|
1004  | 
qed  | 
|
| 36280 | 1005  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1006  | 
|
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1007  | 
lemma fset_strong_cases:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1008  | 
  obtains "xs = {||}"
 | 
| 40953 | 1009  | 
| ys x where "x |\<notin>| ys" and "xs = insert_fset x ys"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1010  | 
by (lifting fset_raw_strong_cases)  | 
| 36280 | 1011  | 
|
| 
39996
 
c02078ff8691
FSet: definition changes propagated from Nominal and more use of 'descending' tactic
 
Cezary Kaliszyk <kaliszyk@in.tum.de> 
parents: 
39995 
diff
changeset
 | 
1012  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1013  | 
lemma fset_induct2:  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1014  | 
  "P {||} {||} \<Longrightarrow>
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1015  | 
  (\<And>x xs. x |\<notin>| xs \<Longrightarrow> P (insert_fset x xs) {||}) \<Longrightarrow>
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1016  | 
  (\<And>y ys. y |\<notin>| ys \<Longrightarrow> P {||} (insert_fset y ys)) \<Longrightarrow>
 | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1017  | 
(\<And>x xs y ys. \<lbrakk>P xs ys; x |\<notin>| xs; y |\<notin>| ys\<rbrakk> \<Longrightarrow> P (insert_fset x xs) (insert_fset y ys)) \<Longrightarrow>  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1018  | 
P xsa ysa"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1019  | 
apply (induct xsa arbitrary: ysa)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1020  | 
apply (induct_tac x rule: fset_induct_stronger)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1021  | 
apply simp_all  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1022  | 
apply (induct_tac xa rule: fset_induct_stronger)  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1023  | 
apply simp_all  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1024  | 
done  | 
| 36280 | 1025  | 
|
| 63167 | 1026  | 
text \<open>Extensionality\<close>  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1027  | 
|
| 41070 | 1028  | 
lemma fset_eqI:  | 
1029  | 
assumes "\<And>x. x \<in> fset A \<longleftrightarrow> x \<in> fset B"  | 
|
1030  | 
shows "A = B"  | 
|
1031  | 
using assms proof (induct A arbitrary: B)  | 
|
1032  | 
case empty then show ?case  | 
|
1033  | 
by (auto simp add: in_fset none_in_empty_fset [symmetric] sym)  | 
|
1034  | 
next  | 
|
1035  | 
case (insert x A)  | 
|
1036  | 
  from insert.prems insert.hyps(1) have "\<And>z. z \<in> fset A \<longleftrightarrow> z \<in> fset (B - {|x|})"
 | 
|
1037  | 
by (auto simp add: in_fset)  | 
|
| 
53374
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
51371 
diff
changeset
 | 
1038  | 
  then have A: "A = B - {|x|}" by (rule insert.hyps(2))
 | 
| 
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
51371 
diff
changeset
 | 
1039  | 
with insert.prems [symmetric, of x] have "x |\<in>| B" by (simp add: in_fset)  | 
| 
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
51371 
diff
changeset
 | 
1040  | 
with A show ?case by (metis in_fset_mdef)  | 
| 41070 | 1041  | 
qed  | 
| 36280 | 1042  | 
|
| 63167 | 1043  | 
subsection \<open>alternate formulation with a different decomposition principle  | 
1044  | 
and a proof of equivalence\<close>  | 
|
| 36280 | 1045  | 
|
1046  | 
inductive  | 
|
| 40952 | 1047  | 
  list_eq2 :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" ("_ \<approx>2 _")
 | 
| 36280 | 1048  | 
where  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1049  | 
"(a # b # xs) \<approx>2 (b # a # xs)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1050  | 
| "[] \<approx>2 []"  | 
| 40952 | 1051  | 
| "xs \<approx>2 ys \<Longrightarrow> ys \<approx>2 xs"  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1052  | 
| "(a # a # xs) \<approx>2 (a # xs)"  | 
| 40952 | 1053  | 
| "xs \<approx>2 ys \<Longrightarrow> (a # xs) \<approx>2 (a # ys)"  | 
1054  | 
| "xs1 \<approx>2 xs2 \<Longrightarrow> xs2 \<approx>2 xs3 \<Longrightarrow> xs1 \<approx>2 xs3"  | 
|
| 36280 | 1055  | 
|
1056  | 
lemma list_eq2_refl:  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1057  | 
shows "xs \<approx>2 xs"  | 
| 36280 | 1058  | 
by (induct xs) (auto intro: list_eq2.intros)  | 
1059  | 
||
1060  | 
lemma cons_delete_list_eq2:  | 
|
| 40953 | 1061  | 
shows "(a # (removeAll a A)) \<approx>2 (if List.member A a then A else a # A)"  | 
| 36280 | 1062  | 
apply (induct A)  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1063  | 
apply (simp add: list_eq2_refl)  | 
| 40953 | 1064  | 
apply (case_tac "List.member (aa # A) a")  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1065  | 
apply (simp_all)  | 
| 36280 | 1066  | 
apply (case_tac [!] "a = aa")  | 
1067  | 
apply (simp_all)  | 
|
| 40953 | 1068  | 
apply (case_tac "List.member A a")  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1069  | 
apply (auto)[2]  | 
| 36280 | 1070  | 
apply (metis list_eq2.intros(3) list_eq2.intros(4) list_eq2.intros(5) list_eq2.intros(6))  | 
1071  | 
apply (metis list_eq2.intros(1) list_eq2.intros(5) list_eq2.intros(6))  | 
|
| 40953 | 1072  | 
apply (auto simp add: list_eq2_refl)  | 
| 36280 | 1073  | 
done  | 
1074  | 
||
| 40953 | 1075  | 
lemma member_delete_list_eq2:  | 
1076  | 
assumes a: "List.member r e"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1077  | 
shows "(e # removeAll e r) \<approx>2 r"  | 
| 36280 | 1078  | 
using a cons_delete_list_eq2[of e r]  | 
1079  | 
by simp  | 
|
1080  | 
||
1081  | 
lemma list_eq2_equiv:  | 
|
1082  | 
"(l \<approx> r) \<longleftrightarrow> (list_eq2 l r)"  | 
|
1083  | 
proof  | 
|
1084  | 
show "list_eq2 l r \<Longrightarrow> l \<approx> r" by (induct rule: list_eq2.induct) auto  | 
|
1085  | 
next  | 
|
1086  | 
  {
 | 
|
1087  | 
fix n  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1088  | 
assume a: "card_list l = n" and b: "l \<approx> r"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1089  | 
have "l \<approx>2 r"  | 
| 36280 | 1090  | 
using a b  | 
1091  | 
proof (induct n arbitrary: l r)  | 
|
1092  | 
case 0  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1093  | 
have "card_list l = 0" by fact  | 
| 40953 | 1094  | 
then have "\<forall>x. \<not> List.member l x" by auto  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1095  | 
then have z: "l = []" by auto  | 
| 63167 | 1096  | 
then have "r = []" using \<open>l \<approx> r\<close> by simp  | 
| 36280 | 1097  | 
then show ?case using z list_eq2_refl by simp  | 
1098  | 
next  | 
|
1099  | 
case (Suc m)  | 
|
1100  | 
have b: "l \<approx> r" by fact  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1101  | 
have d: "card_list l = Suc m" by fact  | 
| 40953 | 1102  | 
then have "\<exists>a. List.member l a"  | 
| 41067 | 1103  | 
apply(simp)  | 
1104  | 
apply(drule card_eq_SucD)  | 
|
1105  | 
apply(blast)  | 
|
1106  | 
done  | 
|
| 40953 | 1107  | 
then obtain a where e: "List.member l a" by auto  | 
1108  | 
then have e': "List.member r a" using list_eq_def [simplified List.member_def [symmetric], of l r] b  | 
|
| 41067 | 1109  | 
by auto  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1110  | 
have f: "card_list (removeAll a l) = m" using e d by (simp)  | 
| 
47198
 
cfd8ff62eab1
use qualified names for rsp and rep_eq theorems in quotient_def
 
kuncar 
parents: 
47092 
diff
changeset
 | 
1111  | 
have g: "removeAll a l \<approx> removeAll a r" using remove_fset.rsp b by simp  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1112  | 
have "(removeAll a l) \<approx>2 (removeAll a r)" by (rule Suc.hyps[OF f g])  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1113  | 
then have h: "(a # removeAll a l) \<approx>2 (a # removeAll a r)" by (rule list_eq2.intros(5))  | 
| 41067 | 1114  | 
have i: "l \<approx>2 (a # removeAll a l)"  | 
| 40953 | 1115  | 
by (rule list_eq2.intros(3)[OF member_delete_list_eq2[OF e]])  | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1116  | 
have "l \<approx>2 (a # removeAll a r)" by (rule list_eq2.intros(6)[OF i h])  | 
| 40953 | 1117  | 
then show ?case using list_eq2.intros(6)[OF _ member_delete_list_eq2[OF e']] by simp  | 
| 36280 | 1118  | 
qed  | 
1119  | 
}  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1120  | 
then show "l \<approx> r \<Longrightarrow> l \<approx>2 r" by blast  | 
| 36280 | 1121  | 
qed  | 
1122  | 
||
1123  | 
||
1124  | 
(* We cannot write it as "assumes .. shows" since Isabelle changes  | 
|
1125  | 
the quantifiers to schematic variables and reintroduces them in  | 
|
1126  | 
a different order *)  | 
|
1127  | 
lemma fset_eq_cases:  | 
|
1128  | 
"\<lbrakk>a1 = a2;  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1129  | 
\<And>a b xs. \<lbrakk>a1 = insert_fset a (insert_fset b xs); a2 = insert_fset b (insert_fset a xs)\<rbrakk> \<Longrightarrow> P;  | 
| 36280 | 1130  | 
   \<lbrakk>a1 = {||}; a2 = {||}\<rbrakk> \<Longrightarrow> P; \<And>xs ys. \<lbrakk>a1 = ys; a2 = xs; xs = ys\<rbrakk> \<Longrightarrow> P;
 | 
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1131  | 
\<And>a xs. \<lbrakk>a1 = insert_fset a (insert_fset a xs); a2 = insert_fset a xs\<rbrakk> \<Longrightarrow> P;  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1132  | 
\<And>xs ys a. \<lbrakk>a1 = insert_fset a xs; a2 = insert_fset a ys; xs = ys\<rbrakk> \<Longrightarrow> P;  | 
| 36280 | 1133  | 
\<And>xs1 xs2 xs3. \<lbrakk>a1 = xs1; a2 = xs3; xs1 = xs2; xs2 = xs3\<rbrakk> \<Longrightarrow> P\<rbrakk>  | 
1134  | 
\<Longrightarrow> P"  | 
|
1135  | 
by (lifting list_eq2.cases[simplified list_eq2_equiv[symmetric]])  | 
|
1136  | 
||
1137  | 
lemma fset_eq_induct:  | 
|
1138  | 
assumes "x1 = x2"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1139  | 
and "\<And>a b xs. P (insert_fset a (insert_fset b xs)) (insert_fset b (insert_fset a xs))"  | 
| 36280 | 1140  | 
  and "P {||} {||}"
 | 
1141  | 
and "\<And>xs ys. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P ys xs"  | 
|
| 
40030
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1142  | 
and "\<And>a xs. P (insert_fset a (insert_fset a xs)) (insert_fset a xs)"  | 
| 
 
9f8dcf6ef563
reorganisation of the FSet theory (changed the primary naming scheme of constants and theorems to *_fset)
 
Christian Urban <urbanc@in.tum.de> 
parents: 
39996 
diff
changeset
 | 
1143  | 
and "\<And>xs ys a. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P (insert_fset a xs) (insert_fset a ys)"  | 
| 36280 | 1144  | 
and "\<And>xs1 xs2 xs3. \<lbrakk>xs1 = xs2; P xs1 xs2; xs2 = xs3; P xs2 xs3\<rbrakk> \<Longrightarrow> P xs1 xs3"  | 
1145  | 
shows "P x1 x2"  | 
|
1146  | 
using assms  | 
|
1147  | 
by (lifting list_eq2.induct[simplified list_eq2_equiv[symmetric]])  | 
|
1148  | 
||
| 63167 | 1149  | 
ML \<open>  | 
| 69597 | 1150  | 
fun dest_fsetT (Type (\<^type_name>\<open>fset\<close>, [T])) = T  | 
| 36280 | 1151  | 
  | dest_fsetT T = raise TYPE ("dest_fsetT: fset type expected", [T], []);
 | 
| 63167 | 1152  | 
\<close>  | 
| 36280 | 1153  | 
|
1154  | 
no_notation  | 
|
| 40034 | 1155  | 
list_eq (infix "\<approx>" 50) and  | 
1156  | 
list_eq2 (infix "\<approx>2" 50)  | 
|
| 36280 | 1157  | 
|
1158  | 
end  |