author | urbanc |
Thu, 27 Jan 2011 16:58:11 +0000 | |
changeset 43 | cb4403fabda7 |
parent 42 | f809cb54de4e |
child 45 | 7aa6c20e6d31 |
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 |
43 | 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 {* |
42 | 21 |
The very basic scheme to show the finiteness of the partion generated by a language @{text "Lang"} |
22 |
is by attaching a tag to every string. The set of tags are carfully choosen to be finite so that |
|
23 |
the range of tagging function is finite. If it can be proved that strings with the same tag |
|
24 |
are equivlent with respect @{text "Lang"}, then the partition given rise by @{text "Lang"} must be finite. |
|
25 |
The detailed argjument for this is formalized by the following lemma @{text "tag_finite_imageD"}. |
|
26 |
The basic idea is using lemma @{thm [source] "finite_imageD"} |
|
27 |
from standard library: |
|
28 |
\[ |
|
29 |
@{thm "finite_imageD" [no_vars]} |
|
30 |
\] |
|
31 |
which says: if the image of injective function @{text "f"} over set @{text "A"} is |
|
32 |
finite, then @{text "A"} must be finte. |
|
33 |
*} |
|
39
a59473f0229d
tuned a little bit the section about finite partitions
urbanc
parents:
35
diff
changeset
|
34 |
|
a59473f0229d
tuned a little bit the section about finite partitions
urbanc
parents:
35
diff
changeset
|
35 |
|
42 | 36 |
|
37 |
(* I am trying to reduce the following proof to even simpler principles. But not yet succeed. *) |
|
38 |
definition |
|
39 |
f_eq_rel ("\<cong>_") |
|
40 |
where |
|
41 |
"\<cong>(f::'a \<Rightarrow> 'b) = {(x, y) | x y. f x = f y}" |
|
42 |
||
43 |
thm finite.induct |
|
44 |
||
45 |
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)" |
|
46 |
by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def) |
|
47 |
||
48 |
lemma "equiv UNIV (\<cong>f)" |
|
49 |
by (auto simp:equiv_def f_eq_rel_def refl_on_def sym_def trans_def) |
|
50 |
||
51 |
lemma |
|
52 |
assumes rng_fnt: "finite (range tag)" |
|
53 |
shows "finite (UNIV // (\<cong>tag))" |
|
54 |
proof - |
|
55 |
let "?f" = "op ` tag" and ?A = "(UNIV // (\<cong>tag))" |
|
56 |
show ?thesis |
|
57 |
proof (rule_tac f = "?f" and A = ?A in finite_imageD) |
|
58 |
-- {* |
|
59 |
The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}: |
|
60 |
*} |
|
61 |
show "finite (?f ` ?A)" |
|
62 |
proof - |
|
63 |
have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def) |
|
64 |
moreover from rng_fnt have "finite (Pow (range tag))" by simp |
|
65 |
ultimately have "finite (range ?f)" |
|
66 |
by (auto simp only:image_def intro:finite_subset) |
|
67 |
from finite_range_image [OF this] show ?thesis . |
|
68 |
qed |
|
69 |
next |
|
70 |
-- {* |
|
71 |
The injectivity of @{text "f"}-image is a consequence of the definition of @{text "\<cong>tag"} |
|
72 |
*} |
|
73 |
show "inj_on ?f ?A" |
|
74 |
proof- |
|
75 |
{ fix X Y |
|
76 |
assume X_in: "X \<in> ?A" |
|
77 |
and Y_in: "Y \<in> ?A" |
|
78 |
and tag_eq: "?f X = ?f Y" |
|
79 |
have "X = Y" |
|
80 |
proof - |
|
81 |
from X_in Y_in tag_eq |
|
82 |
obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y" |
|
83 |
unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def f_eq_rel_def |
|
84 |
apply simp by blast |
|
85 |
with X_in Y_in show ?thesis |
|
86 |
by (auto simp:quotient_def str_eq_rel_def str_eq_def f_eq_rel_def) |
|
87 |
qed |
|
88 |
} thus ?thesis unfolding inj_on_def by auto |
|
89 |
qed |
|
90 |
qed |
|
91 |
qed |
|
92 |
||
93 |
||
43 | 94 |
(* |
42 | 95 |
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)" |
96 |
by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def) |
|
43 | 97 |
*) |
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
|
98 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
99 |
lemma tag_finite_imageD: |
43 | 100 |
fixes L :: "lang" |
42 | 101 |
assumes rng_fnt: "finite (range tag)" |
43 | 102 |
-- {* Suppose the range of tagging fucntion @{text "tag"} is finite. *} |
103 |
and same_tag_eqvt: "\<And> m n. tag m = tag n \<Longrightarrow> m \<approx>L n" |
|
42 | 104 |
-- {* And strings with same tag are equivalent *} |
43 | 105 |
shows "finite (UNIV // \<approx>L)" |
106 |
-- {* Then the partition generated by @{text "\<approx>L"} is finite. *} |
|
42 | 107 |
proof - |
108 |
-- {* The particular @{text "f"} and @{text "A"} used in @{thm [source] "finite_imageD"} are:*} |
|
43 | 109 |
let "?f" = "op ` tag" and ?A = "(UNIV // \<approx>L)" |
42 | 110 |
show ?thesis |
111 |
proof (rule_tac f = "?f" and A = ?A in finite_imageD) |
|
112 |
-- {* |
|
113 |
The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}: |
|
114 |
*} |
|
115 |
show "finite (?f ` ?A)" |
|
116 |
proof - |
|
117 |
have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def) |
|
118 |
moreover from rng_fnt have "finite (Pow (range tag))" by simp |
|
119 |
ultimately have "finite (range ?f)" |
|
120 |
by (auto simp only:image_def intro:finite_subset) |
|
121 |
from finite_range_image [OF this] show ?thesis . |
|
122 |
qed |
|
123 |
next |
|
124 |
-- {* |
|
125 |
The injectivity of @{text "f"} is the consequence of assumption @{text "same_tag_eqvt"}: |
|
126 |
*} |
|
127 |
show "inj_on ?f ?A" |
|
128 |
proof- |
|
129 |
{ fix X Y |
|
130 |
assume X_in: "X \<in> ?A" |
|
131 |
and Y_in: "Y \<in> ?A" |
|
132 |
and tag_eq: "?f X = ?f Y" |
|
133 |
have "X = Y" |
|
134 |
proof - |
|
135 |
from X_in Y_in tag_eq |
|
136 |
obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y" |
|
137 |
unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def |
|
138 |
apply simp by blast |
|
43 | 139 |
from same_tag_eqvt [OF eq_tg] have "x \<approx>L y" . |
42 | 140 |
with X_in Y_in x_in y_in |
141 |
show ?thesis by (auto simp:quotient_def str_eq_rel_def str_eq_def) |
|
142 |
qed |
|
143 |
} thus ?thesis unfolding inj_on_def by auto |
|
144 |
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
|
145 |
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
|
146 |
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
|
147 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
148 |
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
|
149 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
150 |
text {* |
43 | 151 |
The the final result of this direction is in @{text "rexp_imp_finite"}, |
152 |
which is an induction on the structure of regular expressions. There is one |
|
153 |
case for each regular expression operator. For basic operators such as |
|
154 |
@{const NULL}, @{const EMPTY}, @{const CHAR}, the finiteness of their |
|
155 |
language partition can be established directly with no need of tagging. |
|
156 |
This section contains several technical lemma for these base cases. |
|
157 |
||
158 |
The inductive cases involve operators @{const ALT}, @{const SEQ} and @{const |
|
159 |
STAR}. Tagging functions need to be defined individually for each of |
|
160 |
them. There will be one dedicated section for each of these cases, and each |
|
161 |
section goes virtually the same way: gives definition of the tagging |
|
162 |
function and prove that strings with the same tag are equivalent. |
|
163 |
*} |
|
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
|
164 |
|
43 | 165 |
subsection {* The case for @{const "NULL"} *} |
166 |
||
167 |
lemma quot_null_eq: |
|
168 |
shows "(UNIV // \<approx>{}) = ({UNIV}::lang set)" |
|
169 |
unfolding quotient_def Image_def str_eq_rel_def by auto |
|
170 |
||
171 |
lemma quot_null_finiteI [intro]: |
|
172 |
shows "finite ((UNIV // \<approx>{})::lang set)" |
|
173 |
unfolding quot_null_eq by simp |
|
174 |
||
175 |
||
176 |
subsection {* The case for @{const "EMPTY"} *} |
|
177 |
||
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
|
178 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
179 |
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
|
180 |
"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
|
181 |
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
|
182 |
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
|
183 |
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
|
184 |
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
|
185 |
unfolding quotient_def Image_def by blast |
43 | 186 |
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
|
187 |
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
|
188 |
case True with h |
43 | 189 |
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
|
190 |
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
|
191 |
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
|
192 |
case False with h |
43 | 193 |
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
|
194 |
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
|
195 |
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
|
196 |
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
|
197 |
|
43 | 198 |
lemma quot_empty_finiteI [intro]: |
199 |
shows "finite (UNIV // (\<approx>{[]}))" |
|
200 |
by (rule finite_subset[OF quot_empty_subset]) (simp) |
|
201 |
||
202 |
||
203 |
subsection {* The case for @{const "CHAR"} *} |
|
204 |
||
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
|
205 |
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
|
206 |
"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
|
207 |
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
|
208 |
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
|
209 |
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
|
210 |
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
|
211 |
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
|
212 |
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
|
213 |
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
|
214 |
{ 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
|
215 |
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
|
216 |
} 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
|
217 |
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
|
218 |
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
|
219 |
} 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
|
220 |
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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
} 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
|
227 |
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
|
228 |
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
|
229 |
|
43 | 230 |
lemma quot_char_finiteI [intro]: |
231 |
shows "finite (UNIV // (\<approx>{[c]}))" |
|
232 |
by (rule finite_subset[OF quot_char_subset]) (simp) |
|
233 |
||
234 |
||
235 |
subsection {* The case for @{const 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
|
236 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
237 |
definition |
43 | 238 |
tag_str_SEQ :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang set)" |
239 |
where |
|
240 |
"tag_str_SEQ L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, {(\<approx>L2 `` {x - xa}) | xa. xa \<le> x \<and> xa \<in> L1}))" |
|
42 | 241 |
|
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
|
242 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
244 |
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
|
245 |
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
|
246 |
(\<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
|
247 |
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
|
248 |
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
|
249 |
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
|
250 |
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
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
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
|
255 |
\<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
|
256 |
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
|
257 |
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
|
258 |
\<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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
264 |
"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
|
265 |
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
|
266 |
{ 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
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
(\<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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
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
|
281 |
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
|
282 |
{\<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
|
283 |
(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
|
284 |
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
|
285 |
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
|
286 |
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
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
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
|
291 |
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
|
292 |
} 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
|
293 |
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
|
294 |
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
|
295 |
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
|
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 |
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
|
298 |
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
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
306 |
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
|
307 |
} 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
|
308 |
by (auto simp add: str_eq_def str_eq_rel_def) |
43 | 309 |
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
|
310 |
|
43 | 311 |
lemma quot_seq_finiteI [intro]: |
312 |
fixes L1 L2::"lang" |
|
313 |
assumes fin1: "finite (UNIV // \<approx>L1)" |
|
314 |
and fin2: "finite (UNIV // \<approx>L2)" |
|
315 |
shows "finite (UNIV // \<approx>(L1 ;; L2))" |
|
316 |
proof (rule_tac tag = "tag_str_SEQ L1 L2" in tag_finite_imageD) |
|
317 |
show "\<And>x y. tag_str_SEQ L1 L2 x = tag_str_SEQ L1 L2 y \<Longrightarrow> x \<approx>(L1 ;; L2) y" |
|
318 |
by (rule tag_str_SEQ_injI) |
|
319 |
next |
|
320 |
have *: "finite ((UNIV // \<approx>L1) \<times> (Pow (UNIV // \<approx>L2)))" |
|
321 |
using fin1 fin2 by auto |
|
322 |
show "finite (range (tag_str_SEQ L1 L2))" |
|
323 |
unfolding tag_str_SEQ_def |
|
324 |
apply(rule finite_subset[OF _ *]) |
|
325 |
unfolding quotient_def |
|
326 |
by auto |
|
327 |
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
|
328 |
|
43 | 329 |
|
330 |
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
|
331 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
definition |
43 | 333 |
tag_str_ALT :: "lang \<Rightarrow> lang \<Rightarrow> string \<Rightarrow> (lang \<times> lang)" |
334 |
where |
|
335 |
"tag_str_ALT L1 L2 = (\<lambda>x. (\<approx>L1 `` {x}, \<approx>L2 `` {x}))" |
|
336 |
||
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
|
337 |
|
43 | 338 |
lemma quot_union_finiteI [intro]: |
339 |
fixes L1 L2::"lang" |
|
340 |
assumes finite1: "finite (UNIV // \<approx>L1)" |
|
341 |
and finite2: "finite (UNIV // \<approx>L2)" |
|
342 |
shows "finite (UNIV // \<approx>(L1 \<union> L2))" |
|
343 |
proof (rule_tac tag = "tag_str_ALT L1 L2" in tag_finite_imageD) |
|
344 |
show "\<And>x y. tag_str_ALT L1 L2 x = tag_str_ALT L1 L2 y \<Longrightarrow> x \<approx>(L1 \<union> L2) y" |
|
345 |
unfolding tag_str_ALT_def |
|
346 |
unfolding str_eq_def |
|
347 |
unfolding Image_def |
|
348 |
unfolding str_eq_rel_def |
|
349 |
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
|
350 |
next |
43 | 351 |
have *: "finite ((UNIV // \<approx>L1) \<times> (UNIV // \<approx>L2))" |
352 |
using finite1 finite2 by auto |
|
353 |
show "finite (range (tag_str_ALT L1 L2))" |
|
354 |
unfolding tag_str_ALT_def |
|
355 |
apply(rule finite_subset[OF _ *]) |
|
356 |
unfolding quotient_def |
|
357 |
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
|
358 |
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
|
359 |
|
43 | 360 |
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
|
361 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
363 |
This turned out to be the trickiest 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
|
364 |
*} (* I will make some illustrations for it. *) |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
definition |
43 | 367 |
tag_str_STAR :: "lang \<Rightarrow> string \<Rightarrow> lang set" |
368 |
where |
|
369 |
"tag_str_STAR L1 = (\<lambda>x. {\<approx>L1 `` {x - xa} | xa. xa < x \<and> xa \<in> L1\<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
|
370 |
|
43 | 371 |
|
372 |
lemma finite_set_has_max: |
|
373 |
"\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> (\<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
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
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
|
380 |
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
|
381 |
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
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
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
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
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
|
393 |
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
|
394 |
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
|
395 |
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
|
396 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
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
|
401 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
402 |
lemma tag_str_STAR_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
|
403 |
"tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) 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
|
404 |
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
|
405 |
{ 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
|
406 |
assume xz_in_star: "x @ 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
|
407 |
and tag_xy: "tag_str_STAR L\<^isub>1 x = tag_str_STAR 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
|
408 |
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
|
409 |
proof(cases "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
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
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
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
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
|
419 |
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
|
420 |
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
|
421 |
\<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
|
422 |
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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
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
|
429 |
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
|
430 |
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
|
431 |
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
|
432 |
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
|
433 |
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
|
434 |
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
|
435 |
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
|
436 |
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
|
437 |
{\<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
|
438 |
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
|
439 |
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
|
440 |
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
|
441 |
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
|
442 |
(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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
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
|
449 |
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
|
450 |
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
|
451 |
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
|
452 |
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
|
453 |
(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
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
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
|
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
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
|
465 |
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
|
466 |
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
|
467 |
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
|
468 |
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
|
469 |
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
|
470 |
} 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
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
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
|
479 |
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
|
480 |
by (drule_tac star_intro1, 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
|
481 |
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
|
482 |
} thus "tag_str_STAR L\<^isub>1 m = tag_str_STAR L\<^isub>1 n \<Longrightarrow> m \<approx>(L\<^isub>1\<star>) 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
|
483 |
by (auto simp add: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
|
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 |
|
43 | 486 |
lemma quot_star_finiteI [intro]: |
487 |
fixes L1::"lang" |
|
488 |
assumes finite1: "finite (UNIV // \<approx>L1)" |
|
489 |
shows "finite (UNIV // \<approx>(L1\<star>))" |
|
490 |
proof (rule_tac tag = "tag_str_STAR L1" in tag_finite_imageD) |
|
491 |
show "\<And>x y. tag_str_STAR L1 x = tag_str_STAR L1 y \<Longrightarrow> x \<approx>(L1\<star>) y" |
|
492 |
by (rule tag_str_STAR_injI) |
|
40 | 493 |
next |
43 | 494 |
have *: "finite (Pow (UNIV // \<approx>L1))" |
495 |
using finite1 by auto |
|
496 |
show "finite (range (tag_str_STAR L1))" |
|
497 |
unfolding tag_str_STAR_def |
|
498 |
apply(rule finite_subset[OF _ *]) |
|
499 |
unfolding quotient_def |
|
500 |
by auto |
|
501 |
qed |
|
502 |
||
503 |
||
504 |
subsection {* The main lemma *} |
|
505 |
||
506 |
lemma rexp_imp_finite: |
|
507 |
fixes r::"rexp" |
|
508 |
shows "finite (UNIV // \<approx>(L r))" |
|
509 |
by (induct r) (auto) |
|
510 |
||
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
|
511 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
512 |
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
|
513 |