author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Wed, 09 Dec 2009 22:43:11 +0100 | |
changeset 674 | bb276771d85c |
parent 656 | c86a47d4966e |
child 696 | fd718dde1d61 |
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 |
||
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
5 |
definition |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
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
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
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
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
19 |
unfolding equivp_def reflp_def symp_def transp_def expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
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>
parents:
554
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>
parents:
554
diff
changeset
|
25 |
|
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
554
diff
changeset
|
26 |
lemma equivp_symp: |
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
554
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>
parents:
554
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>
parents:
554
diff
changeset
|
29 |
|
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
554
diff
changeset
|
30 |
lemma equivp_transp: |
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
554
diff
changeset
|
31 |
shows "equivp E \<Longrightarrow> (\<And>x y z. E x y \<Longrightarrow> E y z \<Longrightarrow> E x z)" |
18eac4596ef1
QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
554
diff
changeset
|
32 |
by (metis equivp_reflp_symp_transp transp_def) |
217
9cc87d02190a
First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
188
diff
changeset
|
33 |
|
0 | 34 |
definition |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
35 |
"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 | 36 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
37 |
lemma equivp_IMP_part_equivp: |
528 | 38 |
assumes a: "equivp E" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
39 |
shows "part_equivp E" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
40 |
using a unfolding equivp_def part_equivp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
41 |
by auto |
0 | 42 |
|
43 |
definition |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
44 |
"Quotient E Abs Rep \<equiv> (\<forall>a. Abs (Rep a) = a) \<and> |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
45 |
(\<forall>a. E (Rep a) (Rep a)) \<and> |
0 | 46 |
(\<forall>r s. E r s = (E r r \<and> E s s \<and> (Abs r = Abs s)))" |
47 |
||
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
|
48 |
lemma Quotient_abs_rep: |
528 | 49 |
assumes a: "Quotient E Abs Rep" |
546 | 50 |
shows "Abs (Rep a) \<equiv> a" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
51 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
52 |
by simp |
0 | 53 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
54 |
lemma Quotient_rep_reflp: |
528 | 55 |
assumes a: "Quotient E Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
56 |
shows "E (Rep a) (Rep a)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
57 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
58 |
by blast |
0 | 59 |
|
539
8287fb5b8d7a
Cleaning & Renaming coming from QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
537
diff
changeset
|
60 |
lemma Quotient_rel: |
528 | 61 |
assumes a: "Quotient E Abs Rep" |
0 | 62 |
shows " E r s = (E r r \<and> E s s \<and> (Abs r = Abs s))" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
63 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
64 |
by blast |
0 | 65 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
66 |
lemma Quotient_rel_rep: |
528 | 67 |
assumes a: "Quotient R Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
68 |
shows "R (Rep a) (Rep b) \<equiv> (a = b)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
69 |
apply (rule eq_reflection) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
70 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
71 |
by metis |
0 | 72 |
|
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
|
73 |
lemma Quotient_rep_abs: |
528 | 74 |
assumes a: "Quotient R Abs Rep" |
459 | 75 |
shows "R r r \<Longrightarrow> R (Rep (Abs r)) r" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
76 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
77 |
by blast |
0 | 78 |
|
542 | 79 |
lemma identity_equivp: |
528 | 80 |
shows "equivp (op =)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
81 |
unfolding equivp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
82 |
by auto |
0 | 83 |
|
542 | 84 |
lemma identity_quotient: |
528 | 85 |
shows "Quotient (op =) id id" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
86 |
unfolding Quotient_def id_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
87 |
by blast |
0 | 88 |
|
528 | 89 |
lemma Quotient_symp: |
90 |
assumes a: "Quotient E Abs Rep" |
|
91 |
shows "symp E" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
92 |
using a unfolding Quotient_def symp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
93 |
by metis |
0 | 94 |
|
528 | 95 |
lemma Quotient_transp: |
96 |
assumes a: "Quotient E Abs Rep" |
|
97 |
shows "transp E" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
98 |
using a unfolding Quotient_def transp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
99 |
by metis |
0 | 100 |
|
101 |
fun |
|
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
102 |
fun_map |
0 | 103 |
where |
104 |
"fun_map f g h x = g (h (f x))" |
|
105 |
||
106 |
abbreviation |
|
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
107 |
fun_map_syn (infixr "--->" 55) |
0 | 108 |
where |
112
0d6d37d0589d
Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
96
diff
changeset
|
109 |
"f ---> g \<equiv> fun_map f g" |
0 | 110 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
111 |
lemma fun_map_id: |
126
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
112 |
shows "(id ---> id) = id" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
113 |
by (simp add: expand_fun_eq id_def) |
0 | 114 |
|
115 |
fun |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
116 |
fun_rel |
0 | 117 |
where |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
118 |
"fun_rel E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))" |
0 | 119 |
|
120 |
abbreviation |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
121 |
fun_rel_syn (infixr "===>" 55) |
0 | 122 |
where |
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
123 |
"E1 ===> E2 \<equiv> fun_rel E1 E2" |
0 | 124 |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
125 |
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
|
126 |
"(op =) ===> (op =) \<equiv> (op =)" |
515
b00a9b58264d
Fixes after big merge.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
511
diff
changeset
|
127 |
by (rule eq_reflection) (simp add: expand_fun_eq) |
0 | 128 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
129 |
lemma fun_quotient: |
528 | 130 |
assumes q1: "Quotient R1 abs1 rep1" |
131 |
and q2: "Quotient R2 abs2 rep2" |
|
132 |
shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
|
0 | 133 |
proof - |
134 |
have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a" |
|
135 |
apply(simp add: expand_fun_eq) |
|
136 |
using q1 q2 |
|
528 | 137 |
apply(simp add: Quotient_def) |
0 | 138 |
done |
139 |
moreover |
|
140 |
have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)" |
|
141 |
apply(auto) |
|
528 | 142 |
using q1 q2 unfolding Quotient_def |
0 | 143 |
apply(metis) |
144 |
done |
|
145 |
moreover |
|
146 |
have "\<forall>r s. (R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> |
|
147 |
(rep1 ---> abs2) r = (rep1 ---> abs2) s)" |
|
148 |
apply(auto simp add: expand_fun_eq) |
|
528 | 149 |
using q1 q2 unfolding Quotient_def |
0 | 150 |
apply(metis) |
528 | 151 |
using q1 q2 unfolding Quotient_def |
0 | 152 |
apply(metis) |
528 | 153 |
using q1 q2 unfolding Quotient_def |
0 | 154 |
apply(metis) |
528 | 155 |
using q1 q2 unfolding Quotient_def |
0 | 156 |
apply(metis) |
157 |
done |
|
158 |
ultimately |
|
528 | 159 |
show "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
160 |
unfolding Quotient_def by blast |
|
0 | 161 |
qed |
162 |
||
163 |
definition |
|
164 |
Respects |
|
165 |
where |
|
166 |
"Respects R x \<equiv> (R x x)" |
|
167 |
||
542 | 168 |
lemma in_respects: |
0 | 169 |
shows "(x \<in> Respects R) = R x x" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
170 |
unfolding mem_def Respects_def by simp |
0 | 171 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
172 |
lemma equals_rsp: |
528 | 173 |
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
|
174 |
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
|
175 |
shows "R xa ya = R xb yb" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
176 |
using Quotient_symp[OF q] Quotient_transp[OF q] unfolding symp_def transp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
177 |
using a by blast |
0 | 178 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
179 |
lemma lambda_prs: |
528 | 180 |
assumes q1: "Quotient R1 Abs1 Rep1" |
181 |
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
|
182 |
shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
183 |
unfolding expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
184 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
185 |
by simp |
0 | 186 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
187 |
lemma lambda_prs1: |
528 | 188 |
assumes q1: "Quotient R1 Abs1 Rep1" |
189 |
and q2: "Quotient R2 Abs2 Rep2" |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
190 |
shows "(Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x) = (\<lambda>x. f x)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
191 |
unfolding expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
192 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
193 |
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
|
194 |
|
542 | 195 |
lemma rep_abs_rsp: |
528 | 196 |
assumes q: "Quotient R Abs Rep" |
459 | 197 |
and a: "R x1 x2" |
198 |
shows "R x1 (Rep (Abs x2))" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
199 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
0 | 200 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
201 |
(* 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
|
202 |
but we know some of the types of the Rep and Abs functions; |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
203 |
so by solving Quotient assumptions we can get a unique R1 that |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
204 |
will be provable; which is why we need to use apply_rsp and |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
205 |
not the primed version *) |
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
206 |
lemma apply_rsp: |
528 | 207 |
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
|
208 |
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
|
209 |
shows "R2 ((f::'a\<Rightarrow>'c) x) ((g::'a\<Rightarrow>'c) y)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
210 |
using a by simp |
516
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
211 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
212 |
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
|
213 |
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
|
214 |
shows "R2 (f x) (g y)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
215 |
using a by simp |
458 | 216 |
|
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
|
217 |
(* Set of lemmas for regularisation of ball and bex *) |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
218 |
|
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
|
219 |
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
|
220 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 221 |
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
|
222 |
shows "Ball (Respects R) P = (All P)" |
542 | 223 |
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
|
224 |
|
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
|
225 |
lemma bex_reg_eqv: |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
226 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 227 |
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
|
228 |
shows "Bex (Respects R) P = (Ex P)" |
542 | 229 |
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
|
230 |
|
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
|
231 |
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
|
232 |
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
|
233 |
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
|
234 |
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
|
235 |
|
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
|
236 |
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
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
|
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
|
241 |
lemma ball_reg_left: |
528 | 242 |
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
|
243 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P" |
542 | 244 |
by (metis equivp_reflp in_respects a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
245 |
|
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
|
246 |
lemma bex_reg_right: |
528 | 247 |
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
|
248 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P" |
542 | 249 |
by (metis equivp_reflp in_respects a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
250 |
|
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
|
251 |
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
|
252 |
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
|
253 |
and x::"'a" |
528 | 254 |
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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
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>
parents:
597
diff
changeset
|
259 |
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>
parents:
416
diff
changeset
|
260 |
apply(rule impI) |
528 | 261 |
using a equivp_reflp_symp_transp[of "R2"] |
262 |
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
|
263 |
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
|
264 |
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
|
265 |
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
|
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>
parents:
416
diff
changeset
|
267 |
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
|
268 |
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
|
269 |
and x::"'a" |
528 | 270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
apply(simp) |
542 | 275 |
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>
parents:
416
diff
changeset
|
276 |
apply(rule impI) |
528 | 277 |
using a equivp_reflp_symp_transp[of "R2"] |
278 |
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
|
279 |
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
|
280 |
|
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
|
281 |
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
|
282 |
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
|
283 |
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
|
284 |
shows "All Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
285 |
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
|
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>
parents:
416
diff
changeset
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
shows "Ex Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
291 |
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
|
292 |
|
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
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
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
|
298 |
|
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
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
|
432
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
305 |
lemma ball_all_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
306 |
"(\<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
|
307 |
by auto |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
308 |
|
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
309 |
lemma bex_ex_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
310 |
"((\<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
|
311 |
by auto |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
312 |
|
595
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
313 |
(* Bounded abstraction *) |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
314 |
definition |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
315 |
Babs :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b" |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
316 |
where |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
317 |
"(x \<in> p) \<Longrightarrow> (Babs p m x = m x)" |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
318 |
|
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
319 |
(* 3 lemmas needed for proving repabs_inj *) |
458 | 320 |
lemma ball_rsp: |
321 |
assumes a: "(R ===> (op =)) f g" |
|
322 |
shows "Ball (Respects R) f = Ball (Respects R) g" |
|
542 | 323 |
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
|
324 |
|
458 | 325 |
lemma bex_rsp: |
326 |
assumes a: "(R ===> (op =)) f g" |
|
327 |
shows "(Bex (Respects R) f = Bex (Respects R) g)" |
|
542 | 328 |
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
|
329 |
|
595
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
330 |
lemma babs_rsp: |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
331 |
assumes q: "Quotient R1 Abs1 Rep1" |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
332 |
and a: "(R1 ===> R2) f g" |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
333 |
shows "(R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)" |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
334 |
apply (auto simp add: Babs_def) |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
335 |
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1") |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
336 |
using a apply (simp add: Babs_def) |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
337 |
apply (simp add: in_respects) |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
338 |
using Quotient_rel[OF q] |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
339 |
by metis |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
340 |
|
607 | 341 |
lemma babs_prs: |
342 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
343 |
and q2: "Quotient R2 Abs2 Rep2" |
|
344 |
shows "(Rep1 ---> Abs2) (Babs (Respects R1) ((Abs1 ---> Rep2) f)) \<equiv> f" |
|
345 |
apply(rule eq_reflection) |
|
346 |
apply(rule ext) |
|
347 |
apply simp |
|
348 |
apply (subgoal_tac "Rep1 x \<in> Respects R1") |
|
349 |
apply (simp add: Babs_def Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]) |
|
350 |
apply (simp add: in_respects Quotient_rel_rep[OF q1]) |
|
351 |
done |
|
352 |
||
605
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents:
597
diff
changeset
|
353 |
(* needed for regularising? *) |
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents:
597
diff
changeset
|
354 |
lemma babs_reg_eqv: |
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents:
597
diff
changeset
|
355 |
shows "equivp R \<Longrightarrow> Babs (Respects R) P = P" |
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents:
597
diff
changeset
|
356 |
by (simp add: expand_fun_eq Babs_def in_respects equivp_reflp) |
120e479ed367
first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents:
597
diff
changeset
|
357 |
|
458 | 358 |
(* 2 lemmas needed for cleaning of quantifiers *) |
359 |
lemma all_prs: |
|
528 | 360 |
assumes a: "Quotient R absf repf" |
458 | 361 |
shows "Ball (Respects R) ((absf ---> id) f) = All f" |
528 | 362 |
using a unfolding Quotient_def |
542 | 363 |
by (metis in_respects fun_map.simps id_apply) |
162 | 364 |
|
458 | 365 |
lemma ex_prs: |
528 | 366 |
assumes a: "Quotient R absf repf" |
458 | 367 |
shows "Bex (Respects R) ((absf ---> id) f) = Ex f" |
528 | 368 |
using a unfolding Quotient_def |
542 | 369 |
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
|
370 |
|
554
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
371 |
lemma fun_rel_id: |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
372 |
assumes a: "\<And>x y. R1 x y \<Longrightarrow> R2 (f x) (g y)" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
373 |
shows "(R1 ===> R2) f g" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
374 |
using a by simp |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
375 |
|
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
376 |
lemma quot_rel_rsp: |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
377 |
assumes a: "Quotient R Abs Rep" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
378 |
shows "(R ===> R ===> op =) R R" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
379 |
apply(rule fun_rel_id)+ |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
380 |
apply(rule equals_rsp[OF a]) |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
381 |
apply(assumption)+ |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
382 |
done |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
383 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
384 |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
385 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
386 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
387 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
388 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
389 |
(******************************************) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
390 |
(* REST OF THE FILE IS UNUSED (until now) *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
391 |
(******************************************) |
656
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
392 |
|
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
393 |
(* Always safe to apply, but not too helpful *) |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
394 |
lemma app_prs2: |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
395 |
assumes q1: "Quotient R1 abs1 rep1" |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
396 |
and q2: "Quotient R2 abs2 rep2" |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
397 |
shows "((abs1 ---> rep2) ((rep1 ---> abs2) f) (rep1 x)) = rep2 (((rep1 ---> abs2) f) x)" |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
398 |
unfolding expand_fun_eq |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
399 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
400 |
by simp |
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
401 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
402 |
lemma Quotient_rel_abs: |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
403 |
assumes a: "Quotient E Abs Rep" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
404 |
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
|
405 |
using a unfolding Quotient_def |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
406 |
by blast |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
407 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
408 |
lemma Quotient_rel_abs_eq: |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
409 |
assumes a: "Quotient E Abs Rep" |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
410 |
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
|
411 |
using a unfolding Quotient_def |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
412 |
by blast |
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
413 |
|
542 | 414 |
lemma in_fun: |
415 |
shows "x \<in> ((f ---> g) s) = g (f x \<in> s)" |
|
416 |
by (simp add: mem_def) |
|
417 |
||
418 |
lemma RESPECTS_THM: |
|
419 |
shows "Respects (R1 ===> R2) f = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (f y))" |
|
420 |
unfolding Respects_def |
|
421 |
by (simp add: expand_fun_eq) |
|
422 |
||
423 |
lemma RESPECTS_REP_ABS: |
|
424 |
assumes a: "Quotient R1 Abs1 Rep1" |
|
425 |
and b: "Respects (R1 ===> R2) f" |
|
426 |
and c: "R1 x x" |
|
427 |
shows "R2 (f (Rep1 (Abs1 x))) (f x)" |
|
428 |
using a b[simplified RESPECTS_THM] c unfolding Quotient_def |
|
429 |
by blast |
|
430 |
||
431 |
lemma RESPECTS_MP: |
|
432 |
assumes a: "Respects (R1 ===> R2) f" |
|
433 |
and b: "R1 x y" |
|
434 |
shows "R2 (f x) (f y)" |
|
435 |
using a b unfolding Respects_def |
|
436 |
by simp |
|
437 |
||
438 |
lemma RESPECTS_o: |
|
439 |
assumes a: "Respects (R2 ===> R3) f" |
|
440 |
and b: "Respects (R1 ===> R2) g" |
|
441 |
shows "Respects (R1 ===> R3) (f o g)" |
|
442 |
using a b unfolding Respects_def |
|
443 |
by simp |
|
444 |
||
445 |
lemma fun_rel_EQ_REL: |
|
446 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
447 |
and q2: "Quotient R2 Abs2 Rep2" |
|
448 |
shows "(R1 ===> R2) f g = ((Respects (R1 ===> R2) f) \<and> (Respects (R1 ===> R2) g) |
|
449 |
\<and> ((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g))" |
|
450 |
using fun_quotient[OF q1 q2] unfolding Respects_def Quotient_def expand_fun_eq |
|
451 |
by blast |
|
452 |
||
453 |
(* Not used since in the end we just unfold fun_map *) |
|
454 |
lemma APP_PRS: |
|
455 |
assumes q1: "Quotient R1 abs1 rep1" |
|
456 |
and q2: "Quotient R2 abs2 rep2" |
|
457 |
shows "abs2 ((abs1 ---> rep2) f (rep1 x)) = f x" |
|
458 |
unfolding expand_fun_eq |
|
459 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] |
|
460 |
by simp |
|
461 |
||
462 |
(* Ask Peter: assumption q1 and q2 not used and lemma is the 'identity' *) |
|
463 |
lemma LAMBDA_RSP: |
|
464 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
465 |
and q2: "Quotient R2 Abs2 Rep2" |
|
466 |
and a: "(R1 ===> R2) f1 f2" |
|
467 |
shows "(R1 ===> R2) (\<lambda>x. f1 x) (\<lambda>y. f2 y)" |
|
468 |
by (rule a) |
|
469 |
||
470 |
(* ASK Peter about next four lemmas in quotientScript |
|
471 |
lemma ABSTRACT_PRS: |
|
472 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
473 |
and q2: "Quotient R2 Abs2 Rep2" |
|
474 |
shows "f = (Rep1 ---> Abs2) ???" |
|
475 |
*) |
|
476 |
||
477 |
||
478 |
lemma fun_rel_EQUALS: |
|
479 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
480 |
and q2: "Quotient R2 Abs2 Rep2" |
|
481 |
and r1: "Respects (R1 ===> R2) f" |
|
482 |
and r2: "Respects (R1 ===> R2) g" |
|
483 |
shows "((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g) = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))" |
|
484 |
apply(rule_tac iffI) |
|
485 |
using fun_quotient[OF q1 q2] r1 r2 unfolding Quotient_def Respects_def |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
486 |
apply(metis apply_rsp') |
542 | 487 |
using r1 unfolding Respects_def expand_fun_eq |
488 |
apply(simp (no_asm_use)) |
|
489 |
apply(metis Quotient_rel[OF q2] Quotient_rel_rep[OF q1]) |
|
490 |
done |
|
491 |
||
492 |
(* ask Peter: fun_rel_IMP used twice *) |
|
493 |
lemma fun_rel_IMP2: |
|
494 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
495 |
and q2: "Quotient R2 Abs2 Rep2" |
|
496 |
and r1: "Respects (R1 ===> R2) f" |
|
497 |
and r2: "Respects (R1 ===> R2) g" |
|
498 |
and a: "(Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g" |
|
499 |
shows "R1 x y \<Longrightarrow> R2 (f x) (g y)" |
|
500 |
using q1 q2 r1 r2 a |
|
501 |
by (simp add: fun_rel_EQUALS) |
|
502 |
||
503 |
lemma LAMBDA_REP_ABS_RSP: |
|
504 |
assumes r1: "\<And>r r'. R1 r r' \<Longrightarrow>R1 r (Rep1 (Abs1 r'))" |
|
505 |
and r2: "\<And>r r'. R2 r r' \<Longrightarrow>R2 r (Rep2 (Abs2 r'))" |
|
506 |
shows "(R1 ===> R2) f1 f2 \<Longrightarrow> (R1 ===> R2) f1 ((Abs1 ---> Rep2) ((Rep1 ---> Abs2) f2))" |
|
507 |
using r1 r2 by auto |
|
508 |
||
509 |
(* Not used *) |
|
510 |
lemma rep_abs_rsp_left: |
|
511 |
assumes q: "Quotient R Abs Rep" |
|
512 |
and a: "R x1 x2" |
|
674
bb276771d85c
Finished one proof in IntEx2.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
656
diff
changeset
|
513 |
shows "R (Rep (Abs x1)) x2" |
542 | 514 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
515 |
|
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
516 |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
517 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
518 |
(* bool theory: COND, LET *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
519 |
lemma IF_PRS: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
520 |
assumes q: "Quotient R Abs Rep" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
521 |
shows "If a b c = Abs (If a (Rep b) (Rep c))" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
522 |
using Quotient_abs_rep[OF q] by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
523 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
524 |
(* ask peter: no use of q *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
525 |
lemma IF_RSP: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
526 |
assumes q: "Quotient R Abs Rep" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
527 |
and a: "a1 = a2" "R b1 b2" "R c1 c2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
528 |
shows "R (If a1 b1 c1) (If a2 b2 c2)" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
529 |
using a by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
530 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
531 |
lemma LET_PRS: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
532 |
assumes q1: "Quotient R1 Abs1 Rep1" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
533 |
and q2: "Quotient R2 Abs2 Rep2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
534 |
shows "Let x f = Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f))" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
535 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
536 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
537 |
lemma LET_RSP: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
538 |
assumes q1: "Quotient R1 Abs1 Rep1" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
539 |
and a1: "(R1 ===> R2) f g" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
540 |
and a2: "R1 x y" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
541 |
shows "R2 ((Let x f)::'c) ((Let y g)::'c)" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
542 |
using apply_rsp[OF q1 a1] a2 |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
543 |
by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
544 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
545 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
546 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
547 |
(* ask peter what are literal_case *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
548 |
(* literal_case_PRS *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
549 |
(* literal_case_RSP *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
550 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
551 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
552 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
553 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
554 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
555 |
(* combinators: I, K, o, C, W *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
556 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
557 |
(* We use id_simps which includes id_apply; so these 2 theorems can be removed *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
558 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
559 |
lemma I_PRS: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
560 |
assumes q: "Quotient R Abs Rep" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
561 |
shows "id e = Abs (id (Rep e))" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
562 |
using Quotient_abs_rep[OF q] by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
563 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
564 |
lemma I_RSP: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
565 |
assumes q: "Quotient R Abs Rep" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
566 |
and a: "R e1 e2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
567 |
shows "R (id e1) (id e2)" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
568 |
using a by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
569 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
570 |
lemma o_PRS: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
571 |
assumes q1: "Quotient R1 Abs1 Rep1" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
572 |
and q2: "Quotient R2 Abs2 Rep2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
573 |
and q3: "Quotient R3 Abs3 Rep3" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
574 |
shows "f o g = (Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g))" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
575 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] Quotient_abs_rep[OF q3] |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
576 |
unfolding o_def expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
577 |
by simp |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
578 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
579 |
lemma o_RSP: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
580 |
assumes q1: "Quotient R1 Abs1 Rep1" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
581 |
and q2: "Quotient R2 Abs2 Rep2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
582 |
and q3: "Quotient R3 Abs3 Rep3" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
583 |
and a1: "(R2 ===> R3) f1 f2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
584 |
and a2: "(R1 ===> R2) g1 g2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
585 |
shows "(R1 ===> R3) (f1 o g1) (f2 o g2)" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
586 |
using a1 a2 unfolding o_def expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
587 |
by (auto) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
588 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
589 |
lemma COND_PRS: |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
590 |
assumes a: "Quotient R absf repf" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
591 |
shows "(if a then b else c) = absf (if a then repf b else repf c)" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
592 |
using a unfolding Quotient_def by auto |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
593 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
594 |
|
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
595 |
end |
95
8c3a35da4560
Proving the proper RepAbs version
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
93
diff
changeset
|
596 |