0
+ − 1
theory QuotScript
807
a5495a323b49
added a new version of equiv_relation (is not yet used anywhere except in AbsRepTest)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2
imports Plain ATP_Linkup Predicate
0
+ − 3
begin
+ − 4
543
+ − 5
definition
+ − 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
543
+ − 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)"
543
+ − 19
unfolding equivp_def reflp_def symp_def transp_def expand_fun_eq
+ − 20
by (blast)
0
+ − 21
528
+ − 22
lemma equivp_reflp:
+ − 23
shows "equivp E \<Longrightarrow> (\<And>x. E x x)"
593
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 24
by (simp only: equivp_reflp_symp_transp reflp_def)
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 25
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 26
lemma equivp_symp:
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 27
shows "equivp E \<Longrightarrow> (\<And>x y. E x y \<Longrightarrow> E y x)"
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 28
by (metis equivp_reflp_symp_transp symp_def)
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 29
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 30
lemma equivp_transp:
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 31
shows "equivp E \<Longrightarrow> (\<And>x y z. E x y \<Longrightarrow> E y z \<Longrightarrow> E x z)"
721
+ − 32
by (metis equivp_reflp_symp_transp transp_def)
217
+ − 33
700
91b079db7380
added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 34
lemma equivpI:
91b079db7380
added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 35
assumes "reflp R" "symp R" "transp R"
91b079db7380
added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 36
shows "equivp R"
721
+ − 37
using assms by (simp add: equivp_reflp_symp_transp)
700
91b079db7380
added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 38
0
+ − 39
definition
541
+ − 40
"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
+ − 41
541
+ − 42
lemma equivp_IMP_part_equivp:
528
+ − 43
assumes a: "equivp E"
541
+ − 44
shows "part_equivp E"
543
+ − 45
using a unfolding equivp_def part_equivp_def
+ − 46
by auto
0
+ − 47
841
+ − 48
+ − 49
abbreviation
+ − 50
rel_conj (infixr "OOO" 75)
+ − 51
where
+ − 52
"r1 OOO r2 \<equiv> r1 OO r2 OO r1"
+ − 53
0
+ − 54
definition
543
+ − 55
"Quotient E Abs Rep \<equiv> (\<forall>a. Abs (Rep a) = a) \<and>
+ − 56
(\<forall>a. E (Rep a) (Rep a)) \<and>
0
+ − 57
(\<forall>r s. E r s = (E r r \<and> E s s \<and> (Abs r = Abs s)))"
+ − 58
841
+ − 59
(* TEST
+ − 60
lemma
+ − 61
fixes Abs1::"'b \<Rightarrow> 'c"
+ − 62
and Abs2::"'a \<Rightarrow> 'b"
+ − 63
and Rep1::"'c \<Rightarrow> 'b"
+ − 64
and Rep2::"'b \<Rightarrow> 'a"
+ − 65
assumes "Quotient R1 Abs1 Rep1"
+ − 66
and "Quotient R2 Abs2 Rep2"
+ − 67
shows "Quotient (f R2 R1) (Abs1 \<circ> Abs2) (Rep2 \<circ> Rep1)"
+ − 68
*)
+ − 69
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 70
lemma Quotient_abs_rep:
528
+ − 71
assumes a: "Quotient E Abs Rep"
546
+ − 72
shows "Abs (Rep a) \<equiv> a"
543
+ − 73
using a unfolding Quotient_def
+ − 74
by simp
0
+ − 75
541
+ − 76
lemma Quotient_rep_reflp:
528
+ − 77
assumes a: "Quotient E Abs Rep"
541
+ − 78
shows "E (Rep a) (Rep a)"
543
+ − 79
using a unfolding Quotient_def
+ − 80
by blast
0
+ − 81
539
+ − 82
lemma Quotient_rel:
528
+ − 83
assumes a: "Quotient E Abs Rep"
0
+ − 84
shows " E r s = (E r r \<and> E s s \<and> (Abs r = Abs s))"
543
+ − 85
using a unfolding Quotient_def
+ − 86
by blast
0
+ − 87
541
+ − 88
lemma Quotient_rel_rep:
528
+ − 89
assumes a: "Quotient R Abs Rep"
541
+ − 90
shows "R (Rep a) (Rep b) \<equiv> (a = b)"
543
+ − 91
apply (rule eq_reflection)
+ − 92
using a unfolding Quotient_def
+ − 93
by metis
0
+ − 94
540
c0b13fb70d6d
More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 95
lemma Quotient_rep_abs:
528
+ − 96
assumes a: "Quotient R Abs Rep"
459
+ − 97
shows "R r r \<Longrightarrow> R (Rep (Abs r)) r"
543
+ − 98
using a unfolding Quotient_def
+ − 99
by blast
0
+ − 100
721
+ − 101
lemma Quotient_rel_abs:
+ − 102
assumes a: "Quotient E Abs Rep"
+ − 103
shows "E r s \<Longrightarrow> Abs r = Abs s"
+ − 104
using a unfolding Quotient_def
+ − 105
by blast
+ − 106
542
+ − 107
lemma identity_equivp:
528
+ − 108
shows "equivp (op =)"
543
+ − 109
unfolding equivp_def
+ − 110
by auto
0
+ − 111
542
+ − 112
lemma identity_quotient:
528
+ − 113
shows "Quotient (op =) id id"
543
+ − 114
unfolding Quotient_def id_def
+ − 115
by blast
0
+ − 116
528
+ − 117
lemma Quotient_symp:
+ − 118
assumes a: "Quotient E Abs Rep"
+ − 119
shows "symp E"
543
+ − 120
using a unfolding Quotient_def symp_def
+ − 121
by metis
0
+ − 122
528
+ − 123
lemma Quotient_transp:
+ − 124
assumes a: "Quotient E Abs Rep"
+ − 125
shows "transp E"
543
+ − 126
using a unfolding Quotient_def transp_def
+ − 127
by metis
0
+ − 128
+ − 129
fun
112
+ − 130
fun_map
0
+ − 131
where
+ − 132
"fun_map f g h x = g (h (f x))"
+ − 133
+ − 134
abbreviation
112
+ − 135
fun_map_syn (infixr "--->" 55)
0
+ − 136
where
112
+ − 137
"f ---> g \<equiv> fun_map f g"
0
+ − 138
537
+ − 139
lemma fun_map_id:
126
+ − 140
shows "(id ---> id) = id"
543
+ − 141
by (simp add: expand_fun_eq id_def)
0
+ − 142
841
+ − 143
0
+ − 144
fun
536
+ − 145
fun_rel
0
+ − 146
where
536
+ − 147
"fun_rel E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))"
0
+ − 148
+ − 149
abbreviation
536
+ − 150
fun_rel_syn (infixr "===>" 55)
0
+ − 151
where
536
+ − 152
"E1 ===> E2 \<equiv> fun_rel E1 E2"
0
+ − 153
536
+ − 154
lemma fun_rel_eq:
511
+ − 155
"(op =) ===> (op =) \<equiv> (op =)"
721
+ − 156
by (rule eq_reflection) (simp add: expand_fun_eq)
0
+ − 157
537
+ − 158
lemma fun_quotient:
528
+ − 159
assumes q1: "Quotient R1 abs1 rep1"
+ − 160
and q2: "Quotient R2 abs2 rep2"
+ − 161
shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
0
+ − 162
proof -
+ − 163
have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a"
+ − 164
apply(simp add: expand_fun_eq)
+ − 165
using q1 q2
528
+ − 166
apply(simp add: Quotient_def)
0
+ − 167
done
+ − 168
moreover
+ − 169
have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)"
+ − 170
apply(auto)
528
+ − 171
using q1 q2 unfolding Quotient_def
0
+ − 172
apply(metis)
+ − 173
done
+ − 174
moreover
+ − 175
have "\<forall>r s. (R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and>
+ − 176
(rep1 ---> abs2) r = (rep1 ---> abs2) s)"
+ − 177
apply(auto simp add: expand_fun_eq)
528
+ − 178
using q1 q2 unfolding Quotient_def
0
+ − 179
apply(metis)
528
+ − 180
using q1 q2 unfolding Quotient_def
0
+ − 181
apply(metis)
528
+ − 182
using q1 q2 unfolding Quotient_def
0
+ − 183
apply(metis)
528
+ − 184
using q1 q2 unfolding Quotient_def
0
+ − 185
apply(metis)
+ − 186
done
+ − 187
ultimately
528
+ − 188
show "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
+ − 189
unfolding Quotient_def by blast
0
+ − 190
qed
+ − 191
+ − 192
definition
+ − 193
Respects
+ − 194
where
+ − 195
"Respects R x \<equiv> (R x x)"
+ − 196
542
+ − 197
lemma in_respects:
0
+ − 198
shows "(x \<in> Respects R) = R x x"
543
+ − 199
unfolding mem_def Respects_def by simp
0
+ − 200
527
+ − 201
lemma equals_rsp:
528
+ − 202
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>
diff
changeset
+ − 203
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>
diff
changeset
+ − 204
shows "R xa ya = R xb yb"
543
+ − 205
using Quotient_symp[OF q] Quotient_transp[OF q] unfolding symp_def transp_def
+ − 206
using a by blast
0
+ − 207
527
+ − 208
lemma lambda_prs:
528
+ − 209
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 210
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>
diff
changeset
+ − 211
shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)"
543
+ − 212
unfolding expand_fun_eq
+ − 213
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]
+ − 214
by simp
0
+ − 215
527
+ − 216
lemma lambda_prs1:
528
+ − 217
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 218
and q2: "Quotient R2 Abs2 Rep2"
527
+ − 219
shows "(Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x) = (\<lambda>x. f x)"
543
+ − 220
unfolding expand_fun_eq
+ − 221
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]
+ − 222
by simp
253
e169a99c6ada
Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 223
542
+ − 224
lemma rep_abs_rsp:
528
+ − 225
assumes q: "Quotient R Abs Rep"
459
+ − 226
and a: "R x1 x2"
+ − 227
shows "R x1 (Rep (Abs x2))"
543
+ − 228
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q])
0
+ − 229
721
+ − 230
lemma rep_abs_rsp_left:
+ − 231
assumes q: "Quotient R Abs Rep"
+ − 232
and a: "R x1 x2"
+ − 233
shows "R (Rep (Abs x1)) x2"
+ − 234
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q])
+ − 235
527
+ − 236
(* In the following theorem R1 can be instantiated with anything,
516
+ − 237
but we know some of the types of the Rep and Abs functions;
543
+ − 238
so by solving Quotient assumptions we can get a unique R1 that
+ − 239
will be provable; which is why we need to use apply_rsp and
+ − 240
not the primed version *)
527
+ − 241
lemma apply_rsp:
841
+ − 242
fixes f g::"'a \<Rightarrow> 'c"
528
+ − 243
assumes q: "Quotient R1 Abs1 Rep1"
516
+ − 244
and a: "(R1 ===> R2) f g" "R1 x y"
841
+ − 245
shows "R2 (f x) (g y)"
543
+ − 246
using a by simp
516
+ − 247
527
+ − 248
lemma apply_rsp':
317
+ − 249
assumes a: "(R1 ===> R2) f g" "R1 x y"
+ − 250
shows "R2 (f x) (g y)"
543
+ − 251
using a by simp
458
+ − 252
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>
diff
changeset
+ − 253
(* Set of lemmas for regularisation of ball and bex *)
543
+ − 254
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>
diff
changeset
+ − 255
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>
diff
changeset
+ − 256
fixes P :: "'a \<Rightarrow> bool"
528
+ − 257
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>
diff
changeset
+ − 258
shows "Ball (Respects R) P = (All P)"
542
+ − 259
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>
diff
changeset
+ − 260
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 261
lemma bex_reg_eqv:
93
+ − 262
fixes P :: "'a \<Rightarrow> bool"
528
+ − 263
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>
diff
changeset
+ − 264
shows "Bex (Respects R) P = (Ex P)"
542
+ − 265
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>
diff
changeset
+ − 266
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 267
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>
diff
changeset
+ − 268
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>
diff
changeset
+ − 269
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>
diff
changeset
+ − 270
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>
diff
changeset
+ − 271
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 272
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>
diff
changeset
+ − 273
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>
diff
changeset
+ − 274
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>
diff
changeset
+ − 275
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>
diff
changeset
+ − 276
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 277
lemma ball_reg_left:
528
+ − 278
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>
diff
changeset
+ − 279
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P"
542
+ − 280
by (metis equivp_reflp in_respects a)
93
+ − 281
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>
diff
changeset
+ − 282
lemma bex_reg_right:
528
+ − 283
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>
diff
changeset
+ − 284
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P"
542
+ − 285
by (metis equivp_reflp in_respects a)
93
+ − 286
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>
diff
changeset
+ − 287
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>
diff
changeset
+ − 288
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>
diff
changeset
+ − 289
and x::"'a"
528
+ − 290
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>
diff
changeset
+ − 291
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>
diff
changeset
+ − 292
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>
diff
changeset
+ − 293
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>
diff
changeset
+ − 294
apply(drule_tac x="\<lambda>y. f x" in bspec)
605
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 295
apply(simp add: in_respects)
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>
diff
changeset
+ − 296
apply(rule impI)
528
+ − 297
using a equivp_reflp_symp_transp[of "R2"]
+ − 298
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>
diff
changeset
+ − 299
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>
diff
changeset
+ − 300
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>
diff
changeset
+ − 301
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>
diff
changeset
+ − 302
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 303
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>
diff
changeset
+ − 304
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>
diff
changeset
+ − 305
and x::"'a"
528
+ − 306
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>
diff
changeset
+ − 307
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>
diff
changeset
+ − 308
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>
diff
changeset
+ − 309
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>
diff
changeset
+ − 310
apply(simp)
542
+ − 311
apply(simp add: Respects_def in_respects)
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>
diff
changeset
+ − 312
apply(rule impI)
528
+ − 313
using a equivp_reflp_symp_transp[of "R2"]
+ − 314
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>
diff
changeset
+ − 315
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>
diff
changeset
+ − 316
5a3965aa4d80
Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 317
lemma all_reg:
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 318
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>
diff
changeset
+ − 319
and b: "All P"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 320
shows "All Q"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 321
using a b by (metis)
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 322
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>
diff
changeset
+ − 323
lemma ex_reg:
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 324
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>
diff
changeset
+ − 325
and b: "Ex P"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 326
shows "Ex Q"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 327
using a b by (metis)
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 328
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>
diff
changeset
+ − 329
lemma ball_reg:
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 330
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>
diff
changeset
+ − 331
and b: "Ball R P"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 332
shows "Ball R Q"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 333
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>
diff
changeset
+ − 334
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>
diff
changeset
+ − 335
lemma bex_reg:
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 336
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>
diff
changeset
+ − 337
and b: "Bex R P"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 338
shows "Bex R Q"
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 339
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>
diff
changeset
+ − 340
432
+ − 341
lemma ball_all_comm:
+ − 342
"(\<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))"
721
+ − 343
by auto
432
+ − 344
+ − 345
lemma bex_ex_comm:
+ − 346
"((\<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))"
721
+ − 347
by auto
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 348
595
+ − 349
(* Bounded abstraction *)
+ − 350
definition
+ − 351
Babs :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
+ − 352
where
+ − 353
"(x \<in> p) \<Longrightarrow> (Babs p m x = m x)"
+ − 354
+ − 355
(* 3 lemmas needed for proving repabs_inj *)
458
+ − 356
lemma ball_rsp:
+ − 357
assumes a: "(R ===> (op =)) f g"
+ − 358
shows "Ball (Respects R) f = Ball (Respects R) g"
542
+ − 359
using a by (simp add: Ball_def in_respects)
153
+ − 360
458
+ − 361
lemma bex_rsp:
+ − 362
assumes a: "(R ===> (op =)) f g"
+ − 363
shows "(Bex (Respects R) f = Bex (Respects R) g)"
542
+ − 364
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>
diff
changeset
+ − 365
595
+ − 366
lemma babs_rsp:
+ − 367
assumes q: "Quotient R1 Abs1 Rep1"
+ − 368
and a: "(R1 ===> R2) f g"
+ − 369
shows "(R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)"
+ − 370
apply (auto simp add: Babs_def)
+ − 371
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1")
+ − 372
using a apply (simp add: Babs_def)
+ − 373
apply (simp add: in_respects)
+ − 374
using Quotient_rel[OF q]
+ − 375
by metis
+ − 376
607
+ − 377
lemma babs_prs:
+ − 378
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 379
and q2: "Quotient R2 Abs2 Rep2"
+ − 380
shows "(Rep1 ---> Abs2) (Babs (Respects R1) ((Abs1 ---> Rep2) f)) \<equiv> f"
+ − 381
apply(rule eq_reflection)
+ − 382
apply(rule ext)
+ − 383
apply simp
+ − 384
apply (subgoal_tac "Rep1 x \<in> Respects R1")
+ − 385
apply (simp add: Babs_def Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2])
+ − 386
apply (simp add: in_respects Quotient_rel_rep[OF q1])
+ − 387
done
+ − 388
696
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 389
lemma babs_simp:
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 390
assumes q: "Quotient R1 Abs Rep"
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 391
shows "((R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)) = ((R1 ===> R2) f g)"
721
+ − 392
apply(rule iffI)
+ − 393
apply(simp_all only: babs_rsp[OF q])
+ − 394
apply(auto simp add: Babs_def)
+ − 395
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1")
+ − 396
apply(metis Babs_def)
+ − 397
apply (simp add: in_respects)
+ − 398
using Quotient_rel[OF q]
+ − 399
by metis
696
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 400
841
+ − 401
(* If a user proves that a particular functional relation
+ − 402
is an equivalence this may be useful in regularising *)
605
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 403
lemma babs_reg_eqv:
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 404
shows "equivp R \<Longrightarrow> Babs (Respects R) P = P"
721
+ − 405
by (simp add: expand_fun_eq Babs_def in_respects equivp_reflp)
605
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 406
458
+ − 407
(* 2 lemmas needed for cleaning of quantifiers *)
+ − 408
lemma all_prs:
528
+ − 409
assumes a: "Quotient R absf repf"
458
+ − 410
shows "Ball (Respects R) ((absf ---> id) f) = All f"
528
+ − 411
using a unfolding Quotient_def
542
+ − 412
by (metis in_respects fun_map.simps id_apply)
162
+ − 413
458
+ − 414
lemma ex_prs:
528
+ − 415
assumes a: "Quotient R absf repf"
458
+ − 416
shows "Bex (Respects R) ((absf ---> id) f) = Ex f"
528
+ − 417
using a unfolding Quotient_def
542
+ − 418
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>
diff
changeset
+ − 419
554
+ − 420
lemma fun_rel_id:
+ − 421
assumes a: "\<And>x y. R1 x y \<Longrightarrow> R2 (f x) (g y)"
+ − 422
shows "(R1 ===> R2) f g"
721
+ − 423
using a by simp
554
+ − 424
697
+ − 425
lemma fun_rel_id_asm:
+ − 426
assumes a: "\<And>x y. R1 x y \<Longrightarrow> (A \<longrightarrow> R2 (f x) (g y))"
+ − 427
shows "A \<longrightarrow> (R1 ===> R2) f g"
721
+ − 428
using a by auto
697
+ − 429
554
+ − 430
lemma quot_rel_rsp:
+ − 431
assumes a: "Quotient R Abs Rep"
+ − 432
shows "(R ===> R ===> op =) R R"
+ − 433
apply(rule fun_rel_id)+
+ − 434
apply(rule equals_rsp[OF a])
+ − 435
apply(assumption)+
+ − 436
done
+ − 437
721
+ − 438
lemma o_prs:
+ − 439
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 440
and q2: "Quotient R2 Abs2 Rep2"
+ − 441
and q3: "Quotient R3 Abs3 Rep3"
+ − 442
shows "(Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g)) = f o g"
+ − 443
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] Quotient_abs_rep[OF q3]
+ − 444
unfolding o_def expand_fun_eq by simp
541
+ − 445
721
+ − 446
lemma o_rsp:
+ − 447
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 448
and q2: "Quotient R2 Abs2 Rep2"
+ − 449
and q3: "Quotient R3 Abs3 Rep3"
+ − 450
and a1: "(R2 ===> R3) f1 f2"
+ − 451
and a2: "(R1 ===> R2) g1 g2"
+ − 452
shows "(R1 ===> R3) (f1 o g1) (f2 o g2)"
+ − 453
using a1 a2 unfolding o_def expand_fun_eq
+ − 454
by (auto)
+ − 455
+ − 456
lemma cond_prs:
+ − 457
assumes a: "Quotient R absf repf"
+ − 458
shows "absf (if a then repf b else repf c) = (if a then b else c)"
+ − 459
using a unfolding Quotient_def by auto
+ − 460
+ − 461
lemma if_prs:
+ − 462
assumes q: "Quotient R Abs Rep"
+ − 463
shows "Abs (If a (Rep b) (Rep c)) = If a b c"
+ − 464
using Quotient_abs_rep[OF q] by auto
+ − 465
+ − 466
(* q not used *)
+ − 467
lemma if_rsp:
+ − 468
assumes q: "Quotient R Abs Rep"
+ − 469
and a: "a1 = a2" "R b1 b2" "R c1 c2"
+ − 470
shows "R (If a1 b1 c1) (If a2 b2 c2)"
+ − 471
using a by auto
+ − 472
+ − 473
lemma let_prs:
+ − 474
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 475
and q2: "Quotient R2 Abs2 Rep2"
+ − 476
shows "Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f)) = Let x f"
+ − 477
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto
+ − 478
+ − 479
lemma let_rsp:
+ − 480
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 481
and a1: "(R1 ===> R2) f g"
+ − 482
and a2: "R1 x y"
+ − 483
shows "R2 ((Let x f)::'c) ((Let y g)::'c)"
+ − 484
using apply_rsp[OF q1 a1] a2 by auto
543
+ − 485
+ − 486
+ − 487
+ − 488
+ − 489
(******************************************)
+ − 490
(* REST OF THE FILE IS UNUSED (until now) *)
+ − 491
(******************************************)
656
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 492
542
+ − 493
lemma in_fun:
+ − 494
shows "x \<in> ((f ---> g) s) = g (f x \<in> s)"
721
+ − 495
by (simp add: mem_def)
542
+ − 496
721
+ − 497
lemma respects_thm:
542
+ − 498
shows "Respects (R1 ===> R2) f = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (f y))"
721
+ − 499
unfolding Respects_def
+ − 500
by (simp add: expand_fun_eq)
542
+ − 501
721
+ − 502
lemma respects_rep_abs:
542
+ − 503
assumes a: "Quotient R1 Abs1 Rep1"
+ − 504
and b: "Respects (R1 ===> R2) f"
+ − 505
and c: "R1 x x"
+ − 506
shows "R2 (f (Rep1 (Abs1 x))) (f x)"
721
+ − 507
using a b[simplified respects_thm] c unfolding Quotient_def
+ − 508
by blast
542
+ − 509
721
+ − 510
lemma respects_mp:
542
+ − 511
assumes a: "Respects (R1 ===> R2) f"
+ − 512
and b: "R1 x y"
+ − 513
shows "R2 (f x) (f y)"
721
+ − 514
using a b unfolding Respects_def
+ − 515
by simp
542
+ − 516
721
+ − 517
lemma respects_o:
542
+ − 518
assumes a: "Respects (R2 ===> R3) f"
+ − 519
and b: "Respects (R1 ===> R2) g"
+ − 520
shows "Respects (R1 ===> R3) (f o g)"
721
+ − 521
using a b unfolding Respects_def
+ − 522
by simp
542
+ − 523
824
+ − 524
lemma abs_o_rep:
+ − 525
assumes a: "Quotient r absf repf"
+ − 526
shows "absf o repf = id"
+ − 527
apply(rule ext)
+ − 528
apply(simp add: Quotient_abs_rep[OF a])
+ − 529
done
+ − 530
825
+ − 531
lemma eq_comp_r: "op = OO R OO op = \<equiv> R"
+ − 532
apply (rule eq_reflection)
+ − 533
apply (rule ext)+
+ − 534
apply auto
+ − 535
done
+ − 536
721
+ − 537
lemma fun_rel_eq_rel:
542
+ − 538
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 539
and q2: "Quotient R2 Abs2 Rep2"
721
+ − 540
shows "(R1 ===> R2) f g = ((Respects (R1 ===> R2) f) \<and> (Respects (R1 ===> R2) g)
542
+ − 541
\<and> ((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g))"
721
+ − 542
using fun_quotient[OF q1 q2] unfolding Respects_def Quotient_def expand_fun_eq
+ − 543
by blast
542
+ − 544
721
+ − 545
lemma let_babs:
+ − 546
"v \<in> r \<Longrightarrow> Let v (Babs r lam) = Let v lam"
+ − 547
by (simp add: Babs_def)
542
+ − 548
721
+ − 549
lemma fun_rel_equals:
542
+ − 550
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 551
and q2: "Quotient R2 Abs2 Rep2"
+ − 552
and r1: "Respects (R1 ===> R2) f"
+ − 553
and r2: "Respects (R1 ===> R2) g"
+ − 554
shows "((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g) = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))"
721
+ − 555
apply(rule_tac iffI)
+ − 556
using fun_quotient[OF q1 q2] r1 r2 unfolding Quotient_def Respects_def
+ − 557
apply(metis apply_rsp')
+ − 558
using r1 unfolding Respects_def expand_fun_eq
+ − 559
apply(simp (no_asm_use))
+ − 560
apply(metis Quotient_rel[OF q2] Quotient_rel_rep[OF q1])
+ − 561
done
542
+ − 562
+ − 563
(* ask Peter: fun_rel_IMP used twice *)
+ − 564
lemma fun_rel_IMP2:
+ − 565
assumes q1: "Quotient R1 Abs1 Rep1"
+ − 566
and q2: "Quotient R2 Abs2 Rep2"
+ − 567
and r1: "Respects (R1 ===> R2) f"
+ − 568
and r2: "Respects (R1 ===> R2) g"
+ − 569
and a: "(Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g"
+ − 570
shows "R1 x y \<Longrightarrow> R2 (f x) (g y)"
721
+ − 571
using q1 q2 r1 r2 a
+ − 572
by (simp add: fun_rel_equals)
542
+ − 573
721
+ − 574
lemma lambda_rep_abs_rsp:
542
+ − 575
assumes r1: "\<And>r r'. R1 r r' \<Longrightarrow>R1 r (Rep1 (Abs1 r'))"
+ − 576
and r2: "\<And>r r'. R2 r r' \<Longrightarrow>R2 r (Rep2 (Abs2 r'))"
+ − 577
shows "(R1 ===> R2) f1 f2 \<Longrightarrow> (R1 ===> R2) f1 ((Abs1 ---> Rep2) ((Rep1 ---> Abs2) f2))"
721
+ − 578
using r1 r2 by auto
543
+ − 579
+ − 580
(* ask peter what are literal_case *)
+ − 581
(* literal_case_PRS *)
+ − 582
(* literal_case_RSP *)
721
+ − 583
(* Cez: !f x. literal_case f x = f x *)
543
+ − 584
+ − 585
(* We use id_simps which includes id_apply; so these 2 theorems can be removed *)
721
+ − 586
lemma id_prs:
543
+ − 587
assumes q: "Quotient R Abs Rep"
721
+ − 588
shows "Abs (id (Rep e)) = id e"
+ − 589
using Quotient_abs_rep[OF q] by auto
543
+ − 590
721
+ − 591
lemma id_rsp:
543
+ − 592
assumes q: "Quotient R Abs Rep"
+ − 593
and a: "R e1 e2"
+ − 594
shows "R (id e1) (id e2)"
721
+ − 595
using a by auto
543
+ − 596
93
+ − 597
end
95
+ − 598