author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Thu, 21 Jan 2010 19:52:46 +0100 | |
changeset 913 | b1f55dd64481 |
parent 910 | b91782991dc8 |
child 919 | c46b6abad24b |
permissions | -rw-r--r-- |
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>
parents:
721
diff
changeset
|
2 |
imports Plain ATP_Linkup Predicate |
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)" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
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 |
|
700
91b079db7380
added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
parents:
697
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>
parents:
697
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>
parents:
697
diff
changeset
|
36 |
shows "equivp R" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
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>
parents:
697
diff
changeset
|
38 |
|
0 | 39 |
definition |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
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
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
42 |
lemma equivp_IMP_part_equivp: |
528 | 43 |
assumes a: "equivp E" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
44 |
shows "part_equivp E" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
45 |
using a unfolding equivp_def part_equivp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
46 |
by auto |
0 | 47 |
|
841
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
48 |
|
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
49 |
abbreviation |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
50 |
rel_conj (infixr "OOO" 75) |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
51 |
where |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
52 |
"r1 OOO r2 \<equiv> r1 OO r2 OO r1" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
53 |
|
0 | 54 |
definition |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
55 |
"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
|
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
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
59 |
(* TEST |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
60 |
lemma |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
61 |
fixes Abs1::"'b \<Rightarrow> 'c" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
62 |
and Abs2::"'a \<Rightarrow> 'b" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
63 |
and Rep1::"'c \<Rightarrow> 'b" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
64 |
and Rep2::"'b \<Rightarrow> 'a" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
65 |
assumes "Quotient R1 Abs1 Rep1" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
66 |
and "Quotient R2 Abs2 Rep2" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
67 |
shows "Quotient (f R2 R1) (Abs1 \<circ> Abs2) (Rep2 \<circ> Rep1)" |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
68 |
*) |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
69 |
|
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
|
70 |
lemma Quotient_abs_rep: |
528 | 71 |
assumes a: "Quotient E Abs Rep" |
546 | 72 |
shows "Abs (Rep a) \<equiv> a" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
73 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
74 |
by simp |
0 | 75 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
76 |
lemma Quotient_rep_reflp: |
528 | 77 |
assumes a: "Quotient E Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
78 |
shows "E (Rep a) (Rep a)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
79 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
80 |
by blast |
0 | 81 |
|
539
8287fb5b8d7a
Cleaning & Renaming coming from QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
537
diff
changeset
|
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
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
85 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
86 |
by blast |
0 | 87 |
|
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
88 |
lemma Quotient_rel_rep: |
528 | 89 |
assumes a: "Quotient R Abs Rep" |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
90 |
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
|
91 |
apply (rule eq_reflection) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
92 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
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>
parents:
539
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
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
98 |
using a unfolding Quotient_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
99 |
by blast |
0 | 100 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
101 |
lemma Quotient_rel_abs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
102 |
assumes a: "Quotient E Abs Rep" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
103 |
shows "E r s \<Longrightarrow> Abs r = Abs s" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
104 |
using a unfolding Quotient_def |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
105 |
by blast |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
106 |
|
542 | 107 |
lemma identity_equivp: |
528 | 108 |
shows "equivp (op =)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
109 |
unfolding equivp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
110 |
by auto |
0 | 111 |
|
542 | 112 |
lemma identity_quotient: |
528 | 113 |
shows "Quotient (op =) id id" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
114 |
unfolding Quotient_def id_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
115 |
by blast |
0 | 116 |
|
528 | 117 |
lemma Quotient_symp: |
118 |
assumes a: "Quotient E Abs Rep" |
|
119 |
shows "symp E" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
120 |
using a unfolding Quotient_def symp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
121 |
by metis |
0 | 122 |
|
528 | 123 |
lemma Quotient_transp: |
124 |
assumes a: "Quotient E Abs Rep" |
|
125 |
shows "transp E" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
126 |
using a unfolding Quotient_def transp_def |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
127 |
by metis |
0 | 128 |
|
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
129 |
definition |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
130 |
fun_map (infixr "--->" 55) |
0 | 131 |
where |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
132 |
[simp]: "fun_map f g h x = g (h (f x))" |
0 | 133 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
134 |
lemma fun_map_id: |
126
9cb8f9a59402
Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
113
diff
changeset
|
135 |
shows "(id ---> id) = id" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
136 |
by (simp add: expand_fun_eq id_def) |
0 | 137 |
|
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
138 |
definition |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
139 |
fun_rel (infixr "===>" 55) |
0 | 140 |
where |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
141 |
[simp]: "fun_rel E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))" |
0 | 142 |
|
536
44fa9df44e6f
More code cleaning and name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
530
diff
changeset
|
143 |
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
|
144 |
"(op =) ===> (op =) \<equiv> (op =)" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
145 |
by (rule eq_reflection) (simp add: expand_fun_eq) |
0 | 146 |
|
537
57073b0b8fac
Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
536
diff
changeset
|
147 |
lemma fun_quotient: |
528 | 148 |
assumes q1: "Quotient R1 abs1 rep1" |
149 |
and q2: "Quotient R2 abs2 rep2" |
|
150 |
shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
|
0 | 151 |
proof - |
152 |
have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a" |
|
153 |
apply(simp add: expand_fun_eq) |
|
154 |
using q1 q2 |
|
528 | 155 |
apply(simp add: Quotient_def) |
0 | 156 |
done |
157 |
moreover |
|
158 |
have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)" |
|
159 |
apply(auto) |
|
528 | 160 |
using q1 q2 unfolding Quotient_def |
0 | 161 |
apply(metis) |
162 |
done |
|
163 |
moreover |
|
164 |
have "\<forall>r s. (R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> |
|
165 |
(rep1 ---> abs2) r = (rep1 ---> abs2) s)" |
|
166 |
apply(auto simp add: expand_fun_eq) |
|
528 | 167 |
using q1 q2 unfolding Quotient_def |
0 | 168 |
apply(metis) |
528 | 169 |
using q1 q2 unfolding Quotient_def |
0 | 170 |
apply(metis) |
528 | 171 |
using q1 q2 unfolding Quotient_def |
0 | 172 |
apply(metis) |
528 | 173 |
using q1 q2 unfolding Quotient_def |
0 | 174 |
apply(metis) |
175 |
done |
|
176 |
ultimately |
|
528 | 177 |
show "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)" |
178 |
unfolding Quotient_def by blast |
|
0 | 179 |
qed |
180 |
||
181 |
definition |
|
182 |
Respects |
|
183 |
where |
|
184 |
"Respects R x \<equiv> (R x x)" |
|
185 |
||
542 | 186 |
lemma in_respects: |
0 | 187 |
shows "(x \<in> Respects R) = R x x" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
188 |
unfolding mem_def Respects_def by simp |
0 | 189 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
190 |
lemma equals_rsp: |
528 | 191 |
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
|
192 |
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
|
193 |
shows "R xa ya = R xb yb" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
194 |
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
|
195 |
using a by blast |
0 | 196 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
197 |
lemma lambda_prs: |
528 | 198 |
assumes q1: "Quotient R1 Abs1 Rep1" |
199 |
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
|
200 |
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
|
201 |
unfolding expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
202 |
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
|
203 |
by simp |
0 | 204 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
205 |
lemma lambda_prs1: |
528 | 206 |
assumes q1: "Quotient R1 Abs1 Rep1" |
207 |
and q2: "Quotient R2 Abs2 Rep2" |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
208 |
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
|
209 |
unfolding expand_fun_eq |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
210 |
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
|
211 |
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
|
212 |
|
542 | 213 |
lemma rep_abs_rsp: |
528 | 214 |
assumes q: "Quotient R Abs Rep" |
459 | 215 |
and a: "R x1 x2" |
216 |
shows "R x1 (Rep (Abs x2))" |
|
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
217 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
0 | 218 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
219 |
lemma rep_abs_rsp_left: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
220 |
assumes q: "Quotient R Abs Rep" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
221 |
and a: "R x1 x2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
222 |
shows "R (Rep (Abs x1)) x2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
223 |
using q a by (metis Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
224 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
225 |
(* 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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
not the primed version *) |
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
230 |
lemma apply_rsp: |
841
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
231 |
fixes f g::"'a \<Rightarrow> 'c" |
528 | 232 |
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
|
233 |
and a: "(R1 ===> R2) f g" "R1 x y" |
841
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
234 |
shows "R2 (f x) (g y)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
235 |
using a by simp |
516
bed81795848c
Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
515
diff
changeset
|
236 |
|
527
9b1ad366827f
code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
519
diff
changeset
|
237 |
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
|
238 |
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
|
239 |
shows "R2 (f x) (g y)" |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
240 |
using a by simp |
458 | 241 |
|
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
|
242 |
(* 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
|
243 |
|
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
|
244 |
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
|
245 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 246 |
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
|
247 |
shows "Ball (Respects R) P = (All P)" |
542 | 248 |
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
|
249 |
|
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
|
250 |
lemma bex_reg_eqv: |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
251 |
fixes P :: "'a \<Rightarrow> bool" |
528 | 252 |
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
|
253 |
shows "Bex (Respects R) P = (Ex P)" |
542 | 254 |
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
|
255 |
|
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 |
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
|
257 |
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
|
258 |
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
|
259 |
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
|
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>
parents:
416
diff
changeset
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
|
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 |
lemma ball_reg_left: |
528 | 267 |
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
|
268 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P" |
542 | 269 |
by (metis equivp_reflp in_respects a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
270 |
|
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 |
lemma bex_reg_right: |
528 | 272 |
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
|
273 |
shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P" |
542 | 274 |
by (metis equivp_reflp in_respects a) |
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
275 |
|
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 |
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
|
277 |
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
|
278 |
and x::"'a" |
528 | 279 |
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
|
280 |
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
|
281 |
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
|
282 |
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
|
283 |
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
|
284 |
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
|
285 |
apply(rule impI) |
528 | 286 |
using a equivp_reflp_symp_transp[of "R2"] |
287 |
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
|
288 |
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
|
289 |
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
|
290 |
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
|
291 |
|
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
|
292 |
lemma bex_reg_eqv_range: |
528 | 293 |
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
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
apply(simp) |
542 | 298 |
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
|
299 |
apply(rule impI) |
528 | 300 |
using a equivp_reflp_symp_transp[of "R2"] |
301 |
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
|
302 |
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
|
303 |
|
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
|
304 |
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
|
305 |
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
|
306 |
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
|
307 |
shows "All Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
308 |
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
|
309 |
|
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
shows "Ex Q" |
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
314 |
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
|
315 |
|
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
|
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
|
322 |
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
|
323 |
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
|
324 |
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
|
325 |
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
|
326 |
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
|
327 |
|
432
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
328 |
lemma ball_all_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
329 |
"(\<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
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
330 |
by auto |
432
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
331 |
|
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
332 |
lemma bex_ex_comm: |
9c33c0809733
Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
427
diff
changeset
|
333 |
"((\<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
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
334 |
by auto |
96
4da714704611
A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
95
diff
changeset
|
335 |
|
595
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
336 |
(* Bounded abstraction *) |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
337 |
definition |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
338 |
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
|
339 |
where |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
340 |
"(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
|
341 |
|
908
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
342 |
definition |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
343 |
Bexeq :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
344 |
where |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
345 |
"Bexeq R P \<equiv> (\<exists>x \<in> Respects R. P x) \<and> (\<forall>x \<in> Respects R. \<forall>y \<in> Respects R. ((P x \<and> P y) \<longrightarrow> (R x y)))" |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
346 |
|
595
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
347 |
(* 3 lemmas needed for proving repabs_inj *) |
458 | 348 |
lemma ball_rsp: |
349 |
assumes a: "(R ===> (op =)) f g" |
|
350 |
shows "Ball (Respects R) f = Ball (Respects R) g" |
|
542 | 351 |
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
|
352 |
|
458 | 353 |
lemma bex_rsp: |
354 |
assumes a: "(R ===> (op =)) f g" |
|
355 |
shows "(Bex (Respects R) f = Bex (Respects R) g)" |
|
542 | 356 |
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
|
357 |
|
908
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
358 |
lemma bex1_rsp: |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
359 |
assumes a: "(R ===> (op =)) f g" |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
360 |
shows "(Bex1 (Respects R) f = Bex1 (Respects R) g)" |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
361 |
using a |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
362 |
by (simp add: Ex1_def Bex1_def in_respects) auto |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
363 |
|
909
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
364 |
(* TODO/FIXME: simplify the repetitions in this proof *) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
365 |
lemma bexeq_rsp: |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
366 |
assumes a: "Quotient R absf repf" |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
367 |
shows "((R ===> op =) ===> op =) (Bexeq R) (Bexeq R)" |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
368 |
apply simp |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
369 |
unfolding Bexeq_def |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
370 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
371 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
372 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
373 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
374 |
apply (erule conjE)+ |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
375 |
apply (erule bexE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
376 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
377 |
apply (rule_tac x="xa" in bexI) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
378 |
apply metis |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
379 |
apply metis |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
380 |
apply rule+ |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
381 |
apply (erule_tac x="xb" in ballE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
382 |
prefer 2 |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
383 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
384 |
apply (erule_tac x="ya" in ballE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
385 |
prefer 2 |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
386 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
387 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
388 |
apply (erule conjE)+ |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
389 |
apply (erule bexE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
390 |
apply rule |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
391 |
apply (rule_tac x="xa" in bexI) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
392 |
apply metis |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
393 |
apply metis |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
394 |
apply rule+ |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
395 |
apply (erule_tac x="xb" in ballE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
396 |
prefer 2 |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
397 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
398 |
apply (erule_tac x="ya" in ballE) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
399 |
prefer 2 |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
400 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
401 |
apply (metis in_respects) |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
402 |
done |
3e7a6ec549d1
Using Bexeq_rsp, and manually lifted lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
908
diff
changeset
|
403 |
|
595
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
404 |
lemma babs_rsp: |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
405 |
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
|
406 |
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
|
407 |
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
|
408 |
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
|
409 |
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
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
by metis |
a2f2214dc881
Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
593
diff
changeset
|
414 |
|
607 | 415 |
lemma babs_prs: |
416 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
417 |
and q2: "Quotient R2 Abs2 Rep2" |
|
418 |
shows "(Rep1 ---> Abs2) (Babs (Respects R1) ((Abs1 ---> Rep2) f)) \<equiv> f" |
|
419 |
apply(rule eq_reflection) |
|
420 |
apply(rule ext) |
|
421 |
apply simp |
|
422 |
apply (subgoal_tac "Rep1 x \<in> Respects R1") |
|
423 |
apply (simp add: Babs_def Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]) |
|
424 |
apply (simp add: in_respects Quotient_rel_rep[OF q1]) |
|
425 |
done |
|
426 |
||
696
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
674
diff
changeset
|
427 |
lemma babs_simp: |
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
674
diff
changeset
|
428 |
assumes q: "Quotient R1 Abs Rep" |
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
674
diff
changeset
|
429 |
shows "((R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)) = ((R1 ===> R2) f g)" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
430 |
apply(rule iffI) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
431 |
apply(simp_all only: babs_rsp[OF q]) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
432 |
apply(auto simp add: Babs_def) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
433 |
apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1") |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
434 |
apply(metis Babs_def) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
435 |
apply (simp add: in_respects) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
436 |
using Quotient_rel[OF q] |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
437 |
by metis |
696
fd718dde1d61
Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
674
diff
changeset
|
438 |
|
841
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
439 |
(* If a user proves that a particular functional relation |
8e44ce29f974
added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents:
825
diff
changeset
|
440 |
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>
parents:
597
diff
changeset
|
441 |
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
|
442 |
shows "equivp R \<Longrightarrow> Babs (Respects R) P = P" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
443 |
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>
parents:
597
diff
changeset
|
444 |
|
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
445 |
(* 3 lemmas needed for cleaning of quantifiers *) |
458 | 446 |
lemma all_prs: |
528 | 447 |
assumes a: "Quotient R absf repf" |
458 | 448 |
shows "Ball (Respects R) ((absf ---> id) f) = All f" |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
449 |
using a unfolding Quotient_def Ball_def in_respects fun_map_def id_apply |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
450 |
by metis |
162 | 451 |
|
458 | 452 |
lemma ex_prs: |
528 | 453 |
assumes a: "Quotient R absf repf" |
458 | 454 |
shows "Bex (Respects R) ((absf ---> id) f) = Ex f" |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
455 |
using a unfolding Quotient_def Bex_def in_respects fun_map_def id_apply |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
456 |
by metis |
171
13aab4c59096
More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
166
diff
changeset
|
457 |
|
908
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
458 |
lemma ex1_prs: |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
459 |
assumes a: "Quotient R absf repf" |
910
b91782991dc8
Automatic cleaning of Bexeq<->Ex1 theorems.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
909
diff
changeset
|
460 |
shows "((absf ---> id) ---> id) (Bexeq R) f = Ex1 f" |
b91782991dc8
Automatic cleaning of Bexeq<->Ex1 theorems.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
909
diff
changeset
|
461 |
apply simp |
908
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
462 |
apply (subst Bexeq_def) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
463 |
apply (subst Bex_def) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
464 |
apply (subst Ex1_def) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
465 |
apply simp |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
466 |
apply rule |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
467 |
apply (erule conjE)+ |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
468 |
apply (erule_tac exE) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
469 |
apply (erule conjE) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
470 |
apply (subgoal_tac "\<forall>y. R y y \<longrightarrow> f (absf y) \<longrightarrow> R x y") |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
471 |
apply (rule_tac x="absf x" in exI) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
472 |
apply (thin_tac "\<forall>x\<in>Respects R. \<forall>y\<in>Respects R. f (absf x) \<and> f (absf y) \<longrightarrow> R x y") |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
473 |
apply (simp) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
474 |
apply rule+ |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
475 |
using a unfolding Quotient_def |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
476 |
apply metis |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
477 |
apply rule+ |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
478 |
apply (erule_tac x="x" in ballE) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
479 |
apply (erule_tac x="y" in ballE) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
480 |
apply simp |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
481 |
apply (simp add: in_respects) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
482 |
apply (simp add: in_respects) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
483 |
apply (erule_tac exE) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
484 |
apply rule |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
485 |
apply (rule_tac x="repf x" in exI) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
486 |
apply (simp only: in_respects) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
487 |
apply rule |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
488 |
apply (metis Quotient_rel_rep[OF a]) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
489 |
using a unfolding Quotient_def apply (simp) |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
490 |
apply rule+ |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
491 |
using a unfolding Quotient_def in_respects |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
492 |
apply metis |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
493 |
done |
1bf4337919d3
Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
891
diff
changeset
|
494 |
|
554
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
495 |
lemma fun_rel_id: |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
496 |
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
|
497 |
shows "(R1 ===> R2) f g" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
498 |
using a by simp |
554
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
499 |
|
697
57944c1ef728
Regularized the hard lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
696
diff
changeset
|
500 |
lemma fun_rel_id_asm: |
57944c1ef728
Regularized the hard lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
696
diff
changeset
|
501 |
assumes a: "\<And>x y. R1 x y \<Longrightarrow> (A \<longrightarrow> R2 (f x) (g y))" |
57944c1ef728
Regularized the hard lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
696
diff
changeset
|
502 |
shows "A \<longrightarrow> (R1 ===> R2) f g" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
503 |
using a by auto |
697
57944c1ef728
Regularized the hard lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
696
diff
changeset
|
504 |
|
554
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
505 |
lemma quot_rel_rsp: |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
506 |
assumes a: "Quotient R Abs Rep" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
507 |
shows "(R ===> R ===> op =) R R" |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
508 |
apply(rule fun_rel_id)+ |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
509 |
apply(rule equals_rsp[OF a]) |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
510 |
apply(assumption)+ |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
511 |
done |
8395fc6a6945
Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
546
diff
changeset
|
512 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
513 |
lemma o_prs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
514 |
assumes q1: "Quotient R1 Abs1 Rep1" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
515 |
and q2: "Quotient R2 Abs2 Rep2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
516 |
and q3: "Quotient R3 Abs3 Rep3" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
517 |
shows "(Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g)) = f o g" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
518 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] Quotient_abs_rep[OF q3] |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
519 |
unfolding o_def expand_fun_eq by simp |
541
94deffed619d
more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
540
diff
changeset
|
520 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
521 |
lemma o_rsp: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
522 |
assumes q1: "Quotient R1 Abs1 Rep1" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
523 |
and q2: "Quotient R2 Abs2 Rep2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
524 |
and q3: "Quotient R3 Abs3 Rep3" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
525 |
and a1: "(R2 ===> R3) f1 f2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
526 |
and a2: "(R1 ===> R2) g1 g2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
527 |
shows "(R1 ===> R3) (f1 o g1) (f2 o g2)" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
528 |
using a1 a2 unfolding o_def expand_fun_eq |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
529 |
by (auto) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
530 |
|
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
531 |
lemma cond_prs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
532 |
assumes a: "Quotient R absf repf" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
533 |
shows "absf (if a then repf b else repf c) = (if a then b else c)" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
534 |
using a unfolding Quotient_def by auto |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
535 |
|
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
536 |
lemma if_prs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
537 |
assumes q: "Quotient R Abs Rep" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
538 |
shows "Abs (If a (Rep b) (Rep c)) = If a b c" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
539 |
using Quotient_abs_rep[OF q] by auto |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
540 |
|
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
541 |
(* q not used *) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
542 |
lemma if_rsp: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
543 |
assumes q: "Quotient R Abs Rep" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
544 |
and a: "a1 = a2" "R b1 b2" "R c1 c2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
545 |
shows "R (If a1 b1 c1) (If a2 b2 c2)" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
546 |
using a by auto |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
547 |
|
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
548 |
lemma let_prs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
549 |
assumes q1: "Quotient R1 Abs1 Rep1" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
550 |
and q2: "Quotient R2 Abs2 Rep2" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
551 |
shows "Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f)) = Let x f" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
552 |
using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
553 |
|
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
554 |
lemma let_rsp: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
555 |
assumes q1: "Quotient R1 Abs1 Rep1" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
556 |
and a1: "(R1 ===> R2) f g" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
557 |
and a2: "R1 x y" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
558 |
shows "R2 ((Let x f)::'c) ((Let y g)::'c)" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
559 |
using apply_rsp[OF q1 a1] a2 by auto |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
560 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
561 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
562 |
|
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 |
(******************************************) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
565 |
(* REST OF THE FILE IS UNUSED (until now) *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
566 |
(******************************************) |
656
c86a47d4966e
Temporarily repeated fun_map_tac 4 times. Cleaning for all examples work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
607
diff
changeset
|
567 |
|
542 | 568 |
lemma in_fun: |
569 |
shows "x \<in> ((f ---> g) s) = g (f x \<in> s)" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
570 |
by (simp add: mem_def) |
542 | 571 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
572 |
lemma respects_thm: |
542 | 573 |
shows "Respects (R1 ===> R2) f = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (f y))" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
574 |
unfolding Respects_def |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
575 |
by (simp add: expand_fun_eq) |
542 | 576 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
577 |
lemma respects_rep_abs: |
542 | 578 |
assumes a: "Quotient R1 Abs1 Rep1" |
579 |
and b: "Respects (R1 ===> R2) f" |
|
580 |
and c: "R1 x x" |
|
581 |
shows "R2 (f (Rep1 (Abs1 x))) (f x)" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
582 |
using a b[simplified respects_thm] c unfolding Quotient_def |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
583 |
by blast |
542 | 584 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
585 |
lemma respects_mp: |
542 | 586 |
assumes a: "Respects (R1 ===> R2) f" |
587 |
and b: "R1 x y" |
|
588 |
shows "R2 (f x) (f y)" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
589 |
using a b unfolding Respects_def |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
590 |
by simp |
542 | 591 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
592 |
lemma respects_o: |
542 | 593 |
assumes a: "Respects (R2 ===> R3) f" |
594 |
and b: "Respects (R1 ===> R2) g" |
|
595 |
shows "Respects (R1 ===> R3) (f o g)" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
596 |
using a b unfolding Respects_def |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
597 |
by simp |
542 | 598 |
|
824 | 599 |
lemma abs_o_rep: |
600 |
assumes a: "Quotient r absf repf" |
|
601 |
shows "absf o repf = id" |
|
602 |
apply(rule ext) |
|
603 |
apply(simp add: Quotient_abs_rep[OF a]) |
|
604 |
done |
|
605 |
||
825
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
606 |
lemma eq_comp_r: "op = OO R OO op = \<equiv> R" |
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
607 |
apply (rule eq_reflection) |
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
608 |
apply (rule ext)+ |
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
609 |
apply auto |
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
610 |
done |
970e86082cd7
Modifictaions for new_relation.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
824
diff
changeset
|
611 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
612 |
lemma fun_rel_eq_rel: |
542 | 613 |
assumes q1: "Quotient R1 Abs1 Rep1" |
614 |
and q2: "Quotient R2 Abs2 Rep2" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
615 |
shows "(R1 ===> R2) f g = ((Respects (R1 ===> R2) f) \<and> (Respects (R1 ===> R2) g) |
542 | 616 |
\<and> ((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g))" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
617 |
using fun_quotient[OF q1 q2] unfolding Respects_def Quotient_def expand_fun_eq |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
618 |
by blast |
542 | 619 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
620 |
lemma let_babs: |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
621 |
"v \<in> r \<Longrightarrow> Let v (Babs r lam) = Let v lam" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
622 |
by (simp add: Babs_def) |
542 | 623 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
624 |
lemma fun_rel_equals: |
542 | 625 |
assumes q1: "Quotient R1 Abs1 Rep1" |
626 |
and q2: "Quotient R2 Abs2 Rep2" |
|
627 |
and r1: "Respects (R1 ===> R2) f" |
|
628 |
and r2: "Respects (R1 ===> R2) g" |
|
629 |
shows "((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g) = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
630 |
apply(rule_tac iffI) |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
631 |
apply(rule)+ |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
632 |
apply (rule apply_rsp'[of "R1" "R2"]) |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
633 |
apply(subst Quotient_rel[OF fun_quotient[OF q1 q2]]) |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
634 |
apply auto |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
635 |
using fun_quotient[OF q1 q2] r1 r2 unfolding Quotient_def Respects_def |
913
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
636 |
apply (metis let_rsp q1) |
b1f55dd64481
Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
910
diff
changeset
|
637 |
apply (metis fun_rel_eq_rel let_rsp q1 q2 r2) |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
638 |
using r1 unfolding Respects_def expand_fun_eq |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
639 |
apply(simp (no_asm_use)) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
640 |
apply(metis Quotient_rel[OF q2] Quotient_rel_rep[OF q1]) |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
641 |
done |
542 | 642 |
|
643 |
(* ask Peter: fun_rel_IMP used twice *) |
|
644 |
lemma fun_rel_IMP2: |
|
645 |
assumes q1: "Quotient R1 Abs1 Rep1" |
|
646 |
and q2: "Quotient R2 Abs2 Rep2" |
|
647 |
and r1: "Respects (R1 ===> R2) f" |
|
648 |
and r2: "Respects (R1 ===> R2) g" |
|
649 |
and a: "(Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g" |
|
650 |
shows "R1 x y \<Longrightarrow> R2 (f x) (g y)" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
651 |
using q1 q2 r1 r2 a |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
652 |
by (simp add: fun_rel_equals) |
542 | 653 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
654 |
lemma lambda_rep_abs_rsp: |
542 | 655 |
assumes r1: "\<And>r r'. R1 r r' \<Longrightarrow>R1 r (Rep1 (Abs1 r'))" |
656 |
and r2: "\<And>r r'. R2 r r' \<Longrightarrow>R2 r (Rep2 (Abs2 r'))" |
|
657 |
shows "(R1 ===> R2) f1 f2 \<Longrightarrow> (R1 ===> R2) f1 ((Abs1 ---> Rep2) ((Rep1 ---> Abs2) f2))" |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
658 |
using r1 r2 by auto |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
659 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
660 |
(* ask peter what are literal_case *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
661 |
(* literal_case_PRS *) |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
662 |
(* literal_case_RSP *) |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
663 |
(* Cez: !f x. literal_case f x = f x *) |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
664 |
|
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
665 |
(* We use id_simps which includes id_apply; so these 2 theorems can be removed *) |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
666 |
lemma id_prs: |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
667 |
assumes q: "Quotient R Abs Rep" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
668 |
shows "Abs (id (Rep e)) = id e" |
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
669 |
using Quotient_abs_rep[OF q] by auto |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
670 |
|
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
671 |
lemma id_rsp: |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
672 |
assumes q: "Quotient R Abs Rep" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
673 |
and a: "R e1 e2" |
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
674 |
shows "R (id e1) (id e2)" |
721
19032e71fb1c
More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
700
diff
changeset
|
675 |
using a by auto |
543
d030c8e19465
Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
542
diff
changeset
|
676 |
|
93
ec29be471518
Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
0
diff
changeset
|
677 |
end |
95
8c3a35da4560
Proving the proper RepAbs version
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
93
diff
changeset
|
678 |