author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Thu, 22 Apr 2010 12:42:15 +0200 | |
changeset 1936 | 99367d481f78 |
parent 1935 | 266abc3ee228 |
child 1938 | 3641d055b260 |
permissions | -rw-r--r-- |
1823
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
1 |
(* Title: Quotient.thy |
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
2 |
Author: Cezary Kaliszyk |
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
3 |
Author: Christian Urban |
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
4 |
|
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
5 |
provides a reasoning infrastructure for the type of finite sets |
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
6 |
*) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
theory FSet |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
imports Quotient Quotient_List List |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
begin |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
|
1909 | 11 |
text {* Definiton of List relation and the quotient type *} |
12 |
||
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
13 |
fun |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
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
|
15 |
where |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
"list_eq xs ys = (\<forall>x. x \<in> set xs \<longleftrightarrow> x \<in> set ys)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
lemma list_eq_equivp: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
shows "equivp list_eq" |
1909 | 20 |
unfolding equivp_reflp_symp_transp |
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
21 |
unfolding reflp_def symp_def transp_def |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
22 |
by auto |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
23 |
|
1909 | 24 |
quotient_type |
25 |
'a fset = "'a list" / "list_eq" |
|
26 |
by (rule list_eq_equivp) |
|
27 |
||
28 |
text {* Raw definitions *} |
|
29 |
||
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
30 |
definition |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
31 |
memb :: "'a \<Rightarrow> 'a list \<Rightarrow> bool" |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
32 |
where |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
33 |
"memb x xs \<equiv> x \<in> set xs" |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
34 |
|
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
35 |
definition |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
36 |
sub_list :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
37 |
where |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
38 |
"sub_list xs ys \<equiv> (\<forall>x. x \<in> set xs \<longrightarrow> x \<in> set ys)" |
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
39 |
|
1909 | 40 |
fun |
41 |
fcard_raw :: "'a list \<Rightarrow> nat" |
|
42 |
where |
|
43 |
fcard_raw_nil: "fcard_raw [] = 0" |
|
44 |
| fcard_raw_cons: "fcard_raw (x # xs) = (if memb x xs then fcard_raw xs else Suc (fcard_raw xs))" |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
45 |
|
1909 | 46 |
primrec |
47 |
finter_raw :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
|
48 |
where |
|
49 |
"finter_raw [] l = []" |
|
50 |
| "finter_raw (h # t) l = |
|
51 |
(if memb h l then h # (finter_raw t l) else finter_raw t l)" |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
52 |
|
1909 | 53 |
fun |
54 |
delete_raw :: "'a list \<Rightarrow> 'a \<Rightarrow> 'a list" |
|
55 |
where |
|
56 |
"delete_raw [] x = []" |
|
57 |
| "delete_raw (a # A) x = (if (a = x) then delete_raw A x else a # (delete_raw A x))" |
|
58 |
||
59 |
definition |
|
60 |
rsp_fold |
|
61 |
where |
|
62 |
"rsp_fold f = (\<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
|
63 |
|
1909 | 64 |
primrec |
65 |
ffold_raw :: "('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a list \<Rightarrow> 'b" |
|
66 |
where |
|
67 |
"ffold_raw f z [] = z" |
|
68 |
| "ffold_raw f z (a # A) = |
|
69 |
(if (rsp_fold f) then |
|
70 |
if memb a A then ffold_raw f z A |
|
71 |
else f a (ffold_raw f z A) |
|
72 |
else z)" |
|
73 |
||
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
74 |
text {* Composition Quotient *} |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
75 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
76 |
lemma compose_list_refl: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
77 |
shows "(list_rel op \<approx> OOO op \<approx>) r r" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
78 |
proof |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
79 |
show c: "list_rel op \<approx> r r" by (rule list_rel_refl) (metis equivp_def fset_equivp) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
80 |
have d: "r \<approx> r" by (rule equivp_reflp[OF fset_equivp]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
81 |
show b: "(op \<approx> OO list_rel op \<approx>) r r" by (rule pred_compI) (rule d, rule c) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
82 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
83 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
84 |
lemma list_rel_refl: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
85 |
shows "(list_rel op \<approx>) r r" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
86 |
by (rule list_rel_refl)(metis equivp_def fset_equivp) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
87 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
88 |
lemma Quotient_fset_list: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
89 |
shows "Quotient (list_rel op \<approx>) (map abs_fset) (map rep_fset)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
90 |
by (fact list_quotient[OF Quotient_fset]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
91 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
92 |
lemma set_in_eq: "(\<forall>e. ((e \<in> A) \<longleftrightarrow> (e \<in> B))) \<equiv> A = B" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
93 |
by (rule eq_reflection) auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
94 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
95 |
lemma map_rel_cong: "b \<approx> ba \<Longrightarrow> map f b \<approx> map f ba" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
96 |
unfolding list_eq.simps |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
97 |
by (simp only: set_map set_in_eq) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
98 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
99 |
lemma quotient_compose_list[quot_thm]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
100 |
shows "Quotient ((list_rel op \<approx>) OOO (op \<approx>)) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
101 |
(abs_fset \<circ> (map abs_fset)) ((map rep_fset) \<circ> rep_fset)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
102 |
unfolding Quotient_def comp_def |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
103 |
proof (intro conjI allI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
104 |
fix a r s |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
105 |
show "abs_fset (map abs_fset (map rep_fset (rep_fset a))) = a" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
106 |
by (simp add: abs_o_rep[OF Quotient_fset] Quotient_abs_rep[OF Quotient_fset] map_id) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
107 |
have b: "list_rel op \<approx> (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
108 |
by (rule list_rel_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
109 |
have c: "(op \<approx> OO list_rel op \<approx>) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
110 |
by (rule, rule equivp_reflp[OF fset_equivp]) (rule b) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
111 |
show "(list_rel op \<approx> OOO op \<approx>) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
112 |
by (rule, rule list_rel_refl) (rule c) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
113 |
show "(list_rel op \<approx> OOO op \<approx>) r s = ((list_rel op \<approx> OOO op \<approx>) r r \<and> |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
114 |
(list_rel op \<approx> OOO op \<approx>) s s \<and> abs_fset (map abs_fset r) = abs_fset (map abs_fset s))" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
115 |
proof (intro iffI conjI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
116 |
show "(list_rel op \<approx> OOO op \<approx>) r r" by (rule compose_list_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
117 |
show "(list_rel op \<approx> OOO op \<approx>) s s" by (rule compose_list_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
118 |
next |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
119 |
assume a: "(list_rel op \<approx> OOO op \<approx>) r s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
120 |
then have b: "map abs_fset r \<approx> map abs_fset s" proof (elim pred_compE) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
121 |
fix b ba |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
122 |
assume c: "list_rel op \<approx> r b" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
123 |
assume d: "b \<approx> ba" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
124 |
assume e: "list_rel op \<approx> ba s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
125 |
have f: "map abs_fset r = map abs_fset b" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
126 |
by (metis Quotient_rel[OF Quotient_fset_list] c) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
127 |
have g: "map abs_fset s = map abs_fset ba" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
128 |
by (metis Quotient_rel[OF Quotient_fset_list] e) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
129 |
show "map abs_fset r \<approx> map abs_fset s" using d f g map_rel_cong by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
130 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
131 |
then show "abs_fset (map abs_fset r) = abs_fset (map abs_fset s)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
132 |
by (metis Quotient_rel[OF Quotient_fset]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
133 |
next |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
134 |
assume a: "(list_rel op \<approx> OOO op \<approx>) r r \<and> (list_rel op \<approx> OOO op \<approx>) s s |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
135 |
\<and> abs_fset (map abs_fset r) = abs_fset (map abs_fset s)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
136 |
then have s: "(list_rel op \<approx> OOO op \<approx>) s s" by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
137 |
have d: "map abs_fset r \<approx> map abs_fset s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
138 |
by (subst Quotient_rel[OF Quotient_fset]) (simp add: a) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
139 |
have b: "map rep_fset (map abs_fset r) \<approx> map rep_fset (map abs_fset s)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
140 |
by (rule map_rel_cong[OF d]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
141 |
have y: "list_rel op \<approx> (map rep_fset (map abs_fset s)) s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
142 |
by (fact rep_abs_rsp_left[OF Quotient_fset_list, OF list_rel_refl[of s]]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
143 |
have c: "(op \<approx> OO list_rel op \<approx>) (map rep_fset (map abs_fset r)) s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
144 |
by (rule pred_compI) (rule b, rule y) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
145 |
have z: "list_rel op \<approx> r (map rep_fset (map abs_fset r))" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
146 |
by (fact rep_abs_rsp[OF Quotient_fset_list, OF list_rel_refl[of r]]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
147 |
then show "(list_rel op \<approx> OOO op \<approx>) r s" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
148 |
using a c pred_compI by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
149 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
150 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
151 |
|
1909 | 152 |
text {* Respectfullness *} |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
153 |
|
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
154 |
lemma [quot_respect]: |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
155 |
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) op @ op @" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
156 |
by auto |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
157 |
|
1909 | 158 |
lemma [quot_respect]: |
159 |
shows "(op \<approx> ===> op \<approx> ===> op =) sub_list sub_list" |
|
160 |
by (auto simp add: sub_list_def) |
|
161 |
||
162 |
lemma memb_rsp[quot_respect]: |
|
163 |
shows "(op = ===> op \<approx> ===> op =) memb memb" |
|
164 |
by (auto simp add: memb_def) |
|
165 |
||
166 |
lemma nil_rsp[quot_respect]: |
|
167 |
shows "[] \<approx> []" |
|
168 |
by simp |
|
169 |
||
170 |
lemma cons_rsp[quot_respect]: |
|
171 |
shows "(op = ===> op \<approx> ===> op \<approx>) op # op #" |
|
172 |
by simp |
|
173 |
||
174 |
lemma map_rsp[quot_respect]: |
|
175 |
shows "(op = ===> op \<approx> ===> op \<approx>) map map" |
|
176 |
by auto |
|
177 |
||
178 |
lemma set_rsp[quot_respect]: |
|
179 |
"(op \<approx> ===> op =) set set" |
|
180 |
by auto |
|
181 |
||
182 |
lemma list_equiv_rsp[quot_respect]: |
|
183 |
shows "(op \<approx> ===> op \<approx> ===> op =) op \<approx> op \<approx>" |
|
184 |
by auto |
|
185 |
||
186 |
lemma not_memb_nil: |
|
187 |
shows "\<not> memb x []" |
|
188 |
by (simp add: memb_def) |
|
189 |
||
190 |
lemma memb_cons_iff: |
|
191 |
shows "memb x (y # xs) = (x = y \<or> memb x xs)" |
|
192 |
by (induct xs) (auto simp add: memb_def) |
|
193 |
||
194 |
lemma memb_finter_raw: |
|
195 |
"memb x (finter_raw xs ys) \<longleftrightarrow> memb x xs \<and> memb x ys" |
|
196 |
by (induct xs) (auto simp add: not_memb_nil memb_cons_iff) |
|
197 |
||
198 |
lemma [quot_respect]: |
|
199 |
"(op \<approx> ===> op \<approx> ===> op \<approx>) finter_raw finter_raw" |
|
200 |
by (simp add: memb_def[symmetric] memb_finter_raw) |
|
201 |
||
202 |
lemma memb_delete_raw: |
|
203 |
"memb x (delete_raw xs y) = (memb x xs \<and> x \<noteq> y)" |
|
204 |
by (induct xs arbitrary: x y) (auto simp add: memb_def) |
|
205 |
||
206 |
lemma [quot_respect]: |
|
207 |
"(op \<approx> ===> op = ===> op \<approx>) delete_raw delete_raw" |
|
208 |
by (simp add: memb_def[symmetric] memb_delete_raw) |
|
209 |
||
210 |
lemma fcard_raw_gt_0: |
|
211 |
assumes a: "x \<in> set xs" |
|
212 |
shows "0 < fcard_raw xs" |
|
213 |
using a by (induct xs) (auto simp add: memb_def) |
|
214 |
||
215 |
lemma fcard_raw_delete_one: |
|
216 |
shows "fcard_raw ([x \<leftarrow> xs. x \<noteq> y]) = (if memb y xs then fcard_raw xs - 1 else fcard_raw xs)" |
|
217 |
by (induct xs) (auto dest: fcard_raw_gt_0 simp add: memb_def) |
|
218 |
||
219 |
lemma fcard_raw_rsp_aux: |
|
220 |
assumes a: "xs \<approx> ys" |
|
221 |
shows "fcard_raw xs = fcard_raw ys" |
|
222 |
using a |
|
223 |
apply (induct xs arbitrary: ys) |
|
224 |
apply (auto simp add: memb_def) |
|
225 |
apply (subgoal_tac "\<forall>x. (x \<in> set xs) = (x \<in> set ys)") |
|
226 |
apply (auto) |
|
227 |
apply (drule_tac x="x" in spec) |
|
228 |
apply (blast) |
|
229 |
apply (drule_tac x="[x \<leftarrow> ys. x \<noteq> a]" in meta_spec) |
|
230 |
apply (simp add: fcard_raw_delete_one memb_def) |
|
231 |
apply (case_tac "a \<in> set ys") |
|
232 |
apply (simp only: if_True) |
|
233 |
apply (subgoal_tac "\<forall>x. (x \<in> set xs) = (x \<in> set ys \<and> x \<noteq> a)") |
|
234 |
apply (drule Suc_pred'[OF fcard_raw_gt_0]) |
|
235 |
apply (auto) |
|
236 |
done |
|
237 |
||
238 |
lemma fcard_raw_rsp[quot_respect]: |
|
239 |
shows "(op \<approx> ===> op =) fcard_raw fcard_raw" |
|
240 |
by (simp add: fcard_raw_rsp_aux) |
|
241 |
||
242 |
lemma memb_absorb: |
|
243 |
shows "memb x xs \<Longrightarrow> x # xs \<approx> xs" |
|
244 |
by (induct xs) (auto simp add: memb_def) |
|
245 |
||
246 |
lemma none_memb_nil: |
|
247 |
"(\<forall>x. \<not> memb x xs) = (xs \<approx> [])" |
|
248 |
by (simp add: memb_def) |
|
249 |
||
250 |
lemma not_memb_delete_raw_ident: |
|
251 |
shows "\<not> memb x xs \<Longrightarrow> delete_raw xs x = xs" |
|
252 |
by (induct xs) (auto simp add: memb_def) |
|
253 |
||
254 |
lemma memb_commute_ffold_raw: |
|
255 |
"rsp_fold f \<Longrightarrow> memb h b \<Longrightarrow> ffold_raw f z b = f h (ffold_raw f z (delete_raw b h))" |
|
256 |
apply (induct b) |
|
257 |
apply (simp_all add: not_memb_nil) |
|
258 |
apply (auto) |
|
259 |
apply (simp_all add: memb_delete_raw not_memb_delete_raw_ident rsp_fold_def memb_cons_iff) |
|
260 |
done |
|
261 |
||
262 |
lemma ffold_raw_rsp_pre: |
|
263 |
"\<forall>e. memb e a = memb e b \<Longrightarrow> ffold_raw f z a = ffold_raw f z b" |
|
264 |
apply (induct a arbitrary: b) |
|
265 |
apply (simp add: memb_absorb memb_def none_memb_nil) |
|
266 |
apply (simp) |
|
267 |
apply (rule conjI) |
|
268 |
apply (rule_tac [!] impI) |
|
269 |
apply (rule_tac [!] conjI) |
|
270 |
apply (rule_tac [!] impI) |
|
271 |
apply (subgoal_tac "\<forall>e. memb e a2 = memb e b") |
|
272 |
apply (simp) |
|
273 |
apply (simp add: memb_cons_iff memb_def) |
|
274 |
apply (auto)[1] |
|
275 |
apply (drule_tac x="e" in spec) |
|
276 |
apply (blast) |
|
277 |
apply (case_tac b) |
|
278 |
apply (simp_all) |
|
279 |
apply (subgoal_tac "ffold_raw f z b = f a1 (ffold_raw f z (delete_raw b a1))") |
|
280 |
apply (simp only:) |
|
281 |
apply (rule_tac f="f a1" in arg_cong) |
|
282 |
apply (subgoal_tac "\<forall>e. memb e a2 = memb e (delete_raw b a1)") |
|
283 |
apply (simp) |
|
284 |
apply (simp add: memb_delete_raw) |
|
285 |
apply (auto simp add: memb_cons_iff)[1] |
|
286 |
apply (erule memb_commute_ffold_raw) |
|
287 |
apply (drule_tac x="a1" in spec) |
|
288 |
apply (simp add: memb_cons_iff) |
|
289 |
apply (simp add: memb_cons_iff) |
|
290 |
apply (case_tac b) |
|
291 |
apply (simp_all) |
|
292 |
done |
|
293 |
||
294 |
lemma [quot_respect]: |
|
295 |
"(op = ===> op = ===> op \<approx> ===> op =) ffold_raw ffold_raw" |
|
296 |
by (simp add: memb_def[symmetric] ffold_raw_rsp_pre) |
|
297 |
||
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
298 |
lemma concat_rsp_pre: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
299 |
assumes a: "list_rel op \<approx> x x'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
300 |
and b: "x' \<approx> y'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
301 |
and c: "list_rel op \<approx> y' y" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
302 |
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
|
303 |
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
|
304 |
proof - |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
305 |
obtain xb where e: "xb \<in> set x" and f: "xa \<in> set xb" using d by auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
306 |
have "\<exists>y. y \<in> set x' \<and> xb \<approx> y" by (rule list_rel_find_element[OF e a]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
307 |
then obtain ya where h: "ya \<in> set x'" and i: "xb \<approx> ya" by auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
308 |
have j: "ya \<in> set y'" using b h by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
309 |
have "\<exists>yb. yb \<in> set y \<and> ya \<approx> yb" by (rule list_rel_find_element[OF j c]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
310 |
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
|
311 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
312 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
313 |
lemma [quot_respect]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
314 |
shows "(list_rel op \<approx> OOO op \<approx> ===> op \<approx>) concat concat" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
315 |
proof (rule fun_relI, elim pred_compE) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
316 |
fix a b ba bb |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
317 |
assume a: "list_rel op \<approx> a ba" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
318 |
assume b: "ba \<approx> bb" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
319 |
assume c: "list_rel op \<approx> bb b" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
320 |
have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
321 |
fix x |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
322 |
show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
323 |
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
|
324 |
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
|
325 |
next |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
326 |
assume e: "\<exists>xa\<in>set b. x \<in> set xa" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
327 |
have a': "list_rel op \<approx> ba a" by (rule list_rel_symp[OF list_eq_equivp, OF a]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
328 |
have b': "bb \<approx> ba" by (rule equivp_symp[OF list_eq_equivp, OF b]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
329 |
have c': "list_rel op \<approx> b bb" by (rule list_rel_symp[OF list_eq_equivp, OF c]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
330 |
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
|
331 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
332 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
333 |
then show "concat a \<approx> concat b" by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
334 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
335 |
|
1909 | 336 |
text {* Distributive lattice with bot *} |
337 |
||
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
338 |
lemma sub_list_not_eq: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
339 |
"(sub_list x y \<and> \<not> list_eq x y) = (sub_list x y \<and> \<not> sub_list y x)" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
340 |
by (auto simp add: sub_list_def) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
341 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
342 |
lemma sub_list_refl: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
343 |
"sub_list x x" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
344 |
by (simp add: sub_list_def) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
345 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
346 |
lemma sub_list_trans: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
347 |
"sub_list x y \<Longrightarrow> sub_list y z \<Longrightarrow> sub_list x z" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
348 |
by (simp add: sub_list_def) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
349 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
350 |
lemma sub_list_empty: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
351 |
"sub_list [] x" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
352 |
by (simp add: sub_list_def) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
353 |
|
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
354 |
lemma sub_list_append_left: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
355 |
"sub_list x (x @ y)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
356 |
by (simp add: sub_list_def) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
357 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
358 |
lemma sub_list_append_right: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
359 |
"sub_list y (x @ y)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
360 |
by (simp add: sub_list_def) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
361 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
362 |
lemma sub_list_inter_left: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
363 |
shows "sub_list (finter_raw x y) x" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
364 |
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
365 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
366 |
lemma sub_list_inter_right: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
367 |
shows "sub_list (finter_raw x y) y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
368 |
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
369 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
370 |
lemma sub_list_list_eq: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
371 |
"sub_list x y \<Longrightarrow> sub_list y x \<Longrightarrow> list_eq x y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
372 |
unfolding sub_list_def list_eq.simps by blast |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
373 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
374 |
lemma sub_list_append: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
375 |
"sub_list y x \<Longrightarrow> sub_list z x \<Longrightarrow> sub_list (y @ z) x" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
376 |
unfolding sub_list_def by auto |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
377 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
378 |
lemma sub_list_inter: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
379 |
"sub_list x y \<Longrightarrow> sub_list x z \<Longrightarrow> sub_list x (finter_raw y z)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
380 |
by (simp add: sub_list_def memb_def[symmetric] memb_finter_raw) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
381 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
382 |
lemma append_inter_distrib: |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
383 |
"x @ (finter_raw y z) \<approx> finter_raw (x @ y) (x @ z)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
384 |
apply (induct x) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
385 |
apply (simp_all add: memb_def) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
386 |
apply (simp add: memb_def[symmetric] memb_finter_raw) |
1909 | 387 |
by (auto simp add: memb_def) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
388 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
389 |
instantiation fset :: (type) "{bot,distrib_lattice}" |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
390 |
begin |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
391 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
392 |
quotient_definition |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
393 |
"bot :: 'a fset" is "[] :: 'a list" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
394 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
395 |
abbreviation |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
396 |
fempty ("{||}") |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
397 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
398 |
"{||} \<equiv> bot :: 'a fset" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
399 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
400 |
quotient_definition |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
401 |
"less_eq_fset \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> bool)" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
402 |
is |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
403 |
"sub_list \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> bool)" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
404 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
405 |
abbreviation |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
406 |
f_subset_eq :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subseteq>|" 50) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
407 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
408 |
"xs |\<subseteq>| ys \<equiv> xs \<le> ys" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
409 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
410 |
definition |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
411 |
less_fset: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
412 |
"(xs :: 'a fset) < ys \<equiv> xs \<le> ys \<and> xs \<noteq> ys" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
413 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
414 |
abbreviation |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
415 |
f_subset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subset>|" 50) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
416 |
where |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
417 |
"xs |\<subset>| ys \<equiv> xs < ys" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
418 |
|
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
419 |
quotient_definition |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
420 |
"sup \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset)" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
421 |
is |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
422 |
"(op @) \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> 'a list)" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
423 |
|
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
424 |
abbreviation |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
425 |
funion (infixl "|\<union>|" 65) |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
426 |
where |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
427 |
"xs |\<union>| ys \<equiv> sup (xs :: 'a fset) ys" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
428 |
|
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
429 |
quotient_definition |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
430 |
"inf \<Colon> ('a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
431 |
is |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
432 |
"finter_raw \<Colon> ('a list \<Rightarrow> 'a list \<Rightarrow> 'a list)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
433 |
|
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
434 |
abbreviation |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
435 |
finter (infixl "|\<inter>|" 65) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
436 |
where |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
437 |
"xs |\<inter>| ys \<equiv> inf (xs :: 'a fset) ys" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
438 |
|
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
439 |
instance |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
440 |
proof |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
441 |
fix x y z :: "'a fset" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
442 |
show "(x |\<subset>| y) = (x |\<subseteq>| y \<and> \<not> y |\<subseteq>| x)" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
443 |
unfolding less_fset by (lifting sub_list_not_eq) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
444 |
show "x |\<subseteq>| x" by (lifting sub_list_refl) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
445 |
show "{||} |\<subseteq>| x" by (lifting sub_list_empty) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
446 |
show "x |\<subseteq>| x |\<union>| y" by (lifting sub_list_append_left) |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
447 |
show "y |\<subseteq>| x |\<union>| y" by (lifting sub_list_append_right) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
448 |
show "x |\<inter>| y |\<subseteq>| x" by (lifting sub_list_inter_left) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
449 |
show "x |\<inter>| y |\<subseteq>| y" by (lifting sub_list_inter_right) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
450 |
show "x |\<union>| (y |\<inter>| z) = x |\<union>| y |\<inter>| (x |\<union>| z)" by (lifting append_inter_distrib) |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
451 |
next |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
452 |
fix x y z :: "'a fset" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
453 |
assume a: "x |\<subseteq>| y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
454 |
assume b: "y |\<subseteq>| z" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
455 |
show "x |\<subseteq>| z" using a b by (lifting sub_list_trans) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
456 |
next |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
457 |
fix x y :: "'a fset" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
458 |
assume a: "x |\<subseteq>| y" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
459 |
assume b: "y |\<subseteq>| x" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
460 |
show "x = y" using a b by (lifting sub_list_list_eq) |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
461 |
next |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
462 |
fix x y z :: "'a fset" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
463 |
assume a: "y |\<subseteq>| x" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
464 |
assume b: "z |\<subseteq>| x" |
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
465 |
show "y |\<union>| z |\<subseteq>| x" using a b by (lifting sub_list_append) |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
466 |
next |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
467 |
fix x y z :: "'a fset" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
468 |
assume a: "x |\<subseteq>| y" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
469 |
assume b: "x |\<subseteq>| z" |
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
470 |
show "x |\<subseteq>| y |\<inter>| z" using a b by (lifting sub_list_inter) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
471 |
qed |
1905
dbc9e88c44da
fsets are distributive lattices.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1895
diff
changeset
|
472 |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
473 |
end |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
474 |
|
1909 | 475 |
section {* Finsert and Membership *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
476 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
477 |
quotient_definition |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
478 |
"finsert :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
479 |
is "op #" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
480 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
481 |
syntax |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
482 |
"@Finset" :: "args => 'a fset" ("{|(_)|}") |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
483 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
484 |
translations |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
485 |
"{|x, xs|}" == "CONST finsert x {|xs|}" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
486 |
"{|x|}" == "CONST finsert x {||}" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
487 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
488 |
quotient_definition |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
489 |
fin ("_ |\<in>| _" [50, 51] 50) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
490 |
where |
1816
56cebe7f8e24
some small tunings (incompleted work in Lambda.thy)
Christian Urban <urbanc@in.tum.de>
parents:
1682
diff
changeset
|
491 |
"fin :: '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
|
492 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
493 |
abbreviation |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
494 |
fnotin :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" ("_ |\<notin>| _" [50, 51] 50) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
495 |
where |
1860 | 496 |
"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
|
497 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
498 |
section {* Other constants on the Quotient Type *} |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
499 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
500 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
501 |
"fcard :: 'a fset \<Rightarrow> nat" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
502 |
is |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
503 |
"fcard_raw" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
504 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
505 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
506 |
"fmap :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
507 |
is |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
508 |
"map" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
509 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
510 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
511 |
"fdelete :: 'a fset \<Rightarrow> 'a \<Rightarrow> 'a fset" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
512 |
is "delete_raw" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
513 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
514 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
515 |
"fset_to_set :: 'a fset \<Rightarrow> 'a set" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
516 |
is "set" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
517 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
518 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
519 |
"ffold :: ('a \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'b \<Rightarrow> 'a fset \<Rightarrow> 'b" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
520 |
is "ffold_raw" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
521 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
522 |
quotient_definition |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
523 |
"fconcat :: ('a fset) fset \<Rightarrow> 'a fset" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
524 |
is |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
525 |
"concat" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
526 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
527 |
text {* Compositional Respectfullness and Preservation *} |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
528 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
529 |
lemma [quot_respect]: "(list_rel op \<approx> OOO op \<approx>) [] []" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
530 |
by (metis nil_rsp list_rel.simps(1) pred_compI) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
531 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
532 |
lemma [quot_preserve]: "(abs_fset \<circ> map f) [] = abs_fset []" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
533 |
by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
534 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
535 |
lemma [quot_respect]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
536 |
"(op \<approx> ===> list_rel op \<approx> OOO op \<approx> ===> list_rel op \<approx> OOO op \<approx>) op # op #" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
537 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
538 |
apply (simp add: set_in_eq) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
539 |
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
|
540 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
541 |
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
|
542 |
apply auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
543 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
544 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
545 |
lemma [quot_preserve]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
546 |
"(rep_fset ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) op # = finsert" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
547 |
by (simp add: expand_fun_eq Quotient_abs_rep[OF Quotient_fset] |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
548 |
abs_o_rep[OF Quotient_fset] map_id finsert_def) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
549 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
550 |
lemma [quot_preserve]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
551 |
"((map rep_fset \<circ> rep_fset) ---> (map rep_fset \<circ> rep_fset) ---> abs_fset \<circ> map abs_fset) op @ = funion" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
552 |
by (simp add: expand_fun_eq Quotient_abs_rep[OF Quotient_fset] |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
553 |
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
|
554 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
555 |
lemma list_rel_app_l: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
556 |
assumes a: "reflp R" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
557 |
and b: "list_rel R l r" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
558 |
shows "list_rel R (z @ l) (z @ r)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
559 |
by (induct z) (simp_all add: b, metis a reflp_def) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
560 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
561 |
lemma append_rsp2_pre0: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
562 |
assumes a:"list_rel op \<approx> x x'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
563 |
shows "list_rel op \<approx> (x @ z) (x' @ z)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
564 |
using a apply (induct x x' rule: list_induct2') |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
565 |
apply simp_all |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
566 |
apply (rule list_rel_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
567 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
568 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
569 |
lemma append_rsp2_pre1: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
570 |
assumes a:"list_rel op \<approx> x x'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
571 |
shows "list_rel op \<approx> (z @ x) (z @ x')" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
572 |
using a apply (induct x x' arbitrary: z rule: list_induct2') |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
573 |
apply (rule list_rel_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
574 |
apply (simp_all del: list_eq.simps) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
575 |
apply (rule list_rel_app_l) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
576 |
apply (simp_all add: reflp_def) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
577 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
578 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
579 |
lemma append_rsp2_pre: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
580 |
assumes a:"list_rel op \<approx> x x'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
581 |
and b: "list_rel op \<approx> z z'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
582 |
shows "list_rel op \<approx> (x @ z) (x' @ z')" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
583 |
apply (rule list_rel_transp[OF fset_equivp]) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
584 |
apply (rule append_rsp2_pre0) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
585 |
apply (rule a) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
586 |
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
|
587 |
apply (simp_all only: append_Nil2) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
588 |
apply (rule list_rel_refl) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
589 |
apply simp_all |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
590 |
apply (rule append_rsp2_pre1) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
591 |
apply simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
592 |
done |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
593 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
594 |
lemma [quot_respect]: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
595 |
"(list_rel op \<approx> OOO op \<approx> ===> list_rel op \<approx> OOO op \<approx> ===> list_rel op \<approx> OOO op \<approx>) op @ op @" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
596 |
proof (intro fun_relI, elim pred_compE) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
597 |
fix x y z w x' z' y' w' :: "'a list list" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
598 |
assume a:"list_rel op \<approx> x x'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
599 |
and b: "x' \<approx> y'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
600 |
and c: "list_rel op \<approx> y' y" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
601 |
assume aa: "list_rel op \<approx> z z'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
602 |
and bb: "z' \<approx> w'" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
603 |
and cc: "list_rel op \<approx> w' w" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
604 |
have a': "list_rel op \<approx> (x @ z) (x' @ z')" using a aa append_rsp2_pre by auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
605 |
have b': "x' @ z' \<approx> y' @ w'" using b bb by simp |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
606 |
have c': "list_rel op \<approx> (y' @ w') (y @ w)" using c cc append_rsp2_pre by auto |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
607 |
have d': "(op \<approx> OO list_rel op \<approx>) (x' @ z') (y @ w)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
608 |
by (rule pred_compI) (rule b', rule c') |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
609 |
show "(list_rel op \<approx> OOO op \<approx>) (x @ z) (y @ w)" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
610 |
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
|
611 |
qed |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
612 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
613 |
text {* Raw theorems. Finsert, memb, singleron, sub_list *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
614 |
|
1892 | 615 |
lemma nil_not_cons: |
616 |
shows "\<not> ([] \<approx> x # xs)" |
|
617 |
and "\<not> (x # xs \<approx> [])" |
|
618 |
by auto |
|
619 |
||
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
620 |
lemma no_memb_nil: |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
621 |
"(\<forall>x. \<not> memb x xs) = (xs = [])" |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
622 |
by (simp add: memb_def) |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
623 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
624 |
lemma memb_consI1: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
625 |
shows "memb x (x # xs)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
626 |
by (simp add: memb_def) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
627 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
628 |
lemma memb_consI2: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
629 |
shows "memb x xs \<Longrightarrow> memb x (y # xs)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
630 |
by (simp add: memb_def) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
631 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
632 |
lemma singleton_list_eq: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
633 |
shows "[x] \<approx> [y] \<longleftrightarrow> x = y" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
634 |
by (simp add: id_simps) auto |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
635 |
|
1892 | 636 |
lemma sub_list_cons: |
637 |
"sub_list (x # xs) ys = (memb x ys \<and> sub_list xs ys)" |
|
638 |
by (auto simp add: memb_def sub_list_def) |
|
639 |
||
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
640 |
text {* Cardinality of finite sets *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
641 |
|
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
642 |
lemma fcard_raw_0: |
1860 | 643 |
shows "fcard_raw xs = 0 \<longleftrightarrow> xs \<approx> []" |
1821 | 644 |
by (induct xs) (auto simp add: memb_def) |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
645 |
|
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
646 |
lemma fcard_raw_not_memb: |
1860 | 647 |
shows "\<not> memb x xs \<longleftrightarrow> fcard_raw (x # xs) = Suc (fcard_raw xs)" |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
648 |
by auto |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
649 |
|
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
650 |
lemma fcard_raw_suc: |
1860 | 651 |
assumes a: "fcard_raw xs = Suc n" |
652 |
shows "\<exists>x ys. \<not> (memb x ys) \<and> xs \<approx> (x # ys) \<and> fcard_raw ys = n" |
|
653 |
using a |
|
654 |
by (induct xs) (auto simp add: memb_def split: if_splits) |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
655 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
656 |
lemma singleton_fcard_1: |
1860 | 657 |
shows "set xs = {x} \<Longrightarrow> fcard_raw xs = 1" |
658 |
by (induct xs) (auto simp add: memb_def subset_insert) |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
659 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
660 |
lemma fcard_raw_1: |
1823
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
661 |
shows "fcard_raw xs = 1 \<longleftrightarrow> (\<exists>x. xs \<approx> [x])" |
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
662 |
apply (auto dest!: fcard_raw_suc) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
663 |
apply (simp add: fcard_raw_0) |
1821 | 664 |
apply (rule_tac x="x" in exI) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
665 |
apply simp |
1821 | 666 |
apply (subgoal_tac "set xs = {x}") |
1860 | 667 |
apply (drule singleton_fcard_1) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
668 |
apply auto |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
669 |
done |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
670 |
|
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
671 |
lemma fcard_raw_suc_memb: |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
672 |
assumes a: "fcard_raw A = Suc n" |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
673 |
shows "\<exists>a. memb a A" |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
674 |
using a |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
675 |
apply (induct A) |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
676 |
apply simp |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
677 |
apply (rule_tac x="a" in exI) |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
678 |
apply (simp add: memb_def) |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
679 |
done |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
680 |
|
1884 | 681 |
lemma memb_card_not_0: |
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
682 |
assumes a: "memb a A" |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
683 |
shows "\<not>(fcard_raw A = 0)" |
1883
b2fa5de30a73
Getting rid of 'metis'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1881
diff
changeset
|
684 |
proof - |
b2fa5de30a73
Getting rid of 'metis'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1881
diff
changeset
|
685 |
have "\<not>(\<forall>x. \<not> memb x A)" using a by auto |
b2fa5de30a73
Getting rid of 'metis'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1881
diff
changeset
|
686 |
then have "\<not>A \<approx> []" using none_memb_nil[of A] by simp |
b2fa5de30a73
Getting rid of 'metis'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1881
diff
changeset
|
687 |
then show ?thesis using fcard_raw_0[of A] by simp |
b2fa5de30a73
Getting rid of 'metis'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1881
diff
changeset
|
688 |
qed |
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
689 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
690 |
text {* fmap *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
691 |
|
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
692 |
lemma map_append: |
1821 | 693 |
"map f (xs @ ys) \<approx> (map f xs) @ (map f ys)" |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
694 |
by simp |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
695 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
696 |
lemma memb_append: |
1823
91ba55dba5e0
added header and more tuning
Christian Urban <urbanc@in.tum.de>
parents:
1822
diff
changeset
|
697 |
"memb x (xs @ ys) \<longleftrightarrow> memb x xs \<or> memb x ys" |
1821 | 698 |
by (induct xs) (simp_all add: not_memb_nil memb_cons_iff) |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
699 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
700 |
lemma cons_left_comm: |
1821 | 701 |
"x # y # xs \<approx> y # x # xs" |
702 |
by auto |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
703 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
704 |
lemma cons_left_idem: |
1821 | 705 |
"x # x # xs \<approx> x # xs" |
706 |
by auto |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
707 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
708 |
lemma fset_raw_strong_cases: |
1822 | 709 |
"(xs = []) \<or> (\<exists>x ys. ((\<not> memb x ys) \<and> (xs \<approx> x # ys)))" |
1821 | 710 |
apply (induct xs) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
711 |
apply (simp) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
712 |
apply (rule disjI2) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
713 |
apply (erule disjE) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
714 |
apply (rule_tac x="a" in exI) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
715 |
apply (rule_tac x="[]" in exI) |
1822 | 716 |
apply (simp add: memb_def) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
717 |
apply (erule exE)+ |
1821 | 718 |
apply (case_tac "x = a") |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
719 |
apply (rule_tac x="a" in exI) |
1821 | 720 |
apply (rule_tac x="ys" in exI) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
721 |
apply (simp) |
1821 | 722 |
apply (rule_tac x="x" in exI) |
723 |
apply (rule_tac x="a # ys" in exI) |
|
1822 | 724 |
apply (auto simp add: memb_def) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
725 |
done |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
726 |
|
1860 | 727 |
section {* deletion *} |
728 |
||
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
729 |
lemma memb_delete_raw_ident: |
1860 | 730 |
shows "\<not> memb x (delete_raw xs x)" |
1821 | 731 |
by (induct xs) (auto simp add: memb_def) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
732 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
733 |
lemma fset_raw_delete_raw_cases: |
1821 | 734 |
"xs = [] \<or> (\<exists>x. memb x xs \<and> xs \<approx> x # delete_raw xs x)" |
735 |
by (induct xs) (auto simp add: memb_def) |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
736 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
737 |
lemma fdelete_raw_filter: |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
738 |
"delete_raw xs y = [x \<leftarrow> xs. x \<noteq> y]" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
739 |
by (induct xs) simp_all |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
740 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
741 |
lemma fcard_raw_delete: |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
742 |
"fcard_raw (delete_raw xs y) = (if memb y xs then fcard_raw xs - 1 else fcard_raw xs)" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
743 |
by (simp add: fdelete_raw_filter fcard_raw_delete_one) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
744 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
745 |
lemma finter_raw_empty: |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
746 |
"finter_raw l [] = []" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
747 |
by (induct l) (simp_all add: not_memb_nil) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
748 |
|
1821 | 749 |
lemma set_cong: |
750 |
shows "(set x = set y) = (x \<approx> y)" |
|
751 |
by auto |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
752 |
|
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
753 |
lemma inj_map_eq_iff: |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
754 |
"inj f \<Longrightarrow> (map f l \<approx> map f m) = (l \<approx> m)" |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
755 |
by (simp add: expand_set_eq[symmetric] inj_image_eq_iff) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
756 |
|
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
757 |
text {* alternate formulation with a different decomposition principle |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
758 |
and a proof of equivalence *} |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
759 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
760 |
inductive |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
761 |
list_eq2 |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
762 |
where |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
763 |
"list_eq2 (a # b # xs) (b # a # xs)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
764 |
| "list_eq2 [] []" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
765 |
| "list_eq2 xs ys \<Longrightarrow> list_eq2 ys xs" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
766 |
| "list_eq2 (a # a # xs) (a # xs)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
767 |
| "list_eq2 xs ys \<Longrightarrow> list_eq2 (a # xs) (a # ys)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
768 |
| "\<lbrakk>list_eq2 xs1 xs2; list_eq2 xs2 xs3\<rbrakk> \<Longrightarrow> list_eq2 xs1 xs3" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
769 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
770 |
lemma list_eq2_refl: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
771 |
shows "list_eq2 xs xs" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
772 |
by (induct xs) (auto intro: list_eq2.intros) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
773 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
774 |
lemma cons_delete_list_eq2: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
775 |
shows "list_eq2 (a # (delete_raw A a)) (if memb a A then A else a # A)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
776 |
apply (induct A) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
777 |
apply (simp add: memb_def list_eq2_refl) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
778 |
apply (case_tac "memb a (aa # A)") |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
779 |
apply (simp_all only: memb_cons_iff) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
780 |
apply (case_tac [!] "a = aa") |
1909 | 781 |
apply (simp_all) |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
782 |
apply (case_tac "memb a A") |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
783 |
apply (auto simp add: memb_def)[2] |
1927
6c5e3ac737d9
append_rsp2 + isarification
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1913
diff
changeset
|
784 |
apply (case_tac "list_eq2 (a # A) A") |
6c5e3ac737d9
append_rsp2 + isarification
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1913
diff
changeset
|
785 |
apply (metis list_eq2.intros(3) list_eq2.intros(6)) |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
786 |
apply (metis list_eq2.intros(3) list_eq2.intros(4) list_eq2.intros(5) list_eq2.intros(6)) |
1895
91d67240c9c1
FSet is a semi-lattice
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1893
diff
changeset
|
787 |
apply (metis list_eq2.intros(1) list_eq2.intros(5) list_eq2.intros(6)) |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
788 |
apply (auto simp add: list_eq2_refl not_memb_delete_raw_ident) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
789 |
done |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
790 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
791 |
lemma memb_delete_list_eq2: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
792 |
assumes a: "memb e r" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
793 |
shows "list_eq2 (e # delete_raw r e) r" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
794 |
using a cons_delete_list_eq2[of e r] |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
795 |
by simp |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
796 |
|
1909 | 797 |
lemma delete_raw_rsp: |
798 |
"xs \<approx> ys \<Longrightarrow> delete_raw xs x \<approx> delete_raw ys x" |
|
799 |
by (simp add: memb_def[symmetric] memb_delete_raw) |
|
800 |
||
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
801 |
lemma list_eq2_equiv_aux: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
802 |
assumes a: "fcard_raw l = n" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
803 |
and b: "l \<approx> r" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
804 |
shows "list_eq2 l r" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
805 |
using a b |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
806 |
proof (induct n arbitrary: l r) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
807 |
case 0 |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
808 |
have "fcard_raw l = 0" by fact |
1889
6c5b5ec53a0b
sub_list definition and respects
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1888
diff
changeset
|
809 |
then have "\<forall>x. \<not> memb x l" using memb_card_not_0[of _ l] by auto |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
810 |
then have z: "l = []" using no_memb_nil by auto |
1912 | 811 |
then have "r = []" using `l \<approx> r` by simp |
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
812 |
then show ?case using z list_eq2_refl by simp |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
813 |
next |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
814 |
case (Suc m) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
815 |
have b: "l \<approx> r" by fact |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
816 |
have d: "fcard_raw l = Suc m" by fact |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
817 |
have "\<exists>a. memb a l" by (rule fcard_raw_suc_memb[OF d]) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
818 |
then obtain a where e: "memb a l" by auto |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
819 |
then have e': "memb a r" using list_eq.simps[simplified memb_def[symmetric], of l r] b by auto |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
820 |
have f: "fcard_raw (delete_raw l a) = m" using fcard_raw_delete[of l a] e d by simp |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
821 |
have g: "delete_raw l a \<approx> delete_raw r a" using delete_raw_rsp[OF b] by simp |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
822 |
have g': "list_eq2 (delete_raw l a) (delete_raw r a)" by (rule Suc.hyps[OF f g]) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
823 |
have h: "list_eq2 (a # delete_raw l a) (a # delete_raw r a)" by (rule list_eq2.intros(5)[OF g']) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
824 |
have i: "list_eq2 l (a # delete_raw l a)" by (rule list_eq2.intros(3)[OF memb_delete_list_eq2[OF e]]) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
825 |
have "list_eq2 l (a # delete_raw r a)" by (rule list_eq2.intros(6)[OF i h]) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
826 |
then show ?case using list_eq2.intros(6)[OF _ memb_delete_list_eq2[OF e']] by simp |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
827 |
qed |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
828 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
829 |
lemma list_eq2_equiv: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
830 |
"(l \<approx> r) \<longleftrightarrow> (list_eq2 l r)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
831 |
proof |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
832 |
show "list_eq2 l r \<Longrightarrow> l \<approx> r" by (induct rule: list_eq2.induct) auto |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
833 |
show "l \<approx> r \<Longrightarrow> list_eq2 l r" using list_eq2_equiv_aux by blast |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
834 |
qed |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
835 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
836 |
text {* Lifted theorems *} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
837 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
838 |
lemma not_fin_fnil: "x |\<notin>| {||}" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
839 |
by (lifting not_memb_nil) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
840 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
841 |
lemma fin_finsert_iff[simp]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
842 |
"x |\<in>| finsert y S = (x = y \<or> x |\<in>| S)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
843 |
by (lifting memb_cons_iff) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
844 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
845 |
lemma |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
846 |
shows finsertI1: "x |\<in>| finsert x S" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
847 |
and finsertI2: "x |\<in>| S \<Longrightarrow> x |\<in>| finsert y S" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
848 |
by (lifting memb_consI1, lifting memb_consI2) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
849 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
850 |
lemma finsert_absorb[simp]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
851 |
shows "x |\<in>| S \<Longrightarrow> finsert x S = S" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
852 |
by (lifting memb_absorb) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
853 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
854 |
lemma fempty_not_finsert[simp]: |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
855 |
"{||} \<noteq> finsert x S" |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
856 |
"finsert x S \<noteq> {||}" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
857 |
by (lifting nil_not_cons) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
858 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
859 |
lemma finsert_left_comm: |
1822 | 860 |
"finsert x (finsert y S) = finsert y (finsert x S)" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
861 |
by (lifting cons_left_comm) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
862 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
863 |
lemma finsert_left_idem: |
1822 | 864 |
"finsert x (finsert x S) = finsert x S" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
865 |
by (lifting cons_left_idem) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
866 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
867 |
lemma fsingleton_eq[simp]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
868 |
shows "{|x|} = {|y|} \<longleftrightarrow> x = y" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
869 |
by (lifting singleton_list_eq) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
870 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
871 |
text {* fset_to_set *} |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
872 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
873 |
lemma fset_to_set_simps[simp]: |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
874 |
"fset_to_set {||} = ({} :: 'a set)" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
875 |
"fset_to_set (finsert (h :: 'a) t) = insert h (fset_to_set t)" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
876 |
by (lifting set.simps) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
877 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
878 |
lemma in_fset_to_set: |
1822 | 879 |
"x \<in> fset_to_set S \<equiv> x |\<in>| S" |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
880 |
by (lifting memb_def[symmetric]) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
881 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
882 |
lemma none_fin_fempty: |
1824
2ccc1b00377c
merge part1: none_memb_nil
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1823
diff
changeset
|
883 |
"(\<forall>x. x |\<notin>| S) = (S = {||})" |
2ccc1b00377c
merge part1: none_memb_nil
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1823
diff
changeset
|
884 |
by (lifting none_memb_nil) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
885 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
886 |
lemma fset_cong: |
1822 | 887 |
"(fset_to_set S = fset_to_set T) = (S = T)" |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
888 |
by (lifting set_cong) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
889 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
890 |
text {* fcard *} |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
891 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
892 |
lemma fcard_fempty [simp]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
893 |
shows "fcard {||} = 0" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
894 |
by (lifting fcard_raw_nil) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
895 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
896 |
lemma fcard_finsert_if [simp]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
897 |
shows "fcard (finsert x S) = (if x |\<in>| S then fcard S else Suc (fcard S))" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
898 |
by (lifting fcard_raw_cons) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
899 |
|
1822 | 900 |
lemma fcard_0: "(fcard S = 0) = (S = {||})" |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
901 |
by (lifting fcard_raw_0) |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
902 |
|
1821 | 903 |
lemma fcard_1: |
1822 | 904 |
shows "(fcard S = 1) = (\<exists>x. S = {|x|})" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
905 |
by (lifting fcard_raw_1) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
906 |
|
1860 | 907 |
lemma fcard_gt_0: |
908 |
shows "x \<in> fset_to_set S \<Longrightarrow> 0 < fcard S" |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
909 |
by (lifting fcard_raw_gt_0) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
910 |
|
1860 | 911 |
lemma fcard_not_fin: |
912 |
shows "(x |\<notin>| S) = (fcard (finsert x S) = Suc (fcard S))" |
|
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
913 |
by (lifting fcard_raw_not_memb) |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
914 |
|
1822 | 915 |
lemma fcard_suc: "fcard S = Suc n \<Longrightarrow> \<exists>x T. x |\<notin>| T \<and> S = finsert x T \<and> fcard T = n" |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
916 |
by (lifting fcard_raw_suc) |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
917 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
918 |
lemma fcard_delete: |
1822 | 919 |
"fcard (fdelete S y) = (if y |\<in>| S then fcard S - 1 else fcard S)" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
920 |
by (lifting fcard_raw_delete) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
921 |
|
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
922 |
lemma fcard_suc_memb: "fcard A = Suc n \<Longrightarrow> \<exists>a. a |\<in>| A" |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
923 |
by (lifting fcard_raw_suc_memb) |
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
924 |
|
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
925 |
lemma fin_fcard_not_0: "a |\<in>| A \<Longrightarrow> fcard A \<noteq> 0" |
1887 | 926 |
by (lifting memb_card_not_0) |
1878
c22947214948
2 more lifted lemmas needed for second representation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1860
diff
changeset
|
927 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
928 |
text {* funion *} |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
929 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
930 |
lemma funion_simps[simp]: |
1860 | 931 |
shows "{||} |\<union>| S = S" |
932 |
and "finsert x S |\<union>| T = finsert x (S |\<union>| T)" |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
933 |
by (lifting append.simps) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
934 |
|
1887 | 935 |
lemma funion_empty[simp]: |
936 |
shows "S |\<union>| {||} = S" |
|
937 |
by (lifting append_Nil2) |
|
938 |
||
1907 | 939 |
thm sup.commute[where 'a="'a fset"] |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
940 |
|
1907 | 941 |
thm sup.assoc[where 'a="'a fset"] |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
942 |
|
1887 | 943 |
lemma singleton_union_left: |
944 |
"{|a|} |\<union>| S = finsert a S" |
|
945 |
by simp |
|
946 |
||
947 |
lemma singleton_union_right: |
|
948 |
"S |\<union>| {|a|} = finsert a S" |
|
1907 | 949 |
by (subst sup.commute) simp |
1887 | 950 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
951 |
section {* Induction and Cases rules for finite sets *} |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
952 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
953 |
lemma fset_strong_cases: |
1822 | 954 |
"S = {||} \<or> (\<exists>x T. x |\<notin>| T \<and> S = finsert x T)" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
955 |
by (lifting fset_raw_strong_cases) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
956 |
|
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
957 |
lemma fset_exhaust[case_names fempty finsert, cases type: fset]: |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
958 |
shows "\<lbrakk>S = {||} \<Longrightarrow> P; \<And>x S'. S = finsert x S' \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
959 |
by (lifting list.exhaust) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
960 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
961 |
lemma fset_induct_weak[case_names fempty finsert]: |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
962 |
shows "\<lbrakk>P {||}; \<And>x S. P S \<Longrightarrow> P (finsert x S)\<rbrakk> \<Longrightarrow> P S" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
963 |
by (lifting list.induct) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
964 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
965 |
lemma fset_induct[case_names fempty finsert, induct type: fset]: |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
966 |
assumes prem1: "P {||}" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
967 |
and prem2: "\<And>x S. \<lbrakk>x |\<notin>| S; P S\<rbrakk> \<Longrightarrow> P (finsert x S)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
968 |
shows "P S" |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
969 |
proof(induct S rule: fset_induct_weak) |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
970 |
case fempty |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
971 |
show "P {||}" by (rule prem1) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
972 |
next |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
973 |
case (finsert x S) |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
974 |
have asm: "P S" by fact |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
975 |
show "P (finsert x S)" |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
976 |
proof(cases "x |\<in>| S") |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
977 |
case True |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
978 |
have "x |\<in>| S" by fact |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
979 |
then show "P (finsert x S)" using asm by simp |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
980 |
next |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
981 |
case False |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
982 |
have "x |\<notin>| S" by fact |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
983 |
then show "P (finsert x S)" using prem2 asm by simp |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
984 |
qed |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
985 |
qed |
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
986 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
987 |
lemma fset_induct2: |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
988 |
"P {||} {||} \<Longrightarrow> |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
989 |
(\<And>x xs. x |\<notin>| xs \<Longrightarrow> P (finsert x xs) {||}) \<Longrightarrow> |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
990 |
(\<And>y ys. y |\<notin>| ys \<Longrightarrow> P {||} (finsert y ys)) \<Longrightarrow> |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
991 |
(\<And>x xs y ys. \<lbrakk>P xs ys; x |\<notin>| xs; y |\<notin>| ys\<rbrakk> \<Longrightarrow> P (finsert x xs) (finsert y ys)) \<Longrightarrow> |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
992 |
P xsa ysa" |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
993 |
apply (induct xsa arbitrary: ysa) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
994 |
apply (induct_tac x rule: fset_induct) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
995 |
apply simp_all |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
996 |
apply (induct_tac xa rule: fset_induct) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
997 |
apply simp_all |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
998 |
done |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
999 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1000 |
text {* fmap *} |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1001 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1002 |
lemma fmap_simps[simp]: |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1003 |
"fmap (f :: 'a \<Rightarrow> 'b) {||} = {||}" |
1822 | 1004 |
"fmap f (finsert x S) = finsert (f x) (fmap f S)" |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1005 |
by (lifting map.simps) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1006 |
|
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1007 |
lemma fmap_set_image: |
1822 | 1008 |
"fset_to_set (fmap f S) = f ` (fset_to_set S)" |
1009 |
by (induct S) (simp_all) |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1010 |
|
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1011 |
lemma inj_fmap_eq_iff: |
1822 | 1012 |
"inj f \<Longrightarrow> (fmap f S = fmap f T) = (S = T)" |
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1013 |
by (lifting inj_map_eq_iff) |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1014 |
|
1822 | 1015 |
lemma fmap_funion: "fmap f (S |\<union>| T) = fmap f S |\<union>| fmap f T" |
1813
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
1016 |
by (lifting map_append) |
69fff336dd18
Porting lemmas from Quotient package FSet to new FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1682
diff
changeset
|
1017 |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1018 |
lemma fin_funion: |
1822 | 1019 |
"x |\<in>| S |\<union>| T \<longleftrightarrow> x |\<in>| S \<or> x |\<in>| T" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1020 |
by (lifting memb_append) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1021 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1022 |
text {* ffold *} |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1023 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1024 |
lemma ffold_nil: "ffold f z {||} = z" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1025 |
by (lifting ffold_raw.simps(1)[where 'a="'b" and 'b="'a"]) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1026 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1027 |
lemma ffold_finsert: "ffold f z (finsert a A) = |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1028 |
(if rsp_fold f then if a |\<in>| A then ffold f z A else f a (ffold f z A) else z)" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1029 |
by (lifting ffold_raw.simps(2)[where 'a="'b" and 'b="'a"]) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1030 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1031 |
lemma fin_commute_ffold: |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1032 |
"\<lbrakk>rsp_fold f; h |\<in>| b\<rbrakk> \<Longrightarrow> ffold f z b = f h (ffold f z (fdelete b h))" |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1033 |
by (lifting memb_commute_ffold_raw) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1034 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1035 |
text {* fdelete *} |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1036 |
|
1822 | 1037 |
lemma fin_fdelete: |
1038 |
shows "x |\<in>| fdelete S y \<longleftrightarrow> x |\<in>| S \<and> x \<noteq> y" |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1039 |
by (lifting memb_delete_raw) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1040 |
|
1822 | 1041 |
lemma fin_fdelete_ident: |
1042 |
shows "x |\<notin>| fdelete S x" |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1043 |
by (lifting memb_delete_raw_ident) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1044 |
|
1822 | 1045 |
lemma not_memb_fdelete_ident: |
1046 |
shows "x |\<notin>| S \<Longrightarrow> fdelete S x = S" |
|
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1047 |
by (lifting not_memb_delete_raw_ident) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1048 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1049 |
lemma fset_fdelete_cases: |
1822 | 1050 |
shows "S = {||} \<or> (\<exists>x. x |\<in>| S \<and> S = finsert x (fdelete S x))" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1051 |
by (lifting fset_raw_delete_raw_cases) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1052 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1053 |
text {* inter *} |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1054 |
|
1822 | 1055 |
lemma finter_empty_l: "({||} |\<inter>| S) = {||}" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1056 |
by (lifting finter_raw.simps(1)) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1057 |
|
1822 | 1058 |
lemma finter_empty_r: "(S |\<inter>| {||}) = {||}" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1059 |
by (lifting finter_raw_empty) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1060 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1061 |
lemma finter_finsert: |
1822 | 1062 |
"finsert x S |\<inter>| T = (if x |\<in>| T then finsert x (S |\<inter>| T) else S |\<inter>| T)" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1063 |
by (lifting finter_raw.simps(2)) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1064 |
|
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1065 |
lemma fin_finter: |
1822 | 1066 |
"x |\<in>| (S |\<inter>| T) \<longleftrightarrow> x |\<in>| S \<and> x |\<in>| T" |
1819
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1067 |
by (lifting memb_finter_raw) |
63dd459dbc0d
Much more in FSet (currently non-working)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1817
diff
changeset
|
1068 |
|
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1069 |
lemma fsubset_finsert: |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1070 |
"(finsert x xs |\<subseteq>| ys) = (x |\<in>| ys \<and> xs |\<subseteq>| ys)" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1071 |
by (lifting sub_list_cons) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1072 |
|
1936
99367d481f78
Converted 'thm' to a lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1935
diff
changeset
|
1073 |
lemma "xs |\<subseteq>| ys \<equiv> \<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys" |
99367d481f78
Converted 'thm' to a lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1935
diff
changeset
|
1074 |
by (lifting sub_list_def[simplified memb_def[symmetric]]) |
1893
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1075 |
|
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1076 |
lemma fsubset_fin: "xs |\<subseteq>| ys = (\<forall>x. x |\<in>| xs \<longrightarrow> x |\<in>| ys)" |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1077 |
by (rule meta_eq_to_obj_eq) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1078 |
(lifting sub_list_def[simplified memb_def[symmetric]]) |
464dd13efff6
Putting FSet in bot typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1892
diff
changeset
|
1079 |
|
1820
de28a91eaca3
Working FSet with additional lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1819
diff
changeset
|
1080 |
lemma expand_fset_eq: |
1822 | 1081 |
"(S = T) = (\<forall>x. (x |\<in>| S) = (x |\<in>| T))" |
1820
de28a91eaca3
Working FSet with additional lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1819
diff
changeset
|
1082 |
by (lifting list_eq.simps[simplified memb_def[symmetric]]) |
de28a91eaca3
Working FSet with additional lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1819
diff
changeset
|
1083 |
|
1888
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1084 |
(* 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
|
1085 |
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
|
1086 |
a different order *) |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1087 |
lemma fset_eq_cases: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1088 |
"\<lbrakk>a1 = a2; |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1089 |
\<And>a b xs. \<lbrakk>a1 = finsert a (finsert b xs); a2 = finsert b (finsert a xs)\<rbrakk> \<Longrightarrow> P; |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1090 |
\<lbrakk>a1 = {||}; a2 = {||}\<rbrakk> \<Longrightarrow> P; \<And>xs ys. \<lbrakk>a1 = ys; a2 = xs; xs = ys\<rbrakk> \<Longrightarrow> P; |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1091 |
\<And>a xs. \<lbrakk>a1 = finsert a (finsert a xs); a2 = finsert a xs\<rbrakk> \<Longrightarrow> P; |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1092 |
\<And>xs ys a. \<lbrakk>a1 = finsert a xs; a2 = finsert a ys; xs = ys\<rbrakk> \<Longrightarrow> P; |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1093 |
\<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
|
1094 |
\<Longrightarrow> P" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1095 |
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
|
1096 |
|
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1097 |
lemma fset_eq_induct: |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1098 |
assumes "x1 = x2" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1099 |
and "\<And>a b xs. P (finsert a (finsert b xs)) (finsert b (finsert a xs))" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1100 |
and "P {||} {||}" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1101 |
and "\<And>xs ys. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P ys xs" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1102 |
and "\<And>a xs. P (finsert a (finsert a xs)) (finsert a xs)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1103 |
and "\<And>xs ys a. \<lbrakk>xs = ys; P xs ys\<rbrakk> \<Longrightarrow> P (finsert a xs) (finsert a ys)" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1104 |
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
|
1105 |
shows "P x1 x2" |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1106 |
using assms |
59f41804b3f8
Alternate list_eq and equivalence
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1887
diff
changeset
|
1107 |
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
|
1108 |
|
1935
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1109 |
text {* concat *} |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1110 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1111 |
lemma fconcat_empty: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1112 |
shows "fconcat {||} = {||}" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1113 |
by (lifting concat.simps(1)) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1114 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1115 |
lemma fconcat_insert: |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1116 |
shows "fconcat (finsert x S) = x |\<union>| fconcat S" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1117 |
by (lifting concat.simps(2)) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1118 |
|
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1119 |
lemma "fconcat (xs |\<union>| ys) = fconcat xs |\<union>| fconcat ys" |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1120 |
by (lifting concat_append) |
266abc3ee228
Moved working Fset3 properties to FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1927
diff
changeset
|
1121 |
|
1533
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1122 |
ML {* |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1123 |
fun dest_fsetT (Type ("FSet.fset", [T])) = T |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1124 |
| dest_fsetT T = raise TYPE ("dest_fsetT: fset type expected", [T], []); |
5f5e99a11f66
A few more theorems in FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1518
diff
changeset
|
1125 |
*} |
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1126 |
|
1682
ae54ce4cde54
Remove list_eq notation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1533
diff
changeset
|
1127 |
no_notation |
ae54ce4cde54
Remove list_eq notation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1533
diff
changeset
|
1128 |
list_eq (infix "\<approx>" 50) |
ae54ce4cde54
Remove list_eq notation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1533
diff
changeset
|
1129 |
|
1518
212629c90971
Added a cleaned version of FSet.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1130 |
end |