author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Fri, 04 Dec 2009 16:53:11 +0100 | |
changeset 541 | 94deffed619d |
parent 540 | c0b13fb70d6d |
child 542 | fe468f8723fc |
permissions | -rw-r--r-- |
0 | 1 |
theory QuotScript |
530
5e92ce8f306d
smaller theory footprint
Christian Urban <urbanc@in.tum.de>
parents:
528
diff
changeset
|
2 |
imports Plain ATP_Linkup |
0 | 3 |
begin |
4 |
||
5 |
definition |
|
528 | 6 |
"equivp E \<equiv> \<forall>x y. E x y = (E x = E y)" |
0 | 7 |
|
8 |
definition |
|
528 | 9 |
"reflp E \<equiv> \<forall>x. E x x" |
0 | 10 |
|
11 |
definition |
|
528 | 12 |
"symp E \<equiv> \<forall>x y. E x y \<longrightarrow> E y x" |
0 | 13 |
|
14 |
definition |
|
528 | 15 |
"transp E \<equiv> \<forall>x y z. E x y \<and> E y z \<longrightarrow> E x z" |
0 | 16 |
|
528 | 17 |
lemma equivp_reflp_symp_transp: |
18 |
shows "equivp E = (reflp E \<and> symp E \<and> transp E)" |
|
19 |
unfolding equivp_def reflp_def symp_def transp_def expand_fun_eq |
|
0 | 20 |
by (blast) |
21 |
||
528 | 22 |
lemma equivp_refl: |
23 |
shows "equivp R \<Longrightarrow> (\<And>x. R x x)" |
|
24 |
by (simp add: equivp_reflp_symp_transp reflp_def) |
|
25 |
||
26 |
lemma equivp_reflp: |
|
27 |
shows "equivp E \<Longrightarrow> (\<And>x. E x x)" |
|
28 |
by (simp add: equivp_reflp_symp_transp reflp_def) |
|
217
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
188
diff
changeset
|
29 |
|
0 | 30 |
definition |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
31 |
"part_equivp E \<equiv> (\<exists>x. E x x) \<and> (\<forall>x y. E x y = (E x x \<and> E y y \<and> (E x = E y)))" |
0 | 32 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
33 |
lemma equivp_IMP_part_equivp: |
528 | 34 |
assumes a: "equivp E" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
35 |
shows "part_equivp E" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
36 |
using a unfolding equivp_def part_equivp_def |
0 | 37 |
by auto |
38 |
||
39 |
definition |
|
528 | 40 |
"Quotient E Abs Rep \<equiv> (\<forall>a. Abs (Rep a) = a) \<and> |
0 | 41 |
(\<forall>a. E (Rep a) (Rep a)) \<and> |
42 |
(\<forall>r s. E r s = (E r r \<and> E s s \<and> (Abs r = Abs s)))" |
|
43 |
||
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
44 |
lemma Quotient_abs_rep: |
528 | 45 |
assumes a: "Quotient E Abs Rep" |
0 | 46 |
shows "Abs (Rep a) = a" |
528 | 47 |
using a unfolding Quotient_def |
0 | 48 |
by simp |
49 |
||
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
50 |
lemma Quotient_rep_reflp: |
528 | 51 |
assumes a: "Quotient E Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
52 |
shows "E (Rep a) (Rep a)" |
528 | 53 |
using a unfolding Quotient_def |
0 | 54 |
by blast |
55 |
||
539
8287fb5b8d7a
Cleaning & Renaming coming from QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
537
diff
changeset
|
56 |
lemma Quotient_rel: |
528 | 57 |
assumes a: "Quotient E Abs Rep" |
0 | 58 |
shows " E r s = (E r r \<and> E s s \<and> (Abs r = Abs s))" |
528 | 59 |
using a unfolding Quotient_def |
0 | 60 |
by blast |
61 |
||
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
62 |
lemma Quotient_rel_rep: |
528 | 63 |
assumes a: "Quotient R Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
64 |
shows "R (Rep a) (Rep b) \<equiv> (a = b)" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
65 |
apply (rule eq_reflection) |
528 | 66 |
using a unfolding Quotient_def |
0 | 67 |
by metis |
68 |
||
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
69 |
lemma Quotient_rep_abs: |
528 | 70 |
assumes a: "Quotient R Abs Rep" |
459 | 71 |
shows "R r r \<Longrightarrow> R (Rep (Abs r)) r" |
528 | 72 |
using a unfolding Quotient_def |
0 | 73 |
by blast |
74 |
||
528 | 75 |
lemma IDENTITY_equivp: |
76 |
shows "equivp (op =)" |
|
77 |
unfolding equivp_def |
|
0 | 78 |
by auto |
79 |
||
528 | 80 |
lemma IDENTITY_Quotient: |
81 |
shows "Quotient (op =) id id" |
|
82 |
unfolding Quotient_def id_def |
|
0 | 83 |
by blast |
84 |
||
528 | 85 |
lemma Quotient_symp: |
86 |
assumes a: "Quotient E Abs Rep" |
|
87 |
shows "symp E" |
|
88 |
using a unfolding Quotient_def symp_def |
|
0 | 89 |
by metis |
90 |
||
528 | 91 |
lemma Quotient_transp: |
92 |
assumes a: "Quotient E Abs Rep" |
|
93 |
shows "transp E" |
|
94 |
using a unfolding Quotient_def transp_def |
|
0 | 95 |
by metis |
96 |
||
97 |
fun |
|
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
98 |
prod_rel |
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
99 |
where |
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
100 |
"prod_rel r1 r2 = (\<lambda>(a,b) (c,d). r1 a c \<and> r2 b d)" |
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
101 |
|
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
102 |
fun |
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
103 |
fun_map |
0 | 104 |
where |
105 |
"fun_map f g h x = g (h (f x))" |
|
106 |
||
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
107 |
|
0 | 108 |
abbreviation |
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
109 |
fun_map_syn (infixr "--->" 55) |
0 | 110 |
where |
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
111 |
"f ---> g \<equiv> fun_map f g" |
0 | 112 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
113 |
lemma fun_map_id: |
126
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
114 |
shows "(id ---> id) = id" |
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
115 |
by (simp add: expand_fun_eq id_def) |
0 | 116 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
117 |
(* Not used *) |
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
118 |
lemma in_fun: |
0 | 119 |
shows "x \<in> ((f ---> g) s) = g (f x \<in> s)" |
120 |
by (simp add: mem_def) |
|
121 |
||
122 |
fun |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
123 |
fun_rel |
0 | 124 |
where |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
125 |
"fun_rel E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))" |
0 | 126 |
|
127 |
abbreviation |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
128 |
fun_rel_syn (infixr "===>" 55) |
0 | 129 |
where |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
130 |
"E1 ===> E2 \<equiv> fun_rel E1 E2" |
0 | 131 |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
132 |
lemma fun_rel_eq: |
511
28bb34eeedc5
Changing = to \<equiv> in case if we want to use simp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
459
diff
changeset
|
133 |
"(op =) ===> (op =) \<equiv> (op =)" |
515
b00a9b58264d
Fixes after big merge.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
511
diff
changeset
|
134 |
by (rule eq_reflection) (simp add: expand_fun_eq) |
0 | 135 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
136 |
lemma fun_quotient: |
528 | 137 |
assumes q1: "Quotient R1 abs1 rep1" |
138 |
and q2: "Quotient R2 abs2 rep2" |
|
139 |
shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
|
0 | 140 |
proof - |
141 |
have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a" |
|
142 |
apply(simp add: expand_fun_eq) |
|
143 |
using q1 q2 |
|
528 | 144 |
apply(simp add: Quotient_def) |
0 | 145 |
done |
146 |
moreover |
|
147 |
have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)" |
|
148 |
apply(auto) |
|
528 | 149 |
using q1 q2 unfolding Quotient_def |
0 | 150 |
apply(metis) |
151 |
done |
|
152 |
moreover |
|
153 |
have "\<forall>r s. (R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> |
|
154 |
(rep1 ---> abs2) r = (rep1 ---> abs2) s)" |
|
155 |
apply(auto simp add: expand_fun_eq) |
|
528 | 156 |
using q1 q2 unfolding Quotient_def |
0 | 157 |
apply(metis) |
528 | 158 |
using q1 q2 unfolding Quotient_def |
0 | 159 |
apply(metis) |
528 | 160 |
using q1 q2 unfolding Quotient_def |
0 | 161 |
apply(metis) |
528 | 162 |
using q1 q2 unfolding Quotient_def |
0 | 163 |
apply(metis) |
164 |
done |
|
165 |
ultimately |
|
528 | 166 |
show "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
167 |
unfolding Quotient_def by blast |
|
0 | 168 |
qed |
169 |
||
170 |
definition |
|
171 |
Respects |
|
172 |
where |
|
173 |
"Respects R x \<equiv> (R x x)" |
|
174 |
||
175 |
lemma IN_RESPECTS: |
|
176 |
shows "(x \<in> Respects R) = R x x" |
|
177 |
unfolding mem_def Respects_def by simp |
|
178 |
||
179 |
lemma RESPECTS_THM: |
|
180 |
shows "Respects (R1 ===> R2) f = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (f y))" |
|
181 |
unfolding Respects_def |
|
182 |
by (simp add: expand_fun_eq) |
|
183 |
||
184 |
lemma RESPECTS_MP: |
|
185 |
assumes a: "Respects (R1 ===> R2) f" |
|
186 |
and b: "R1 x y" |
|
187 |
shows "R2 (f x) (f y)" |
|
188 |
using a b unfolding Respects_def |
|
189 |
by simp |
|
190 |
||
191 |
lemma RESPECTS_REP_ABS: |
|
528 | 192 |
assumes a: "Quotient R1 Abs1 Rep1" |
0 | 193 |
and b: "Respects (R1 ===> R2) f" |
194 |
and c: "R1 x x" |
|
195 |
shows "R2 (f (Rep1 (Abs1 x))) (f x)" |
|
528 | 196 |
using a b[simplified RESPECTS_THM] c unfolding Quotient_def |
0 | 197 |
by blast |
198 |
||
199 |
lemma RESPECTS_o: |
|
200 |
assumes a: "Respects (R2 ===> R3) f" |
|
201 |
and b: "Respects (R1 ===> R2) g" |
|
202 |
shows "Respects (R1 ===> R3) (f o g)" |
|
203 |
using a b unfolding Respects_def |
|
204 |
by simp |
|
205 |
||
206 |
(* |
|
207 |
definition |
|
208 |
"RES_EXISTS_EQUIV R P \<equiv> (\<exists>x \<in> Respects R. P x) \<and> |
|
209 |
(\<forall>x\<in> Respects R. \<forall>y\<in> Respects R. P x \<and> P y \<longrightarrow> R x y)" |
|
210 |
*) |
|
211 |
||
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
212 |
lemma fun_rel_EQ_REL: |
528 | 213 |
assumes q1: "Quotient R1 Abs1 Rep1" |
214 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 215 |
shows "(R1 ===> R2) f g = ((Respects (R1 ===> R2) f) \<and> (Respects (R1 ===> R2) g) |
216 |
\<and> ((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g))" |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
217 |
using fun_quotient[OF q1 q2] unfolding Respects_def Quotient_def expand_fun_eq |
0 | 218 |
by blast |
219 |
||
458 | 220 |
(* TODO: it is the same as APPLY_RSP *) |
0 | 221 |
(* q1 and q2 not used; see next lemma *) |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
222 |
lemma fun_rel_MP: |
528 | 223 |
assumes q1: "Quotient R1 Abs1 Rep1" |
224 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 225 |
shows "(R1 ===> R2) f g \<Longrightarrow> R1 x y \<Longrightarrow> R2 (f x) (g y)" |
226 |
by simp |
|
227 |
||
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
228 |
lemma fun_rel_IMP: |
0 | 229 |
shows "(R1 ===> R2) f g \<Longrightarrow> R1 x y \<Longrightarrow> R2 (f x) (g y)" |
230 |
by simp |
|
231 |
||
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
232 |
lemma fun_rel_EQUALS: |
528 | 233 |
assumes q1: "Quotient R1 Abs1 Rep1" |
234 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 235 |
and r1: "Respects (R1 ===> R2) f" |
236 |
and r2: "Respects (R1 ===> R2) g" |
|
237 |
shows "((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g) = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))" |
|
238 |
apply(rule_tac iffI) |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
239 |
using fun_quotient[OF q1 q2] r1 r2 unfolding Quotient_def Respects_def |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
240 |
apply(metis fun_rel_IMP) |
0 | 241 |
using r1 unfolding Respects_def expand_fun_eq |
242 |
apply(simp (no_asm_use)) |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
243 |
apply(metis Quotient_rel[OF q2] Quotient_rel_rep[OF q1]) |
0 | 244 |
done |
245 |
||
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
246 |
(* ask Peter: fun_rel_IMP used twice *) |
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
247 |
lemma fun_rel_IMP2: |
528 | 248 |
assumes q1: "Quotient R1 Abs1 Rep1" |
249 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 250 |
and r1: "Respects (R1 ===> R2) f" |
251 |
and r2: "Respects (R1 ===> R2) g" |
|
252 |
and a: "(Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g" |
|
253 |
shows "R1 x y \<Longrightarrow> R2 (f x) (g y)" |
|
254 |
using q1 q2 r1 r2 a |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
255 |
by (simp add: fun_rel_EQUALS) |
0 | 256 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
257 |
lemma equals_rsp: |
528 | 258 |
assumes q: "Quotient R Abs Rep" |
519
ebfd747b47ab
Change equiv_trans2 to EQUALS_RSP, since we can prove it for any quotient type, not only for eqv relations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
516
diff
changeset
|
259 |
and a: "R xa xb" "R ya yb" |
ebfd747b47ab
Change equiv_trans2 to EQUALS_RSP, since we can prove it for any quotient type, not only for eqv relations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
516
diff
changeset
|
260 |
shows "R xa ya = R xb yb" |
528 | 261 |
using Quotient_symp[OF q] Quotient_transp[OF q] unfolding symp_def transp_def |
0 | 262 |
using a by blast |
263 |
||
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
264 |
lemma lambda_prs: |
528 | 265 |
assumes q1: "Quotient R1 Abs1 Rep1" |
266 |
and q2: "Quotient R2 Abs2 Rep2" |
|
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
267 |
shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)" |
0 | 268 |
unfolding expand_fun_eq |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
269 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
0 | 270 |
by simp |
271 |
||
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
272 |
lemma lambda_prs1: |
528 | 273 |
assumes q1: "Quotient R1 Abs1 Rep1" |
274 |
and q2: "Quotient R2 Abs2 Rep2" |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
275 |
shows "(Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x) = (\<lambda>x. f x)" |
0 | 276 |
unfolding expand_fun_eq |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
277 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
459 | 278 |
by simp |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
279 |
|
459 | 280 |
(* Not used since applic_prs proves a version for an arbitrary number of arguments *) |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
281 |
lemma APP_PRS: |
528 | 282 |
assumes q1: "Quotient R1 abs1 rep1" |
283 |
and q2: "Quotient R2 abs2 rep2" |
|
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
284 |
shows "abs2 ((abs1 ---> rep2) f (rep1 x)) = f x" |
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
285 |
unfolding expand_fun_eq |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
286 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
252
diff
changeset
|
287 |
by simp |
0 | 288 |
|
289 |
(* Ask Peter: assumption q1 and q2 not used and lemma is the 'identity' *) |
|
290 |
lemma LAMBDA_RSP: |
|
528 | 291 |
assumes q1: "Quotient R1 Abs1 Rep1" |
292 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 293 |
and a: "(R1 ===> R2) f1 f2" |
294 |
shows "(R1 ===> R2) (\<lambda>x. f1 x) (\<lambda>y. f2 y)" |
|
295 |
by (rule a) |
|
296 |
||
297 |
(* ASK Peter about next four lemmas in quotientScript |
|
298 |
lemma ABSTRACT_PRS: |
|
528 | 299 |
assumes q1: "Quotient R1 Abs1 Rep1" |
300 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 301 |
shows "f = (Rep1 ---> Abs2) ???" |
302 |
*) |
|
303 |
||
304 |
lemma LAMBDA_REP_ABS_RSP: |
|
305 |
assumes r1: "\<And>r r'. R1 r r' \<Longrightarrow>R1 r (Rep1 (Abs1 r'))" |
|
306 |
and r2: "\<And>r r'. R2 r r' \<Longrightarrow>R2 r (Rep2 (Abs2 r'))" |
|
307 |
shows "(R1 ===> R2) f1 f2 \<Longrightarrow> (R1 ===> R2) f1 ((Abs1 ---> Rep2) ((Rep1 ---> Abs2) f2))" |
|
308 |
using r1 r2 by auto |
|
309 |
||
310 |
lemma REP_ABS_RSP: |
|
528 | 311 |
assumes q: "Quotient R Abs Rep" |
0 | 312 |
and a: "R x1 x2" |
313 |
shows "R x1 (Rep (Abs x2))" |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
314 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
459 | 315 |
|
316 |
(* Not used *) |
|
317 |
lemma REP_ABS_RSP_LEFT: |
|
528 | 318 |
assumes q: "Quotient R Abs Rep" |
459 | 319 |
and a: "R x1 x2" |
320 |
shows "R x1 (Rep (Abs x2))" |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
321 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
0 | 322 |
|
323 |
(* ----------------------------------------------------- *) |
|
324 |
(* Quantifiers: FORALL, EXISTS, EXISTS_UNIQUE, *) |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
325 |
(* Ball, Bex, RES_EXISTS_EQUIV *) |
0 | 326 |
(* ----------------------------------------------------- *) |
327 |
||
328 |
(* bool theory: COND, LET *) |
|
329 |
||
330 |
lemma IF_PRS: |
|
528 | 331 |
assumes q: "Quotient R Abs Rep" |
0 | 332 |
shows "If a b c = Abs (If a (Rep b) (Rep c))" |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
333 |
using Quotient_abs_rep[OF q] by auto |
0 | 334 |
|
335 |
(* ask peter: no use of q *) |
|
336 |
lemma IF_RSP: |
|
528 | 337 |
assumes q: "Quotient R Abs Rep" |
0 | 338 |
and a: "a1 = a2" "R b1 b2" "R c1 c2" |
339 |
shows "R (If a1 b1 c1) (If a2 b2 c2)" |
|
340 |
using a by auto |
|
341 |
||
342 |
lemma LET_PRS: |
|
528 | 343 |
assumes q1: "Quotient R1 Abs1 Rep1" |
344 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 345 |
shows "Let x f = Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f))" |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
346 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto |
0 | 347 |
|
348 |
lemma LET_RSP: |
|
528 | 349 |
assumes q1: "Quotient R1 Abs1 Rep1" |
350 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 351 |
and a1: "(R1 ===> R2) f g" |
352 |
and a2: "R1 x y" |
|
353 |
shows "R2 (Let x f) (Let y g)" |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
354 |
using fun_rel_MP[OF q1 q2 a1] a2 |
0 | 355 |
by auto |
356 |
||
357 |
||
358 |
(* ask peter what are literal_case *) |
|
359 |
(* literal_case_PRS *) |
|
360 |
(* literal_case_RSP *) |
|
361 |
||
362 |
||
363 |
(* FUNCTION APPLICATION *) |
|
364 |
||
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
365 |
(* Not used *) |
0 | 366 |
lemma APPLY_PRS: |
528 | 367 |
assumes q1: "Quotient R1 Abs1 Rep1" |
368 |
and q2: "Quotient R2 Abs2 Rep2" |
|
0 | 369 |
shows "f x = Abs2 (((Abs1 ---> Rep2) f) (Rep1 x))" |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
370 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto |
0 | 371 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
372 |
(* In the following theorem R1 can be instantiated with anything, |
516
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
373 |
but we know some of the types of the Rep and Abs functions; |
528 | 374 |
so by solving Quotient assumptions we can get a unique R2 that |
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
375 |
will be provable; which is why we need to use APPLY_RSP *) |
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
376 |
lemma apply_rsp: |
528 | 377 |
assumes q: "Quotient R1 Abs1 Rep1" |
516
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
378 |
and a: "(R1 ===> R2) f g" "R1 x y" |
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
379 |
shows "R2 ((f::'a\<Rightarrow>'c) x) ((g::'a\<Rightarrow>'c) y)" |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
380 |
using a by (rule fun_rel_IMP) |
516
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
381 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
382 |
lemma apply_rsp': |
317
d3c7f6d19c7f
Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
383 |
assumes a: "(R1 ===> R2) f g" "R1 x y" |
d3c7f6d19c7f
Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
384 |
shows "R2 (f x) (g y)" |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
385 |
using a by (rule fun_rel_IMP) |
317
d3c7f6d19c7f
Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
253
diff
changeset
|
386 |
|
0 | 387 |
|
388 |
(* combinators: I, K, o, C, W *) |
|
389 |
||
459 | 390 |
(* We use id_simps which includes id_apply; so these 2 theorems can be removed *) |
0 | 391 |
lemma I_PRS: |
528 | 392 |
assumes q: "Quotient R Abs Rep" |
126
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
393 |
shows "id e = Abs (id (Rep e))" |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
394 |
using Quotient_abs_rep[OF q] by auto |
0 | 395 |
|
396 |
lemma I_RSP: |
|
528 | 397 |
assumes q: "Quotient R Abs Rep" |
0 | 398 |
and a: "R e1 e2" |
126
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
399 |
shows "R (id e1) (id e2)" |
0 | 400 |
using a by auto |
401 |
||
402 |
lemma o_PRS: |
|
528 | 403 |
assumes q1: "Quotient R1 Abs1 Rep1" |
404 |
and q2: "Quotient R2 Abs2 Rep2" |
|
405 |
and q3: "Quotient R3 Abs3 Rep3" |
|
0 | 406 |
shows "f o g = (Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g))" |
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
539
diff
changeset
|
407 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] Quotient_abs_rep[OF q3] |
0 | 408 |
unfolding o_def expand_fun_eq |
409 |
by simp |
|
410 |
||
411 |
lemma o_RSP: |
|
528 | 412 |
assumes q1: "Quotient R1 Abs1 Rep1" |
413 |
and q2: "Quotient R2 Abs2 Rep2" |
|
414 |
and q3: "Quotient R3 Abs3 Rep3" |
|
0 | 415 |
and a1: "(R2 ===> R3) f1 f2" |
416 |
and a2: "(R1 ===> R2) g1 g2" |
|
417 |
shows "(R1 ===> R3) (f1 o g1) (f2 o g2)" |
|
418 |
using a1 a2 unfolding o_def expand_fun_eq |
|
419 |
by (auto) |
|
420 |
||
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
421 |
|
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
422 |
|
458 | 423 |
|
424 |
||
425 |
lemma COND_PRS: |
|
528 | 426 |
assumes a: "Quotient R absf repf" |
458 | 427 |
shows "(if a then b else c) = absf (if a then repf b else repf c)" |
528 | 428 |
using a unfolding Quotient_def by auto |
458 | 429 |
|
430 |
||
431 |
||
432 |
||
433 |
||
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
434 |
(* Set of lemmas for regularisation of ball and bex *) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
435 |
lemma ball_reg_eqv: |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
436 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 437 |
assumes a: "equivp R" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
438 |
shows "Ball (Respects R) P = (All P)" |
528 | 439 |
by (metis equivp_def IN_RESPECTS a) |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
440 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
441 |
lemma bex_reg_eqv: |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
442 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 443 |
assumes a: "equivp R" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
444 |
shows "Bex (Respects R) P = (Ex P)" |
528 | 445 |
by (metis equivp_def IN_RESPECTS a) |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
446 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
447 |
lemma ball_reg_right: |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
448 |
assumes a: "\<And>x. R x \<Longrightarrow> P x \<longrightarrow> Q x" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
449 |
shows "All P \<longrightarrow> Ball R Q" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
450 |
by (metis COMBC_def Collect_def Collect_mem_eq a) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
451 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
452 |
lemma bex_reg_left: |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
453 |
assumes a: "\<And>x. R x \<Longrightarrow> Q x \<longrightarrow> P x" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
454 |
shows "Bex R Q \<longrightarrow> Ex P" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
455 |
by (metis COMBC_def Collect_def Collect_mem_eq a) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
456 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
457 |
lemma ball_reg_left: |
528 | 458 |
assumes a: "equivp R" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
459 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P" |
528 | 460 |
by (metis equivp_reflp IN_RESPECTS a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
461 |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
462 |
lemma bex_reg_right: |
528 | 463 |
assumes a: "equivp R" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
464 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P" |
528 | 465 |
by (metis equivp_reflp IN_RESPECTS a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
466 |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
467 |
lemma ball_reg_eqv_range: |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
468 |
fixes P::"'a \<Rightarrow> bool" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
469 |
and x::"'a" |
528 | 470 |
assumes a: "equivp R2" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
471 |
shows "(Ball (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = All (\<lambda>f. P (f x)))" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
472 |
apply(rule iffI) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
473 |
apply(rule allI) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
474 |
apply(drule_tac x="\<lambda>y. f x" in bspec) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
475 |
apply(simp add: Respects_def IN_RESPECTS) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
476 |
apply(rule impI) |
528 | 477 |
using a equivp_reflp_symp_transp[of "R2"] |
478 |
apply(simp add: reflp_def) |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
479 |
apply(simp) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
480 |
apply(simp) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
481 |
done |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
482 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
483 |
lemma bex_reg_eqv_range: |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
484 |
fixes P::"'a \<Rightarrow> bool" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
485 |
and x::"'a" |
528 | 486 |
assumes a: "equivp R2" |
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
487 |
shows "(Bex (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = Ex (\<lambda>f. P (f x)))" |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
488 |
apply(auto) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
489 |
apply(rule_tac x="\<lambda>y. f x" in bexI) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
490 |
apply(simp) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
491 |
apply(simp add: Respects_def IN_RESPECTS) |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
492 |
apply(rule impI) |
528 | 493 |
using a equivp_reflp_symp_transp[of "R2"] |
494 |
apply(simp add: reflp_def) |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
495 |
done |
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
496 |
|
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
497 |
lemma all_reg: |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
498 |
assumes a: "!x :: 'a. (P x --> Q x)" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
499 |
and b: "All P" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
500 |
shows "All Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
501 |
using a b by (metis) |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
502 |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
503 |
lemma ex_reg: |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
504 |
assumes a: "!x :: 'a. (P x --> Q x)" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
505 |
and b: "Ex P" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
506 |
shows "Ex Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
507 |
using a b by (metis) |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
508 |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
509 |
lemma ball_reg: |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
510 |
assumes a: "!x :: 'a. (R x --> P x --> Q x)" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
511 |
and b: "Ball R P" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
512 |
shows "Ball R Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
513 |
using a b by (metis COMBC_def Collect_def Collect_mem_eq) |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
514 |
|
427
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
416
diff
changeset
|
515 |
lemma bex_reg: |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
516 |
assumes a: "!x :: 'a. (R x --> P x --> Q x)" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
517 |
and b: "Bex R P" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
518 |
shows "Bex R Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
519 |
using a b by (metis COMBC_def Collect_def Collect_mem_eq) |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
520 |
|
432
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
521 |
lemma ball_all_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
522 |
"(\<And>y. (\<forall>x\<in>P. A x y) \<longrightarrow> (\<forall>x. B x y)) \<Longrightarrow> ((\<forall>x\<in>P. \<forall>y. A x y) \<longrightarrow> (\<forall>x. \<forall>y. B x y))" |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
523 |
by auto |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
524 |
|
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
525 |
lemma bex_ex_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
526 |
"((\<exists>y. \<exists>x. A x y) \<longrightarrow> (\<exists>y. \<exists>x\<in>P. B x y)) \<Longrightarrow> ((\<exists>x. \<exists>y. A x y) \<longrightarrow> (\<exists>x\<in>P. \<exists>y. B x y))" |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
527 |
by auto |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
528 |
|
458 | 529 |
(* 2 lemmas needed for proving repabs_inj *) |
530 |
lemma ball_rsp: |
|
531 |
assumes a: "(R ===> (op =)) f g" |
|
532 |
shows "Ball (Respects R) f = Ball (Respects R) g" |
|
533 |
using a by (simp add: Ball_def IN_RESPECTS) |
|
153
0288dd5b7ed4
The problems with 'abs' term.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
126
diff
changeset
|
534 |
|
458 | 535 |
lemma bex_rsp: |
536 |
assumes a: "(R ===> (op =)) f g" |
|
537 |
shows "(Bex (Respects R) f = Bex (Respects R) g)" |
|
538 |
using a by (simp add: Bex_def IN_RESPECTS) |
|
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
166
diff
changeset
|
539 |
|
458 | 540 |
(* 2 lemmas needed for cleaning of quantifiers *) |
541 |
lemma all_prs: |
|
528 | 542 |
assumes a: "Quotient R absf repf" |
458 | 543 |
shows "Ball (Respects R) ((absf ---> id) f) = All f" |
528 | 544 |
using a unfolding Quotient_def |
183
6acf9e001038
proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
parents:
173
diff
changeset
|
545 |
by (metis IN_RESPECTS fun_map.simps id_apply) |
162 | 546 |
|
458 | 547 |
lemma ex_prs: |
528 | 548 |
assumes a: "Quotient R absf repf" |
458 | 549 |
shows "Bex (Respects R) ((absf ---> id) f) = Ex f" |
528 | 550 |
using a unfolding Quotient_def |
458 | 551 |
by (metis COMBC_def Collect_def Collect_mem_eq IN_RESPECTS fun_map.simps id_apply) |
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
166
diff
changeset
|
552 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
553 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
554 |
(* UNUSED *) |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
555 |
lemma Quotient_rel_abs: |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
556 |
assumes a: "Quotient E Abs Rep" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
557 |
shows "E r s \<Longrightarrow> Abs r = Abs s" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
558 |
using a unfolding Quotient_def |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
559 |
by blast |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
560 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
561 |
lemma Quotient_rel_abs_eq: |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
562 |
assumes a: "Quotient E Abs Rep" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
563 |
shows "E r r \<Longrightarrow> E s s \<Longrightarrow> E r s = (Abs r = Abs s)" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
564 |
using a unfolding Quotient_def |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
565 |
by blast |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
566 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
567 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
568 |
|
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
569 |
end |
95
8c3a35da4560
Proving the proper RepAbs version
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
93
diff
changeset
|
570 |