author | urbanc |
Tue, 02 Aug 2011 15:27:37 +0000 | |
changeset 182 | 560712a29a36 |
parent 181 | 97090fc7aa9f |
child 183 | c4893e84c88e |
permissions | -rw-r--r-- |
63 | 1 |
theory Myhill_2 |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
2 |
imports Myhill_1 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
3 |
"~~/src/HOL/Library/List_Prefix" |
63 | 4 |
begin |
5 |
||
166 | 6 |
section {* Direction @{text "regular language \<Rightarrow> finite partition"} *} |
63 | 7 |
|
8 |
definition |
|
181 | 9 |
tag_eq :: "('a list \<Rightarrow> 'b) \<Rightarrow> ('a list \<times> 'a list) set" ("=_=") |
63 | 10 |
where |
166 | 11 |
"=tag= \<equiv> {(x, y). tag x = tag y}" |
117 | 12 |
|
181 | 13 |
abbreviation |
14 |
tag_eq_applied :: "'a list \<Rightarrow> ('a list \<Rightarrow> 'b) \<Rightarrow> 'a list \<Rightarrow> bool" ("_ =_= _") |
|
15 |
where |
|
16 |
"x =tag= y \<equiv> (x, y) \<in> =tag=" |
|
17 |
||
18 |
lemma test: |
|
19 |
shows "(\<approx>A) `` {x} = (\<approx>A) `` {y} \<longleftrightarrow> x \<approx>A y" |
|
20 |
unfolding str_eq_def |
|
21 |
by auto |
|
22 |
||
23 |
lemma test_refined_intro: |
|
24 |
assumes "\<And>x y z. \<lbrakk>x =tag= y; x @ z \<in> A\<rbrakk> \<Longrightarrow> y @ z \<in> A" |
|
25 |
shows "=tag= \<subseteq> \<approx>A" |
|
26 |
using assms |
|
27 |
unfolding str_eq_def tag_eq_def |
|
28 |
apply(clarify, simp (no_asm_use)) |
|
29 |
by metis |
|
30 |
||
117 | 31 |
lemma finite_eq_tag_rel: |
63 | 32 |
assumes rng_fnt: "finite (range tag)" |
109 | 33 |
shows "finite (UNIV // =tag=)" |
63 | 34 |
proof - |
119 | 35 |
let "?f" = "\<lambda>X. tag ` X" and ?A = "(UNIV // =tag=)" |
118 | 36 |
have "finite (?f ` ?A)" |
37 |
proof - |
|
119 | 38 |
have "range ?f \<subseteq> (Pow (range tag))" unfolding Pow_def by auto |
39 |
moreover |
|
40 |
have "finite (Pow (range tag))" using rng_fnt by simp |
|
41 |
ultimately |
|
42 |
have "finite (range ?f)" unfolding image_def by (blast intro: finite_subset) |
|
43 |
moreover |
|
44 |
have "?f ` ?A \<subseteq> range ?f" by auto |
|
45 |
ultimately show "finite (?f ` ?A)" by (rule rev_finite_subset) |
|
63 | 46 |
qed |
118 | 47 |
moreover |
119 | 48 |
have "inj_on ?f ?A" |
118 | 49 |
proof - |
50 |
{ fix X Y |
|
51 |
assume X_in: "X \<in> ?A" |
|
52 |
and Y_in: "Y \<in> ?A" |
|
53 |
and tag_eq: "?f X = ?f Y" |
|
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
54 |
then obtain x y |
119 | 55 |
where "x \<in> X" "y \<in> Y" "tag x = tag y" |
181 | 56 |
unfolding quotient_def Image_def image_def tag_eq_def |
119 | 57 |
by (simp) (blast) |
58 |
with X_in Y_in |
|
118 | 59 |
have "X = Y" |
181 | 60 |
unfolding quotient_def tag_eq_def by auto |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
61 |
} |
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
62 |
then show "inj_on ?f ?A" unfolding inj_on_def by auto |
118 | 63 |
qed |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
64 |
ultimately show "finite (UNIV // =tag=)" by (rule finite_imageD) |
63 | 65 |
qed |
66 |
||
67 |
lemma refined_partition_finite: |
|
118 | 68 |
assumes fnt: "finite (UNIV // R1)" |
63 | 69 |
and refined: "R1 \<subseteq> R2" |
118 | 70 |
and eq1: "equiv UNIV R1" and eq2: "equiv UNIV R2" |
71 |
shows "finite (UNIV // R2)" |
|
63 | 72 |
proof - |
118 | 73 |
let ?f = "\<lambda>X. {R1 `` {x} | x. x \<in> X}" |
74 |
and ?A = "UNIV // R2" and ?B = "UNIV // R1" |
|
75 |
have "?f ` ?A \<subseteq> Pow ?B" |
|
76 |
unfolding image_def Pow_def quotient_def by auto |
|
77 |
moreover |
|
78 |
have "finite (Pow ?B)" using fnt by simp |
|
79 |
ultimately |
|
80 |
have "finite (?f ` ?A)" by (rule finite_subset) |
|
81 |
moreover |
|
82 |
have "inj_on ?f ?A" |
|
83 |
proof - |
|
84 |
{ fix X Y |
|
85 |
assume X_in: "X \<in> ?A" and Y_in: "Y \<in> ?A" and eq_f: "?f X = ?f Y" |
|
86 |
from quotientE [OF X_in] |
|
87 |
obtain x where "X = R2 `` {x}" by blast |
|
88 |
with equiv_class_self[OF eq2] have x_in: "x \<in> X" by simp |
|
89 |
then have "R1 ``{x} \<in> ?f X" by auto |
|
90 |
with eq_f have "R1 `` {x} \<in> ?f Y" by simp |
|
91 |
then obtain y |
|
92 |
where y_in: "y \<in> Y" and eq_r1_xy: "R1 `` {x} = R1 `` {y}" by auto |
|
93 |
with eq_equiv_class[OF _ eq1] |
|
94 |
have "(x, y) \<in> R1" by blast |
|
95 |
with refined have "(x, y) \<in> R2" by auto |
|
96 |
with quotient_eqI [OF eq2 X_in Y_in x_in y_in] |
|
97 |
have "X = Y" . |
|
98 |
} |
|
99 |
then show "inj_on ?f ?A" unfolding inj_on_def by blast |
|
63 | 100 |
qed |
118 | 101 |
ultimately show "finite (UNIV // R2)" by (rule finite_imageD) |
63 | 102 |
qed |
103 |
||
104 |
lemma tag_finite_imageD: |
|
105 |
assumes rng_fnt: "finite (range tag)" |
|
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
106 |
and same_tag_eqvt: "\<And>m n. tag m = tag n \<Longrightarrow> m \<approx>A n" |
119 | 107 |
shows "finite (UNIV // \<approx>A)" |
108 |
proof (rule_tac refined_partition_finite [of "=tag="]) |
|
109 |
show "finite (UNIV // =tag=)" by (rule finite_eq_tag_rel[OF rng_fnt]) |
|
110 |
next |
|
111 |
from same_tag_eqvt |
|
181 | 112 |
show "=tag= \<subseteq> \<approx>A" unfolding tag_eq_def str_eq_def |
113 |
by blast |
|
119 | 114 |
next |
115 |
show "equiv UNIV =tag=" |
|
181 | 116 |
unfolding equiv_def tag_eq_def refl_on_def sym_def trans_def |
119 | 117 |
by auto |
118 |
next |
|
119 |
show "equiv UNIV (\<approx>A)" |
|
181 | 120 |
unfolding equiv_def str_eq_def sym_def refl_on_def trans_def |
119 | 121 |
by blast |
63 | 122 |
qed |
123 |
||
124 |
||
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
125 |
subsection {* The proof *} |
63 | 126 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
127 |
subsubsection {* The base case for @{const "Zero"} *} |
63 | 128 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
129 |
lemma quot_zero_eq: |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
130 |
shows "UNIV // \<approx>{} = {UNIV}" |
181 | 131 |
unfolding quotient_def Image_def str_eq_def by auto |
63 | 132 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
133 |
lemma quot_zero_finiteI [intro]: |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
134 |
shows "finite (UNIV // \<approx>{})" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
135 |
unfolding quot_zero_eq by simp |
63 | 136 |
|
137 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
138 |
subsubsection {* The base case for @{const "One"} *} |
63 | 139 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
140 |
lemma quot_one_subset: |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
141 |
shows "UNIV // \<approx>{[]} \<subseteq> {{[]}, UNIV - {[]}}" |
63 | 142 |
proof |
143 |
fix x |
|
144 |
assume "x \<in> UNIV // \<approx>{[]}" |
|
145 |
then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[]}}" |
|
146 |
unfolding quotient_def Image_def by blast |
|
147 |
show "x \<in> {{[]}, UNIV - {[]}}" |
|
148 |
proof (cases "y = []") |
|
149 |
case True with h |
|
181 | 150 |
have "x = {[]}" by (auto simp: str_eq_def) |
63 | 151 |
thus ?thesis by simp |
152 |
next |
|
153 |
case False with h |
|
181 | 154 |
have "x = UNIV - {[]}" by (auto simp: str_eq_def) |
63 | 155 |
thus ?thesis by simp |
156 |
qed |
|
157 |
qed |
|
158 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
159 |
lemma quot_one_finiteI [intro]: |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
160 |
shows "finite (UNIV // \<approx>{[]})" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
161 |
by (rule finite_subset[OF quot_one_subset]) (simp) |
63 | 162 |
|
163 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
164 |
subsubsection {* The base case for @{const "Atom"} *} |
63 | 165 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
166 |
lemma quot_atom_subset: |
63 | 167 |
"UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}" |
168 |
proof |
|
169 |
fix x |
|
170 |
assume "x \<in> UNIV // \<approx>{[c]}" |
|
171 |
then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[c]}}" |
|
172 |
unfolding quotient_def Image_def by blast |
|
173 |
show "x \<in> {{[]},{[c]}, UNIV - {[], [c]}}" |
|
174 |
proof - |
|
175 |
{ assume "y = []" hence "x = {[]}" using h |
|
181 | 176 |
by (auto simp: str_eq_def) } |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
177 |
moreover |
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
178 |
{ assume "y = [c]" hence "x = {[c]}" using h |
181 | 179 |
by (auto dest!: spec[where x = "[]"] simp: str_eq_def) } |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
180 |
moreover |
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
181 |
{ assume "y \<noteq> []" and "y \<noteq> [c]" |
63 | 182 |
hence "\<forall> z. (y @ z) \<noteq> [c]" by (case_tac y, auto) |
183 |
moreover have "\<And> p. (p \<noteq> [] \<and> p \<noteq> [c]) = (\<forall> q. p @ q \<noteq> [c])" |
|
184 |
by (case_tac p, auto) |
|
185 |
ultimately have "x = UNIV - {[],[c]}" using h |
|
181 | 186 |
by (auto simp add: str_eq_def) |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
187 |
} |
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
188 |
ultimately show ?thesis by blast |
63 | 189 |
qed |
190 |
qed |
|
191 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
192 |
lemma quot_atom_finiteI [intro]: |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
193 |
shows "finite (UNIV // \<approx>{[c]})" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
194 |
by (rule finite_subset[OF quot_atom_subset]) (simp) |
63 | 195 |
|
196 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
197 |
subsubsection {* The inductive case for @{const Plus} *} |
63 | 198 |
|
199 |
definition |
|
181 | 200 |
tag_Plus :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang \<times> 'a lang)" |
63 | 201 |
where |
181 | 202 |
"tag_Plus A B \<equiv> (\<lambda>x. (\<approx>A `` {x}, \<approx>B `` {x}))" |
63 | 203 |
|
181 | 204 |
lemma quot_plus_finiteI [intro]: |
119 | 205 |
assumes finite1: "finite (UNIV // \<approx>A)" |
206 |
and finite2: "finite (UNIV // \<approx>B)" |
|
207 |
shows "finite (UNIV // \<approx>(A \<union> B))" |
|
181 | 208 |
proof (rule_tac tag = "tag_Plus A B" in tag_finite_imageD) |
119 | 209 |
have "finite ((UNIV // \<approx>A) \<times> (UNIV // \<approx>B))" |
210 |
using finite1 finite2 by auto |
|
181 | 211 |
then show "finite (range (tag_Plus A B))" |
212 |
unfolding tag_Plus_def quotient_def |
|
119 | 213 |
by (rule rev_finite_subset) (auto) |
214 |
next |
|
181 | 215 |
show "\<And>x y. tag_Plus A B x = tag_Plus A B y \<Longrightarrow> x \<approx>(A \<union> B) y" |
216 |
unfolding tag_Plus_def |
|
63 | 217 |
unfolding str_eq_def |
218 |
by auto |
|
219 |
qed |
|
220 |
||
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
221 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
222 |
subsubsection {* The inductive case for @{text "Times"}*} |
63 | 223 |
|
181 | 224 |
definition |
225 |
"Partitions s \<equiv> {(u, v). u @ v = s}" |
|
226 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
227 |
lemma conc_partitions_elim: |
181 | 228 |
assumes "x \<in> A \<cdot> B" |
229 |
shows "\<exists>(u, v) \<in> Partitions x. u \<in> A \<and> v \<in> B" |
|
230 |
using assms |
|
231 |
unfolding conc_def Partitions_def |
|
232 |
by auto |
|
233 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
234 |
lemma conc_partitions_intro: |
181 | 235 |
assumes "(u, v) \<in> Partitions x \<and> u \<in> A \<and> v \<in> B" |
236 |
shows "x \<in> A \<cdot> B" |
|
237 |
using assms |
|
238 |
unfolding conc_def Partitions_def |
|
239 |
by auto |
|
240 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
241 |
lemma equiv_class_member: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
242 |
assumes "x \<in> A" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
243 |
and "\<approx>A `` {x} = \<approx>A `` {y}" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
244 |
shows "y \<in> A" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
245 |
using assms |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
246 |
apply(simp add: Image_def str_eq_def set_eq_iff) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
247 |
apply(metis append_Nil2) |
181 | 248 |
done |
249 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
250 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
251 |
abbreviation |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
252 |
tag_Times_1 :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> 'a lang" |
181 | 253 |
where |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
254 |
"tag_Times_1 A B \<equiv> \<lambda>x. \<approx>A `` {x}" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
255 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
256 |
abbreviation |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
257 |
tag_Times_2 :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang \<times> 'a lang) set" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
258 |
where |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
259 |
"tag_Times_2 A B \<equiv> \<lambda>x. {(\<approx>A `` {u}, \<approx>B `` {v}) | u v. (u, v) \<in> Partitions x}" |
181 | 260 |
|
261 |
definition |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
262 |
tag_Times :: "'a lang \<Rightarrow> 'a lang \<Rightarrow> 'a list \<Rightarrow> 'a lang \<times> ('a lang \<times> 'a lang) set" |
181 | 263 |
where |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
264 |
"tag_Times A B \<equiv> \<lambda>x. (tag_Times_1 A B x, tag_Times_2 A B x)" |
181 | 265 |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
266 |
lemma tag_Times_injI: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
267 |
assumes a: "tag_Times_1 A B x = tag_Times_1 A B y" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
268 |
and b: "tag_Times_2 A B x = tag_Times_2 A B y" |
181 | 269 |
and c: "x @ z \<in> A \<cdot> B" |
270 |
shows "y @ z \<in> A \<cdot> B" |
|
271 |
proof - |
|
272 |
from c obtain u v where |
|
273 |
h1: "(u, v) \<in> Partitions (x @ z)" and |
|
274 |
h2: "u \<in> A" and |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
275 |
h3: "v \<in> B" by (auto dest: conc_partitions_elim) |
181 | 276 |
from h1 have "x @ z = u @ v" unfolding Partitions_def by simp |
277 |
then obtain us |
|
278 |
where "(x = u @ us \<and> us @ z = v) \<or> (x @ us = u \<and> z = us @ v)" |
|
279 |
by (auto simp add: append_eq_append_conv2) |
|
280 |
moreover |
|
281 |
{ assume eq: "x = u @ us" "us @ z = v" |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
282 |
have "(\<approx>A `` {u}, \<approx>B `` {us}) \<in> tag_Times_2 A B x" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
283 |
unfolding Partitions_def using eq by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
284 |
then have "(\<approx>A `` {u}, \<approx>B `` {us}) \<in> tag_Times_2 A B y" |
181 | 285 |
using b by simp |
286 |
then obtain u' us' where |
|
287 |
q1: "\<approx>A `` {u} = \<approx>A `` {u'}" and |
|
288 |
q2: "\<approx>B `` {us} = \<approx>B `` {us'}" and |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
289 |
q3: "(u', us') \<in> Partitions y" by auto |
181 | 290 |
from q1 h2 have "u' \<in> A" |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
291 |
using equiv_class_member by auto |
181 | 292 |
moreover from q2 h3 eq |
293 |
have "us' @ z \<in> B" |
|
294 |
unfolding Image_def str_eq_def by auto |
|
295 |
ultimately have "y @ z \<in> A \<cdot> B" using q3 |
|
296 |
unfolding Partitions_def by auto |
|
297 |
} |
|
298 |
moreover |
|
299 |
{ assume eq: "x @ us = u" "z = us @ v" |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
300 |
have "(\<approx>A `` {x}) = tag_Times_1 A B x" by simp |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
301 |
then have "(\<approx>A `` {x}) = tag_Times_1 A B y" |
181 | 302 |
using a by simp |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
303 |
then have "\<approx>A `` {x} = \<approx>A `` {y}" by simp |
181 | 304 |
moreover |
305 |
have "x @ us \<in> A" using h2 eq by simp |
|
306 |
ultimately |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
307 |
have "y @ us \<in> A" using equiv_class_member |
181 | 308 |
unfolding Image_def str_eq_def by blast |
309 |
then have "(y @ us) @ v \<in> A \<cdot> B" |
|
310 |
using h3 unfolding conc_def by blast |
|
311 |
then have "y @ z \<in> A \<cdot> B" using eq by simp |
|
312 |
} |
|
313 |
ultimately show "y @ z \<in> A \<cdot> B" by blast |
|
314 |
qed |
|
315 |
||
316 |
lemma quot_conc_finiteI [intro]: |
|
317 |
fixes A B::"'a lang" |
|
318 |
assumes fin1: "finite (UNIV // \<approx>A)" |
|
319 |
and fin2: "finite (UNIV // \<approx>B)" |
|
320 |
shows "finite (UNIV // \<approx>(A \<cdot> B))" |
|
321 |
proof (rule_tac tag = "tag_Times A B" in tag_finite_imageD) |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
322 |
have "=(tag_Times A B)= \<subseteq> \<approx>(A \<cdot> B)" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
323 |
apply(rule test_refined_intro) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
324 |
apply(rule tag_Times_injI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
325 |
prefer 3 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
326 |
apply(assumption) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
327 |
apply(simp add: tag_Times_def tag_eq_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
328 |
apply(simp add: tag_eq_def tag_Times_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
329 |
done |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
330 |
then show "\<And>x y. tag_Times A B x = tag_Times A B y \<Longrightarrow> x \<approx>(A \<cdot> B) y" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
331 |
unfolding tag_eq_def by auto |
63 | 332 |
next |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
333 |
have *: "finite ((UNIV // \<approx>A) \<times> (Pow (UNIV // \<approx>A \<times> UNIV // \<approx>B)))" |
63 | 334 |
using fin1 fin2 by auto |
181 | 335 |
show "finite (range (tag_Times A B))" |
336 |
unfolding tag_Times_def |
|
63 | 337 |
apply(rule finite_subset[OF _ *]) |
338 |
unfolding quotient_def |
|
339 |
by auto |
|
340 |
qed |
|
341 |
||
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
342 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
343 |
subsubsection {* The inductive case for @{const "Star"} *} |
63 | 344 |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
345 |
lemma append_eq_append_conv3: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
346 |
assumes "xs @ ys = zs @ ts" "zs < xs" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
347 |
shows "\<exists>us. xs = zs @ us \<and> us @ ys = ts" |
181 | 348 |
using assms |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
349 |
apply(auto simp add: append_eq_append_conv2 strict_prefix_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
350 |
done |
181 | 351 |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
352 |
lemma star_spartitions_elim: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
353 |
assumes "x @ z \<in> A\<star>" "x \<noteq> []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
354 |
shows "\<exists>(u, v) \<in> Partitions (x @ z). u < x \<and> u \<in> A\<star> \<and> v \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
355 |
proof - |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
356 |
have "([], x @ z) \<in> Partitions (x @ z)" "[] < x" "[] \<in> A\<star>" "x @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
357 |
using assms by (auto simp add: Partitions_def strict_prefix_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
358 |
then show "\<exists>(u, v) \<in> Partitions (x @ z). u < x \<and> u \<in> A\<star> \<and> v \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
359 |
by blast |
63 | 360 |
qed |
361 |
||
362 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
363 |
lemma finite_set_has_max2: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
364 |
"\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists> max \<in> A. \<forall> a \<in> A. length a \<le> length max" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
365 |
apply(induct rule:finite.induct) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
366 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
367 |
by (metis (full_types) all_not_in_conv insert_iff linorder_linear order_trans) |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
368 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
369 |
lemma finite_strict_prefix_set: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
370 |
shows "finite {xa. xa < (x::'a list)}" |
63 | 371 |
apply (induct x rule:rev_induct, simp) |
372 |
apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}") |
|
373 |
by (auto simp:strict_prefix_def) |
|
374 |
||
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
375 |
lemma append_eq_cases: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
376 |
assumes a: "x @ y = m @ n" "m \<noteq> []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
377 |
shows "x \<le> m \<or> m < x" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
378 |
unfolding prefix_def strict_prefix_def using a |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
379 |
by (auto simp add: append_eq_append_conv2) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
380 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
381 |
lemma star_spartitions_elim2: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
382 |
assumes a: "x @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
383 |
and b: "x \<noteq> []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
384 |
shows "\<exists>(u, v) \<in> Partitions x. \<exists> (u', v') \<in> Partitions z. u < x \<and> u \<in> A\<star> \<and> v @ u' \<in> A \<and> v' \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
385 |
proof - |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
386 |
def S \<equiv> "{u | u v. (u, v) \<in> Partitions x \<and> u < x \<and> u \<in> A\<star> \<and> v @ z \<in> A\<star>}" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
387 |
have "finite {u. u < x}" by (rule finite_strict_prefix_set) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
388 |
then have "finite S" unfolding S_def |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
389 |
by (rule rev_finite_subset) (auto) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
390 |
moreover |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
391 |
have "S \<noteq> {}" using a b unfolding S_def Partitions_def |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
392 |
by (auto simp: strict_prefix_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
393 |
ultimately have "\<exists> u_max \<in> S. \<forall> u \<in> S. length u \<le> length u_max" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
394 |
using finite_set_has_max2 by blast |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
395 |
then obtain u_max v |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
396 |
where h0: "(u_max, v) \<in> Partitions x" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
397 |
and h1: "u_max < x" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
398 |
and h2: "u_max \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
399 |
and h3: "v @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
400 |
and h4: "\<forall> u v. (u, v) \<in> Partitions x \<and> u < x \<and> u \<in> A\<star> \<and> v @ z \<in> A\<star> \<longrightarrow> length u \<le> length u_max" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
401 |
unfolding S_def Partitions_def by blast |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
402 |
have q: "v \<noteq> []" using h0 h1 b unfolding Partitions_def by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
403 |
from h3 obtain a b |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
404 |
where i1: "(a, b) \<in> Partitions (v @ z)" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
405 |
and i2: "a \<in> A" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
406 |
and i3: "b \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
407 |
and i4: "a \<noteq> []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
408 |
unfolding Partitions_def |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
409 |
using q by (auto dest: star_decom) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
410 |
have "v \<le> a" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
411 |
proof (rule ccontr) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
412 |
assume a: "\<not>(v \<le> a)" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
413 |
from i1 have i1': "a @ b = v @ z" unfolding Partitions_def by simp |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
414 |
then have "a \<le> v \<or> v < a" using append_eq_cases q by blast |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
415 |
then have q: "a < v" using a unfolding strict_prefix_def prefix_def by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
416 |
then obtain as where eq: "a @ as = v" unfolding strict_prefix_def prefix_def by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
417 |
have "(u_max @ a, as) \<in> Partitions x" using eq h0 unfolding Partitions_def by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
418 |
moreover |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
419 |
have "u_max @ a < x" using h0 eq q unfolding Partitions_def strict_prefix_def prefix_def by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
420 |
moreover |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
421 |
have "u_max @ a \<in> A\<star>" using i2 h2 by simp |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
422 |
moreover |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
423 |
have "as @ z \<in> A\<star>" using i1' i2 i3 eq by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
424 |
ultimately have "length (u_max @ a) \<le> length u_max" using h4 by blast |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
425 |
moreover |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
426 |
have "a \<noteq> []" using i4 . |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
427 |
ultimately show "False" by auto |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
428 |
qed |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
429 |
with i1 obtain za zb |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
430 |
where k1: "v @ za = a" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
431 |
and k2: "(za, zb) \<in> Partitions z" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
432 |
and k4: "zb = b" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
433 |
unfolding Partitions_def prefix_def |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
434 |
by (auto simp add: append_eq_append_conv2) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
435 |
show "\<exists> (u, v) \<in> Partitions x. \<exists> (u', v') \<in> Partitions z. u < x \<and> u \<in> A\<star> \<and> v @ u' \<in> A \<and> v' \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
436 |
using h0 k2 h1 h2 i2 k1 i3 k4 unfolding Partitions_def by blast |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
437 |
qed |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
438 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
439 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
440 |
definition |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
441 |
tag_Star :: "'a lang \<Rightarrow> 'a list \<Rightarrow> ('a lang) set" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
442 |
where |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
443 |
"tag_Star A \<equiv> (\<lambda>x. {\<approx>A `` {v} | u v. u < x \<and> u \<in> A\<star> \<and> (u, v) \<in> Partitions x})" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
444 |
|
63 | 445 |
|
181 | 446 |
lemma tag_Star_injI: |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
447 |
fixes x::"'a list" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
448 |
assumes a: "tag_Star A x = tag_Star A y" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
449 |
and c: "x @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
450 |
and d: "x \<noteq> []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
451 |
shows "y @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
452 |
using c d |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
453 |
apply(drule_tac star_spartitions_elim2) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
454 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
455 |
apply(simp add: Partitions_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
456 |
apply(erule exE | erule conjE)+ |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
457 |
apply(subgoal_tac "((\<approx>A) `` {b}) \<in> tag_Star A x") |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
458 |
apply(simp add: a) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
459 |
apply(simp add: tag_Star_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
460 |
apply(erule exE | erule conjE)+ |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
461 |
apply(simp add: test) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
462 |
apply(simp add: Partitions_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
463 |
apply(subgoal_tac "v @ aa \<in> A\<star>") |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
464 |
prefer 2 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
465 |
apply(simp add: str_eq_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
466 |
apply(subgoal_tac "(u @ v) @ aa @ ba \<in> A\<star>") |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
467 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
468 |
apply(simp (no_asm_use)) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
469 |
apply(rule append_in_starI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
470 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
471 |
apply(simp (no_asm) only: append_assoc[symmetric]) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
472 |
apply(rule append_in_starI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
473 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
474 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
475 |
apply(simp add: tag_Star_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
476 |
apply(rule_tac x="a" in exI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
477 |
apply(rule_tac x="b" in exI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
478 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
479 |
apply(simp add: Partitions_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
480 |
done |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
481 |
|
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
482 |
lemma tag_Star_injI2: |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
483 |
fixes x::"'a list" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
484 |
assumes a: "tag_Star A x = tag_Star A y" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
485 |
and c: "x @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
486 |
and d: "x = []" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
487 |
shows "y @ z \<in> A\<star>" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
488 |
using c d |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
489 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
490 |
using a |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
491 |
apply(simp add: tag_Star_def strict_prefix_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
492 |
apply(auto simp add: prefix_def Partitions_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
493 |
by (metis Nil_in_star append_self_conv2) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
494 |
|
63 | 495 |
|
496 |
lemma quot_star_finiteI [intro]: |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
497 |
fixes A::"('a::finite) lang" |
166 | 498 |
assumes finite1: "finite (UNIV // \<approx>A)" |
499 |
shows "finite (UNIV // \<approx>(A\<star>))" |
|
181 | 500 |
proof (rule_tac tag = "tag_Star A" in tag_finite_imageD) |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
501 |
have "=(tag_Star A)= \<subseteq> \<approx>(A\<star>)" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
502 |
apply(rule test_refined_intro) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
503 |
apply(case_tac "x=[]") |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
504 |
apply(rule tag_Star_injI2) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
505 |
prefer 3 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
506 |
apply(assumption) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
507 |
prefer 2 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
508 |
apply(assumption) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
509 |
apply(simp add: tag_eq_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
510 |
apply(rule tag_Star_injI) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
511 |
prefer 3 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
512 |
apply(assumption) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
513 |
prefer 2 |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
514 |
apply(assumption) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
515 |
unfolding tag_eq_def |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
516 |
apply(simp) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
517 |
done |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
518 |
then show "\<And>x y. tag_Star A x = tag_Star A y \<Longrightarrow> x \<approx>(A\<star>) y" |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
519 |
apply(simp add: tag_eq_def) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
520 |
apply(auto) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
521 |
done |
63 | 522 |
next |
166 | 523 |
have *: "finite (Pow (UNIV // \<approx>A))" |
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
524 |
using finite1 by auto |
181 | 525 |
show "finite (range (tag_Star A))" |
526 |
unfolding tag_Star_def |
|
63 | 527 |
apply(rule finite_subset[OF _ *]) |
528 |
unfolding quotient_def |
|
182
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
529 |
apply(auto) |
560712a29a36
a version of the proof which dispenses with the notion of string-subtraction
urbanc
parents:
181
diff
changeset
|
530 |
done |
63 | 531 |
qed |
532 |
||
533 |
subsubsection{* The conclusion *} |
|
534 |
||
112 | 535 |
lemma Myhill_Nerode2: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
536 |
fixes r::"('a::finite) rexp" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
537 |
shows "finite (UNIV // \<approx>(lang r))" |
63 | 538 |
by (induct r) (auto) |
539 |
||
132 | 540 |
theorem Myhill_Nerode: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
541 |
fixes A::"('a::finite) lang" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
166
diff
changeset
|
542 |
shows "(\<exists>r. A = lang r) \<longleftrightarrow> finite (UNIV // \<approx>A)" |
162
e93760534354
added directory for journal version; took uptodate version of the theory files
urbanc
parents:
160
diff
changeset
|
543 |
using Myhill_Nerode1 Myhill_Nerode2 by auto |
112 | 544 |
|
63 | 545 |
end |