author | urbanc |
Fri, 28 Jan 2011 19:17:40 +0000 | |
changeset 47 | bea2466a6084 |
parent 45 | 7aa6c20e6d31 |
child 48 | 61d9684a557a |
permissions | -rw-r--r-- |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
1 |
theory Myhill |
42 | 2 |
imports Myhill_1 |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
3 |
begin |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
4 |
|
42 | 5 |
section {* Direction: @{text "regular language \<Rightarrow>finite partition"} *} |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
6 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
7 |
subsection {* The scheme for this direction *} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
8 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
9 |
text {* |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
10 |
The following convenient notation @{text "x \<approx>Lang y"} means: |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
11 |
string @{text "x"} and @{text "y"} are equivalent with respect to |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
12 |
language @{text "Lang"}. |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
13 |
*} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
14 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
15 |
definition |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
16 |
str_eq :: "string \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> bool" ("_ \<approx>_ _") |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
17 |
where |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
18 |
"x \<approx>Lang y \<equiv> (x, y) \<in> (\<approx>Lang)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
19 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
20 |
text {* |
45 | 21 |
The basic idea to show the finiteness of the partition induced by relation @{text "\<approx>Lang"} |
22 |
is to attach a tag @{text "tag(x)"} to every string @{text "x"}, the set of tags are carfully |
|
23 |
choosen, so that the range of tagging function @{text "tag"} (denoted @{text "range(tag)"}) is finite. |
|
24 |
If strings with the same tag are equivlent with respect @{text "\<approx>Lang"}, |
|
25 |
i.e. @{text "tag(x) = tag(y) \<Longrightarrow> x \<approx>Lang y"} (this property is named `injectivity' in the following), |
|
26 |
then it can be proved that: the partition given rise by @{text "(\<approx>Lang)"} is finite. |
|
27 |
||
28 |
There are two arguments for this. The first goes as the following: |
|
29 |
\begin{enumerate} |
|
30 |
\item First, the tagging function @{text "tag"} induces an equivalent relation @{text "(=tag=)"} |
|
31 |
(defiintion of @{text "f_eq_rel"} and lemma @{text "equiv_f_eq_rel"}). |
|
32 |
\item It is shown that: if the range of @{text "tag"} is finite, |
|
33 |
the partition given rise by @{text "(=tag=)"} is finite (lemma @{text "finite_eq_f_rel"}). |
|
34 |
\item It is proved that if equivalent relation @{text "R1"} is more refined than @{text "R2"} |
|
35 |
(expressed as @{text "R1 \<subseteq> R2"}), |
|
36 |
and the partition induced by @{text "R1"} is finite, then the partition induced by @{text "R2"} |
|
37 |
is finite as well (lemma @{text "refined_partition_finite"}). |
|
38 |
\item The injectivity assumption @{text "tag(x) = tag(y) \<Longrightarrow> x \<approx>Lang y"} implies that |
|
39 |
@{text "(=tag=)"} is more refined than @{text "(\<approx>Lang)"}. |
|
40 |
\item Combining the points above, we have: the partition induced by language @{text "Lang"} |
|
41 |
is finite (lemma @{text "tag_finite_imageD"}). |
|
42 |
\end{enumerate} |
|
43 |
*} |
|
39
a59473f0229d
tuned a little bit the section about finite partitions
urbanc
parents:
35
diff
changeset
|
44 |
|
45 | 45 |
definition |
46 |
f_eq_rel ("=_=") |
|
47 |
where |
|
48 |
"(=f=) = {(x, y) | x y. f x = f y}" |
|
42 | 49 |
|
45 | 50 |
lemma equiv_f_eq_rel:"equiv UNIV (=f=)" |
51 |
by (auto simp:equiv_def f_eq_rel_def refl_on_def sym_def trans_def) |
|
42 | 52 |
|
53 |
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)" |
|
54 |
by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def) |
|
55 |
||
45 | 56 |
lemma finite_eq_f_rel: |
42 | 57 |
assumes rng_fnt: "finite (range tag)" |
45 | 58 |
shows "finite (UNIV // (=tag=))" |
42 | 59 |
proof - |
45 | 60 |
let "?f" = "op ` tag" and ?A = "(UNIV // (=tag=))" |
42 | 61 |
show ?thesis |
62 |
proof (rule_tac f = "?f" and A = ?A in finite_imageD) |
|
63 |
-- {* |
|
64 |
The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}: |
|
65 |
*} |
|
66 |
show "finite (?f ` ?A)" |
|
67 |
proof - |
|
68 |
have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def) |
|
69 |
moreover from rng_fnt have "finite (Pow (range tag))" by simp |
|
70 |
ultimately have "finite (range ?f)" |
|
71 |
by (auto simp only:image_def intro:finite_subset) |
|
72 |
from finite_range_image [OF this] show ?thesis . |
|
73 |
qed |
|
74 |
next |
|
75 |
-- {* |
|
45 | 76 |
The injectivity of @{text "f"}-image is a consequence of the definition of @{text "(=tag=)"}: |
42 | 77 |
*} |
78 |
show "inj_on ?f ?A" |
|
79 |
proof- |
|
80 |
{ fix X Y |
|
81 |
assume X_in: "X \<in> ?A" |
|
82 |
and Y_in: "Y \<in> ?A" |
|
83 |
and tag_eq: "?f X = ?f Y" |
|
84 |
have "X = Y" |
|
85 |
proof - |
|
86 |
from X_in Y_in tag_eq |
|
45 | 87 |
obtain x y |
88 |
where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y" |
|
89 |
unfolding quotient_def Image_def str_eq_rel_def |
|
90 |
str_eq_def image_def f_eq_rel_def |
|
42 | 91 |
apply simp by blast |
92 |
with X_in Y_in show ?thesis |
|
93 |
by (auto simp:quotient_def str_eq_rel_def str_eq_def f_eq_rel_def) |
|
94 |
qed |
|
95 |
} thus ?thesis unfolding inj_on_def by auto |
|
96 |
qed |
|
97 |
qed |
|
98 |
qed |
|
99 |
||
45 | 100 |
lemma finite_image_finite: "\<lbrakk>\<forall> x \<in> A. f x \<in> B; finite B\<rbrakk> \<Longrightarrow> finite (f ` A)" |
101 |
by (rule finite_subset [of _ B], auto) |
|
42 | 102 |
|
45 | 103 |
lemma refined_partition_finite: |
104 |
fixes R1 R2 A |
|
105 |
assumes fnt: "finite (A // R1)" |
|
106 |
and refined: "R1 \<subseteq> R2" |
|
107 |
and eq1: "equiv A R1" and eq2: "equiv A R2" |
|
108 |
shows "finite (A // R2)" |
|
109 |
proof - |
|
110 |
let ?f = "\<lambda> X. {R1 `` {x} | x. x \<in> X}" |
|
111 |
and ?A = "(A // R2)" and ?B = "(A // R1)" |
|
112 |
show ?thesis |
|
113 |
proof(rule_tac f = ?f and A = ?A in finite_imageD) |
|
114 |
show "finite (?f ` ?A)" |
|
115 |
proof(rule finite_subset [of _ "Pow ?B"]) |
|
116 |
from fnt show "finite (Pow (A // R1))" by simp |
|
117 |
next |
|
118 |
from eq2 |
|
119 |
show " ?f ` A // R2 \<subseteq> Pow ?B" |
|
120 |
apply (unfold image_def Pow_def quotient_def, auto) |
|
121 |
by (rule_tac x = xb in bexI, simp, |
|
122 |
unfold equiv_def sym_def refl_on_def, blast) |
|
123 |
qed |
|
124 |
next |
|
125 |
show "inj_on ?f ?A" |
|
126 |
proof - |
|
127 |
{ fix X Y |
|
128 |
assume X_in: "X \<in> ?A" and Y_in: "Y \<in> ?A" |
|
129 |
and eq_f: "?f X = ?f Y" (is "?L = ?R") |
|
130 |
have "X = Y" using X_in |
|
131 |
proof(rule quotientE) |
|
132 |
fix x |
|
133 |
assume "X = R2 `` {x}" and "x \<in> A" with eq2 |
|
134 |
have x_in: "x \<in> X" |
|
135 |
by (unfold equiv_def quotient_def refl_on_def, auto) |
|
136 |
with eq_f have "R1 `` {x} \<in> ?R" by auto |
|
137 |
then obtain y where |
|
138 |
y_in: "y \<in> Y" and eq_r: "R1 `` {x} = R1 ``{y}" by auto |
|
139 |
have "(x, y) \<in> R1" |
|
140 |
proof - |
|
141 |
from x_in X_in y_in Y_in eq2 |
|
142 |
have "x \<in> A" and "y \<in> A" |
|
143 |
by (unfold equiv_def quotient_def refl_on_def, auto) |
|
144 |
from eq_equiv_class_iff [OF eq1 this] and eq_r |
|
145 |
show ?thesis by simp |
|
146 |
qed |
|
147 |
with refined have xy_r2: "(x, y) \<in> R2" by auto |
|
148 |
from quotient_eqI [OF eq2 X_in Y_in x_in y_in this] |
|
149 |
show ?thesis . |
|
150 |
qed |
|
151 |
} thus ?thesis by (auto simp:inj_on_def) |
|
152 |
qed |
|
153 |
qed |
|
154 |
qed |
|
155 |
||
156 |
lemma equiv_lang_eq: "equiv UNIV (\<approx>Lang)" |
|
157 |
apply (unfold equiv_def str_eq_rel_def sym_def refl_on_def trans_def) |
|
158 |
by blast |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
159 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
160 |
lemma tag_finite_imageD: |
45 | 161 |
fixes tag |
42 | 162 |
assumes rng_fnt: "finite (range tag)" |
45 | 163 |
-- {* Suppose the rang of tagging fucntion @{text "tag"} is finite. *} |
164 |
and same_tag_eqvt: "\<And> m n. tag m = tag (n::string) \<Longrightarrow> m \<approx>Lang n" |
|
42 | 165 |
-- {* And strings with same tag are equivalent *} |
45 | 166 |
shows "finite (UNIV // (\<approx>Lang))" |
167 |
proof - |
|
168 |
let ?R1 = "(=tag=)" |
|
169 |
show ?thesis |
|
170 |
proof(rule_tac refined_partition_finite [of _ ?R1]) |
|
171 |
from finite_eq_f_rel [OF rng_fnt] |
|
172 |
show "finite (UNIV // =tag=)" . |
|
173 |
next |
|
174 |
from same_tag_eqvt |
|
175 |
show "(=tag=) \<subseteq> (\<approx>Lang)" |
|
176 |
by (auto simp:f_eq_rel_def str_eq_def) |
|
177 |
next |
|
178 |
from equiv_f_eq_rel |
|
179 |
show "equiv UNIV (=tag=)" by blast |
|
180 |
next |
|
181 |
from equiv_lang_eq |
|
182 |
show "equiv UNIV (\<approx>Lang)" by blast |
|
183 |
qed |
|
184 |
qed |
|
185 |
||
186 |
text {* |
|
187 |
A more concise, but less intelligible argument for @{text "tag_finite_imageD"} |
|
188 |
is given as the following. The basic idea is still using standard library |
|
189 |
lemma @{thm [source] "finite_imageD"}: |
|
190 |
\[ |
|
191 |
@{thm "finite_imageD" [no_vars]} |
|
192 |
\] |
|
193 |
which says: if the image of injective function @{text "f"} over set @{text "A"} is |
|
194 |
finite, then @{text "A"} must be finte, as we did in the lemmas above. |
|
195 |
*} |
|
196 |
||
197 |
lemma |
|
198 |
fixes tag |
|
199 |
assumes rng_fnt: "finite (range tag)" |
|
200 |
-- {* Suppose the rang of tagging fucntion @{text "tag"} is finite. *} |
|
201 |
and same_tag_eqvt: "\<And> m n. tag m = tag (n::string) \<Longrightarrow> m \<approx>Lang n" |
|
202 |
-- {* And strings with same tag are equivalent *} |
|
203 |
shows "finite (UNIV // (\<approx>Lang))" |
|
204 |
-- {* Then the partition generated by @{text "(\<approx>Lang)"} is finite. *} |
|
42 | 205 |
proof - |
206 |
-- {* The particular @{text "f"} and @{text "A"} used in @{thm [source] "finite_imageD"} are:*} |
|
45 | 207 |
let "?f" = "op ` tag" and ?A = "(UNIV // \<approx>Lang)" |
42 | 208 |
show ?thesis |
209 |
proof (rule_tac f = "?f" and A = ?A in finite_imageD) |
|
210 |
-- {* |
|
211 |
The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}: |
|
212 |
*} |
|
213 |
show "finite (?f ` ?A)" |
|
214 |
proof - |
|
215 |
have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def) |
|
216 |
moreover from rng_fnt have "finite (Pow (range tag))" by simp |
|
217 |
ultimately have "finite (range ?f)" |
|
218 |
by (auto simp only:image_def intro:finite_subset) |
|
219 |
from finite_range_image [OF this] show ?thesis . |
|
220 |
qed |
|
221 |
next |
|
222 |
-- {* |
|
223 |
The injectivity of @{text "f"} is the consequence of assumption @{text "same_tag_eqvt"}: |
|
224 |
*} |
|
225 |
show "inj_on ?f ?A" |
|
226 |
proof- |
|
227 |
{ fix X Y |
|
228 |
assume X_in: "X \<in> ?A" |
|
229 |
and Y_in: "Y \<in> ?A" |
|
230 |
and tag_eq: "?f X = ?f Y" |
|
231 |
have "X = Y" |
|
232 |
proof - |
|
233 |
from X_in Y_in tag_eq |
|
234 |
obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y" |
|
235 |
unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def |
|
236 |
apply simp by blast |
|
45 | 237 |
from same_tag_eqvt [OF eq_tg] have "x \<approx>Lang y" . |
42 | 238 |
with X_in Y_in x_in y_in |
239 |
show ?thesis by (auto simp:quotient_def str_eq_rel_def str_eq_def) |
|
240 |
qed |
|
241 |
} thus ?thesis unfolding inj_on_def by auto |
|
242 |
qed |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
243 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
244 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
245 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
246 |
subsection {* Lemmas for basic cases *} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
247 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
248 |
subsection {* The case for @{const "NULL"} *} |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
249 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
250 |
lemma quot_null_eq: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
251 |
shows "(UNIV // \<approx>{}) = ({UNIV}::lang set)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
252 |
unfolding quotient_def Image_def str_eq_rel_def by auto |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
253 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
254 |
lemma quot_null_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
255 |
shows "finite ((UNIV // \<approx>{})::lang set)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
256 |
unfolding quot_null_eq by simp |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
257 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
258 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
259 |
subsection {* The case for @{const "EMPTY"} *} |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
260 |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
261 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
262 |
lemma quot_empty_subset: |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
263 |
"UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
264 |
proof |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
265 |
fix x |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
266 |
assume "x \<in> UNIV // \<approx>{[]}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
267 |
then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[]}}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
268 |
unfolding quotient_def Image_def by blast |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
269 |
show "x \<in> {{[]}, UNIV - {[]}}" |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
270 |
proof (cases "y = []") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
271 |
case True with h |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
272 |
have "x = {[]}" by (auto simp: str_eq_rel_def) |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
273 |
thus ?thesis by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
274 |
next |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
275 |
case False with h |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
276 |
have "x = UNIV - {[]}" by (auto simp: str_eq_rel_def) |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
277 |
thus ?thesis by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
278 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
279 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
280 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
281 |
lemma quot_empty_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
282 |
shows "finite (UNIV // (\<approx>{[]}))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
283 |
by (rule finite_subset[OF quot_empty_subset]) (simp) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
284 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
285 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
286 |
subsection {* The case for @{const "CHAR"} *} |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
287 |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
288 |
lemma quot_char_subset: |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
289 |
"UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
290 |
proof |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
291 |
fix x |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
292 |
assume "x \<in> UNIV // \<approx>{[c]}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
293 |
then obtain y where h: "x = {z. (y, z) \<in> \<approx>{[c]}}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
294 |
unfolding quotient_def Image_def by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
295 |
show "x \<in> {{[]},{[c]}, UNIV - {[], [c]}}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
296 |
proof - |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
297 |
{ assume "y = []" hence "x = {[]}" using h |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
298 |
by (auto simp:str_eq_rel_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
299 |
} moreover { |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
300 |
assume "y = [c]" hence "x = {[c]}" using h |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
301 |
by (auto dest!:spec[where x = "[]"] simp:str_eq_rel_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
302 |
} moreover { |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
303 |
assume "y \<noteq> []" and "y \<noteq> [c]" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
304 |
hence "\<forall> z. (y @ z) \<noteq> [c]" by (case_tac y, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
305 |
moreover have "\<And> p. (p \<noteq> [] \<and> p \<noteq> [c]) = (\<forall> q. p @ q \<noteq> [c])" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
306 |
by (case_tac p, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
307 |
ultimately have "x = UNIV - {[],[c]}" using h |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
308 |
by (auto simp add:str_eq_rel_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
309 |
} ultimately show ?thesis by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
310 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
311 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
312 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
313 |
lemma quot_char_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
314 |
shows "finite (UNIV // (\<approx>{[c]}))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
315 |
by (rule finite_subset[OF quot_char_subset]) (simp) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
316 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
317 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
318 |
|
45 | 319 |
subsection {* The case for @{text "SEQ"}*} |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
320 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
321 |
definition |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
322 |
tag_str_SEQ :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang set)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
323 |
where |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
324 |
"tag_str_SEQ L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, {(\<approx>L2 `` {x - xa}) | xa. xa \<le> x \<and> xa \<in> L1}))" |
42 | 325 |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
326 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
327 |
lemma append_seq_elim: |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
328 |
assumes "x @ y \<in> L\<^isub>1 ;; L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
329 |
shows "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2) \<or> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
330 |
(\<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
331 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
332 |
from assms obtain s\<^isub>1 s\<^isub>2 |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
333 |
where "x @ y = s\<^isub>1 @ s\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
334 |
and in_seq: "s\<^isub>1 \<in> L\<^isub>1 \<and> s\<^isub>2 \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
335 |
by (auto simp:Seq_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
336 |
hence "(x \<le> s\<^isub>1 \<and> (s\<^isub>1 - x) @ s\<^isub>2 = y) \<or> (s\<^isub>1 \<le> x \<and> (x - s\<^isub>1) @ y = s\<^isub>2)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
337 |
using app_eq_dest by auto |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
338 |
moreover have "\<lbrakk>x \<le> s\<^isub>1; (s\<^isub>1 - x) @ s\<^isub>2 = y\<rbrakk> \<Longrightarrow> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
339 |
\<exists> ya \<le> y. (x @ ya) \<in> L\<^isub>1 \<and> (y - ya) \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
340 |
using in_seq by (rule_tac x = "s\<^isub>1 - x" in exI, auto elim:prefixE) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
341 |
moreover have "\<lbrakk>s\<^isub>1 \<le> x; (x - s\<^isub>1) @ y = s\<^isub>2\<rbrakk> \<Longrightarrow> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
342 |
\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ y \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
343 |
using in_seq by (rule_tac x = s\<^isub>1 in exI, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
344 |
ultimately show ?thesis by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
345 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
346 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
347 |
lemma tag_str_SEQ_injI: |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
348 |
"tag_str_SEQ L\<^isub>1 L\<^isub>2 m = tag_str_SEQ L\<^isub>1 L\<^isub>2 n \<Longrightarrow> m \<approx>(L\<^isub>1 ;; L\<^isub>2) n" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
349 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
350 |
{ fix x y z |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
351 |
assume xz_in_seq: "x @ z \<in> L\<^isub>1 ;; L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
352 |
and tag_xy: "tag_str_SEQ L\<^isub>1 L\<^isub>2 x = tag_str_SEQ L\<^isub>1 L\<^isub>2 y" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
353 |
have"y @ z \<in> L\<^isub>1 ;; L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
354 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
355 |
have "(\<exists> xa \<le> x. xa \<in> L\<^isub>1 \<and> (x - xa) @ z \<in> L\<^isub>2) \<or> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
356 |
(\<exists> za \<le> z. (x @ za) \<in> L\<^isub>1 \<and> (z - za) \<in> L\<^isub>2)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
357 |
using xz_in_seq append_seq_elim by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
358 |
moreover { |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
359 |
fix xa |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
360 |
assume h1: "xa \<le> x" and h2: "xa \<in> L\<^isub>1" and h3: "(x - xa) @ z \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
361 |
obtain ya where "ya \<le> y" and "ya \<in> L\<^isub>1" and "(y - ya) @ z \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
362 |
proof - |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
363 |
have "\<exists> ya. ya \<le> y \<and> ya \<in> L\<^isub>1 \<and> (x - xa) \<approx>L\<^isub>2 (y - ya)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
364 |
proof - |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
365 |
have "{\<approx>L\<^isub>2 `` {x - xa} |xa. xa \<le> x \<and> xa \<in> L\<^isub>1} = |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
366 |
{\<approx>L\<^isub>2 `` {y - xa} |xa. xa \<le> y \<and> xa \<in> L\<^isub>1}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
367 |
(is "?Left = ?Right") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
368 |
using h1 tag_xy by (auto simp:tag_str_SEQ_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
369 |
moreover have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Left" using h1 h2 by auto |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
370 |
ultimately have "\<approx>L\<^isub>2 `` {x - xa} \<in> ?Right" by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
371 |
thus ?thesis by (auto simp:Image_def str_eq_rel_def str_eq_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
372 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
373 |
with prems show ?thesis by (auto simp:str_eq_rel_def str_eq_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
374 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
375 |
hence "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" by (erule_tac prefixE, auto simp:Seq_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
376 |
} moreover { |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
377 |
fix za |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
378 |
assume h1: "za \<le> z" and h2: "(x @ za) \<in> L\<^isub>1" and h3: "z - za \<in> L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
379 |
hence "y @ za \<in> L\<^isub>1" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
380 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
381 |
have "\<approx>L\<^isub>1 `` {x} = \<approx>L\<^isub>1 `` {y}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
382 |
using h1 tag_xy by (auto simp:tag_str_SEQ_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
383 |
with h2 show ?thesis |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
384 |
by (auto simp:Image_def str_eq_rel_def str_eq_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
385 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
386 |
with h1 h3 have "y @ z \<in> L\<^isub>1 ;; L\<^isub>2" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
387 |
by (drule_tac A = L\<^isub>1 in seq_intro, auto elim:prefixE) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
388 |
} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
389 |
ultimately show ?thesis by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
390 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
391 |
} thus "tag_str_SEQ L\<^isub>1 L\<^isub>2 m = tag_str_SEQ L\<^isub>1 L\<^isub>2 n \<Longrightarrow> m \<approx>(L\<^isub>1 ;; L\<^isub>2) n" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
392 |
by (auto simp add: str_eq_def str_eq_rel_def) |
45 | 393 |
qed |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
394 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
395 |
lemma quot_seq_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
396 |
fixes L1 L2::"lang" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
397 |
assumes fin1: "finite (UNIV // \<approx>L1)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
398 |
and fin2: "finite (UNIV // \<approx>L2)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
399 |
shows "finite (UNIV // \<approx>(L1 ;; L2))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
400 |
proof (rule_tac tag = "tag_str_SEQ L1 L2" in tag_finite_imageD) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
401 |
show "\<And>x y. tag_str_SEQ L1 L2 x = tag_str_SEQ L1 L2 y \<Longrightarrow> x \<approx>(L1 ;; L2) y" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
402 |
by (rule tag_str_SEQ_injI) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
403 |
next |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
404 |
have *: "finite ((UNIV // \<approx>L1) \<times> (Pow (UNIV // \<approx>L2)))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
405 |
using fin1 fin2 by auto |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
406 |
show "finite (range (tag_str_SEQ L1 L2))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
407 |
unfolding tag_str_SEQ_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
408 |
apply(rule finite_subset[OF _ *]) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
409 |
unfolding quotient_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
410 |
by auto |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
411 |
qed |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
412 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
413 |
subsection {* The case for @{const ALT} *} |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
414 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
415 |
definition |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
416 |
tag_str_ALT :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
417 |
where |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
418 |
"tag_str_ALT L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, \<approx>L2 `` {x}))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
419 |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
420 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
421 |
lemma quot_union_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
422 |
fixes L1 L2::"lang" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
423 |
assumes finite1: "finite (UNIV // \<approx>L1)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
424 |
and finite2: "finite (UNIV // \<approx>L2)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
425 |
shows "finite (UNIV // \<approx>(L1 \<union> L2))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
426 |
proof (rule_tac tag = "tag_str_ALT L1 L2" in tag_finite_imageD) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
427 |
show "\<And>x y. tag_str_ALT L1 L2 x = tag_str_ALT L1 L2 y \<Longrightarrow> x \<approx>(L1 \<union> L2) y" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
428 |
unfolding tag_str_ALT_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
429 |
unfolding str_eq_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
430 |
unfolding Image_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
431 |
unfolding str_eq_rel_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
432 |
by auto |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
433 |
next |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
434 |
have *: "finite ((UNIV // \<approx>L1) \<times> (UNIV // \<approx>L2))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
435 |
using finite1 finite2 by auto |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
436 |
show "finite (range (tag_str_ALT L1 L2))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
437 |
unfolding tag_str_ALT_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
438 |
apply(rule finite_subset[OF _ *]) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
439 |
unfolding quotient_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
440 |
by auto |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
441 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
442 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
443 |
subsection {* The case for @{const "STAR"} *} |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
444 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
445 |
text {* |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
446 |
This turned out to be the trickiest case. |
45 | 447 |
Any string @{text "x"} in language @{text "L\<^isub>1\<star>"}, |
448 |
can be splited into a prefix @{text "xa \<in> L\<^isub>1\<star>"} and a suffix @{text "x - xa \<in> L\<^isub>1"}. |
|
449 |
For one such @{text "x"}, there can be many such splits. The tagging of @{text "x"} is then |
|
450 |
defined by collecting the @{text "L\<^isub>1"}-state of the suffixes from every possible split. |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
451 |
*} |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
452 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
453 |
definition |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
454 |
tag_str_STAR :: "lang \<Rightarrow> string \<Rightarrow> lang set" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
455 |
where |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
456 |
"tag_str_STAR L1 = (\<lambda>x. {\<approx>L1 `` {x - xa} | xa. xa < x \<and> xa \<in> L1\<star>})" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
457 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
458 |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
459 |
|
45 | 460 |
text {* A technical lemma. *} |
461 |
lemma finite_set_has_max: "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> |
|
462 |
(\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))" |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
463 |
proof (induct rule:finite.induct) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
464 |
case emptyI thus ?case by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
465 |
next |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
466 |
case (insertI A a) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
467 |
show ?case |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
468 |
proof (cases "A = {}") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
469 |
case True thus ?thesis by (rule_tac x = a in bexI, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
470 |
next |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
471 |
case False |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
472 |
with prems obtain max |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
473 |
where h1: "max \<in> A" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
474 |
and h2: "\<forall>a\<in>A. f a \<le> f max" by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
475 |
show ?thesis |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
476 |
proof (cases "f a \<le> f max") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
477 |
assume "f a \<le> f max" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
478 |
with h1 h2 show ?thesis by (rule_tac x = max in bexI, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
479 |
next |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
480 |
assume "\<not> (f a \<le> f max)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
481 |
thus ?thesis using h2 by (rule_tac x = a in bexI, auto) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
482 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
483 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
484 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
485 |
|
45 | 486 |
|
487 |
text {* Technical lemma. *} |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
488 |
lemma finite_strict_prefix_set: "finite {xa. xa < (x::string)}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
489 |
apply (induct x rule:rev_induct, simp) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
490 |
apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
491 |
by (auto simp:strict_prefix_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
492 |
|
45 | 493 |
|
494 |
text {* |
|
495 |
The following lemma @{text "tag_str_STAR_injI"} establishes the injectivity of |
|
496 |
the tagging function for case @{text "STAR"}. |
|
497 |
*} |
|
498 |
||
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
499 |
lemma tag_str_STAR_injI: |
45 | 500 |
fixes v w |
501 |
assumes eq_tag: "tag_str_STAR L\<^isub>1 v = tag_str_STAR L\<^isub>1 w" |
|
502 |
shows "(v::string) \<approx>(L\<^isub>1\<star>) w" |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
503 |
proof- |
45 | 504 |
-- {* |
505 |
\begin{minipage}{0.9\textwidth} |
|
506 |
According to the definition of @{text "\<approx>Lang"}, |
|
507 |
proving @{text "v \<approx>(L\<^isub>1\<star>) w"} amounts to |
|
508 |
showing: for any string @{text "u"}, |
|
509 |
if @{text "v @ u \<in> (L\<^isub>1\<star>)"} then @{text "w @ u \<in> (L\<^isub>1\<star>)"} and vice versa. |
|
510 |
The reasoning pattern for both directions are the same, as derived |
|
511 |
in the following: |
|
512 |
\end{minipage} |
|
513 |
*} |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
514 |
{ fix x y z |
45 | 515 |
assume xz_in_star: "x @ z \<in> L\<^isub>1\<star>" |
516 |
and tag_xy: "tag_str_STAR L\<^isub>1 x = tag_str_STAR L\<^isub>1 y" |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
517 |
have "y @ z \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
518 |
proof(cases "x = []") |
45 | 519 |
-- {* |
520 |
The degenerated case when @{text "x"} is a null string is easy to prove: |
|
521 |
*} |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
522 |
case True |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
523 |
with tag_xy have "y = []" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
524 |
by (auto simp:tag_str_STAR_def strict_prefix_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
525 |
thus ?thesis using xz_in_star True by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
526 |
next |
45 | 527 |
-- {* |
528 |
\begin{minipage}{0.9\textwidth} |
|
529 |
The case when @{text "x"} is not null, and |
|
530 |
@{text "x @ z"} is in @{text "L\<^isub>1\<star>"}, |
|
531 |
\end{minipage} |
|
532 |
*} |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
533 |
case False |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
534 |
obtain x_max |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
535 |
where h1: "x_max < x" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
536 |
and h2: "x_max \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
537 |
and h3: "(x - x_max) @ z \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
538 |
and h4:"\<forall> xa < x. xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
539 |
\<longrightarrow> length xa \<le> length x_max" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
540 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
541 |
let ?S = "{xa. xa < x \<and> xa \<in> L\<^isub>1\<star> \<and> (x - xa) @ z \<in> L\<^isub>1\<star>}" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
542 |
have "finite ?S" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
543 |
by (rule_tac B = "{xa. xa < x}" in finite_subset, |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
544 |
auto simp:finite_strict_prefix_set) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
545 |
moreover have "?S \<noteq> {}" using False xz_in_star |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
546 |
by (simp, rule_tac x = "[]" in exI, auto simp:strict_prefix_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
547 |
ultimately have "\<exists> max \<in> ?S. \<forall> a \<in> ?S. length a \<le> length max" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
548 |
using finite_set_has_max by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
549 |
with prems show ?thesis by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
550 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
551 |
obtain ya |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
552 |
where h5: "ya < y" and h6: "ya \<in> L\<^isub>1\<star>" and h7: "(x - x_max) \<approx>L\<^isub>1 (y - ya)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
553 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
554 |
from tag_xy have "{\<approx>L\<^isub>1 `` {x - xa} |xa. xa < x \<and> xa \<in> L\<^isub>1\<star>} = |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
555 |
{\<approx>L\<^isub>1 `` {y - xa} |xa. xa < y \<and> xa \<in> L\<^isub>1\<star>}" (is "?left = ?right") |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
556 |
by (auto simp:tag_str_STAR_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
557 |
moreover have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?left" using h1 h2 by auto |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
558 |
ultimately have "\<approx>L\<^isub>1 `` {x - x_max} \<in> ?right" by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
559 |
with prems show ?thesis apply |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
560 |
(simp add:Image_def str_eq_rel_def str_eq_def) by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
561 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
562 |
have "(y - ya) @ z \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
563 |
proof- |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
564 |
from h3 h1 obtain a b where a_in: "a \<in> L\<^isub>1" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
565 |
and a_neq: "a \<noteq> []" and b_in: "b \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
566 |
and ab_max: "(x - x_max) @ z = a @ b" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
567 |
by (drule_tac star_decom, auto simp:strict_prefix_def elim:prefixE) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
568 |
have "(x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
569 |
proof - |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
570 |
have "((x - x_max) \<le> a \<and> (a - (x - x_max)) @ b = z) \<or> |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
571 |
(a < (x - x_max) \<and> ((x - x_max) - a) @ z = b)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
572 |
using app_eq_dest[OF ab_max] by (auto simp:strict_prefix_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
573 |
moreover { |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
574 |
assume np: "a < (x - x_max)" and b_eqs: " ((x - x_max) - a) @ z = b" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
575 |
have "False" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
576 |
proof - |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
577 |
let ?x_max' = "x_max @ a" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
578 |
have "?x_max' < x" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
579 |
using np h1 by (clarsimp simp:strict_prefix_def diff_prefix) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
580 |
moreover have "?x_max' \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
581 |
using a_in h2 by (simp add:star_intro3) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
582 |
moreover have "(x - ?x_max') @ z \<in> L\<^isub>1\<star>" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
583 |
using b_eqs b_in np h1 by (simp add:diff_diff_appd) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
584 |
moreover have "\<not> (length ?x_max' \<le> length x_max)" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
585 |
using a_neq by simp |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
586 |
ultimately show ?thesis using h4 by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
587 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
588 |
} ultimately show ?thesis by blast |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
589 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
590 |
then obtain za where z_decom: "z = za @ b" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
591 |
and x_za: "(x - x_max) @ za \<in> L\<^isub>1" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
592 |
using a_in by (auto elim:prefixE) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
593 |
from x_za h7 have "(y - ya) @ za \<in> L\<^isub>1" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
594 |
by (auto simp:str_eq_def str_eq_rel_def) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
595 |
with z_decom b_in show ?thesis by (auto dest!:step[of "(y - ya) @ za"]) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
596 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
597 |
with h5 h6 show ?thesis |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
598 |
by (drule_tac star_intro1, auto simp:strict_prefix_def elim:prefixE) |
45 | 599 |
qed |
600 |
} |
|
601 |
-- {* By instantiating the reasoning pattern just derived for both directions:*} |
|
602 |
from this [OF _ eq_tag] and this [OF _ eq_tag [THEN sym]] |
|
603 |
-- {* The thesis is proved as a trival consequence: *} |
|
604 |
show ?thesis by (unfold str_eq_def str_eq_rel_def, blast) |
|
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
605 |
qed |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
606 |
|
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
607 |
lemma quot_star_finiteI [intro]: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
608 |
fixes L1::"lang" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
609 |
assumes finite1: "finite (UNIV // \<approx>L1)" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
610 |
shows "finite (UNIV // \<approx>(L1\<star>))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
611 |
proof (rule_tac tag = "tag_str_STAR L1" in tag_finite_imageD) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
612 |
show "\<And>x y. tag_str_STAR L1 x = tag_str_STAR L1 y \<Longrightarrow> x \<approx>(L1\<star>) y" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
613 |
by (rule tag_str_STAR_injI) |
40 | 614 |
next |
47
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
615 |
have *: "finite (Pow (UNIV // \<approx>L1))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
616 |
using finite1 by auto |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
617 |
show "finite (range (tag_str_STAR L1))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
618 |
unfolding tag_str_STAR_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
619 |
apply(rule finite_subset[OF _ *]) |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
620 |
unfolding quotient_def |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
621 |
by auto |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
622 |
qed |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
623 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
624 |
|
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
625 |
lemma rexp_imp_finite: |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
626 |
fixes r::"rexp" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
627 |
shows "finite (UNIV // \<approx>(L r))" |
bea2466a6084
slightly tuned the main lemma and the finiteness proofs
urbanc
parents:
45
diff
changeset
|
628 |
by (induct r) (auto) |
31
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
629 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
630 |
end |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
631 |
|
45 | 632 |
(* |
633 |
lemma refined_quotient_union_eq: |
|
634 |
assumes refined: "R1 \<subseteq> R2" |
|
635 |
and eq1: "equiv A R1" and eq2: "equiv A R2" |
|
636 |
and y_in: "y \<in> A" |
|
637 |
shows "\<Union>{R1 `` {x} | x. x \<in> (R2 `` {y})} = R2 `` {y}" |
|
638 |
proof |
|
639 |
show "\<Union>{R1 `` {x} |x. x \<in> R2 `` {y}} \<subseteq> R2 `` {y}" (is "?L \<subseteq> ?R") |
|
640 |
proof - |
|
641 |
{ fix z |
|
642 |
assume zl: "z \<in> ?L" and nzr: "z \<notin> ?R" |
|
643 |
have "False" |
|
644 |
proof - |
|
645 |
from zl and eq1 eq2 and y_in |
|
646 |
obtain x where xy2: "(x, y) \<in> R2" and zx1: "(z, x) \<in> R1" |
|
647 |
by (simp only:equiv_def sym_def, blast) |
|
648 |
have "(z, y) \<in> R2" |
|
649 |
proof - |
|
650 |
from zx1 and refined have "(z, x) \<in> R2" by blast |
|
651 |
moreover from xy2 have "(x, y) \<in> R2" . |
|
652 |
ultimately show ?thesis using eq2 |
|
653 |
by (simp only:equiv_def, unfold trans_def, blast) |
|
654 |
qed |
|
655 |
with nzr eq2 show ?thesis by (auto simp:equiv_def sym_def) |
|
656 |
qed |
|
657 |
} thus ?thesis by blast |
|
658 |
qed |
|
659 |
next |
|
660 |
show "R2 `` {y} \<subseteq> \<Union>{R1 `` {x} |x. x \<in> R2 `` {y}}" (is "?L \<subseteq> ?R") |
|
661 |
proof |
|
662 |
fix x |
|
663 |
assume x_in: "x \<in> ?L" |
|
664 |
with eq1 eq2 have "x \<in> R1 `` {x}" |
|
665 |
by (unfold equiv_def refl_on_def, auto) |
|
666 |
with x_in show "x \<in> ?R" by auto |
|
667 |
qed |
|
668 |
qed |
|
669 |
*) |
|
670 |
||
671 |
(* |
|
672 |
lemma refined_partition_finite: |
|
673 |
fixes R1 R2 A |
|
674 |
assumes fnt: "finite (A // R1)" |
|
675 |
and refined: "R1 \<subseteq> R2" |
|
676 |
and eq1: "equiv A R1" and eq2: "equiv A R2" |
|
677 |
shows "finite (A // R2)" |
|
678 |
proof - |
|
679 |
let ?f = "\<lambda> X. {R1 `` {x} | x. x \<in> X}" |
|
680 |
and ?A = "(A // R2)" and ?B = "(A // R1)" |
|
681 |
show ?thesis |
|
682 |
proof(rule_tac f = ?f and A = ?A in finite_imageD) |
|
683 |
show "finite (?f ` ?A)" |
|
684 |
proof(rule finite_subset [of _ "Pow ?B"]) |
|
685 |
from fnt show "finite (Pow (A // R1))" by simp |
|
686 |
next |
|
687 |
from eq2 |
|
688 |
show " ?f ` A // R2 \<subseteq> Pow ?B" |
|
689 |
apply (unfold image_def Pow_def quotient_def, auto) |
|
690 |
by (rule_tac x = xb in bexI, simp, |
|
691 |
unfold equiv_def sym_def refl_on_def, blast) |
|
692 |
qed |
|
693 |
next |
|
694 |
show "inj_on ?f ?A" |
|
695 |
proof - |
|
696 |
{ fix X Y |
|
697 |
assume X_in: "X \<in> ?A" and Y_in: "Y \<in> ?A" |
|
698 |
and eq_f: "?f X = ?f Y" (is "?L = ?R") |
|
699 |
hence "X = Y" |
|
700 |
proof - |
|
701 |
from X_in eq2 |
|
702 |
obtain x |
|
703 |
where x_in: "x \<in> A" |
|
704 |
and eq_x: "X = R2 `` {x}" (is "X = ?X") |
|
705 |
by (unfold quotient_def equiv_def refl_on_def, auto) |
|
706 |
from Y_in eq2 obtain y |
|
707 |
where y_in: "y \<in> A" |
|
708 |
and eq_y: "Y = R2 `` {y}" (is "Y = ?Y") |
|
709 |
by (unfold quotient_def equiv_def refl_on_def, auto) |
|
710 |
have "?X = ?Y" |
|
711 |
proof - |
|
712 |
from eq_f have "\<Union> ?L = \<Union> ?R" by auto |
|
713 |
moreover have "\<Union> ?L = ?X" |
|
714 |
proof - |
|
715 |
from eq_x have "\<Union> ?L = \<Union>{R1 `` {x} |x. x \<in> ?X}" by simp |
|
716 |
also from refined_quotient_union_eq [OF refined eq1 eq2 x_in] |
|
717 |
have "\<dots> = ?X" . |
|
718 |
finally show ?thesis . |
|
719 |
qed |
|
720 |
moreover have "\<Union> ?R = ?Y" |
|
721 |
proof - |
|
722 |
from eq_y have "\<Union> ?R = \<Union>{R1 `` {y} |y. y \<in> ?Y}" by simp |
|
723 |
also from refined_quotient_union_eq [OF refined eq1 eq2 y_in] |
|
724 |
have "\<dots> = ?Y" . |
|
725 |
finally show ?thesis . |
|
726 |
qed |
|
727 |
ultimately show ?thesis by simp |
|
728 |
qed |
|
729 |
with eq_x eq_y show ?thesis by auto |
|
730 |
qed |
|
731 |
} thus ?thesis by (auto simp:inj_on_def) |
|
732 |
qed |
|
733 |
qed |
|
734 |
qed |
|
735 |
*) |