author | zhang |
Thu, 27 Jan 2011 12:35:06 +0000 | |
changeset 42 | f809cb54de4e |
parent 40 | 50d00d7dc413 |
child 43 | cb4403fabda7 |
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 |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
16 |
str_eq ("_ \<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
|
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 |
||
38 |
(* I am trying to reduce the following proof to even simpler principles. But not yet succeed. *) |
|
39 |
definition |
|
40 |
f_eq_rel ("\<cong>_") |
|
41 |
where |
|
42 |
"\<cong>(f::'a \<Rightarrow> 'b) = {(x, y) | x y. f x = f y}" |
|
43 |
||
44 |
thm finite.induct |
|
45 |
||
46 |
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)" |
|
47 |
by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_def) |
|
48 |
||
49 |
lemma "equiv UNIV (\<cong>f)" |
|
50 |
by (auto simp:equiv_def f_eq_rel_def refl_on_def sym_def trans_def) |
|
51 |
||
52 |
lemma |
|
53 |
assumes rng_fnt: "finite (range tag)" |
|
54 |
shows "finite (UNIV // (\<cong>tag))" |
|
55 |
proof - |
|
56 |
let "?f" = "op ` tag" and ?A = "(UNIV // (\<cong>tag))" |
|
57 |
show ?thesis |
|
58 |
proof (rule_tac f = "?f" and A = ?A in finite_imageD) |
|
59 |
-- {* |
|
60 |
The finiteness of @{text "f"}-image is a simple consequence of assumption @{text "rng_fnt"}: |
|
61 |
*} |
|
62 |
show "finite (?f ` ?A)" |
|
63 |
proof - |
|
64 |
have "\<forall> X. ?f X \<in> (Pow (range tag))" by (auto simp:image_def Pow_def) |
|
65 |
moreover from rng_fnt have "finite (Pow (range tag))" by simp |
|
66 |
ultimately have "finite (range ?f)" |
|
67 |
by (auto simp only:image_def intro:finite_subset) |
|
68 |
from finite_range_image [OF this] show ?thesis . |
|
69 |
qed |
|
70 |
next |
|
71 |
-- {* |
|
72 |
The injectivity of @{text "f"}-image is a consequence of the definition of @{text "\<cong>tag"} |
|
73 |
*} |
|
74 |
show "inj_on ?f ?A" |
|
75 |
proof- |
|
76 |
{ fix X Y |
|
77 |
assume X_in: "X \<in> ?A" |
|
78 |
and Y_in: "Y \<in> ?A" |
|
79 |
and tag_eq: "?f X = ?f Y" |
|
80 |
have "X = Y" |
|
81 |
proof - |
|
82 |
from X_in Y_in tag_eq |
|
83 |
obtain x y where x_in: "x \<in> X" and y_in: "y \<in> Y" and eq_tg: "tag x = tag y" |
|
84 |
unfolding quotient_def Image_def str_eq_rel_def str_eq_def image_def f_eq_rel_def |
|
85 |
apply simp by blast |
|
86 |
with X_in Y_in show ?thesis |
|
87 |
by (auto simp:quotient_def str_eq_rel_def str_eq_def f_eq_rel_def) |
|
88 |
qed |
|
89 |
} thus ?thesis unfolding inj_on_def by auto |
|
90 |
qed |
|
91 |
qed |
|
92 |
qed |
|
93 |
||
94 |
*) |
|
95 |
||
96 |
lemma finite_range_image: "finite (range f) \<Longrightarrow> finite (f ` A)" |
|
97 |
by (rule_tac B = "{y. \<exists>x. y = f x}" in finite_subset, auto simp:image_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
|
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: |
42 | 100 |
fixes tag |
101 |
assumes rng_fnt: "finite (range tag)" |
|
102 |
-- {* Suppose the rang of tagging fucntion @{text "tag"} is finite. *} |
|
103 |
and same_tag_eqvt: "\<And> m n. tag m = tag (n::string) \<Longrightarrow> m \<approx>lang n" |
|
104 |
-- {* And strings with same tag are equivalent *} |
|
105 |
shows "finite (UNIV // (\<approx>lang))" |
|
106 |
-- {* Then the partition generated by @{text "(\<approx>lang)"} is finite. *} |
|
107 |
proof - |
|
108 |
-- {* The particular @{text "f"} and @{text "A"} used in @{thm [source] "finite_imageD"} are:*} |
|
109 |
let "?f" = "op ` tag" and ?A = "(UNIV // \<approx>lang)" |
|
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 |
|
139 |
from same_tag_eqvt [OF eq_tg] have "x \<approx>lang y" . |
|
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 {* |
42 | 151 |
The the final result of this direction is in @{text "easier_direction"}, which |
152 |
is an induction on the structure of regular expressions. There is one case |
|
153 |
for each regular expression operator. For basic operators such as @{text "NULL, EMPTY, CHAR c"}, |
|
154 |
the finiteness of their language partition can be established directly with no need |
|
155 |
of taggiing. This section contains several technical lemma for these base cases. |
|
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
|
156 |
|
42 | 157 |
The inductive cases involve operators @{text "ALT, SEQ"} and @{text "STAR"}. |
158 |
Tagging functions need to be defined individually for each of them. There will be one |
|
159 |
dedicated section for each of these cases, and each section goes virtually the same way: |
|
160 |
gives definition of the tagging function and prove that strings |
|
161 |
with the same tag are equivalent. |
|
162 |
*} |
|
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
|
163 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
165 |
"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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
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
|
170 |
unfolding quotient_def Image_def by blast |
42 | 171 |
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
|
172 |
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
|
173 |
case True with h |
42 | 174 |
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
|
175 |
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
|
176 |
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
|
177 |
case False with h |
42 | 178 |
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
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
184 |
"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
|
185 |
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
|
186 |
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
|
187 |
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
|
188 |
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
|
189 |
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
|
190 |
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
|
191 |
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
|
192 |
{ 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
|
193 |
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
|
194 |
} 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
|
195 |
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
|
196 |
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
|
197 |
} 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
|
198 |
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
|
199 |
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
|
200 |
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
|
201 |
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
|
202 |
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
|
203 |
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
|
204 |
} 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
|
205 |
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
|
206 |
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
|
207 |
|
42 | 208 |
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
|
209 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
definition |
42 | 211 |
"tag_str_SEQ L\<^isub>1 L\<^isub>2 x \<equiv> |
212 |
((\<approx>L\<^isub>1) `` {x}, {(\<approx>L\<^isub>2) `` {x - xa}| xa. xa \<le> x \<and> xa \<in> L\<^isub>1})" |
|
213 |
||
214 |
lemma tag_str_seq_range_finite: |
|
215 |
"\<lbrakk>finite (UNIV // \<approx>L\<^isub>1); finite (UNIV // \<approx>L\<^isub>2)\<rbrakk> |
|
216 |
\<Longrightarrow> finite (range (tag_str_SEQ L\<^isub>1 L\<^isub>2))" |
|
217 |
apply (rule_tac B = "(UNIV // \<approx>L\<^isub>1) \<times> (Pow (UNIV // \<approx>L\<^isub>2))" in finite_subset) |
|
218 |
by (auto simp:tag_str_SEQ_def Image_def quotient_def split:if_splits) |
|
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
|
219 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
221 |
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
|
222 |
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
|
223 |
(\<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
|
224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
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
|
232 |
\<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
|
233 |
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
|
234 |
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
|
235 |
\<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
|
236 |
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
|
237 |
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
|
238 |
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
|
239 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
240 |
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
|
241 |
"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
|
242 |
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
|
243 |
{ 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
|
244 |
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
|
245 |
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
|
246 |
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
|
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 |
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
|
249 |
(\<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
|
250 |
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
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
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
|
259 |
{\<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
|
260 |
(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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
} 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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
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 |
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
|
280 |
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
|
281 |
} |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
283 |
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
|
284 |
} 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
|
285 |
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
|
286 |
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
|
287 |
|
42 | 288 |
lemma quot_seq_finiteI: |
289 |
"\<lbrakk>finite (UNIV // \<approx>L\<^isub>1); finite (UNIV // \<approx>L\<^isub>2)\<rbrakk> |
|
290 |
\<Longrightarrow> finite (UNIV // \<approx>(L\<^isub>1 ;; L\<^isub>2))" |
|
291 |
apply (rule_tac tag = "tag_str_SEQ L\<^isub>1 L\<^isub>2" in tag_finite_imageD) |
|
292 |
by (auto intro:tag_str_SEQ_injI elim:tag_str_seq_range_finite) |
|
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
|
293 |
|
42 | 294 |
subsection {* The case for @{text "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
|
295 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
definition |
42 | 297 |
"tag_str_ALT L\<^isub>1 L\<^isub>2 (x::string) \<equiv> ((\<approx>L\<^isub>1) `` {x}, (\<approx>L\<^isub>2) `` {x})" |
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
|
298 |
|
42 | 299 |
lemma quot_union_finiteI: |
300 |
assumes finite1: "finite (UNIV // \<approx>(L\<^isub>1::string set))" |
|
301 |
and finite2: "finite (UNIV // \<approx>L\<^isub>2)" |
|
302 |
shows "finite (UNIV // \<approx>(L\<^isub>1 \<union> L\<^isub>2))" |
|
303 |
proof (rule_tac tag = "tag_str_ALT L\<^isub>1 L\<^isub>2" in tag_finite_imageD) |
|
304 |
show "\<And>m n. tag_str_ALT L\<^isub>1 L\<^isub>2 m = tag_str_ALT L\<^isub>1 L\<^isub>2 n \<Longrightarrow> m \<approx>(L\<^isub>1 \<union> L\<^isub>2) n" |
|
305 |
unfolding tag_str_ALT_def str_eq_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
|
306 |
next |
42 | 307 |
show "finite (range (tag_str_ALT L\<^isub>1 L\<^isub>2))" using finite1 finite2 |
308 |
apply (rule_tac B = "(UNIV // \<approx>L\<^isub>1) \<times> (UNIV // \<approx>L\<^isub>2)" in finite_subset) |
|
309 |
by (auto simp:tag_str_ALT_def Image_def quotient_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
|
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 |
|
42 | 312 |
subsection {* |
313 |
The case for @{text "STAR"} |
|
314 |
*} |
|
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
|
315 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
316 |
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
|
317 |
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
|
318 |
*} (* 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
|
319 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
definition |
42 | 321 |
"tag_str_STAR L\<^isub>1 x \<equiv> {(\<approx>L\<^isub>1) `` {x - xa} | xa. xa < x \<and> xa \<in> L\<^isub>1\<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
|
322 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
323 |
lemma finite_set_has_max: "\<lbrakk>finite A; A \<noteq> {}\<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
|
324 |
(\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))" |
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents:
30
diff
changeset
|
325 |
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
|
326 |
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
|
327 |
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
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
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
|
344 |
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
|
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 |
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
|
347 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
349 |
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
|
350 |
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
|
351 |
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
|
352 |
|
42 | 353 |
|
354 |
lemma tag_str_star_range_finite: |
|
355 |
"finite (UNIV // \<approx>L\<^isub>1) \<Longrightarrow> finite (range (tag_str_STAR L\<^isub>1))" |
|
356 |
apply (rule_tac B = "Pow (UNIV // \<approx>L\<^isub>1)" in finite_subset) |
|
357 |
by (auto simp:tag_str_STAR_def Image_def |
|
358 |
quotient_def split:if_splits) |
|
359 |
||
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
|
360 |
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
|
361 |
"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
|
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 |
{ 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
|
364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
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
|
373 |
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
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
\<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
|
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 |
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
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
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
|
389 |
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
|
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 |
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
|
392 |
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
|
393 |
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
|
394 |
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
|
395 |
{\<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
|
396 |
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
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
(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
|
401 |
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
|
402 |
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
|
403 |
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
|
404 |
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
|
405 |
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
|
406 |
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
|
407 |
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
|
408 |
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
|
409 |
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
|
410 |
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
|
411 |
(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
|
412 |
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
|
413 |
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
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
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
|
419 |
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
|
420 |
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
|
421 |
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
|
422 |
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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
} 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
|
429 |
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
|
430 |
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
|
431 |
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
|
432 |
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
|
433 |
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
|
434 |
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
|
435 |
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
|
436 |
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
|
437 |
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
|
438 |
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
|
439 |
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
|
440 |
} 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
|
441 |
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
|
442 |
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
|
443 |
|
42 | 444 |
lemma quot_star_finiteI: |
445 |
"finite (UNIV // \<approx>L\<^isub>1) \<Longrightarrow> finite (UNIV // \<approx>(L\<^isub>1\<star>))" |
|
446 |
apply (rule_tac tag = "tag_str_STAR L\<^isub>1" in tag_finite_imageD) |
|
447 |
by (auto intro:tag_str_STAR_injI elim:tag_str_star_range_finite) |
|
40 | 448 |
|
42 | 449 |
subsection {* |
450 |
The main lemma |
|
451 |
*} |
|
452 |
||
453 |
lemma easier_directio\<nu>: |
|
454 |
"Lang = L (r::rexp) \<Longrightarrow> finite (UNIV // (\<approx>Lang))" |
|
455 |
proof (induct arbitrary:Lang rule:rexp.induct) |
|
456 |
case NULL |
|
457 |
have "UNIV // (\<approx>{}) \<subseteq> {UNIV} " |
|
458 |
by (auto simp:quotient_def str_eq_rel_def str_eq_def) |
|
459 |
with prems show "?case" by (auto intro:finite_subset) |
|
460 |
next |
|
461 |
case EMPTY |
|
462 |
have "UNIV // (\<approx>{[]}) \<subseteq> {{[]}, UNIV - {[]}}" |
|
463 |
by (rule quot_empty_subset) |
|
464 |
with prems show ?case by (auto intro:finite_subset) |
|
40 | 465 |
next |
42 | 466 |
case (CHAR c) |
467 |
have "UNIV // (\<approx>{[c]}) \<subseteq> {{[]},{[c]}, UNIV - {[], [c]}}" |
|
468 |
by (rule quot_char_subset) |
|
469 |
with prems show ?case by (auto intro:finite_subset) |
|
470 |
next |
|
471 |
case (SEQ r\<^isub>1 r\<^isub>2) |
|
472 |
have "\<lbrakk>finite (UNIV // \<approx>(L r\<^isub>1)); finite (UNIV // \<approx>(L r\<^isub>2))\<rbrakk> |
|
473 |
\<Longrightarrow> finite (UNIV // \<approx>(L r\<^isub>1 ;; L r\<^isub>2))" |
|
474 |
by (erule quot_seq_finiteI, simp) |
|
475 |
with prems show ?case by simp |
|
476 |
next |
|
477 |
case (ALT r\<^isub>1 r\<^isub>2) |
|
478 |
have "\<lbrakk>finite (UNIV // \<approx>(L r\<^isub>1)); finite (UNIV // \<approx>(L r\<^isub>2))\<rbrakk> |
|
479 |
\<Longrightarrow> finite (UNIV // \<approx>(L r\<^isub>1 \<union> L r\<^isub>2))" |
|
480 |
by (erule quot_union_finiteI, simp) |
|
481 |
with prems show ?case by simp |
|
482 |
next |
|
483 |
case (STAR r) |
|
484 |
have "finite (UNIV // \<approx>(L r)) |
|
485 |
\<Longrightarrow> finite (UNIV // \<approx>((L r)\<star>))" |
|
486 |
by (erule quot_star_finiteI) |
|
487 |
with prems show ?case by simp |
|
488 |
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
|
489 |
|
b6815473ee2e
1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first 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 |
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
|
491 |