author | Christian Urban <urbanc@in.tum.de> |
Mon, 18 Oct 2010 12:15:44 +0100 | |
changeset 2547 | 17b369a73f15 |
parent 2546 | 3a7155fce1da |
child 2548 | cd2aca704279 |
permissions | -rw-r--r-- |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
1 |
(* Title: HOL/Quotient_Examples/FSet.thy |
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
2 |
Author: Cezary Kaliszyk, TU Munich |
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
3 |
Author: Christian Urban, TU Munich |
1823
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
4 |
|
2533 | 5 |
Type of finite sets. |
1823
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
6 |
*) |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
7 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
theory FSet |
2528
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
9 |
imports Quotient_List |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
begin |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
11 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
12 |
text {* |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
13 |
The type of finite sets is created by a quotient construction |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
14 |
over lists. The definition of the equivalence: |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
15 |
*} |
1909 | 16 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
fun |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
list_eq :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" (infix "\<approx>" 50) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
where |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
20 |
"list_eq xs ys \<longleftrightarrow> set xs = set ys" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
lemma list_eq_equivp: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
23 |
shows "equivp list_eq" |
1909 | 24 |
unfolding equivp_reflp_symp_transp |
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
25 |
unfolding reflp_def symp_def transp_def |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
26 |
by auto |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
27 |
|
2533 | 28 |
text {* Fset type *} |
29 |
||
1909 | 30 |
quotient_type |
31 |
'a fset = "'a list" / "list_eq" |
|
32 |
by (rule list_eq_equivp) |
|
33 |
||
2533 | 34 |
text {* |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
35 |
Definitions for membership, sublist, cardinality, |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
36 |
intersection, difference and respectful fold over |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
37 |
lists. |
2372 | 38 |
*} |
1909 | 39 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
40 |
fun |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
41 |
memb :: "'a \<Rightarrow> 'a list \<Rightarrow> bool" |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
42 |
where |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
43 |
"memb x xs \<longleftrightarrow> x \<in> set xs" |
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
44 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
45 |
fun |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
46 |
sub_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
47 |
where |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
48 |
"sub_list xs ys \<longleftrightarrow> set xs \<subseteq> set ys" |
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
49 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
50 |
fun |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
51 |
card_list :: "'a list \<Rightarrow> nat" |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
52 |
where |
2536
98e84b56543f
renamed fcard_raw to card_list
Christian Urban <urbanc@in.tum.de>
parents:
2534
diff
changeset
|
53 |
"card_list xs = card (set xs)" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
55 |
fun |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
56 |
inter_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
57 |
where |
2538 | 58 |
"inter_list xs ys = [x \<leftarrow> xs. x \<in> set xs \<and> x \<in> set ys]" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
59 |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
60 |
fun |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
61 |
diff_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
62 |
where |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
63 |
"diff_list xs ys = [x \<leftarrow> xs. x \<notin> set ys]" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
64 |
|
1909 | 65 |
definition |
66 |
rsp_fold |
|
67 |
where |
|
2538 | 68 |
"rsp_fold f \<equiv> \<forall>u v w. (f u (f v w) = f v (f u w))" |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
69 |
|
1909 | 70 |
primrec |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
71 |
fold_list :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a list \<Rightarrow> 'b" |
1909 | 72 |
where |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
73 |
"fold_list f z [] = z" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
74 |
| "fold_list f z (a # xs) = |
1909 | 75 |
(if (rsp_fold f) then |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
76 |
if a \<in> set xs then fold_list f z xs |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
77 |
else f a (fold_list f z xs) |
1909 | 78 |
else z)" |
79 |
||
2533 | 80 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
81 |
|
2533 | 82 |
section {* Quotient composition lemmas *} |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
83 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
84 |
lemma list_all2_refl': |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
85 |
assumes q: "equivp R" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
86 |
shows "(list_all2 R) r r" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
87 |
by (rule list_all2_refl) (metis equivp_def q) |
1938
3641d055b260
Further cleaning of proofs in FSet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1936
diff
changeset
|
88 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
89 |
lemma compose_list_refl: |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
90 |
assumes q: "equivp R" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
91 |
shows "(list_all2 R OOO op \<approx>) r r" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
92 |
proof |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
93 |
have *: "r \<approx> r" by (rule equivp_reflp[OF fset_equivp]) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
94 |
show "list_all2 R r r" by (rule list_all2_refl'[OF q]) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
95 |
with * show "(op \<approx> OO list_all2 R) r r" .. |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
96 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
97 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
98 |
lemma map_list_eq_cong: "b \<approx> ba \<Longrightarrow> map f b \<approx> map f ba" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
99 |
unfolding list_eq.simps |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
100 |
by (simp only: set_map) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
101 |
|
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
102 |
lemma quotient_compose_list_g: |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
103 |
assumes q: "Quotient R Abs Rep" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
104 |
and e: "equivp R" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
105 |
shows "Quotient ((list_all2 R) OOO (op \<approx>)) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
106 |
(abs_fset \<circ> (map Abs)) ((map Rep) \<circ> rep_fset)" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
107 |
unfolding Quotient_def comp_def |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
108 |
proof (intro conjI allI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
109 |
fix a r s |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
110 |
show "abs_fset (map Abs (map Rep (rep_fset a))) = a" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
111 |
by (simp add: abs_o_rep[OF q] Quotient_abs_rep[OF Quotient_fset] map_id) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
112 |
have b: "list_all2 R (map Rep (rep_fset a)) (map Rep (rep_fset a))" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
113 |
by (rule list_all2_refl'[OF e]) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
114 |
have c: "(op \<approx> OO list_all2 R) (map Rep (rep_fset a)) (map Rep (rep_fset a))" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
115 |
by (rule, rule equivp_reflp[OF fset_equivp]) (rule b) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
116 |
show "(list_all2 R OOO op \<approx>) (map Rep (rep_fset a)) (map Rep (rep_fset a))" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
117 |
by (rule, rule list_all2_refl'[OF e]) (rule c) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
118 |
show "(list_all2 R OOO op \<approx>) r s = ((list_all2 R OOO op \<approx>) r r \<and> |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
119 |
(list_all2 R OOO op \<approx>) s s \<and> abs_fset (map Abs r) = abs_fset (map Abs s))" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
120 |
proof (intro iffI conjI) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
121 |
show "(list_all2 R OOO op \<approx>) r r" by (rule compose_list_refl[OF e]) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
122 |
show "(list_all2 R OOO op \<approx>) s s" by (rule compose_list_refl[OF e]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
123 |
next |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
124 |
assume a: "(list_all2 R OOO op \<approx>) r s" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
125 |
then have b: "map Abs r \<approx> map Abs s" |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
126 |
proof (elim pred_compE) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
127 |
fix b ba |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
128 |
assume c: "list_all2 R r b" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
129 |
assume d: "b \<approx> ba" |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
130 |
assume e: "list_all2 R ba s" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
131 |
have f: "map Abs r = map Abs b" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
132 |
using Quotient_rel[OF list_quotient[OF q]] c by blast |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
133 |
have "map Abs ba = map Abs s" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
134 |
using Quotient_rel[OF list_quotient[OF q]] e by blast |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
135 |
then have g: "map Abs s = map Abs ba" by simp |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
136 |
then show "map Abs r \<approx> map Abs s" using d f map_list_eq_cong by simp |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
137 |
qed |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
138 |
then show "abs_fset (map Abs r) = abs_fset (map Abs s)" |
1938
3641d055b260
Further cleaning of proofs in FSet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1936
diff
changeset
|
139 |
using Quotient_rel[OF Quotient_fset] by blast |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
140 |
next |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
141 |
assume a: "(list_all2 R OOO op \<approx>) r r \<and> (list_all2 R OOO op \<approx>) s s |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
142 |
\<and> abs_fset (map Abs r) = abs_fset (map Abs s)" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
143 |
then have s: "(list_all2 R OOO op \<approx>) s s" by simp |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
144 |
have d: "map Abs r \<approx> map Abs s" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
145 |
by (subst Quotient_rel[OF Quotient_fset]) (simp add: a) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
146 |
have b: "map Rep (map Abs r) \<approx> map Rep (map Abs s)" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
147 |
by (rule map_list_eq_cong[OF d]) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
148 |
have y: "list_all2 R (map Rep (map Abs s)) s" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
149 |
by (fact rep_abs_rsp_left[OF list_quotient[OF q], OF list_all2_refl'[OF e, of s]]) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
150 |
have c: "(op \<approx> OO list_all2 R) (map Rep (map Abs r)) s" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
151 |
by (rule pred_compI) (rule b, rule y) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
152 |
have z: "list_all2 R r (map Rep (map Abs r))" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
153 |
by (fact rep_abs_rsp[OF list_quotient[OF q], OF list_all2_refl'[OF e, of r]]) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
154 |
then show "(list_all2 R OOO op \<approx>) r s" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
155 |
using a c pred_compI by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
156 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
157 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
158 |
|
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
159 |
lemma quotient_compose_list[quot_thm]: |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
160 |
shows "Quotient ((list_all2 op \<approx>) OOO (op \<approx>)) |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
161 |
(abs_fset \<circ> (map abs_fset)) ((map rep_fset) \<circ> rep_fset)" |
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
162 |
by (rule quotient_compose_list_g, rule Quotient_fset, rule list_eq_equivp) |
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
163 |
|
2547 | 164 |
|
165 |
||
2538 | 166 |
subsection {* Respectfulness lemmas for list operations *} |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
167 |
|
2538 | 168 |
lemma list_equiv_rsp [quot_respect]: |
169 |
shows "(op \<approx> ===> op \<approx> ===> op =) op \<approx> op \<approx>" |
|
170 |
by auto |
|
171 |
||
172 |
lemma append_rsp [quot_respect]: |
|
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
173 |
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) append append" |
2533 | 174 |
by simp |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
175 |
|
2538 | 176 |
lemma sub_list_rsp [quot_respect]: |
1909 | 177 |
shows "(op \<approx> ===> op \<approx> ===> op =) sub_list sub_list" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
178 |
by simp |
1909 | 179 |
|
2538 | 180 |
lemma memb_rsp [quot_respect]: |
1909 | 181 |
shows "(op = ===> op \<approx> ===> op =) memb memb" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
182 |
by simp |
1909 | 183 |
|
2538 | 184 |
lemma nil_rsp [quot_respect]: |
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
185 |
shows "(op \<approx>) Nil Nil" |
1909 | 186 |
by simp |
187 |
||
2538 | 188 |
lemma cons_rsp [quot_respect]: |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
189 |
shows "(op = ===> op \<approx> ===> op \<approx>) Cons Cons" |
1909 | 190 |
by simp |
191 |
||
2538 | 192 |
lemma map_rsp [quot_respect]: |
1909 | 193 |
shows "(op = ===> op \<approx> ===> op \<approx>) map map" |
194 |
by auto |
|
195 |
||
2538 | 196 |
lemma set_rsp [quot_respect]: |
1909 | 197 |
"(op \<approx> ===> op =) set set" |
198 |
by auto |
|
199 |
||
2538 | 200 |
lemma inter_list_rsp [quot_respect]: |
201 |
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) inter_list inter_list" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
202 |
by simp |
1909 | 203 |
|
2538 | 204 |
lemma removeAll_rsp [quot_respect]: |
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
205 |
shows "(op = ===> op \<approx> ===> op \<approx>) removeAll removeAll" |
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
206 |
by simp |
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
207 |
|
2538 | 208 |
lemma diff_list_rsp [quot_respect]: |
2537
d73fa7a3e04b
renamed fminus_raw to diff_list
Christian Urban <urbanc@in.tum.de>
parents:
2536
diff
changeset
|
209 |
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) diff_list diff_list" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
210 |
by simp |
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
211 |
|
2538 | 212 |
lemma card_list_rsp [quot_respect]: |
2536
98e84b56543f
renamed fcard_raw to card_list
Christian Urban <urbanc@in.tum.de>
parents:
2534
diff
changeset
|
213 |
shows "(op \<approx> ===> op =) card_list card_list" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
214 |
by simp |
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
215 |
|
2538 | 216 |
lemma filter_rsp [quot_respect]: |
217 |
shows "(op = ===> op \<approx> ===> op \<approx>) filter filter" |
|
218 |
by simp |
|
2525
c848f93807b9
deleted some unused lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
219 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
220 |
lemma memb_commute_fold_list: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
221 |
assumes a: "rsp_fold f" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
222 |
and b: "x \<in> set xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
223 |
shows "fold_list f y xs = f x (fold_list f y (removeAll x xs))" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
224 |
using a b by (induct xs) (auto simp add: rsp_fold_def) |
1909 | 225 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
226 |
lemma fold_list_rsp_pre: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
227 |
assumes a: "set xs = set ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
228 |
shows "fold_list f z xs = fold_list f z ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
229 |
using a |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
230 |
apply (induct xs arbitrary: ys) |
1909 | 231 |
apply (simp) |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
232 |
apply (simp (no_asm_use)) |
1909 | 233 |
apply (rule conjI) |
234 |
apply (rule_tac [!] impI) |
|
235 |
apply (rule_tac [!] conjI) |
|
236 |
apply (rule_tac [!] impI) |
|
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
237 |
apply (metis insert_absorb) |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
238 |
apply (metis List.insert_def List.set.simps(2) List.set_insert fold_list.simps(2)) |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
239 |
apply (metis Diff_insert_absorb insertI1 memb_commute_fold_list set_removeAll) |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
240 |
apply(drule_tac x="removeAll a ys" in meta_spec) |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
241 |
apply(auto) |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
242 |
apply(drule meta_mp) |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
243 |
apply(blast) |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
244 |
by (metis List.set.simps(2) emptyE fold_list.simps(2) in_listsp_conv_set listsp.simps mem_def) |
1909 | 245 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
246 |
lemma fold_list_rsp [quot_respect]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
247 |
shows "(op = ===> op = ===> op \<approx> ===> op =) fold_list fold_list" |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
248 |
unfolding fun_rel_def |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
249 |
by(auto intro: fold_list_rsp_pre) |
1909 | 250 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
251 |
lemma concat_rsp_pre: |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
252 |
assumes a: "list_all2 op \<approx> x x'" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
253 |
and b: "x' \<approx> y'" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
254 |
and c: "list_all2 op \<approx> y' y" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
255 |
and d: "\<exists>x\<in>set x. xa \<in> set x" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
256 |
shows "\<exists>x\<in>set y. xa \<in> set x" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
257 |
proof - |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
258 |
obtain xb where e: "xb \<in> set x" and f: "xa \<in> set xb" using d by auto |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
259 |
have "\<exists>y. y \<in> set x' \<and> xb \<approx> y" by (rule list_all2_find_element[OF e a]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
260 |
then obtain ya where h: "ya \<in> set x'" and i: "xb \<approx> ya" by auto |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
261 |
have "ya \<in> set y'" using b h by simp |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
262 |
then have "\<exists>yb. yb \<in> set y \<and> ya \<approx> yb" using c by (rule list_all2_find_element) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
263 |
then show ?thesis using f i by auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
264 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
265 |
|
2538 | 266 |
lemma concat_rsp [quot_respect]: |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
267 |
shows "(list_all2 op \<approx> OOO op \<approx> ===> op \<approx>) concat concat" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
268 |
proof (rule fun_relI, elim pred_compE) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
269 |
fix a b ba bb |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
270 |
assume a: "list_all2 op \<approx> a ba" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
271 |
assume b: "ba \<approx> bb" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
272 |
assume c: "list_all2 op \<approx> bb b" |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
273 |
have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
274 |
proof |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
275 |
fix x |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
276 |
show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
277 |
proof |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
278 |
assume d: "\<exists>xa\<in>set a. x \<in> set xa" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
279 |
show "\<exists>xa\<in>set b. x \<in> set xa" by (rule concat_rsp_pre[OF a b c d]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
280 |
next |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
281 |
assume e: "\<exists>xa\<in>set b. x \<in> set xa" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
282 |
have a': "list_all2 op \<approx> ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
283 |
have b': "bb \<approx> ba" by (rule equivp_symp[OF list_eq_equivp, OF b]) |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
284 |
have c': "list_all2 op \<approx> b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
285 |
show "\<exists>xa\<in>set a. x \<in> set xa" by (rule concat_rsp_pre[OF c' b' a' e]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
286 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
287 |
qed |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
288 |
then show "concat a \<approx> concat b" by auto |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
289 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
290 |
|
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
291 |
|
2539 | 292 |
|
293 |
section {* Quotient definitions for fsets *} |
|
294 |
||
295 |
||
2538 | 296 |
subsection {* Finite sets are a bounded, distributive lattice with minus *} |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
297 |
|
2528
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
298 |
instantiation fset :: (type) "{bounded_lattice_bot, distrib_lattice, minus}" |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
299 |
begin |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
300 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
301 |
quotient_definition |
2538 | 302 |
"bot :: 'a fset" |
303 |
is "Nil :: 'a list" |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
304 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
305 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
306 |
empty_fset ("{||}") |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
307 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
308 |
"{||} \<equiv> bot :: 'a fset" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
309 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
310 |
quotient_definition |
2538 | 311 |
"less_eq_fset :: ('a fset \<Rightarrow> 'a fset \<Rightarrow> bool)" |
312 |
is "sub_list :: ('a list \<Rightarrow> 'a list \<Rightarrow> bool)" |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
313 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
314 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
315 |
subset_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subseteq>|" 50) |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
316 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
317 |
"xs |\<subseteq>| ys \<equiv> xs \<le> ys" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
318 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
319 |
definition |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
320 |
less_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
321 |
where |
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
322 |
"xs < ys \<equiv> xs \<le> ys \<and> xs \<noteq> (ys::'a fset)" |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
323 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
324 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
325 |
psubset_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subset>|" 50) |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
326 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
327 |
"xs |\<subset>| ys \<equiv> xs < ys" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
328 |
|
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
329 |
quotient_definition |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
330 |
"sup :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2538 | 331 |
is "append :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
332 |
|
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
333 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
334 |
union_fset (infixl "|\<union>|" 65) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
335 |
where |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
336 |
"xs |\<union>| ys \<equiv> sup xs (ys::'a fset)" |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
337 |
|
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
338 |
quotient_definition |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
339 |
"inf :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2538 | 340 |
is "inter_list :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
341 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
342 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
343 |
inter_fset (infixl "|\<inter>|" 65) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
344 |
where |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
345 |
"xs |\<inter>| ys \<equiv> inf xs (ys::'a fset)" |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
346 |
|
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
347 |
quotient_definition |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
348 |
"minus :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2538 | 349 |
is "diff_list :: 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
350 |
|
2533 | 351 |
|
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
352 |
instance |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
353 |
proof |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
354 |
fix x y z :: "'a fset" |
2528
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
355 |
show "x |\<subset>| y \<longleftrightarrow> x |\<subseteq>| y \<and> \<not> y |\<subseteq>| x" |
2530 | 356 |
unfolding less_fset_def |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
357 |
by (descending) (auto) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
358 |
show "x |\<subseteq>| x" by (descending) (simp) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
359 |
show "{||} |\<subseteq>| x" by (descending) (simp) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
360 |
show "x |\<subseteq>| x |\<union>| y" by (descending) (simp) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
361 |
show "y |\<subseteq>| x |\<union>| y" by (descending) (simp) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
362 |
show "x |\<inter>| y |\<subseteq>| x" by (descending) (auto) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
363 |
show "x |\<inter>| y |\<subseteq>| y" by (descending) (auto) |
2528
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
364 |
show "x |\<union>| (y |\<inter>| z) = x |\<union>| y |\<inter>| (x |\<union>| z)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
365 |
by (descending) (auto) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
366 |
next |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
367 |
fix x y z :: "'a fset" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
368 |
assume a: "x |\<subseteq>| y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
369 |
assume b: "y |\<subseteq>| z" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
370 |
show "x |\<subseteq>| z" using a b by (descending) (simp) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
371 |
next |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
372 |
fix x y :: "'a fset" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
373 |
assume a: "x |\<subseteq>| y" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
374 |
assume b: "y |\<subseteq>| x" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
375 |
show "x = y" using a b by (descending) (auto) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
376 |
next |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
377 |
fix x y z :: "'a fset" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
378 |
assume a: "y |\<subseteq>| x" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
379 |
assume b: "z |\<subseteq>| x" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
380 |
show "y |\<union>| z |\<subseteq>| x" using a b by (descending) (simp) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
381 |
next |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
382 |
fix x y z :: "'a fset" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
383 |
assume a: "x |\<subseteq>| y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
384 |
assume b: "x |\<subseteq>| z" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
385 |
show "x |\<subseteq>| y |\<inter>| z" using a b by (descending) (auto) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
386 |
qed |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
387 |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
388 |
end |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
389 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
390 |
|
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
391 |
subsection {* Other constants for fsets *} |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
392 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
393 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
394 |
"insert_fset :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
395 |
is "Cons" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
396 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
397 |
syntax |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
398 |
"@Insert_fset" :: "args => 'a fset" ("{|(_)|}") |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
399 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
400 |
translations |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
401 |
"{|x, xs|}" == "CONST insert_fset x {|xs|}" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
402 |
"{|x|}" == "CONST insert_fset x {||}" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
403 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
404 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
405 |
in_fset (infix "|\<in>|" 50) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
406 |
where |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
407 |
"in_fset :: 'a \<Rightarrow> 'a fset \<Rightarrow> bool" is "memb" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
408 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
409 |
abbreviation |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
410 |
notin_fset :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<notin>|" 50) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
411 |
where |
1860 | 412 |
"x |\<notin>| S \<equiv> \<not> (x |\<in>| S)" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
413 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
414 |
|
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
415 |
subsection {* Other constants on the Quotient Type *} |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
416 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
417 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
418 |
"card_fset :: 'a fset \<Rightarrow> nat" |
2536
98e84b56543f
renamed fcard_raw to card_list
Christian Urban <urbanc@in.tum.de>
parents:
2534
diff
changeset
|
419 |
is card_list |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
420 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
421 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
422 |
"map_fset :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
423 |
is map |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
424 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
425 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
426 |
"remove_fset :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
427 |
is removeAll |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
428 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
429 |
quotient_definition |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
430 |
"fset :: 'a fset \<Rightarrow> 'a set" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
431 |
is "set" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
432 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
433 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
434 |
"fold_fset :: ('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a fset \<Rightarrow> 'b" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
435 |
is fold_list |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
436 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
437 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
438 |
"concat_fset :: ('a fset) fset \<Rightarrow> 'a fset" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
439 |
is concat |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
440 |
|
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
441 |
quotient_definition |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
442 |
"filter_fset :: ('a \<Rightarrow> bool) \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
443 |
is filter |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
444 |
|
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
445 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
446 |
subsection {* Compositional respectfulness and preservation lemmas *} |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
447 |
|
2539 | 448 |
lemma Nil_rsp2 [quot_respect]: |
449 |
shows "(list_all2 op \<approx> OOO op \<approx>) Nil Nil" |
|
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
450 |
by (rule compose_list_refl, rule list_eq_equivp) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
451 |
|
2539 | 452 |
lemma Cons_rsp2 [quot_respect]: |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
453 |
shows "(op \<approx> ===> list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx>) Cons Cons" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
454 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
455 |
apply (rule_tac b="x # b" in pred_compI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
456 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
457 |
apply (rule_tac b="x # ba" in pred_compI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
458 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
459 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
460 |
|
2539 | 461 |
lemma map_prs [quot_preserve]: |
462 |
shows "(abs_fset \<circ> map f) [] = abs_fset []" |
|
463 |
by simp |
|
464 |
||
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
465 |
lemma insert_fset_rsp [quot_preserve]: |
2541 | 466 |
"(rep_fset ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) Cons = insert_fset" |
2479
a9b6a00b1ba0
updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents:
2378
diff
changeset
|
467 |
by (simp add: fun_eq_iff Quotient_abs_rep[OF Quotient_fset] |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
468 |
abs_o_rep[OF Quotient_fset] map_id insert_fset_def) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
469 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
470 |
lemma union_fset_rsp [quot_preserve]: |
2541 | 471 |
"((map rep_fset \<circ> rep_fset) ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) |
472 |
append = union_fset" |
|
2479
a9b6a00b1ba0
updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents:
2378
diff
changeset
|
473 |
by (simp add: fun_eq_iff Quotient_abs_rep[OF Quotient_fset] |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
474 |
abs_o_rep[OF Quotient_fset] map_id sup_fset_def) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
475 |
|
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
476 |
lemma list_all2_app_l: |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
477 |
assumes a: "reflp R" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
478 |
and b: "list_all2 R l r" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
479 |
shows "list_all2 R (z @ l) (z @ r)" |
1938
3641d055b260
Further cleaning of proofs in FSet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1936
diff
changeset
|
480 |
by (induct z) (simp_all add: b rev_iffD1[OF a meta_eq_to_obj_eq[OF reflp_def]]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
481 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
482 |
lemma append_rsp2_pre0: |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
483 |
assumes a:"list_all2 op \<approx> x x'" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
484 |
shows "list_all2 op \<approx> (x @ z) (x' @ z)" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
485 |
using a apply (induct x x' rule: list_induct2') |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
486 |
by simp_all (rule list_all2_refl'[OF list_eq_equivp]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
487 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
488 |
lemma append_rsp2_pre1: |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
489 |
assumes a:"list_all2 op \<approx> x x'" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
490 |
shows "list_all2 op \<approx> (z @ x) (z @ x')" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
491 |
using a apply (induct x x' arbitrary: z rule: list_induct2') |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
492 |
apply (rule list_all2_refl'[OF list_eq_equivp]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
493 |
apply (simp_all del: list_eq.simps) |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
494 |
apply (rule list_all2_app_l) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
495 |
apply (simp_all add: reflp_def) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
496 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
497 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
498 |
lemma append_rsp2_pre: |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
499 |
assumes a:"list_all2 op \<approx> x x'" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
500 |
and b: "list_all2 op \<approx> z z'" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
501 |
shows "list_all2 op \<approx> (x @ z) (x' @ z')" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
502 |
apply (rule list_all2_transp[OF fset_equivp]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
503 |
apply (rule append_rsp2_pre0) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
504 |
apply (rule a) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
505 |
using b apply (induct z z' rule: list_induct2') |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
506 |
apply (simp_all only: append_Nil2) |
2544
3b24b5d2b68c
Use the generalized compositional quotient theorem
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2543
diff
changeset
|
507 |
apply (rule list_all2_refl'[OF list_eq_equivp]) |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
508 |
apply simp_all |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
509 |
apply (rule append_rsp2_pre1) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
510 |
apply simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
511 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
512 |
|
2547 | 513 |
lemma append_rsp2 [quot_respect]: |
2539 | 514 |
"(list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx> ===> list_all2 op \<approx> OOO op \<approx>) append append" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
515 |
proof (intro fun_relI, elim pred_compE) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
516 |
fix x y z w x' z' y' w' :: "'a list list" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
517 |
assume a:"list_all2 op \<approx> x x'" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
518 |
and b: "x' \<approx> y'" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
519 |
and c: "list_all2 op \<approx> y' y" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
520 |
assume aa: "list_all2 op \<approx> z z'" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
521 |
and bb: "z' \<approx> w'" |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
522 |
and cc: "list_all2 op \<approx> w' w" |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
523 |
have a': "list_all2 op \<approx> (x @ z) (x' @ z')" using a aa append_rsp2_pre by auto |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
524 |
have b': "x' @ z' \<approx> y' @ w'" using b bb by simp |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
525 |
have c': "list_all2 op \<approx> (y' @ w') (y @ w)" using c cc append_rsp2_pre by auto |
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
526 |
have d': "(op \<approx> OO list_all2 op \<approx>) (x' @ z') (y @ w)" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
527 |
by (rule pred_compI) (rule b', rule c') |
2326
b51532dd5689
Changes for PER and list_all2 committed to Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2278
diff
changeset
|
528 |
show "(list_all2 op \<approx> OOO op \<approx>) (x @ z) (y @ w)" |
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
529 |
by (rule pred_compI) (rule a', rule d') |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
530 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
531 |
|
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
532 |
|
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
533 |
|
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
534 |
section {* Lifted theorems *} |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
535 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
536 |
subsection {* fset *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
537 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
538 |
lemma fset_simps [simp]: |
2543 | 539 |
shows "fset {||} = {}" |
540 |
and "fset (insert_fset x S) = insert x (fset S)" |
|
541 |
by (descending, simp)+ |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
542 |
|
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
543 |
lemma finite_fset [simp]: |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
544 |
shows "finite (fset S)" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
545 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
546 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
547 |
lemma fset_cong: |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
548 |
shows "fset S = fset T \<longleftrightarrow> S = T" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
549 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
550 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
551 |
lemma filter_fset [simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
552 |
shows "fset (filter_fset P xs) = P \<inter> fset xs" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
553 |
by (descending) (auto simp add: mem_def) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
554 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
555 |
lemma remove_fset [simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
556 |
shows "fset (remove_fset x xs) = fset xs - {x}" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
557 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
558 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
559 |
lemma inter_fset [simp]: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
560 |
shows "fset (xs |\<inter>| ys) = fset xs \<inter> fset ys" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
561 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
562 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
563 |
lemma union_fset [simp]: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
564 |
shows "fset (xs |\<union>| ys) = fset xs \<union> fset ys" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
565 |
by (lifting set_append) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
566 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
567 |
lemma minus_fset [simp]: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
568 |
shows "fset (xs - ys) = fset xs - fset ys" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
569 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
570 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
571 |
|
2541 | 572 |
subsection {* in_fset *} |
573 |
||
574 |
lemma in_fset: |
|
575 |
shows "x |\<in>| S \<longleftrightarrow> x \<in> fset S" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
576 |
by (descending) (simp) |
2541 | 577 |
|
578 |
lemma notin_fset: |
|
579 |
shows "x |\<notin>| S \<longleftrightarrow> x \<notin> fset S" |
|
580 |
by (simp add: in_fset) |
|
581 |
||
582 |
lemma notin_empty_fset: |
|
583 |
shows "x |\<notin>| {||}" |
|
584 |
by (simp add: in_fset) |
|
585 |
||
586 |
lemma fset_eq_iff: |
|
587 |
shows "S = T \<longleftrightarrow> (\<forall>x. (x |\<in>| S) = (x |\<in>| T))" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
588 |
by (descending) (auto) |
2541 | 589 |
|
590 |
lemma none_in_empty_fset: |
|
591 |
shows "(\<forall>x. x |\<notin>| S) \<longleftrightarrow> S = {||}" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
592 |
by (descending) (simp) |
2541 | 593 |
|
594 |
||
595 |
subsection {* insert_fset *} |
|
596 |
||
597 |
lemma in_insert_fset_iff [simp]: |
|
598 |
shows "x |\<in>| insert_fset y S \<longleftrightarrow> x = y \<or> x |\<in>| S" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
599 |
by (descending) (simp) |
2541 | 600 |
|
601 |
lemma |
|
602 |
shows insert_fsetI1: "x |\<in>| insert_fset x S" |
|
603 |
and insert_fsetI2: "x |\<in>| S \<Longrightarrow> x |\<in>| insert_fset y S" |
|
604 |
by simp_all |
|
605 |
||
606 |
lemma insert_absorb_fset [simp]: |
|
607 |
shows "x |\<in>| S \<Longrightarrow> insert_fset x S = S" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
608 |
by (descending) (auto) |
2541 | 609 |
|
610 |
lemma empty_not_insert_fset[simp]: |
|
611 |
shows "{||} \<noteq> insert_fset x S" |
|
612 |
and "insert_fset x S \<noteq> {||}" |
|
613 |
by (descending, simp)+ |
|
614 |
||
615 |
lemma insert_fset_left_comm: |
|
616 |
shows "insert_fset x (insert_fset y S) = insert_fset y (insert_fset x S)" |
|
617 |
by (descending) (auto) |
|
618 |
||
619 |
lemma insert_fset_left_idem: |
|
620 |
shows "insert_fset x (insert_fset x S) = insert_fset x S" |
|
621 |
by (descending) (auto) |
|
622 |
||
623 |
lemma singleton_fset_eq[simp]: |
|
624 |
shows "{|x|} = {|y|} \<longleftrightarrow> x = y" |
|
625 |
by (descending) (auto) |
|
626 |
||
627 |
lemma in_fset_mdef: |
|
628 |
shows "x |\<in>| F \<longleftrightarrow> x |\<notin>| (F - {|x|}) \<and> F = insert_fset x (F - {|x|})" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
629 |
by (descending) (auto) |
2541 | 630 |
|
631 |
||
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
632 |
subsection {* union_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
633 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
634 |
lemmas [simp] = |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
635 |
sup_bot_left[where 'a="'a fset", standard] |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
636 |
sup_bot_right[where 'a="'a fset", standard] |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
637 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
638 |
lemma union_insert_fset [simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
639 |
shows "insert_fset x S |\<union>| T = insert_fset x (S |\<union>| T)" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
640 |
by (lifting append.simps(2)) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
641 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
642 |
lemma singleton_union_fset_left: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
643 |
shows "{|a|} |\<union>| S = insert_fset a S" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
644 |
by simp |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
645 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
646 |
lemma singleton_union_fset_right: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
647 |
shows "S |\<union>| {|a|} = insert_fset a S" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
648 |
by (subst sup.commute) simp |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
649 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
650 |
lemma in_union_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
651 |
shows "x |\<in>| S |\<union>| T \<longleftrightarrow> x |\<in>| S \<or> x |\<in>| T" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
652 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
653 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
654 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
655 |
subsection {* minus_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
656 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
657 |
lemma minus_in_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
658 |
shows "x |\<in>| (xs - ys) \<longleftrightarrow> x |\<in>| xs \<and> x |\<notin>| ys" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
659 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
660 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
661 |
lemma minus_insert_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
662 |
shows "insert_fset x xs - ys = (if x |\<in>| ys then xs - ys else insert_fset x (xs - ys))" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
663 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
664 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
665 |
lemma minus_insert_in_fset[simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
666 |
shows "x |\<in>| ys \<Longrightarrow> insert_fset x xs - ys = xs - ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
667 |
by (simp add: minus_insert_fset) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
668 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
669 |
lemma minus_insert_notin_fset[simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
670 |
shows "x |\<notin>| ys \<Longrightarrow> insert_fset x xs - ys = insert_fset x (xs - ys)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
671 |
by (simp add: minus_insert_fset) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
672 |
|
2541 | 673 |
lemma in_minus_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
674 |
shows "x |\<in>| F - S \<Longrightarrow> x |\<notin>| S" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
675 |
unfolding in_fset minus_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
676 |
by blast |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
677 |
|
2541 | 678 |
lemma notin_minus_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
679 |
shows "x |\<in>| S \<Longrightarrow> x |\<notin>| F - S" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
680 |
unfolding in_fset minus_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
681 |
by blast |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
682 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
683 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
684 |
subsection {* remove_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
685 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
686 |
lemma in_remove_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
687 |
shows "x |\<in>| remove_fset y S \<longleftrightarrow> x |\<in>| S \<and> x \<noteq> y" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
688 |
by (descending) (simp) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
689 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
690 |
lemma notin_remove_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
691 |
shows "x |\<notin>| remove_fset x S" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
692 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
693 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
694 |
lemma notin_remove_ident_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
695 |
shows "x |\<notin>| S \<Longrightarrow> remove_fset x S = S" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
696 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
697 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
698 |
lemma remove_fset_cases: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
699 |
shows "S = {||} \<or> (\<exists>x. x |\<in>| S \<and> S = insert_fset x (remove_fset x S))" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
700 |
by (descending) (auto simp add: insert_absorb) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
701 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
702 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
703 |
subsection {* inter_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
704 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
705 |
lemma inter_empty_fset_l: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
706 |
shows "{||} |\<inter>| S = {||}" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
707 |
by simp |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
708 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
709 |
lemma inter_empty_fset_r: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
710 |
shows "S |\<inter>| {||} = {||}" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
711 |
by simp |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
712 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
713 |
lemma inter_insert_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
714 |
shows "insert_fset x S |\<inter>| T = (if x |\<in>| T then insert_fset x (S |\<inter>| T) else S |\<inter>| T)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
715 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
716 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
717 |
lemma in_inter_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
718 |
shows "x |\<in>| (S |\<inter>| T) \<longleftrightarrow> x |\<in>| S \<and> x |\<in>| T" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
719 |
by (descending) (simp) |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
720 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
721 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
722 |
subsection {* subset_fset and psubset_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
723 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
724 |
lemma subset_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
725 |
shows "xs |\<subseteq>| ys \<longleftrightarrow> fset xs \<subseteq> fset ys" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
726 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
727 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
728 |
lemma psubset_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
729 |
shows "xs |\<subset>| ys \<longleftrightarrow> fset xs \<subset> fset ys" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
730 |
unfolding less_fset_def |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
731 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
732 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
733 |
lemma subset_insert_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
734 |
shows "(insert_fset x xs) |\<subseteq>| ys \<longleftrightarrow> x |\<in>| ys \<and> xs |\<subseteq>| ys" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
735 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
736 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
737 |
lemma subset_in_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
738 |
shows "xs |\<subseteq>| ys = (\<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
739 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
740 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
741 |
lemma subset_empty_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
742 |
shows "xs |\<subseteq>| {||} \<longleftrightarrow> xs = {||}" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
743 |
by (descending) (simp) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
744 |
|
2541 | 745 |
lemma not_psubset_empty_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
746 |
shows "\<not> xs |\<subset>| {||}" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
747 |
by (metis fset_simps(1) psubset_fset not_psubset_empty) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
748 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
749 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
750 |
subsection {* map_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
751 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
752 |
lemma map_fset_simps [simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
753 |
shows "map_fset f {||} = {||}" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
754 |
and "map_fset f (insert_fset x S) = insert_fset (f x) (map_fset f S)" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
755 |
by (descending, simp)+ |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
756 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
757 |
lemma map_fset_image [simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
758 |
shows "fset (map_fset f S) = f ` (fset S)" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
759 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
760 |
|
2542 | 761 |
lemma inj_map_fset_cong: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
762 |
shows "inj f \<Longrightarrow> map_fset f S = map_fset f T \<longleftrightarrow> S = T" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
763 |
by (descending) (metis inj_vimage_image_eq list_eq.simps set_map) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
764 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
765 |
lemma map_union_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
766 |
shows "map_fset f (S |\<union>| T) = map_fset f S |\<union>| map_fset f T" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
767 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
768 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
769 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
770 |
subsection {* card_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
771 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
772 |
lemma card_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
773 |
shows "card_fset xs = card (fset xs)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
774 |
by (descending) (simp) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
775 |
|
2541 | 776 |
lemma card_insert_fset_iff [simp]: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
777 |
shows "card_fset (insert_fset x S) = (if x |\<in>| S then card_fset S else Suc (card_fset S))" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
778 |
by (descending) (simp add: insert_absorb) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
779 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
780 |
lemma card_fset_0[simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
781 |
shows "card_fset S = 0 \<longleftrightarrow> S = {||}" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
782 |
by (descending) (simp) |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
783 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
784 |
lemma card_empty_fset[simp]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
785 |
shows "card_fset {||} = 0" |
2541 | 786 |
by (simp add: card_fset) |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
787 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
788 |
lemma card_fset_1: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
789 |
shows "card_fset S = 1 \<longleftrightarrow> (\<exists>x. S = {|x|})" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
790 |
by (descending) (auto simp add: card_Suc_eq) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
791 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
792 |
lemma card_fset_gt_0: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
793 |
shows "x \<in> fset S \<Longrightarrow> 0 < card_fset S" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
794 |
by (descending) (auto simp add: card_gt_0_iff) |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
795 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
796 |
lemma card_notin_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
797 |
shows "(x |\<notin>| S) = (card_fset (insert_fset x S) = Suc (card_fset S))" |
2541 | 798 |
by simp |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
799 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
800 |
lemma card_fset_Suc: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
801 |
shows "card_fset S = Suc n \<Longrightarrow> \<exists>x T. x |\<notin>| T \<and> S = insert_fset x T \<and> card_fset T = n" |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
802 |
apply(descending) |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
803 |
apply(auto dest!: card_eq_SucD) |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
804 |
by (metis Diff_insert_absorb set_removeAll) |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
805 |
|
2541 | 806 |
lemma card_remove_fset_iff [simp]: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
807 |
shows "card_fset (remove_fset y S) = (if y |\<in>| S then card_fset S - 1 else card_fset S)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
808 |
by (descending) (simp) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
809 |
|
2541 | 810 |
lemma card_Suc_exists_in_fset: |
811 |
shows "card_fset S = Suc n \<Longrightarrow> \<exists>a. a |\<in>| S" |
|
812 |
by (drule card_fset_Suc) (auto) |
|
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
813 |
|
2541 | 814 |
lemma in_card_fset_not_0: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
815 |
shows "a |\<in>| A \<Longrightarrow> card_fset A \<noteq> 0" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
816 |
by (descending) (auto) |
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
817 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
818 |
lemma card_fset_mono: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
819 |
shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset xs \<le> card_fset ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
820 |
unfolding card_fset psubset_fset |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
821 |
by (simp add: card_mono subset_fset) |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
822 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
823 |
lemma card_subset_fset_eq: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
824 |
shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset ys \<le> card_fset xs \<Longrightarrow> xs = ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
825 |
unfolding card_fset subset_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
826 |
by (auto dest: card_seteq[OF finite_fset] simp add: fset_cong) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
827 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
828 |
lemma psubset_card_fset_mono: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
829 |
shows "xs |\<subset>| ys \<Longrightarrow> card_fset xs < card_fset ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
830 |
unfolding card_fset subset_fset |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
831 |
by (metis finite_fset psubset_fset psubset_card_mono) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
832 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
833 |
lemma card_union_inter_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
834 |
shows "card_fset xs + card_fset ys = card_fset (xs |\<union>| ys) + card_fset (xs |\<inter>| ys)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
835 |
unfolding card_fset union_fset inter_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
836 |
by (rule card_Un_Int[OF finite_fset finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
837 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
838 |
lemma card_union_disjoint_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
839 |
shows "xs |\<inter>| ys = {||} \<Longrightarrow> card_fset (xs |\<union>| ys) = card_fset xs + card_fset ys" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
840 |
unfolding card_fset union_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
841 |
apply (rule card_Un_disjoint[OF finite_fset finite_fset]) |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
842 |
by (metis inter_fset fset_simps(1)) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
843 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
844 |
lemma card_remove_fset_less1: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
845 |
shows "x |\<in>| xs \<Longrightarrow> card_fset (remove_fset x xs) < card_fset xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
846 |
unfolding card_fset in_fset remove_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
847 |
by (rule card_Diff1_less[OF finite_fset]) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
848 |
|
2541 | 849 |
lemma card_remove_fset_less2: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
850 |
shows "x |\<in>| xs \<Longrightarrow> y |\<in>| xs \<Longrightarrow> card_fset (remove_fset y (remove_fset x xs)) < card_fset xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
851 |
unfolding card_fset remove_fset in_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
852 |
by (rule card_Diff2_less[OF finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
853 |
|
2541 | 854 |
lemma card_remove_fset_le1: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
855 |
shows "card_fset (remove_fset x xs) \<le> card_fset xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
856 |
unfolding remove_fset card_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
857 |
by (rule card_Diff1_le[OF finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
858 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
859 |
lemma card_psubset_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
860 |
shows "ys |\<subseteq>| xs \<Longrightarrow> card_fset ys < card_fset xs \<Longrightarrow> ys |\<subset>| xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
861 |
unfolding card_fset psubset_fset subset_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
862 |
by (rule card_psubset[OF finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
863 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
864 |
lemma card_map_fset_le: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
865 |
shows "card_fset (map_fset f xs) \<le> card_fset xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
866 |
unfolding card_fset map_fset_image |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
867 |
by (rule card_image_le[OF finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
868 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
869 |
lemma card_minus_insert_fset[simp]: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
870 |
assumes "a |\<in>| A" and "a |\<notin>| B" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
871 |
shows "card_fset (A - insert_fset a B) = card_fset (A - B) - 1" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
872 |
using assms |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
873 |
unfolding in_fset card_fset minus_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
874 |
by (simp add: card_Diff_insert[OF finite_fset]) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
875 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
876 |
lemma card_minus_subset_fset: |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
877 |
assumes "B |\<subseteq>| A" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
878 |
shows "card_fset (A - B) = card_fset A - card_fset B" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
879 |
using assms |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
880 |
unfolding subset_fset card_fset minus_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
881 |
by (rule card_Diff_subset[OF finite_fset]) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
882 |
|
2541 | 883 |
lemma card_minus_fset: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
884 |
shows "card_fset (A - B) = card_fset A - card_fset (A |\<inter>| B)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
885 |
unfolding inter_fset card_fset minus_fset |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
886 |
by (rule card_Diff_subset_Int) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
887 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
888 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
889 |
subsection {* concat_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
890 |
|
2541 | 891 |
lemma concat_empty_fset [simp]: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
892 |
shows "concat_fset {||} = {||}" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
893 |
by (lifting concat.simps(1)) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
894 |
|
2541 | 895 |
lemma concat_insert_fset [simp]: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
896 |
shows "concat_fset (insert_fset x S) = x |\<union>| concat_fset S" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
897 |
by (lifting concat.simps(2)) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
898 |
|
2541 | 899 |
lemma concat_inter_fset [simp]: |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
900 |
shows "concat_fset (xs |\<union>| ys) = concat_fset xs |\<union>| concat_fset ys" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
901 |
by (lifting concat_append) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
902 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
903 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
904 |
subsection {* filter_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
905 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
906 |
lemma subset_filter_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
907 |
shows "filter_fset P xs |\<subseteq>| filter_fset Q xs = (\<forall> x. x |\<in>| xs \<longrightarrow> P x \<longrightarrow> Q x)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
908 |
by (descending) (auto) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
909 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
910 |
lemma eq_filter_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
911 |
shows "(filter_fset P xs = filter_fset Q xs) = (\<forall>x. x |\<in>| xs \<longrightarrow> P x = Q x)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
912 |
by (descending) (auto) |
1887 | 913 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
914 |
lemma psubset_filter_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
915 |
shows "(\<And>x. x |\<in>| xs \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> (x |\<in>| xs & \<not> P x & Q x) \<Longrightarrow> |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
916 |
filter_fset P xs |\<subset>| filter_fset Q xs" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
917 |
unfolding less_fset_def by (auto simp add: subset_filter_fset eq_filter_fset) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
918 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
919 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
920 |
subsection {* fold_fset *} |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
921 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
922 |
lemma fold_empty_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
923 |
shows "fold_fset f z {||} = z" |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
924 |
by (descending) (simp) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
925 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
926 |
lemma fold_insert_fset: "fold_fset f z (insert_fset a A) = |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
927 |
(if rsp_fold f then if a |\<in>| A then fold_fset f z A else f a (fold_fset f z A) else z)" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
928 |
by (descending) (simp) |
1887 | 929 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
930 |
lemma in_commute_fold_fset: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
931 |
"\<lbrakk>rsp_fold f; h |\<in>| b\<rbrakk> \<Longrightarrow> fold_fset f z b = f h (fold_fset f z (remove_fset h b))" |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
932 |
by (descending) (simp add: memb_commute_fold_list) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
933 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
934 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
935 |
subsection {* Choice in fsets *} |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
936 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
937 |
lemma fset_choice: |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
938 |
assumes a: "\<forall>x. x |\<in>| A \<longrightarrow> (\<exists>y. P x y)" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
939 |
shows "\<exists>f. \<forall>x. x |\<in>| A \<longrightarrow> P x (f x)" |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
940 |
using a |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
941 |
apply(descending) |
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
942 |
using finite_set_choice |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
943 |
by (auto simp add: Ball_def) |
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
944 |
|
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
945 |
|
2539 | 946 |
section {* Induction and Cases rules for fsets *} |
947 |
||
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
948 |
lemma fset_exhaust [case_names empty_fset insert_fset, cases type: fset]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
949 |
assumes empty_fset_case: "S = {||} \<Longrightarrow> P" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
950 |
and insert_fset_case: "\<And>x S'. S = insert_fset x S' \<Longrightarrow> P" |
2539 | 951 |
shows "P" |
952 |
using assms by (lifting list.exhaust) |
|
2534
f99578469d08
Further reorganisation and cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2533
diff
changeset
|
953 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
954 |
lemma fset_induct [case_names empty_fset insert_fset]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
955 |
assumes empty_fset_case: "P {||}" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
956 |
and insert_fset_case: "\<And>x S. P S \<Longrightarrow> P (insert_fset x S)" |
2539 | 957 |
shows "P S" |
958 |
using assms |
|
959 |
by (descending) (blast intro: list.induct) |
|
960 |
||
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
961 |
lemma fset_induct_stronger [case_names empty_fset insert_fset, induct type: fset]: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
962 |
assumes empty_fset_case: "P {||}" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
963 |
and insert_fset_case: "\<And>x S. \<lbrakk>x |\<notin>| S; P S\<rbrakk> \<Longrightarrow> P (insert_fset x S)" |
2539 | 964 |
shows "P S" |
965 |
proof(induct S rule: fset_induct) |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
966 |
case empty_fset |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
967 |
show "P {||}" using empty_fset_case by simp |
2539 | 968 |
next |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
969 |
case (insert_fset x S) |
2539 | 970 |
have "P S" by fact |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
971 |
then show "P (insert_fset x S)" using insert_fset_case |
2539 | 972 |
by (cases "x |\<in>| S") (simp_all) |
973 |
qed |
|
1887 | 974 |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
975 |
lemma fset_card_induct: |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
976 |
assumes empty_fset_case: "P {||}" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
977 |
and card_fset_Suc_case: "\<And>S T. Suc (card_fset S) = (card_fset T) \<Longrightarrow> P S \<Longrightarrow> P T" |
2539 | 978 |
shows "P S" |
979 |
proof (induct S) |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
980 |
case empty_fset |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
981 |
show "P {||}" by (rule empty_fset_case) |
2539 | 982 |
next |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
983 |
case (insert_fset x S) |
2539 | 984 |
have h: "P S" by fact |
985 |
have "x |\<notin>| S" by fact |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
986 |
then have "Suc (card_fset S) = card_fset (insert_fset x S)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
987 |
using card_fset_Suc by auto |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
988 |
then show "P (insert_fset x S)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
989 |
using h card_fset_Suc_case by simp |
2539 | 990 |
qed |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
991 |
|
2539 | 992 |
lemma fset_raw_strong_cases: |
993 |
obtains "xs = []" |
|
994 |
| x ys where "\<not> memb x ys" and "xs \<approx> x # ys" |
|
995 |
proof (induct xs arbitrary: x ys) |
|
996 |
case Nil |
|
997 |
then show thesis by simp |
|
998 |
next |
|
999 |
case (Cons a xs) |
|
1000 |
have a: "\<lbrakk>xs = [] \<Longrightarrow> thesis; \<And>x ys. \<lbrakk>\<not> memb x ys; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis" by fact |
|
1001 |
have b: "\<And>x' ys'. \<lbrakk>\<not> memb x' ys'; a # xs \<approx> x' # ys'\<rbrakk> \<Longrightarrow> thesis" by fact |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1002 |
have c: "xs = [] \<Longrightarrow> thesis" using b |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1003 |
apply(simp) |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1004 |
by (metis List.set.simps(1) emptyE empty_subsetI) |
2539 | 1005 |
have "\<And>x ys. \<lbrakk>\<not> memb x ys; xs \<approx> x # ys\<rbrakk> \<Longrightarrow> thesis" |
1006 |
proof - |
|
1007 |
fix x :: 'a |
|
1008 |
fix ys :: "'a list" |
|
1009 |
assume d:"\<not> memb x ys" |
|
1010 |
assume e:"xs \<approx> x # ys" |
|
1011 |
show thesis |
|
1012 |
proof (cases "x = a") |
|
1013 |
assume h: "x = a" |
|
1014 |
then have f: "\<not> memb a ys" using d by simp |
|
1015 |
have g: "a # xs \<approx> a # ys" using e h by auto |
|
1016 |
show thesis using b f g by simp |
|
1017 |
next |
|
1018 |
assume h: "x \<noteq> a" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1019 |
then have f: "\<not> memb x (a # ys)" using d by auto |
2539 | 1020 |
have g: "a # xs \<approx> x # (a # ys)" using e h by auto |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1021 |
show thesis using b f g by (simp del: memb.simps) |
2539 | 1022 |
qed |
1023 |
qed |
|
1024 |
then show thesis using a c by blast |
|
1025 |
qed |
|
1026 |
||
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1027 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1028 |
lemma fset_strong_cases: |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
1029 |
obtains "xs = {||}" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1030 |
| x ys where "x |\<notin>| ys" and "xs = insert_fset x ys" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1031 |
by (lifting fset_raw_strong_cases) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1032 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1033 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1034 |
lemma fset_induct2: |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1035 |
"P {||} {||} \<Longrightarrow> |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1036 |
(\<And>x xs. x |\<notin>| xs \<Longrightarrow> P (insert_fset x xs) {||}) \<Longrightarrow> |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1037 |
(\<And>y ys. y |\<notin>| ys \<Longrightarrow> P {||} (insert_fset y ys)) \<Longrightarrow> |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1038 |
(\<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> |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1039 |
P xsa ysa" |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1040 |
apply (induct xsa arbitrary: ysa) |
2539 | 1041 |
apply (induct_tac x rule: fset_induct_stronger) |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1042 |
apply simp_all |
2539 | 1043 |
apply (induct_tac xa rule: fset_induct_stronger) |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1044 |
apply simp_all |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1045 |
done |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1046 |
|
2539 | 1047 |
|
1048 |
||
1049 |
subsection {* alternate formulation with a different decomposition principle |
|
1050 |
and a proof of equivalence *} |
|
1051 |
||
1052 |
inductive |
|
1053 |
list_eq2 ("_ \<approx>2 _") |
|
1054 |
where |
|
1055 |
"(a # b # xs) \<approx>2 (b # a # xs)" |
|
1056 |
| "[] \<approx>2 []" |
|
1057 |
| "xs \<approx>2 ys \<Longrightarrow> ys \<approx>2 xs" |
|
1058 |
| "(a # a # xs) \<approx>2 (a # xs)" |
|
1059 |
| "xs \<approx>2 ys \<Longrightarrow> (a # xs) \<approx>2 (a # ys)" |
|
1060 |
| "\<lbrakk>xs1 \<approx>2 xs2; xs2 \<approx>2 xs3\<rbrakk> \<Longrightarrow> xs1 \<approx>2 xs3" |
|
1061 |
||
1062 |
lemma list_eq2_refl: |
|
1063 |
shows "xs \<approx>2 xs" |
|
1064 |
by (induct xs) (auto intro: list_eq2.intros) |
|
1065 |
||
1066 |
lemma cons_delete_list_eq2: |
|
1067 |
shows "(a # (removeAll a A)) \<approx>2 (if memb a A then A else a # A)" |
|
1068 |
apply (induct A) |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1069 |
apply (simp add: list_eq2_refl) |
2539 | 1070 |
apply (case_tac "memb a (aa # A)") |
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1071 |
apply (simp_all) |
2539 | 1072 |
apply (case_tac [!] "a = aa") |
1073 |
apply (simp_all) |
|
1074 |
apply (case_tac "memb a A") |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1075 |
apply (auto)[2] |
2539 | 1076 |
apply (metis list_eq2.intros(3) list_eq2.intros(4) list_eq2.intros(5) list_eq2.intros(6)) |
1077 |
apply (metis list_eq2.intros(1) list_eq2.intros(5) list_eq2.intros(6)) |
|
1078 |
apply (auto simp add: list_eq2_refl memb_def) |
|
1079 |
done |
|
1080 |
||
1081 |
lemma memb_delete_list_eq2: |
|
1082 |
assumes a: "memb e r" |
|
1083 |
shows "(e # removeAll e r) \<approx>2 r" |
|
1084 |
using a cons_delete_list_eq2[of e r] |
|
1085 |
by simp |
|
1086 |
||
1087 |
lemma list_eq2_equiv: |
|
1088 |
"(l \<approx> r) \<longleftrightarrow> (list_eq2 l r)" |
|
1089 |
proof |
|
1090 |
show "list_eq2 l r \<Longrightarrow> l \<approx> r" by (induct rule: list_eq2.induct) auto |
|
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
1091 |
next |
2539 | 1092 |
{ |
1093 |
fix n |
|
1094 |
assume a: "card_list l = n" and b: "l \<approx> r" |
|
1095 |
have "l \<approx>2 r" |
|
1096 |
using a b |
|
1097 |
proof (induct n arbitrary: l r) |
|
1098 |
case 0 |
|
1099 |
have "card_list l = 0" by fact |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1100 |
then have "\<forall>x. \<not> memb x l" by auto |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1101 |
then have z: "l = []" by auto |
2539 | 1102 |
then have "r = []" using `l \<approx> r` by simp |
1103 |
then show ?case using z list_eq2_refl by simp |
|
1104 |
next |
|
1105 |
case (Suc m) |
|
1106 |
have b: "l \<approx> r" by fact |
|
1107 |
have d: "card_list l = Suc m" by fact |
|
1108 |
then have "\<exists>a. memb a l" |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1109 |
apply(simp) |
2539 | 1110 |
apply(drule card_eq_SucD) |
1111 |
apply(blast) |
|
1112 |
done |
|
1113 |
then obtain a where e: "memb a l" by auto |
|
1114 |
then have e': "memb a r" using list_eq.simps[simplified memb_def[symmetric], of l r] b |
|
2546
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1115 |
by auto |
3a7155fce1da
used functions instead of definitions
Christian Urban <urbanc@in.tum.de>
parents:
2544
diff
changeset
|
1116 |
have f: "card_list (removeAll a l) = m" using e d by (simp) |
2539 | 1117 |
have g: "removeAll a l \<approx> removeAll a r" using removeAll_rsp b by simp |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1118 |
have "(removeAll a l) \<approx>2 (removeAll a r)" by (rule Suc.hyps[OF f g]) |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1119 |
then have h: "(a # removeAll a l) \<approx>2 (a # removeAll a r)" by (rule list_eq2.intros(5)) |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1120 |
have i: "l \<approx>2 (a # removeAll a l)" |
2539 | 1121 |
by (rule list_eq2.intros(3)[OF memb_delete_list_eq2[OF e]]) |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1122 |
have "l \<approx>2 (a # removeAll a r)" by (rule list_eq2.intros(6)[OF i h]) |
2539 | 1123 |
then show ?case using list_eq2.intros(6)[OF _ memb_delete_list_eq2[OF e']] by simp |
1124 |
qed |
|
1125 |
} |
|
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1126 |
then show "l \<approx> r \<Longrightarrow> l \<approx>2 r" by blast |
2084
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
1127 |
qed |
72b777cc5479
Synchronize FSet with repository
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1952
diff
changeset
|
1128 |
|
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2479
diff
changeset
|
1129 |
|
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1130 |
(* We cannot write it as "assumes .. shows" since Isabelle changes |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1131 |
the quantifiers to schematic variables and reintroduces them in |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1132 |
a different order *) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1133 |
lemma fset_eq_cases: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1134 |
"\<lbrakk>a1 = a2; |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1135 |
\<And>a b xs. \<lbrakk>a1 = insert_fset a (insert_fset b xs); a2 = insert_fset b (insert_fset a xs)\<rbrakk> \<Longrightarrow> P; |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1136 |
\<lbrakk>a1 = {||}; a2 = {||}\<rbrakk> \<Longrightarrow> P; \<And>xs ys. \<lbrakk>a1 = ys; a2 = xs; xs = ys\<rbrakk> \<Longrightarrow> P; |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1137 |
\<And>a xs. \<lbrakk>a1 = insert_fset a (insert_fset a xs); a2 = insert_fset a xs\<rbrakk> \<Longrightarrow> P; |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1138 |
\<And>xs ys a. \<lbrakk>a1 = insert_fset a xs; a2 = insert_fset a ys; xs = ys\<rbrakk> \<Longrightarrow> P; |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1139 |
\<And>xs1 xs2 xs3. \<lbrakk>a1 = xs1; a2 = xs3; xs1 = xs2; xs2 = xs3\<rbrakk> \<Longrightarrow> P\<rbrakk> |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1140 |
\<Longrightarrow> P" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1141 |
by (lifting list_eq2.cases[simplified list_eq2_equiv[symmetric]]) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1142 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1143 |
lemma fset_eq_induct: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1144 |
assumes "x1 = x2" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1145 |
and "\<And>a b xs. P (insert_fset a (insert_fset b xs)) (insert_fset b (insert_fset a xs))" |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1146 |
and "P {||} {||}" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1147 |
and "\<And>xs ys. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P ys xs" |
2540
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1148 |
and "\<And>a xs. P (insert_fset a (insert_fset a xs)) (insert_fset a xs)" |
135ac0fb2686
naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents:
2539
diff
changeset
|
1149 |
and "\<And>xs ys a. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P (insert_fset a xs) (insert_fset a ys)" |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1150 |
and "\<And>xs1 xs2 xs3. \<lbrakk>xs1 = xs2; P xs1 xs2; xs2 = xs3; P xs2 xs3\<rbrakk> \<Longrightarrow> P xs1 xs3" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1151 |
shows "P x1 x2" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1152 |
using assms |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1153 |
by (lifting list_eq2.induct[simplified list_eq2_equiv[symmetric]]) |
1820
de28a91eaca3
Working FSet with additional lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1819
diff
changeset
|
1154 |
|
2528
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
1155 |
ML {* |
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
1156 |
fun dest_fsetT (Type (@{type_name fset}, [T])) = T |
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
1157 |
| dest_fsetT T = raise TYPE ("dest_fsetT: fset type expected", [T], []); |
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
1158 |
*} |
9bde8a508594
Partially merging changes from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2525
diff
changeset
|
1159 |
|
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2250
diff
changeset
|
1160 |
no_notation |
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2250
diff
changeset
|
1161 |
list_eq (infix "\<approx>" 50) |
2539 | 1162 |
and list_eq2 (infix "\<approx>2" 50) |
2266
dcffc2f132c9
Qpaper / Clarify the typing system and composition of quotients issue.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2250
diff
changeset
|
1163 |
|
2234
8035515bbbc6
something about the quotient ype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2222
diff
changeset
|
1164 |
end |