author | urbanc |
Tue, 09 Aug 2011 22:15:11 +0000 | |
changeset 190 | b73478aaf33e |
parent 187 | 9f46a9571e37 |
child 191 | f6a603be52d6 |
permissions | -rw-r--r-- |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
1 |
theory Derivatives |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
2 |
imports Myhill_2 |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
3 |
begin |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
4 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
5 |
section {* Left-Quotients and Derivatives *} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
6 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
7 |
subsection {* Left-Quotients *} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
8 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
9 |
definition |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
10 |
Delta :: "'a lang \<Rightarrow> 'a lang" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
11 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
12 |
"Delta A = (if [] \<in> A then {[]} else {})" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
13 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
14 |
definition |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
15 |
Der :: "'a \<Rightarrow> 'a lang \<Rightarrow> 'a lang" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
16 |
where |
179 | 17 |
"Der c A \<equiv> {s'. [c] @ s' \<in> A}" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
18 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
19 |
definition |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
20 |
Ders :: "'a list \<Rightarrow> 'a lang \<Rightarrow> 'a lang" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
21 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
22 |
"Ders s A \<equiv> {s'. s @ s' \<in> A}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
23 |
|
187 | 24 |
abbreviation |
25 |
"Derss s A \<equiv> \<Union> (Ders s) ` A" |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
26 |
|
187 | 27 |
lemma Der_simps [simp]: |
28 |
shows "Der c {} = {}" |
|
29 |
and "Der c {[]} = {}" |
|
30 |
and "Der c {[d]} = (if c = d then {[]} else {})" |
|
31 |
and "Der c (A \<union> B) = Der c A \<union> Der c B" |
|
32 |
unfolding Der_def by auto |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
33 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
34 |
lemma Der_conc [simp]: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
35 |
shows "Der c (A \<cdot> B) = (Der c A) \<cdot> B \<union> (Delta A \<cdot> Der c B)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
36 |
unfolding Der_def Delta_def conc_def |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
37 |
by (auto simp add: Cons_eq_append_conv) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
38 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
39 |
lemma Der_star [simp]: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
40 |
shows "Der c (A\<star>) = (Der c A) \<cdot> A\<star>" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
41 |
proof - |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
42 |
have incl: "Delta A \<cdot> Der c (A\<star>) \<subseteq> (Der c A) \<cdot> A\<star>" |
187 | 43 |
unfolding Der_def Delta_def conc_def |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
44 |
apply(auto) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
45 |
apply(drule star_decom) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
46 |
apply(auto simp add: Cons_eq_append_conv) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
47 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
48 |
|
180 | 49 |
have "Der c (A\<star>) = Der c (A \<cdot> A\<star> \<union> {[]})" |
50 |
by (simp only: star_unfold_left[symmetric]) |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
51 |
also have "... = Der c (A \<cdot> A\<star>)" |
187 | 52 |
by (simp only: Der_simps) (simp) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
53 |
also have "... = (Der c A) \<cdot> A\<star> \<union> (Delta A \<cdot> Der c (A\<star>))" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
54 |
by simp |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
55 |
also have "... = (Der c A) \<cdot> A\<star>" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
56 |
using incl by auto |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
57 |
finally show "Der c (A\<star>) = (Der c A) \<cdot> A\<star>" . |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
58 |
qed |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
59 |
|
187 | 60 |
lemma Ders_simps [simp]: |
179 | 61 |
shows "Ders [] A = A" |
187 | 62 |
and "Ders (c # s) A = Ders s (Der c A)" |
63 |
and "Ders (s1 @ s2) A = Ders s2 (Ders s1 A)" |
|
179 | 64 |
unfolding Ders_def Der_def by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
65 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
66 |
subsection {* Brozowsky's derivatives of regular expressions *} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
67 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
68 |
fun |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
69 |
nullable :: "'a rexp \<Rightarrow> bool" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
70 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
71 |
"nullable (Zero) = False" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
72 |
| "nullable (One) = True" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
73 |
| "nullable (Atom c) = False" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
74 |
| "nullable (Plus r1 r2) = (nullable r1 \<or> nullable r2)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
75 |
| "nullable (Times r1 r2) = (nullable r1 \<and> nullable r2)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
76 |
| "nullable (Star r) = True" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
77 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
78 |
fun |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
79 |
der :: "'a \<Rightarrow> 'a rexp \<Rightarrow> 'a rexp" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
80 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
81 |
"der c (Zero) = Zero" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
82 |
| "der c (One) = Zero" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
83 |
| "der c (Atom c') = (if c = c' then One else Zero)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
84 |
| "der c (Plus r1 r2) = Plus (der c r1) (der c r2)" |
174 | 85 |
| "der c (Times r1 r2) = |
86 |
(if nullable r1 then Plus (Times (der c r1) r2) (der c r2) else Times (der c r1) r2)" |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
87 |
| "der c (Star r) = Times (der c r) (Star r)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
88 |
|
179 | 89 |
fun |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
90 |
ders :: "'a list \<Rightarrow> 'a rexp \<Rightarrow> 'a rexp" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
91 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
92 |
"ders [] r = r" |
179 | 93 |
| "ders (c # s) r = ders s (der c r)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
94 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
95 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
96 |
lemma Delta_nullable: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
97 |
shows "Delta (lang r) = (if nullable r then {[]} else {})" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
98 |
unfolding Delta_def |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
99 |
by (induct r) (auto simp add: conc_def split: if_splits) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
100 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
101 |
lemma Der_der: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
102 |
shows "Der c (lang r) = lang (der c r)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
103 |
by (induct r) (simp_all add: Delta_nullable) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
104 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
105 |
lemma Ders_ders: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
106 |
shows "Ders s (lang r) = lang (ders s r)" |
179 | 107 |
by (induct s arbitrary: r) (simp_all add: Der_der) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
108 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
109 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
110 |
subsection {* Antimirov's Partial Derivatives *} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
111 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
112 |
abbreviation |
187 | 113 |
"Timess rs r \<equiv> {Times r' r | r'. r' \<in> rs}" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
114 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
115 |
fun |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
116 |
pder :: "'a \<Rightarrow> 'a rexp \<Rightarrow> ('a rexp) set" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
117 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
118 |
"pder c Zero = {Zero}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
119 |
| "pder c One = {Zero}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
120 |
| "pder c (Atom c') = (if c = c' then {One} else {Zero})" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
121 |
| "pder c (Plus r1 r2) = (pder c r1) \<union> (pder c r2)" |
179 | 122 |
| "pder c (Times r1 r2) = |
187 | 123 |
(if nullable r1 then Timess (pder c r1) r2 \<union> pder c r2 else Timess (pder c r1) r2)" |
124 |
| "pder c (Star r) = Timess (pder c r) (Star r)" |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
125 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
126 |
abbreviation |
187 | 127 |
"pder_set c rs \<equiv> \<Union> pder c ` rs" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
128 |
|
179 | 129 |
fun |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
130 |
pders :: "'a list \<Rightarrow> 'a rexp \<Rightarrow> ('a rexp) set" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
131 |
where |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
132 |
"pders [] r = {r}" |
180 | 133 |
| "pders (c # s) r = \<Union> (pders s) ` (pder c r)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
134 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
135 |
abbreviation |
187 | 136 |
"pderss s A \<equiv> \<Union> (pders s) ` A" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
137 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
138 |
lemma pders_append: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
139 |
"pders (s1 @ s2) r = \<Union> (pders s2) ` (pders s1 r)" |
179 | 140 |
by (induct s1 arbitrary: r) (simp_all) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
141 |
|
179 | 142 |
lemma pders_snoc: |
143 |
shows "pders (s @ [c]) r = pder_set c (pders s r)" |
|
144 |
by (simp add: pders_append) |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
145 |
|
187 | 146 |
lemma pders_simps [simp]: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
147 |
shows "pders s Zero = {Zero}" |
187 | 148 |
and "pders s One = (if s = [] then {One} else {Zero})" |
149 |
and "pders s (Atom c) = (if s = [] then {Atom c} else (if s = [c] then {One} else {Zero}))" |
|
150 |
and "pders s (Plus r1 r2) = (if s = [] then {Plus r1 r2} else (pders s r1) \<union> (pders s r2))" |
|
179 | 151 |
by (induct s) (auto) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
152 |
|
187 | 153 |
subsection {* Relating left-quotients and partial derivatives *} |
154 |
||
155 |
lemma Der_pder: |
|
156 |
shows "Der c (lang r) = \<Union> lang ` (pder c r)" |
|
157 |
by (induct r) (auto simp add: Delta_nullable conc_UNION_distrib) |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
158 |
|
187 | 159 |
lemma Ders_pders: |
160 |
shows "Ders s (lang r) = \<Union> lang ` (pders s r)" |
|
161 |
proof (induct s arbitrary: r) |
|
162 |
case (Cons c s) |
|
163 |
have ih: "\<And>r. Ders s (lang r) = \<Union> lang ` (pders s r)" by fact |
|
164 |
have "Ders (c # s) (lang r) = Ders s (Der c (lang r))" by simp |
|
165 |
also have "\<dots> = Ders s (\<Union> lang ` (pder c r))" by (simp add: Der_pder) |
|
166 |
also have "\<dots> = Derss s (lang ` (pder c r))" |
|
167 |
by (auto simp add: Ders_def) |
|
168 |
also have "\<dots> = \<Union> lang ` (pderss s (pder c r))" |
|
169 |
using ih by auto |
|
170 |
also have "\<dots> = \<Union> lang ` (pders (c # s) r)" by simp |
|
171 |
finally show "Ders (c # s) (lang r) = \<Union> lang ` pders (c # s) r" . |
|
172 |
qed (simp add: Ders_def) |
|
173 |
||
174 |
subsection {* Relating derivatives and partial derivatives *} |
|
175 |
||
190 | 176 |
lemma der_pder: |
187 | 177 |
shows "(\<Union> lang ` (pder c r)) = lang (der c r)" |
178 |
unfolding Der_der[symmetric] Der_pder by simp |
|
179 |
||
190 | 180 |
lemma ders_pders: |
187 | 181 |
shows "(\<Union> lang ` (pders s r)) = lang (ders s r)" |
182 |
unfolding Ders_ders[symmetric] Ders_pders by simp |
|
183 |
||
184 |
||
185 |
subsection {* There are only finitely many partial derivatives for a language *} |
|
186 |
||
187 |
abbreviation |
|
190 | 188 |
"pders_lang A r \<equiv> \<Union>s \<in> A. pders s r" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
189 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
190 |
text {* Non-empty suffixes of a string *} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
191 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
192 |
definition |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
193 |
"Suf s \<equiv> {v. v \<noteq> [] \<and> (\<exists>u. u @ v = s)}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
194 |
|
187 | 195 |
lemma Suf_snoc: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
196 |
shows "Suf (s @ [c]) = (Suf s) \<cdot> {[c]} \<union> {[c]}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
197 |
unfolding Suf_def conc_def |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
198 |
by (auto simp add: append_eq_append_conv2 append_eq_Cons_conv) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
199 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
200 |
lemma Suf_Union: |
187 | 201 |
shows "(\<Union>v \<in> Suf s \<cdot> {[c]}. f v) = (\<Union>v \<in> Suf s. f (v @ [c]))" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
202 |
by (auto simp add: conc_def) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
203 |
|
190 | 204 |
lemma pders_lang_snoc: |
205 |
shows "pders_lang (Suf s \<cdot> {[c]}) r = (pder_set c (pders_lang (Suf s) r))" |
|
187 | 206 |
by (simp add: Suf_Union pders_snoc) |
207 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
208 |
lemma pders_Times: |
190 | 209 |
shows "pders s (Times r1 r2) \<subseteq> Timess (pders s r1) r2 \<union> (pders_lang (Suf s) r2)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
210 |
proof (induct s rule: rev_induct) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
211 |
case (snoc c s) |
190 | 212 |
have ih: "pders s (Times r1 r2) \<subseteq> Timess (pders s r1) r2 \<union> (pders_lang (Suf s) r2)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
213 |
by fact |
179 | 214 |
have "pders (s @ [c]) (Times r1 r2) = pder_set c (pders s (Times r1 r2))" |
215 |
by (simp add: pders_snoc) |
|
190 | 216 |
also have "\<dots> \<subseteq> pder_set c (Timess (pders s r1) r2 \<union> (pders_lang (Suf s) r2))" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
217 |
using ih by (auto) (blast) |
190 | 218 |
also have "\<dots> = pder_set c (Timess (pders s r1) r2) \<union> pder_set c (pders_lang (Suf s) r2)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
219 |
by (simp) |
190 | 220 |
also have "\<dots> = pder_set c (Timess (pders s r1) r2) \<union> pders_lang (Suf s \<cdot> {[c]}) r2" |
221 |
by (simp add: pders_lang_snoc) |
|
222 |
also have "\<dots> \<subseteq> pder_set c (Timess (pders s r1) r2) \<union> pder c r2 \<union> pders_lang (Suf s \<cdot> {[c]}) r2" |
|
187 | 223 |
by auto |
190 | 224 |
also have "\<dots> \<subseteq> Timess (pder_set c (pders s r1)) r2 \<union> pder c r2 \<union> pders_lang (Suf s \<cdot> {[c]}) r2" |
225 |
by (auto simp add: if_splits) (blast) |
|
226 |
also have "\<dots> = Timess (pders (s @ [c]) r1) r2 \<union> pder c r2 \<union> pders_lang (Suf s \<cdot> {[c]}) r2" |
|
227 |
by (simp add: pders_snoc) |
|
228 |
also have "\<dots> \<subseteq> Timess (pders (s @ [c]) r1) r2 \<union> pders_lang (Suf (s @ [c])) r2" |
|
187 | 229 |
by (auto simp add: Suf_snoc) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
230 |
finally show ?case . |
187 | 231 |
qed (simp) |
232 |
||
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
233 |
lemma pders_Star: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
234 |
assumes a: "s \<noteq> []" |
190 | 235 |
shows "pders s (Star r) \<subseteq> Timess (pders_lang (Suf s) r) (Star r)" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
236 |
using a |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
237 |
proof (induct s rule: rev_induct) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
238 |
case (snoc c s) |
190 | 239 |
have ih: "s \<noteq> [] \<Longrightarrow> pders s (Star r) \<subseteq> Timess (pders_lang (Suf s) r) (Star r)" by fact |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
240 |
{ assume asm: "s \<noteq> []" |
179 | 241 |
have "pders (s @ [c]) (Star r) = pder_set c (pders s (Star r))" by (simp add: pders_snoc) |
190 | 242 |
also have "\<dots> \<subseteq> pder_set c (Timess (pders_lang (Suf s) r) (Star r))" |
187 | 243 |
using ih[OF asm] by (auto) (blast) |
190 | 244 |
also have "\<dots> \<subseteq> Timess (pder_set c (pders_lang (Suf s) r)) (Star r) \<union> pder c (Star r)" |
245 |
by (auto split: if_splits) (blast)+ |
|
246 |
also have "\<dots> \<subseteq> Timess (pders_lang (Suf (s @ [c])) r) (Star r) \<union> (Timess (pder c r) (Star r))" |
|
247 |
by (auto simp add: Suf_snoc pders_lang_snoc) |
|
248 |
also have "\<dots> = Timess (pders_lang (Suf (s @ [c])) r) (Star r)" |
|
187 | 249 |
by (auto simp add: Suf_snoc Suf_Union pders_snoc) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
250 |
finally have ?case . |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
251 |
} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
252 |
moreover |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
253 |
{ assume asm: "s = []" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
254 |
then have ?case |
190 | 255 |
apply (auto simp add: pders_snoc Suf_def) |
256 |
apply(rule_tac x = "[c]" in exI) |
|
257 |
apply(auto) |
|
258 |
done |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
259 |
} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
260 |
ultimately show ?case by blast |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
261 |
qed (simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
262 |
|
179 | 263 |
definition |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
264 |
"UNIV1 \<equiv> UNIV - {[]}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
265 |
|
190 | 266 |
lemma pders_lang_Zero [simp]: |
267 |
shows "pders_lang UNIV1 Zero = {Zero}" |
|
179 | 268 |
unfolding UNIV1_def by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
269 |
|
190 | 270 |
lemma pders_lang_One [simp]: |
271 |
shows "pders_lang UNIV1 One = {Zero}" |
|
179 | 272 |
unfolding UNIV1_def by (auto split: if_splits) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
273 |
|
190 | 274 |
lemma pders_lang_Atom: |
275 |
shows "pders_lang UNIV1 (Atom c) \<subseteq> {One, Zero}" |
|
179 | 276 |
unfolding UNIV1_def by (auto split: if_splits) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
277 |
|
190 | 278 |
lemma pders_lang_Plus: |
279 |
shows "pders_lang UNIV1 (Plus r1 r2) = pders_lang UNIV1 r1 \<union> pders_lang UNIV1 r2" |
|
179 | 280 |
unfolding UNIV1_def by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
281 |
|
190 | 282 |
lemma pders_lang_Times_aux: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
283 |
assumes a: "s \<in> UNIV1" |
190 | 284 |
shows "pders_lang (Suf s) r \<subseteq> pders_lang UNIV1 r" |
285 |
using a unfolding UNIV1_def Suf_def by auto |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
286 |
|
190 | 287 |
lemma pders_lang_Times [intro]: |
288 |
shows "pders_lang UNIV1 (Times r1 r2) \<subseteq> Timess (pders_lang UNIV1 r1) r2 \<union> pders_lang UNIV1 r2" |
|
179 | 289 |
unfolding UNIV1_def |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
290 |
apply(rule UN_least) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
291 |
apply(rule subset_trans) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
292 |
apply(rule pders_Times) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
293 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
294 |
apply(rule conjI) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
295 |
apply(auto)[1] |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
296 |
apply(rule subset_trans) |
190 | 297 |
apply(rule pders_lang_Times_aux) |
179 | 298 |
apply(auto simp add: UNIV1_def) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
299 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
300 |
|
190 | 301 |
lemma pders_lang_Star [intro]: |
302 |
shows "pders_lang UNIV1 (Star r) \<subseteq> Timess (pders_lang UNIV1 r) (Star r)" |
|
179 | 303 |
unfolding UNIV1_def |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
304 |
apply(rule UN_least) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
305 |
apply(rule subset_trans) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
306 |
apply(rule pders_Star) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
307 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
308 |
apply(simp add: Suf_def) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
309 |
apply(auto) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
310 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
311 |
|
187 | 312 |
lemma finite_Timess: |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
313 |
assumes a: "finite A" |
187 | 314 |
shows "finite (Timess A r)" |
190 | 315 |
using a by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
316 |
|
190 | 317 |
lemma finite_pders_lang_UNIV1: |
318 |
shows "finite (pders_lang UNIV1 r)" |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
319 |
apply(induct r) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
320 |
apply(simp) |
190 | 321 |
apply(simp only: pders_lang_One) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
322 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
323 |
apply(rule finite_subset) |
190 | 324 |
apply(rule pders_lang_Atom) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
325 |
apply(simp) |
190 | 326 |
apply(simp only: pders_lang_Plus) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
327 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
328 |
apply(rule finite_subset) |
190 | 329 |
apply(rule pders_lang_Times) |
187 | 330 |
apply(simp only: finite_Timess finite_Un) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
331 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
332 |
apply(rule finite_subset) |
190 | 333 |
apply(rule pders_lang_Star) |
187 | 334 |
apply(simp only: finite_Timess) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
335 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
336 |
|
190 | 337 |
lemma pders_lang_UNIV_UNIV1: |
338 |
shows "pders_lang UNIV r = pders [] r \<union> pders_lang UNIV1 r" |
|
179 | 339 |
unfolding UNIV1_def |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
340 |
apply(auto) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
341 |
apply(rule_tac x="[]" in exI) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
342 |
apply(simp) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
343 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
344 |
|
190 | 345 |
lemma finite_pders_lang_UNIV: |
346 |
shows "finite (pders_lang UNIV r)" |
|
347 |
unfolding pders_lang_UNIV_UNIV1 |
|
348 |
by (simp add: finite_pders_lang_UNIV1) |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
349 |
|
190 | 350 |
lemma finite_pders_lang: |
351 |
shows "finite (pders_lang A r)" |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
352 |
apply(rule rev_finite_subset) |
190 | 353 |
apply(rule_tac r="r" in finite_pders_lang_UNIV) |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
354 |
apply(auto) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
355 |
done |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
356 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
357 |
lemma finite_pders: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
358 |
shows "finite (pders s r)" |
190 | 359 |
using finite_pders_lang[where A="{s}" and r="r"] |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
360 |
by simp |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
361 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
362 |
lemma finite_pders2: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
363 |
shows "finite {pders s r | s. s \<in> A}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
364 |
proof - |
190 | 365 |
have "{pders s r | s. s \<in> A} \<subseteq> Pow (pders_lang A r)" by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
366 |
moreover |
190 | 367 |
have "finite (Pow (pders_lang A r))" |
368 |
using finite_pders_lang by simp |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
369 |
ultimately |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
370 |
show "finite {pders s r | s. s \<in> A}" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
371 |
by(rule finite_subset) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
372 |
qed |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
373 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
374 |
|
179 | 375 |
text {* Relating the Myhill-Nerode relation with left-quotients. *} |
376 |
||
377 |
lemma MN_Rel_Ders: |
|
378 |
shows "x \<approx>A y \<longleftrightarrow> Ders x A = Ders y A" |
|
181 | 379 |
unfolding Ders_def str_eq_def |
179 | 380 |
by auto |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
381 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
382 |
subsection {* |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
383 |
The second direction of the Myhill-Nerode theorem using |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
384 |
partial derivatives. |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
385 |
*} |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
386 |
|
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
387 |
lemma Myhill_Nerode3: |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
388 |
fixes r::"'a rexp" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
389 |
shows "finite (UNIV // \<approx>(lang r))" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
390 |
proof - |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
391 |
have "finite (UNIV // =(\<lambda>x. pders x r)=)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
392 |
proof - |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
393 |
have "range (\<lambda>x. pders x r) = {pders s r | s. s \<in> UNIV}" by auto |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
394 |
moreover |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
395 |
have "finite {pders s r | s. s \<in> UNIV}" by (rule finite_pders2) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
396 |
ultimately |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
397 |
have "finite (range (\<lambda>x. pders x r))" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
398 |
by simp |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
399 |
then show "finite (UNIV // =(\<lambda>x. pders x r)=)" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
400 |
by (rule finite_eq_tag_rel) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
401 |
qed |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
402 |
moreover |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
403 |
have "=(\<lambda>x. pders x r)= \<subseteq> \<approx>(lang r)" |
181 | 404 |
unfolding tag_eq_def |
405 |
by (auto simp add: MN_Rel_Ders Ders_pders) |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
406 |
moreover |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
407 |
have "equiv UNIV =(\<lambda>x. pders x r)=" |
190 | 408 |
and "equiv UNIV (\<approx>(lang r))" |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
409 |
unfolding equiv_def refl_on_def sym_def trans_def |
190 | 410 |
unfolding tag_eq_def str_eq_def |
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
411 |
by auto |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
412 |
ultimately show "finite (UNIV // \<approx>(lang r))" |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
413 |
by (rule refined_partition_finite) |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
414 |
qed |
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
415 |
|
179 | 416 |
|
170
b1258b7d2789
made the theories compatible with the existing developments in the AFP; old theories are in the directory Attic
urbanc
parents:
diff
changeset
|
417 |
end |