author | Chengsong |
Thu, 12 Sep 2019 18:06:01 +0100 | |
changeset 350 | e4e507292bd8 |
parent 349 | e29812ea4427 |
child 356 | 8f9ea6453ba2 |
permissions | -rw-r--r-- |
337 | 1 |
|
2 |
theory BitCoded2 |
|
3 |
imports "Lexer" |
|
4 |
begin |
|
5 |
||
6 |
section \<open>Bit-Encodings\<close> |
|
7 |
||
8 |
datatype bit = Z | S |
|
9 |
||
10 |
fun |
|
11 |
code :: "val \<Rightarrow> bit list" |
|
12 |
where |
|
13 |
"code Void = []" |
|
14 |
| "code (Char c) = []" |
|
15 |
| "code (Left v) = Z # (code v)" |
|
16 |
| "code (Right v) = S # (code v)" |
|
17 |
| "code (Seq v1 v2) = (code v1) @ (code v2)" |
|
18 |
| "code (Stars []) = [S]" |
|
19 |
| "code (Stars (v # vs)) = (Z # code v) @ code (Stars vs)" |
|
20 |
||
21 |
||
22 |
fun |
|
23 |
Stars_add :: "val \<Rightarrow> val \<Rightarrow> val" |
|
24 |
where |
|
25 |
"Stars_add v (Stars vs) = Stars (v # vs)" |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
26 |
| "Stars_add v _ = Stars [v]" |
337 | 27 |
|
28 |
function |
|
29 |
decode' :: "bit list \<Rightarrow> rexp \<Rightarrow> (val * bit list)" |
|
30 |
where |
|
31 |
"decode' ds ZERO = (Void, [])" |
|
32 |
| "decode' ds ONE = (Void, ds)" |
|
33 |
| "decode' ds (CHAR d) = (Char d, ds)" |
|
34 |
| "decode' [] (ALT r1 r2) = (Void, [])" |
|
35 |
| "decode' (Z # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r1 in (Left v, ds'))" |
|
36 |
| "decode' (S # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r2 in (Right v, ds'))" |
|
37 |
| "decode' ds (SEQ r1 r2) = (let (v1, ds') = decode' ds r1 in |
|
38 |
let (v2, ds'') = decode' ds' r2 in (Seq v1 v2, ds''))" |
|
39 |
| "decode' [] (STAR r) = (Void, [])" |
|
40 |
| "decode' (S # ds) (STAR r) = (Stars [], ds)" |
|
41 |
| "decode' (Z # ds) (STAR r) = (let (v, ds') = decode' ds r in |
|
42 |
let (vs, ds'') = decode' ds' (STAR r) |
|
43 |
in (Stars_add v vs, ds''))" |
|
44 |
by pat_completeness auto |
|
45 |
||
46 |
lemma decode'_smaller: |
|
47 |
assumes "decode'_dom (ds, r)" |
|
48 |
shows "length (snd (decode' ds r)) \<le> length ds" |
|
49 |
using assms |
|
50 |
apply(induct ds r) |
|
51 |
apply(auto simp add: decode'.psimps split: prod.split) |
|
52 |
using dual_order.trans apply blast |
|
53 |
by (meson dual_order.trans le_SucI) |
|
54 |
||
55 |
termination "decode'" |
|
56 |
apply(relation "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s)) (%(ds,r). (r,ds))") |
|
57 |
apply(auto dest!: decode'_smaller) |
|
58 |
by (metis less_Suc_eq_le snd_conv) |
|
59 |
||
60 |
definition |
|
61 |
decode :: "bit list \<Rightarrow> rexp \<Rightarrow> val option" |
|
62 |
where |
|
63 |
"decode ds r \<equiv> (let (v, ds') = decode' ds r |
|
64 |
in (if ds' = [] then Some v else None))" |
|
65 |
||
66 |
lemma decode'_code_Stars: |
|
67 |
assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> (\<forall>x. decode' (code v @ x) r = (v, x)) \<and> flat v \<noteq> []" |
|
68 |
shows "decode' (code (Stars vs) @ ds) (STAR r) = (Stars vs, ds)" |
|
69 |
using assms |
|
70 |
apply(induct vs) |
|
71 |
apply(auto) |
|
72 |
done |
|
73 |
||
74 |
lemma decode'_code: |
|
75 |
assumes "\<Turnstile> v : r" |
|
76 |
shows "decode' ((code v) @ ds) r = (v, ds)" |
|
77 |
using assms |
|
78 |
apply(induct v r arbitrary: ds) |
|
79 |
apply(auto) |
|
80 |
using decode'_code_Stars by blast |
|
81 |
||
82 |
lemma decode_code: |
|
83 |
assumes "\<Turnstile> v : r" |
|
84 |
shows "decode (code v) r = Some v" |
|
85 |
using assms unfolding decode_def |
|
86 |
by (smt append_Nil2 decode'_code old.prod.case) |
|
87 |
||
88 |
||
89 |
section {* Annotated Regular Expressions *} |
|
90 |
||
91 |
datatype arexp = |
|
92 |
AZERO |
|
93 |
| AONE "bit list" |
|
94 |
| ACHAR "bit list" char |
|
95 |
| ASEQ "bit list" arexp arexp |
|
96 |
| AALTs "bit list" "arexp list" |
|
97 |
| ASTAR "bit list" arexp |
|
98 |
||
99 |
abbreviation |
|
100 |
"AALT bs r1 r2 \<equiv> AALTs bs [r1, r2]" |
|
101 |
||
102 |
fun asize :: "arexp \<Rightarrow> nat" where |
|
103 |
"asize AZERO = 1" |
|
104 |
| "asize (AONE cs) = 1" |
|
105 |
| "asize (ACHAR cs c) = 1" |
|
106 |
| "asize (AALTs cs rs) = Suc (sum_list (map asize rs))" |
|
107 |
| "asize (ASEQ cs r1 r2) = Suc (asize r1 + asize r2)" |
|
108 |
| "asize (ASTAR cs r) = Suc (asize r)" |
|
109 |
||
110 |
fun |
|
111 |
erase :: "arexp \<Rightarrow> rexp" |
|
112 |
where |
|
113 |
"erase AZERO = ZERO" |
|
114 |
| "erase (AONE _) = ONE" |
|
115 |
| "erase (ACHAR _ c) = CHAR c" |
|
116 |
| "erase (AALTs _ []) = ZERO" |
|
117 |
| "erase (AALTs _ [r]) = (erase r)" |
|
118 |
| "erase (AALTs bs (r#rs)) = ALT (erase r) (erase (AALTs bs rs))" |
|
119 |
| "erase (ASEQ _ r1 r2) = SEQ (erase r1) (erase r2)" |
|
120 |
| "erase (ASTAR _ r) = STAR (erase r)" |
|
121 |
||
122 |
lemma decode_code_erase: |
|
123 |
assumes "\<Turnstile> v : (erase a)" |
|
124 |
shows "decode (code v) (erase a) = Some v" |
|
125 |
using assms |
|
126 |
by (simp add: decode_code) |
|
127 |
||
128 |
||
129 |
fun nonalt :: "arexp \<Rightarrow> bool" |
|
130 |
where |
|
131 |
"nonalt (AALTs bs2 rs) = False" |
|
132 |
| "nonalt r = True" |
|
133 |
||
134 |
||
135 |
fun good :: "arexp \<Rightarrow> bool" where |
|
136 |
"good AZERO = False" |
|
137 |
| "good (AONE cs) = True" |
|
138 |
| "good (ACHAR cs c) = True" |
|
139 |
| "good (AALTs cs []) = False" |
|
140 |
| "good (AALTs cs [r]) = False" |
|
141 |
| "good (AALTs cs (r1#r2#rs)) = (\<forall>r' \<in> set (r1#r2#rs). good r' \<and> nonalt r')" |
|
142 |
| "good (ASEQ _ AZERO _) = False" |
|
143 |
| "good (ASEQ _ (AONE _) _) = False" |
|
144 |
| "good (ASEQ _ _ AZERO) = False" |
|
145 |
| "good (ASEQ cs r1 r2) = (good r1 \<and> good r2)" |
|
146 |
| "good (ASTAR cs r) = True" |
|
147 |
||
148 |
||
149 |
||
150 |
||
151 |
fun fuse :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp" where |
|
152 |
"fuse bs AZERO = AZERO" |
|
153 |
| "fuse bs (AONE cs) = AONE (bs @ cs)" |
|
154 |
| "fuse bs (ACHAR cs c) = ACHAR (bs @ cs) c" |
|
155 |
| "fuse bs (AALTs cs rs) = AALTs (bs @ cs) rs" |
|
156 |
| "fuse bs (ASEQ cs r1 r2) = ASEQ (bs @ cs) r1 r2" |
|
157 |
| "fuse bs (ASTAR cs r) = ASTAR (bs @ cs) r" |
|
158 |
||
159 |
lemma fuse_append: |
|
160 |
shows "fuse (bs1 @ bs2) r = fuse bs1 (fuse bs2 r)" |
|
161 |
apply(induct r) |
|
162 |
apply(auto) |
|
163 |
done |
|
164 |
||
165 |
||
166 |
fun intern :: "rexp \<Rightarrow> arexp" where |
|
167 |
"intern ZERO = AZERO" |
|
168 |
| "intern ONE = AONE []" |
|
169 |
| "intern (CHAR c) = ACHAR [] c" |
|
170 |
| "intern (ALT r1 r2) = AALT [] (fuse [Z] (intern r1)) |
|
171 |
(fuse [S] (intern r2))" |
|
172 |
| "intern (SEQ r1 r2) = ASEQ [] (intern r1) (intern r2)" |
|
173 |
| "intern (STAR r) = ASTAR [] (intern r)" |
|
174 |
||
175 |
||
176 |
fun retrieve :: "arexp \<Rightarrow> val \<Rightarrow> bit list" where |
|
177 |
"retrieve (AONE bs) Void = bs" |
|
178 |
| "retrieve (ACHAR bs c) (Char d) = bs" |
|
179 |
| "retrieve (AALTs bs [r]) v = bs @ retrieve r v" |
|
180 |
| "retrieve (AALTs bs (r#rs)) (Left v) = bs @ retrieve r v" |
|
181 |
| "retrieve (AALTs bs (r#rs)) (Right v) = bs @ retrieve (AALTs [] rs) v" |
|
182 |
| "retrieve (ASEQ bs r1 r2) (Seq v1 v2) = bs @ retrieve r1 v1 @ retrieve r2 v2" |
|
183 |
| "retrieve (ASTAR bs r) (Stars []) = bs @ [S]" |
|
184 |
| "retrieve (ASTAR bs r) (Stars (v#vs)) = |
|
185 |
bs @ [Z] @ retrieve r v @ retrieve (ASTAR [] r) (Stars vs)" |
|
186 |
||
187 |
||
188 |
||
189 |
fun |
|
190 |
bnullable :: "arexp \<Rightarrow> bool" |
|
191 |
where |
|
192 |
"bnullable (AZERO) = False" |
|
193 |
| "bnullable (AONE bs) = True" |
|
194 |
| "bnullable (ACHAR bs c) = False" |
|
195 |
| "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)" |
|
196 |
| "bnullable (ASEQ bs r1 r2) = (bnullable r1 \<and> bnullable r2)" |
|
197 |
| "bnullable (ASTAR bs r) = True" |
|
198 |
||
199 |
fun |
|
200 |
bmkeps :: "arexp \<Rightarrow> bit list" |
|
201 |
where |
|
202 |
"bmkeps(AONE bs) = bs" |
|
203 |
| "bmkeps(ASEQ bs r1 r2) = bs @ (bmkeps r1) @ (bmkeps r2)" |
|
204 |
| "bmkeps(AALTs bs [r]) = bs @ (bmkeps r)" |
|
205 |
| "bmkeps(AALTs bs (r#rs)) = (if bnullable(r) then bs @ (bmkeps r) else (bmkeps (AALTs bs rs)))" |
|
206 |
| "bmkeps(ASTAR bs r) = bs @ [S]" |
|
207 |
||
208 |
||
209 |
fun |
|
210 |
bder :: "char \<Rightarrow> arexp \<Rightarrow> arexp" |
|
211 |
where |
|
212 |
"bder c (AZERO) = AZERO" |
|
213 |
| "bder c (AONE bs) = AZERO" |
|
214 |
| "bder c (ACHAR bs d) = (if c = d then AONE bs else AZERO)" |
|
215 |
| "bder c (AALTs bs rs) = AALTs bs (map (bder c) rs)" |
|
216 |
| "bder c (ASEQ bs r1 r2) = |
|
217 |
(if bnullable r1 |
|
218 |
then AALT bs (ASEQ [] (bder c r1) r2) (fuse (bmkeps r1) (bder c r2)) |
|
219 |
else ASEQ bs (bder c r1) r2)" |
|
220 |
| "bder c (ASTAR bs r) = ASEQ bs (fuse [Z] (bder c r)) (ASTAR [] r)" |
|
221 |
||
222 |
||
223 |
fun |
|
224 |
bders :: "arexp \<Rightarrow> string \<Rightarrow> arexp" |
|
225 |
where |
|
226 |
"bders r [] = r" |
|
227 |
| "bders r (c#s) = bders (bder c r) s" |
|
228 |
||
229 |
lemma bders_append: |
|
230 |
"bders r (s1 @ s2) = bders (bders r s1) s2" |
|
231 |
apply(induct s1 arbitrary: r s2) |
|
232 |
apply(simp_all) |
|
233 |
done |
|
234 |
||
235 |
lemma bnullable_correctness: |
|
236 |
shows "nullable (erase r) = bnullable r" |
|
237 |
apply(induct r rule: erase.induct) |
|
238 |
apply(simp_all) |
|
239 |
done |
|
240 |
||
241 |
lemma erase_fuse: |
|
242 |
shows "erase (fuse bs r) = erase r" |
|
243 |
apply(induct r rule: erase.induct) |
|
244 |
apply(simp_all) |
|
245 |
done |
|
246 |
||
247 |
lemma erase_intern [simp]: |
|
248 |
shows "erase (intern r) = r" |
|
249 |
apply(induct r) |
|
250 |
apply(simp_all add: erase_fuse) |
|
251 |
done |
|
252 |
||
253 |
lemma erase_bder [simp]: |
|
254 |
shows "erase (bder a r) = der a (erase r)" |
|
255 |
apply(induct r rule: erase.induct) |
|
256 |
apply(simp_all add: erase_fuse bnullable_correctness) |
|
257 |
done |
|
258 |
||
259 |
lemma erase_bders [simp]: |
|
260 |
shows "erase (bders r s) = ders s (erase r)" |
|
261 |
apply(induct s arbitrary: r ) |
|
262 |
apply(simp_all) |
|
263 |
done |
|
264 |
||
265 |
lemma retrieve_encode_STARS: |
|
266 |
assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> code v = retrieve (intern r) v" |
|
267 |
shows "code (Stars vs) = retrieve (ASTAR [] (intern r)) (Stars vs)" |
|
268 |
using assms |
|
269 |
apply(induct vs) |
|
270 |
apply(simp_all) |
|
271 |
done |
|
272 |
||
273 |
lemma retrieve_fuse2: |
|
274 |
assumes "\<Turnstile> v : (erase r)" |
|
275 |
shows "retrieve (fuse bs r) v = bs @ retrieve r v" |
|
276 |
using assms |
|
277 |
apply(induct r arbitrary: v bs) |
|
278 |
apply(auto elim: Prf_elims)[4] |
|
279 |
defer |
|
280 |
using retrieve_encode_STARS |
|
281 |
apply(auto elim!: Prf_elims)[1] |
|
282 |
apply(case_tac vs) |
|
283 |
apply(simp) |
|
284 |
apply(simp) |
|
285 |
(* AALTs case *) |
|
286 |
apply(simp) |
|
287 |
apply(case_tac x2a) |
|
288 |
apply(simp) |
|
289 |
apply(auto elim!: Prf_elims)[1] |
|
290 |
apply(simp) |
|
291 |
apply(case_tac list) |
|
292 |
apply(simp) |
|
293 |
apply(auto) |
|
294 |
apply(auto elim!: Prf_elims)[1] |
|
295 |
done |
|
296 |
||
297 |
lemma retrieve_fuse: |
|
298 |
assumes "\<Turnstile> v : r" |
|
299 |
shows "retrieve (fuse bs (intern r)) v = bs @ retrieve (intern r) v" |
|
300 |
using assms |
|
301 |
by (simp_all add: retrieve_fuse2) |
|
302 |
||
303 |
||
304 |
lemma retrieve_code: |
|
305 |
assumes "\<Turnstile> v : r" |
|
306 |
shows "code v = retrieve (intern r) v" |
|
307 |
using assms |
|
308 |
apply(induct v r ) |
|
309 |
apply(simp_all add: retrieve_fuse retrieve_encode_STARS) |
|
310 |
done |
|
311 |
||
312 |
lemma r: |
|
313 |
assumes "bnullable (AALTs bs (a # rs))" |
|
314 |
shows "bnullable a \<or> (\<not> bnullable a \<and> bnullable (AALTs bs rs))" |
|
315 |
using assms |
|
316 |
apply(induct rs) |
|
317 |
apply(auto) |
|
318 |
done |
|
319 |
||
320 |
lemma r0: |
|
321 |
assumes "bnullable a" |
|
322 |
shows "bmkeps (AALTs bs (a # rs)) = bs @ (bmkeps a)" |
|
323 |
using assms |
|
324 |
by (metis bmkeps.simps(3) bmkeps.simps(4) list.exhaust) |
|
325 |
||
326 |
lemma r1: |
|
327 |
assumes "\<not> bnullable a" "bnullable (AALTs bs rs)" |
|
328 |
shows "bmkeps (AALTs bs (a # rs)) = bmkeps (AALTs bs rs)" |
|
329 |
using assms |
|
330 |
apply(induct rs) |
|
331 |
apply(auto) |
|
332 |
done |
|
333 |
||
334 |
lemma r2: |
|
335 |
assumes "x \<in> set rs" "bnullable x" |
|
336 |
shows "bnullable (AALTs bs rs)" |
|
337 |
using assms |
|
338 |
apply(induct rs) |
|
339 |
apply(auto) |
|
340 |
done |
|
341 |
||
342 |
lemma r3: |
|
343 |
assumes "\<not> bnullable r" |
|
344 |
" \<exists> x \<in> set rs. bnullable x" |
|
345 |
shows "retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs))) = |
|
346 |
retrieve (AALTs bs (r # rs)) (mkeps (erase (AALTs bs (r # rs))))" |
|
347 |
using assms |
|
348 |
apply(induct rs arbitrary: r bs) |
|
349 |
apply(auto)[1] |
|
350 |
apply(auto) |
|
351 |
using bnullable_correctness apply blast |
|
352 |
apply(auto simp add: bnullable_correctness mkeps_nullable retrieve_fuse2) |
|
353 |
apply(subst retrieve_fuse2[symmetric]) |
|
354 |
apply (smt bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable) |
|
355 |
apply(simp) |
|
356 |
apply(case_tac "bnullable a") |
|
357 |
apply (smt append_Nil2 bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) fuse.simps(4) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable retrieve_fuse2) |
|
358 |
apply(drule_tac x="a" in meta_spec) |
|
359 |
apply(drule_tac x="bs" in meta_spec) |
|
360 |
apply(drule meta_mp) |
|
361 |
apply(simp) |
|
362 |
apply(drule meta_mp) |
|
363 |
apply(auto) |
|
364 |
apply(subst retrieve_fuse2[symmetric]) |
|
365 |
apply(case_tac rs) |
|
366 |
apply(simp) |
|
367 |
apply(auto)[1] |
|
368 |
apply (simp add: bnullable_correctness) |
|
369 |
apply (metis append_Nil2 bnullable_correctness erase_fuse fuse.simps(4) list.set_intros(1) mkeps.simps(3) mkeps_nullable nullable.simps(4) r2) |
|
370 |
apply (simp add: bnullable_correctness) |
|
371 |
apply (metis append_Nil2 bnullable_correctness erase.simps(6) erase_fuse fuse.simps(4) list.set_intros(2) mkeps.simps(3) mkeps_nullable r2) |
|
372 |
apply(simp) |
|
373 |
done |
|
374 |
||
375 |
||
376 |
lemma t: |
|
377 |
assumes "\<forall>r \<in> set rs. nullable (erase r) \<longrightarrow> bmkeps r = retrieve r (mkeps (erase r))" |
|
378 |
"nullable (erase (AALTs bs rs))" |
|
379 |
shows " bmkeps (AALTs bs rs) = retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs)))" |
|
380 |
using assms |
|
381 |
apply(induct rs arbitrary: bs) |
|
382 |
apply(simp) |
|
383 |
apply(auto simp add: bnullable_correctness) |
|
384 |
apply(case_tac rs) |
|
385 |
apply(auto simp add: bnullable_correctness)[2] |
|
386 |
apply(subst r1) |
|
387 |
apply(simp) |
|
388 |
apply(rule r2) |
|
389 |
apply(assumption) |
|
390 |
apply(simp) |
|
391 |
apply(drule_tac x="bs" in meta_spec) |
|
392 |
apply(drule meta_mp) |
|
393 |
apply(auto)[1] |
|
394 |
prefer 2 |
|
395 |
apply(case_tac "bnullable a") |
|
396 |
apply(subst r0) |
|
397 |
apply blast |
|
398 |
apply(subgoal_tac "nullable (erase a)") |
|
399 |
prefer 2 |
|
400 |
using bnullable_correctness apply blast |
|
401 |
apply (metis (no_types, lifting) erase.simps(5) erase.simps(6) list.exhaust mkeps.simps(3) retrieve.simps(3) retrieve.simps(4)) |
|
402 |
apply(subst r1) |
|
403 |
apply(simp) |
|
404 |
using r2 apply blast |
|
405 |
apply(drule_tac x="bs" in meta_spec) |
|
406 |
apply(drule meta_mp) |
|
407 |
apply(auto)[1] |
|
408 |
apply(simp) |
|
409 |
using r3 apply blast |
|
410 |
apply(auto) |
|
411 |
using r3 by blast |
|
412 |
||
413 |
lemma bmkeps_retrieve: |
|
414 |
assumes "nullable (erase r)" |
|
415 |
shows "bmkeps r = retrieve r (mkeps (erase r))" |
|
416 |
using assms |
|
417 |
apply(induct r) |
|
418 |
apply(simp) |
|
419 |
apply(simp) |
|
420 |
apply(simp) |
|
421 |
apply(simp) |
|
422 |
defer |
|
423 |
apply(simp) |
|
424 |
apply(rule t) |
|
425 |
apply(auto) |
|
426 |
done |
|
427 |
||
428 |
lemma bder_retrieve: |
|
429 |
assumes "\<Turnstile> v : der c (erase r)" |
|
430 |
shows "retrieve (bder c r) v = retrieve r (injval (erase r) c v)" |
|
431 |
using assms |
|
432 |
apply(induct r arbitrary: v rule: erase.induct) |
|
433 |
apply(simp) |
|
434 |
apply(erule Prf_elims) |
|
435 |
apply(simp) |
|
436 |
apply(erule Prf_elims) |
|
437 |
apply(simp) |
|
438 |
apply(case_tac "c = ca") |
|
439 |
apply(simp) |
|
440 |
apply(erule Prf_elims) |
|
441 |
apply(simp) |
|
442 |
apply(simp) |
|
443 |
apply(erule Prf_elims) |
|
444 |
apply(simp) |
|
445 |
apply(erule Prf_elims) |
|
446 |
apply(simp) |
|
447 |
apply(simp) |
|
448 |
apply(rename_tac "r\<^sub>1" "r\<^sub>2" rs v) |
|
449 |
apply(erule Prf_elims) |
|
450 |
apply(simp) |
|
451 |
apply(simp) |
|
452 |
apply(case_tac rs) |
|
453 |
apply(simp) |
|
454 |
apply(simp) |
|
455 |
apply (smt Prf_elims(3) injval.simps(2) injval.simps(3) retrieve.simps(4) retrieve.simps(5) same_append_eq) |
|
456 |
apply(simp) |
|
457 |
apply(case_tac "nullable (erase r1)") |
|
458 |
apply(simp) |
|
459 |
apply(erule Prf_elims) |
|
460 |
apply(subgoal_tac "bnullable r1") |
|
461 |
prefer 2 |
|
462 |
using bnullable_correctness apply blast |
|
463 |
apply(simp) |
|
464 |
apply(erule Prf_elims) |
|
465 |
apply(simp) |
|
466 |
apply(subgoal_tac "bnullable r1") |
|
467 |
prefer 2 |
|
468 |
using bnullable_correctness apply blast |
|
469 |
apply(simp) |
|
470 |
apply(simp add: retrieve_fuse2) |
|
471 |
apply(simp add: bmkeps_retrieve) |
|
472 |
apply(simp) |
|
473 |
apply(erule Prf_elims) |
|
474 |
apply(simp) |
|
475 |
using bnullable_correctness apply blast |
|
476 |
apply(rename_tac bs r v) |
|
477 |
apply(simp) |
|
478 |
apply(erule Prf_elims) |
|
479 |
apply(clarify) |
|
480 |
apply(erule Prf_elims) |
|
481 |
apply(clarify) |
|
482 |
apply(subst injval.simps) |
|
483 |
apply(simp del: retrieve.simps) |
|
484 |
apply(subst retrieve.simps) |
|
485 |
apply(subst retrieve.simps) |
|
486 |
apply(simp) |
|
487 |
apply(simp add: retrieve_fuse2) |
|
488 |
done |
|
489 |
||
490 |
||
491 |
||
492 |
lemma MAIN_decode: |
|
493 |
assumes "\<Turnstile> v : ders s r" |
|
494 |
shows "Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r" |
|
495 |
using assms |
|
496 |
proof (induct s arbitrary: v rule: rev_induct) |
|
497 |
case Nil |
|
498 |
have "\<Turnstile> v : ders [] r" by fact |
|
499 |
then have "\<Turnstile> v : r" by simp |
|
500 |
then have "Some v = decode (retrieve (intern r) v) r" |
|
501 |
using decode_code retrieve_code by auto |
|
502 |
then show "Some (flex r id [] v) = decode (retrieve (bders (intern r) []) v) r" |
|
503 |
by simp |
|
504 |
next |
|
505 |
case (snoc c s v) |
|
506 |
have IH: "\<And>v. \<Turnstile> v : ders s r \<Longrightarrow> |
|
507 |
Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r" by fact |
|
508 |
have asm: "\<Turnstile> v : ders (s @ [c]) r" by fact |
|
509 |
then have asm2: "\<Turnstile> injval (ders s r) c v : ders s r" |
|
510 |
by (simp add: Prf_injval ders_append) |
|
511 |
have "Some (flex r id (s @ [c]) v) = Some (flex r id s (injval (ders s r) c v))" |
|
512 |
by (simp add: flex_append) |
|
513 |
also have "... = decode (retrieve (bders (intern r) s) (injval (ders s r) c v)) r" |
|
514 |
using asm2 IH by simp |
|
515 |
also have "... = decode (retrieve (bder c (bders (intern r) s)) v) r" |
|
516 |
using asm by (simp_all add: bder_retrieve ders_append) |
|
517 |
finally show "Some (flex r id (s @ [c]) v) = |
|
518 |
decode (retrieve (bders (intern r) (s @ [c])) v) r" by (simp add: bders_append) |
|
519 |
qed |
|
520 |
||
521 |
||
522 |
definition blex where |
|
523 |
"blex a s \<equiv> if bnullable (bders a s) then Some (bmkeps (bders a s)) else None" |
|
524 |
||
525 |
||
526 |
||
527 |
definition blexer where |
|
528 |
"blexer r s \<equiv> if bnullable (bders (intern r) s) then |
|
529 |
decode (bmkeps (bders (intern r) s)) r else None" |
|
530 |
||
531 |
lemma blexer_correctness: |
|
532 |
shows "blexer r s = lexer r s" |
|
533 |
proof - |
|
534 |
{ define bds where "bds \<equiv> bders (intern r) s" |
|
535 |
define ds where "ds \<equiv> ders s r" |
|
536 |
assume asm: "nullable ds" |
|
537 |
have era: "erase bds = ds" |
|
538 |
unfolding ds_def bds_def by simp |
|
539 |
have mke: "\<Turnstile> mkeps ds : ds" |
|
540 |
using asm by (simp add: mkeps_nullable) |
|
541 |
have "decode (bmkeps bds) r = decode (retrieve bds (mkeps ds)) r" |
|
542 |
using bmkeps_retrieve |
|
543 |
using asm era by (simp add: bmkeps_retrieve) |
|
544 |
also have "... = Some (flex r id s (mkeps ds))" |
|
545 |
using mke by (simp_all add: MAIN_decode ds_def bds_def) |
|
546 |
finally have "decode (bmkeps bds) r = Some (flex r id s (mkeps ds))" |
|
547 |
unfolding bds_def ds_def . |
|
548 |
} |
|
549 |
then show "blexer r s = lexer r s" |
|
550 |
unfolding blexer_def lexer_flex |
|
551 |
apply(subst bnullable_correctness[symmetric]) |
|
552 |
apply(simp) |
|
553 |
done |
|
554 |
qed |
|
555 |
||
556 |
lemma asize0: |
|
557 |
shows "0 < asize r" |
|
558 |
apply(induct r) |
|
559 |
apply(auto) |
|
560 |
done |
|
561 |
||
562 |
lemma asize_fuse: |
|
563 |
shows "asize (fuse bs r) = asize r" |
|
564 |
apply(induct r) |
|
565 |
apply(auto) |
|
566 |
done |
|
567 |
||
568 |
lemma bder_fuse: |
|
569 |
shows "bder c (fuse bs a) = fuse bs (bder c a)" |
|
570 |
apply(induct a arbitrary: bs c) |
|
571 |
apply(simp_all) |
|
572 |
done |
|
573 |
||
574 |
lemma map_bder_fuse: |
|
575 |
shows "map (bder c \<circ> fuse bs1) as1 = map (fuse bs1) (map (bder c) as1)" |
|
576 |
apply(induct as1) |
|
577 |
apply(auto simp add: bder_fuse) |
|
578 |
done |
|
579 |
||
580 |
||
581 |
fun nonnested :: "arexp \<Rightarrow> bool" |
|
582 |
where |
|
583 |
"nonnested (AALTs bs2 []) = True" |
|
584 |
| "nonnested (AALTs bs2 ((AALTs bs1 rs1) # rs2)) = False" |
|
585 |
| "nonnested (AALTs bs2 (r # rs2)) = nonnested (AALTs bs2 rs2)" |
|
586 |
| "nonnested r = True" |
|
587 |
||
588 |
||
589 |
||
590 |
fun distinctBy :: "'a list \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b set \<Rightarrow> 'a list" |
|
591 |
where |
|
592 |
"distinctBy [] f acc = []" |
|
593 |
| "distinctBy (x#xs) f acc = |
|
594 |
(if (f x) \<in> acc then distinctBy xs f acc |
|
595 |
else x # (distinctBy xs f ({f x} \<union> acc)))" |
|
596 |
||
597 |
fun flts :: "arexp list \<Rightarrow> arexp list" |
|
598 |
where |
|
599 |
"flts [] = []" |
|
600 |
| "flts (AZERO # rs) = flts rs" |
|
601 |
| "flts ((AALTs bs rs1) # rs) = (map (fuse bs) rs1) @ flts rs" |
|
602 |
| "flts (r1 # rs) = r1 # flts rs" |
|
603 |
||
604 |
||
605 |
fun spill :: "arexp list \<Rightarrow> arexp list" |
|
606 |
where |
|
607 |
"spill [] = []" |
|
608 |
| "spill ((AALTs bs rs1) # rs) = (map (fuse bs) rs1) @ spill rs" |
|
609 |
| "spill (r1 # rs) = r1 # spill rs" |
|
610 |
||
611 |
lemma spill_Cons: |
|
612 |
shows "spill (r # rs1) = spill [r] @ spill rs1" |
|
613 |
apply(induct r arbitrary: rs1) |
|
614 |
apply(auto) |
|
615 |
done |
|
616 |
||
617 |
lemma spill_append: |
|
618 |
shows "spill (rs1 @ rs2) = spill rs1 @ spill rs2" |
|
619 |
apply(induct rs1 arbitrary: rs2) |
|
620 |
apply(auto) |
|
621 |
by (metis append.assoc spill_Cons) |
|
622 |
||
623 |
fun bsimp_ASEQ :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp \<Rightarrow> arexp" |
|
624 |
where |
|
625 |
"bsimp_ASEQ _ AZERO _ = AZERO" |
|
626 |
| "bsimp_ASEQ _ _ AZERO = AZERO" |
|
627 |
| "bsimp_ASEQ bs1 (AONE bs2) r2 = fuse (bs1 @ bs2) r2" |
|
628 |
| "bsimp_ASEQ bs1 r1 r2 = ASEQ bs1 r1 r2" |
|
629 |
||
630 |
||
631 |
fun bsimp_AALTs :: "bit list \<Rightarrow> arexp list \<Rightarrow> arexp" |
|
632 |
where |
|
633 |
"bsimp_AALTs _ [] = AZERO" |
|
634 |
| "bsimp_AALTs bs1 [r] = fuse bs1 r" |
|
635 |
| "bsimp_AALTs bs1 rs = AALTs bs1 rs" |
|
636 |
||
637 |
||
638 |
fun bsimp :: "arexp \<Rightarrow> arexp" |
|
639 |
where |
|
640 |
"bsimp (ASEQ bs1 r1 r2) = bsimp_ASEQ bs1 (bsimp r1) (bsimp r2)" |
|
641 |
| "bsimp (AALTs bs1 rs) = bsimp_AALTs bs1 (flts (map bsimp rs))" |
|
642 |
| "bsimp r = r" |
|
643 |
||
343 | 644 |
|
645 |
inductive contains2 :: "arexp \<Rightarrow> bit list \<Rightarrow> bool" ("_ >>2 _" [51, 50] 50) |
|
646 |
where |
|
647 |
"AONE bs >>2 bs" |
|
648 |
| "ACHAR bs c >>2 bs" |
|
649 |
| "\<lbrakk>a1 >>2 bs1; a2 >>2 bs2\<rbrakk> \<Longrightarrow> ASEQ bs a1 a2 >>2 bs @ bs1 @ bs2" |
|
650 |
| "r >>2 bs1 \<Longrightarrow> AALTs bs (r#rs) >>2 bs @ bs1" |
|
651 |
| "AALTs bs rs >>2 bs @ bs1 \<Longrightarrow> AALTs bs (r#rs) >>2 bs @ bs1" |
|
652 |
| "ASTAR bs r >>2 bs @ [S]" |
|
653 |
| "\<lbrakk>r >>2 bs1; ASTAR [] r >>2 bs2\<rbrakk> \<Longrightarrow> ASTAR bs r >>2 bs @ Z # bs1 @ bs2" |
|
654 |
| "r >>2 bs \<Longrightarrow> (bsimp r) >>2 bs" |
|
655 |
||
656 |
||
337 | 657 |
inductive contains :: "arexp \<Rightarrow> bit list \<Rightarrow> bool" ("_ >> _" [51, 50] 50) |
658 |
where |
|
659 |
"AONE bs >> bs" |
|
660 |
| "ACHAR bs c >> bs" |
|
661 |
| "\<lbrakk>a1 >> bs1; a2 >> bs2\<rbrakk> \<Longrightarrow> ASEQ bs a1 a2 >> bs @ bs1 @ bs2" |
|
662 |
| "r >> bs1 \<Longrightarrow> AALTs bs (r#rs) >> bs @ bs1" |
|
663 |
| "AALTs bs rs >> bs @ bs1 \<Longrightarrow> AALTs bs (r#rs) >> bs @ bs1" |
|
664 |
| "ASTAR bs r >> bs @ [S]" |
|
665 |
| "\<lbrakk>r >> bs1; ASTAR [] r >> bs2\<rbrakk> \<Longrightarrow> ASTAR bs r >> bs @ Z # bs1 @ bs2" |
|
666 |
||
667 |
lemma contains0: |
|
668 |
assumes "a >> bs" |
|
669 |
shows "(fuse bs1 a) >> bs1 @ bs" |
|
670 |
using assms |
|
671 |
apply(induct arbitrary: bs1) |
|
672 |
apply(auto intro: contains.intros) |
|
673 |
apply (metis append.assoc contains.intros(3)) |
|
674 |
apply (metis append.assoc contains.intros(4)) |
|
675 |
apply (metis append.assoc contains.intros(5)) |
|
676 |
apply (metis append.assoc contains.intros(6)) |
|
677 |
apply (metis append_assoc contains.intros(7)) |
|
678 |
done |
|
679 |
||
680 |
lemma contains1: |
|
681 |
assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> intern r >> code v" |
|
682 |
shows "ASTAR [] (intern r) >> code (Stars vs)" |
|
683 |
using assms |
|
684 |
apply(induct vs) |
|
685 |
apply(simp) |
|
686 |
using contains.simps apply blast |
|
687 |
apply(simp) |
|
688 |
apply(subst (2) append_Nil[symmetric]) |
|
689 |
apply(rule contains.intros) |
|
690 |
apply(auto) |
|
691 |
done |
|
692 |
||
693 |
||
343 | 694 |
|
695 |
||
696 |
||
337 | 697 |
lemma contains2: |
698 |
assumes "\<Turnstile> v : r" |
|
699 |
shows "(intern r) >> code v" |
|
700 |
using assms |
|
701 |
apply(induct) |
|
702 |
prefer 4 |
|
703 |
apply(simp) |
|
704 |
apply(rule contains.intros) |
|
705 |
prefer 4 |
|
706 |
apply(simp) |
|
707 |
apply(rule contains.intros) |
|
708 |
apply(simp) |
|
709 |
apply(subst (3) append_Nil[symmetric]) |
|
710 |
apply(rule contains.intros) |
|
711 |
apply(simp) |
|
712 |
apply(simp) |
|
713 |
apply(simp) |
|
714 |
apply(subst (9) append_Nil[symmetric]) |
|
715 |
apply(rule contains.intros) |
|
716 |
apply (metis append_Cons append_self_conv2 contains0) |
|
717 |
apply(simp) |
|
718 |
apply(subst (9) append_Nil[symmetric]) |
|
719 |
apply(rule contains.intros) |
|
720 |
back |
|
721 |
apply(rule contains.intros) |
|
722 |
apply(drule_tac ?bs1.0="[S]" in contains0) |
|
723 |
apply(simp) |
|
724 |
apply(simp) |
|
725 |
apply(case_tac vs) |
|
726 |
apply(simp) |
|
727 |
apply (metis append_Nil contains.intros(6)) |
|
728 |
using contains1 by blast |
|
729 |
||
730 |
lemma qq1: |
|
731 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
732 |
shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs)" |
|
733 |
using assms |
|
734 |
apply(induct rs arbitrary: rs1 bs) |
|
735 |
apply(simp) |
|
736 |
apply(simp) |
|
737 |
by (metis Nil_is_append_conv bmkeps.simps(4) neq_Nil_conv r0 split_list_last) |
|
738 |
||
739 |
lemma qq2: |
|
740 |
assumes "\<forall>r \<in> set rs. \<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r" |
|
741 |
shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs1)" |
|
742 |
using assms |
|
743 |
apply(induct rs arbitrary: rs1 bs) |
|
744 |
apply(simp) |
|
745 |
apply(simp) |
|
746 |
by (metis append_assoc in_set_conv_decomp r1 r2) |
|
747 |
||
748 |
lemma qq2a: |
|
749 |
assumes "\<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r" |
|
750 |
shows "bmkeps (AALTs bs (r # rs1)) = bmkeps (AALTs bs rs1)" |
|
751 |
using assms |
|
752 |
by (simp add: r1) |
|
753 |
||
754 |
lemma qq3: |
|
755 |
shows "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)" |
|
756 |
apply(induct rs arbitrary: bs) |
|
757 |
apply(simp) |
|
758 |
apply(simp) |
|
759 |
done |
|
760 |
||
761 |
lemma qq4: |
|
762 |
assumes "bnullable (AALTs bs rs)" |
|
763 |
shows "bmkeps (AALTs bs rs) = bs @ bmkeps (AALTs [] rs)" |
|
764 |
by (metis append_Nil2 assms bmkeps_retrieve bnullable_correctness erase_fuse fuse.simps(4) mkeps_nullable retrieve_fuse2) |
|
765 |
||
766 |
||
767 |
lemma contains3a: |
|
768 |
assumes "AALTs bs lst >> bs @ bs1" |
|
769 |
shows "AALTs bs (a # lst) >> bs @ bs1" |
|
770 |
using assms |
|
771 |
apply - |
|
772 |
by (simp add: contains.intros(5)) |
|
773 |
||
774 |
||
775 |
lemma contains3b: |
|
776 |
assumes "a >> bs1" |
|
777 |
shows "AALTs bs (a # lst) >> bs @ bs1" |
|
778 |
using assms |
|
779 |
apply - |
|
780 |
apply(rule contains.intros) |
|
781 |
apply(simp) |
|
782 |
done |
|
783 |
||
784 |
||
785 |
lemma contains3: |
|
786 |
assumes "\<And>x. \<lbrakk>x \<in> set rs; bnullable x\<rbrakk> \<Longrightarrow> x >> bmkeps x" "x \<in> set rs" "bnullable x" |
|
787 |
shows "AALTs bs rs >> bmkeps (AALTs bs rs)" |
|
788 |
using assms |
|
789 |
apply(induct rs arbitrary: bs x) |
|
790 |
apply simp |
|
791 |
by (metis contains.intros(4) contains.intros(5) list.set_intros(1) list.set_intros(2) qq3 qq4 r r0 r1) |
|
792 |
||
793 |
lemma cont1: |
|
794 |
assumes "\<And>v. \<Turnstile> v : erase r \<Longrightarrow> r >> retrieve r v" |
|
795 |
"\<forall>v\<in>set vs. \<Turnstile> v : erase r \<and> flat v \<noteq> []" |
|
796 |
shows "ASTAR bs r >> retrieve (ASTAR bs r) (Stars vs)" |
|
797 |
using assms |
|
798 |
apply(induct vs arbitrary: bs r) |
|
799 |
apply(simp) |
|
800 |
using contains.intros(6) apply auto[1] |
|
801 |
by (simp add: contains.intros(7)) |
|
802 |
||
803 |
lemma contains4: |
|
804 |
assumes "bnullable a" |
|
805 |
shows "a >> bmkeps a" |
|
806 |
using assms |
|
807 |
apply(induct a rule: bnullable.induct) |
|
808 |
apply(auto intro: contains.intros) |
|
809 |
using contains3 by blast |
|
810 |
||
811 |
lemma contains5: |
|
812 |
assumes "\<Turnstile> v : r" |
|
813 |
shows "(intern r) >> retrieve (intern r) v" |
|
814 |
using contains2[OF assms] retrieve_code[OF assms] |
|
815 |
by (simp) |
|
816 |
||
343 | 817 |
|
337 | 818 |
lemma contains6: |
819 |
assumes "\<Turnstile> v : (erase r)" |
|
820 |
shows "r >> retrieve r v" |
|
821 |
using assms |
|
822 |
apply(induct r arbitrary: v rule: erase.induct) |
|
823 |
apply(auto)[1] |
|
824 |
using Prf_elims(1) apply blast |
|
825 |
using Prf_elims(4) contains.intros(1) apply force |
|
826 |
using Prf_elims(5) contains.intros(2) apply force |
|
827 |
apply(auto)[1] |
|
828 |
using Prf_elims(1) apply blast |
|
829 |
apply(auto)[1] |
|
830 |
using contains3b contains3a apply blast |
|
831 |
prefer 2 |
|
832 |
apply(auto)[1] |
|
833 |
apply (metis Prf_elims(2) contains.intros(3) retrieve.simps(6)) |
|
834 |
prefer 2 |
|
835 |
apply(auto)[1] |
|
836 |
apply (metis Prf_elims(6) cont1) |
|
837 |
apply(simp) |
|
838 |
apply(erule Prf_elims) |
|
839 |
apply(auto) |
|
840 |
apply (simp add: contains3b) |
|
841 |
using retrieve_fuse2 contains3b contains3a |
|
842 |
apply(subst retrieve_fuse2[symmetric]) |
|
843 |
apply (metis append_Nil2 erase_fuse fuse.simps(4)) |
|
844 |
apply(simp) |
|
845 |
by (metis append_Nil2 erase_fuse fuse.simps(4)) |
|
846 |
||
847 |
lemma contains7: |
|
848 |
assumes "\<Turnstile> v : der c (erase r)" |
|
849 |
shows "(bder c r) >> retrieve r (injval (erase r) c v)" |
|
850 |
using bder_retrieve[OF assms(1)] retrieve_code[OF assms(1)] |
|
851 |
by (metis assms contains6 erase_bder) |
|
852 |
||
853 |
||
338 | 854 |
lemma contains7a: |
855 |
assumes "\<Turnstile> v : der c (erase r)" |
|
856 |
shows "r >> retrieve r (injval (erase r) c v)" |
|
857 |
using assms |
|
858 |
apply - |
|
859 |
apply(drule Prf_injval) |
|
860 |
apply(drule contains6) |
|
861 |
apply(simp) |
|
862 |
done |
|
863 |
||
343 | 864 |
lemma contains7b: |
865 |
assumes "\<Turnstile> v : ders s (erase r)" |
|
866 |
shows "(bders r s) >> retrieve r (flex (erase r) id s v)" |
|
867 |
using assms |
|
868 |
apply(induct s arbitrary: r v) |
|
869 |
apply(simp) |
|
870 |
apply (simp add: contains6) |
|
871 |
apply(simp add: bders_append flex_append ders_append) |
|
872 |
apply(drule_tac x="bder a r" in meta_spec) |
|
873 |
apply(drule meta_spec) |
|
874 |
apply(drule meta_mp) |
|
875 |
apply(simp) |
|
876 |
apply(simp) |
|
877 |
apply(subst (asm) bder_retrieve) |
|
878 |
defer |
|
879 |
apply (simp add: flex_injval) |
|
880 |
by (simp add: Prf_flex) |
|
881 |
||
882 |
lemma contains7_iff: |
|
883 |
assumes "\<Turnstile> v : der c (erase r)" |
|
884 |
shows "(bder c r) >> retrieve r (injval (erase r) c v) \<longleftrightarrow> |
|
885 |
r >> retrieve r (injval (erase r) c v)" |
|
886 |
by (simp add: assms contains7 contains7a) |
|
887 |
||
888 |
lemma contains8_iff: |
|
889 |
assumes "\<Turnstile> v : ders s (erase r)" |
|
890 |
shows "(bders r s) >> retrieve r (flex (erase r) id s v) \<longleftrightarrow> |
|
891 |
r >> retrieve r (flex (erase r) id s v)" |
|
892 |
using Prf_flex assms contains6 contains7b by blast |
|
893 |
||
894 |
||
337 | 895 |
fun |
896 |
bders_simp :: "arexp \<Rightarrow> string \<Rightarrow> arexp" |
|
897 |
where |
|
898 |
"bders_simp r [] = r" |
|
899 |
| "bders_simp r (c # s) = bders_simp (bsimp (bder c r)) s" |
|
900 |
||
901 |
definition blexer_simp where |
|
902 |
"blexer_simp r s \<equiv> if bnullable (bders_simp (intern r) s) then |
|
903 |
decode (bmkeps (bders_simp (intern r) s)) r else None" |
|
904 |
||
905 |
||
906 |
||
907 |
||
908 |
||
909 |
lemma bders_simp_append: |
|
910 |
shows "bders_simp r (s1 @ s2) = bders_simp (bders_simp r s1) s2" |
|
911 |
apply(induct s1 arbitrary: r s2) |
|
912 |
apply(simp) |
|
913 |
apply(simp) |
|
914 |
done |
|
915 |
||
916 |
lemma bsimp_ASEQ_size: |
|
917 |
shows "asize (bsimp_ASEQ bs r1 r2) \<le> Suc (asize r1 + asize r2)" |
|
918 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
919 |
apply(auto) |
|
920 |
done |
|
921 |
||
922 |
||
923 |
||
924 |
lemma flts_size: |
|
925 |
shows "sum_list (map asize (flts rs)) \<le> sum_list (map asize rs)" |
|
926 |
apply(induct rs rule: flts.induct) |
|
927 |
apply(simp_all) |
|
928 |
by (simp add: asize_fuse comp_def) |
|
929 |
||
930 |
||
931 |
lemma bsimp_AALTs_size: |
|
932 |
shows "asize (bsimp_AALTs bs rs) \<le> Suc (sum_list (map asize rs))" |
|
933 |
apply(induct rs rule: bsimp_AALTs.induct) |
|
934 |
apply(auto simp add: asize_fuse) |
|
935 |
done |
|
936 |
||
937 |
||
938 |
lemma bsimp_size: |
|
939 |
shows "asize (bsimp r) \<le> asize r" |
|
940 |
apply(induct r) |
|
941 |
apply(simp_all) |
|
942 |
apply (meson Suc_le_mono add_mono_thms_linordered_semiring(1) bsimp_ASEQ_size le_trans) |
|
943 |
apply(rule le_trans) |
|
944 |
apply(rule bsimp_AALTs_size) |
|
945 |
apply(simp) |
|
946 |
apply(rule le_trans) |
|
947 |
apply(rule flts_size) |
|
948 |
by (simp add: sum_list_mono) |
|
949 |
||
950 |
lemma bsimp_asize0: |
|
951 |
shows "(\<Sum>x\<leftarrow>rs. asize (bsimp x)) \<le> sum_list (map asize rs)" |
|
952 |
apply(induct rs) |
|
953 |
apply(auto) |
|
954 |
by (simp add: add_mono bsimp_size) |
|
955 |
||
956 |
lemma bsimp_AALTs_size2: |
|
957 |
assumes "\<forall>r \<in> set rs. nonalt r" |
|
958 |
shows "asize (bsimp_AALTs bs rs) \<ge> sum_list (map asize rs)" |
|
959 |
using assms |
|
960 |
apply(induct rs rule: bsimp_AALTs.induct) |
|
961 |
apply(simp_all add: asize_fuse) |
|
962 |
done |
|
963 |
||
964 |
||
965 |
lemma qq: |
|
966 |
shows "map (asize \<circ> fuse bs) rs = map asize rs" |
|
967 |
apply(induct rs) |
|
968 |
apply(auto simp add: asize_fuse) |
|
969 |
done |
|
970 |
||
971 |
lemma flts_size2: |
|
972 |
assumes "\<exists>bs rs'. AALTs bs rs' \<in> set rs" |
|
973 |
shows "sum_list (map asize (flts rs)) < sum_list (map asize rs)" |
|
974 |
using assms |
|
975 |
apply(induct rs) |
|
976 |
apply(auto simp add: qq) |
|
977 |
apply (simp add: flts_size less_Suc_eq_le) |
|
978 |
apply(case_tac a) |
|
979 |
apply(auto simp add: qq) |
|
980 |
prefer 2 |
|
981 |
apply (simp add: flts_size le_imp_less_Suc) |
|
982 |
using less_Suc_eq by auto |
|
983 |
||
984 |
lemma bsimp_AALTs_size3: |
|
985 |
assumes "\<exists>r \<in> set (map bsimp rs). \<not>nonalt r" |
|
986 |
shows "asize (bsimp (AALTs bs rs)) < asize (AALTs bs rs)" |
|
987 |
using assms flts_size2 |
|
988 |
apply - |
|
989 |
apply(clarify) |
|
990 |
apply(simp) |
|
991 |
apply(drule_tac x="map bsimp rs" in meta_spec) |
|
992 |
apply(drule meta_mp) |
|
993 |
apply (metis list.set_map nonalt.elims(3)) |
|
994 |
apply(simp) |
|
995 |
apply(rule order_class.order.strict_trans1) |
|
996 |
apply(rule bsimp_AALTs_size) |
|
997 |
apply(simp) |
|
998 |
by (smt Suc_leI bsimp_asize0 comp_def le_imp_less_Suc le_trans map_eq_conv not_less_eq) |
|
999 |
||
1000 |
||
1001 |
||
1002 |
||
1003 |
lemma L_bsimp_ASEQ: |
|
1004 |
"L (SEQ (erase r1) (erase r2)) = L (erase (bsimp_ASEQ bs r1 r2))" |
|
1005 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
1006 |
apply(simp_all) |
|
1007 |
by (metis erase_fuse fuse.simps(4)) |
|
1008 |
||
1009 |
lemma L_bsimp_AALTs: |
|
1010 |
"L (erase (AALTs bs rs)) = L (erase (bsimp_AALTs bs rs))" |
|
1011 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1012 |
apply(simp_all add: erase_fuse) |
|
1013 |
done |
|
1014 |
||
1015 |
lemma L_erase_AALTs: |
|
1016 |
shows "L (erase (AALTs bs rs)) = \<Union> (L ` erase ` (set rs))" |
|
1017 |
apply(induct rs) |
|
1018 |
apply(simp) |
|
1019 |
apply(simp) |
|
1020 |
apply(case_tac rs) |
|
1021 |
apply(simp) |
|
1022 |
apply(simp) |
|
1023 |
done |
|
1024 |
||
1025 |
lemma L_erase_flts: |
|
1026 |
shows "\<Union> (L ` erase ` (set (flts rs))) = \<Union> (L ` erase ` (set rs))" |
|
1027 |
apply(induct rs rule: flts.induct) |
|
1028 |
apply(simp_all) |
|
1029 |
apply(auto) |
|
1030 |
using L_erase_AALTs erase_fuse apply auto[1] |
|
1031 |
by (simp add: L_erase_AALTs erase_fuse) |
|
1032 |
||
1033 |
||
1034 |
lemma L_bsimp_erase: |
|
1035 |
shows "L (erase r) = L (erase (bsimp r))" |
|
1036 |
apply(induct r) |
|
1037 |
apply(simp) |
|
1038 |
apply(simp) |
|
1039 |
apply(simp) |
|
1040 |
apply(auto simp add: Sequ_def)[1] |
|
1041 |
apply(subst L_bsimp_ASEQ[symmetric]) |
|
1042 |
apply(auto simp add: Sequ_def)[1] |
|
1043 |
apply(subst (asm) L_bsimp_ASEQ[symmetric]) |
|
1044 |
apply(auto simp add: Sequ_def)[1] |
|
1045 |
apply(simp) |
|
1046 |
apply(subst L_bsimp_AALTs[symmetric]) |
|
1047 |
defer |
|
1048 |
apply(simp) |
|
1049 |
apply(subst (2)L_erase_AALTs) |
|
1050 |
apply(subst L_erase_flts) |
|
1051 |
apply(auto) |
|
1052 |
apply (simp add: L_erase_AALTs) |
|
1053 |
using L_erase_AALTs by blast |
|
1054 |
||
1055 |
lemma bsimp_ASEQ0: |
|
1056 |
shows "bsimp_ASEQ bs r1 AZERO = AZERO" |
|
1057 |
apply(induct r1) |
|
1058 |
apply(auto) |
|
1059 |
done |
|
1060 |
||
1061 |
||
1062 |
||
1063 |
lemma bsimp_ASEQ1: |
|
1064 |
assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs" |
|
1065 |
shows "bsimp_ASEQ bs r1 r2 = ASEQ bs r1 r2" |
|
1066 |
using assms |
|
1067 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
1068 |
apply(auto) |
|
1069 |
done |
|
1070 |
||
1071 |
lemma bsimp_ASEQ2: |
|
1072 |
shows "bsimp_ASEQ bs (AONE bs1) r2 = fuse (bs @ bs1) r2" |
|
1073 |
apply(induct r2) |
|
1074 |
apply(auto) |
|
1075 |
done |
|
1076 |
||
1077 |
||
1078 |
lemma L_bders_simp: |
|
1079 |
shows "L (erase (bders_simp r s)) = L (erase (bders r s))" |
|
1080 |
apply(induct s arbitrary: r rule: rev_induct) |
|
1081 |
apply(simp) |
|
1082 |
apply(simp) |
|
1083 |
apply(simp add: ders_append) |
|
1084 |
apply(simp add: bders_simp_append) |
|
1085 |
apply(simp add: L_bsimp_erase[symmetric]) |
|
1086 |
by (simp add: der_correctness) |
|
1087 |
||
1088 |
lemma b1: |
|
1089 |
"bsimp_ASEQ bs1 (AONE bs) r = fuse (bs1 @ bs) r" |
|
1090 |
apply(induct r) |
|
1091 |
apply(auto) |
|
1092 |
done |
|
1093 |
||
1094 |
lemma b2: |
|
1095 |
assumes "bnullable r" |
|
1096 |
shows "bmkeps (fuse bs r) = bs @ bmkeps r" |
|
1097 |
by (simp add: assms bmkeps_retrieve bnullable_correctness erase_fuse mkeps_nullable retrieve_fuse2) |
|
1098 |
||
1099 |
lemma b3: |
|
1100 |
shows "bnullable r = bnullable (bsimp r)" |
|
1101 |
using L_bsimp_erase bnullable_correctness nullable_correctness by auto |
|
1102 |
||
1103 |
||
1104 |
lemma b4: |
|
1105 |
shows "bnullable (bders_simp r s) = bnullable (bders r s)" |
|
1106 |
by (metis L_bders_simp bnullable_correctness lexer.simps(1) lexer_correct_None option.distinct(1)) |
|
1107 |
||
1108 |
lemma q1: |
|
1109 |
assumes "\<forall>r \<in> set rs. bmkeps(bsimp r) = bmkeps r" |
|
1110 |
shows "map (\<lambda>r. bmkeps(bsimp r)) rs = map bmkeps rs" |
|
1111 |
using assms |
|
1112 |
apply(induct rs) |
|
1113 |
apply(simp) |
|
1114 |
apply(simp) |
|
1115 |
done |
|
1116 |
||
1117 |
lemma q3: |
|
1118 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
1119 |
shows "bmkeps (AALTs bs rs) = bmkeps (bsimp_AALTs bs rs)" |
|
1120 |
using assms |
|
1121 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1122 |
apply(simp) |
|
1123 |
apply(simp) |
|
1124 |
apply (simp add: b2) |
|
1125 |
apply(simp) |
|
1126 |
done |
|
1127 |
||
1128 |
||
1129 |
lemma fuse_empty: |
|
1130 |
shows "fuse [] r = r" |
|
1131 |
apply(induct r) |
|
1132 |
apply(auto) |
|
1133 |
done |
|
1134 |
||
1135 |
lemma flts_fuse: |
|
1136 |
shows "map (fuse bs) (flts rs) = flts (map (fuse bs) rs)" |
|
1137 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1138 |
apply(auto simp add: fuse_append) |
|
1139 |
done |
|
1140 |
||
1141 |
lemma bsimp_ASEQ_fuse: |
|
1142 |
shows "fuse bs1 (bsimp_ASEQ bs2 r1 r2) = bsimp_ASEQ (bs1 @ bs2) r1 r2" |
|
1143 |
apply(induct r1 r2 arbitrary: bs1 bs2 rule: bsimp_ASEQ.induct) |
|
1144 |
apply(auto) |
|
1145 |
done |
|
1146 |
||
1147 |
lemma bsimp_AALTs_fuse: |
|
1148 |
assumes "\<forall>r \<in> set rs. fuse bs1 (fuse bs2 r) = fuse (bs1 @ bs2) r" |
|
1149 |
shows "fuse bs1 (bsimp_AALTs bs2 rs) = bsimp_AALTs (bs1 @ bs2) rs" |
|
1150 |
using assms |
|
1151 |
apply(induct bs2 rs arbitrary: bs1 rule: bsimp_AALTs.induct) |
|
1152 |
apply(auto) |
|
1153 |
done |
|
1154 |
||
1155 |
||
1156 |
||
1157 |
lemma bsimp_fuse: |
|
1158 |
shows "fuse bs (bsimp r) = bsimp (fuse bs r)" |
|
1159 |
apply(induct r arbitrary: bs) |
|
1160 |
apply(simp) |
|
1161 |
apply(simp) |
|
1162 |
apply(simp) |
|
1163 |
prefer 3 |
|
1164 |
apply(simp) |
|
1165 |
apply(simp) |
|
1166 |
apply (simp add: bsimp_ASEQ_fuse) |
|
1167 |
apply(simp) |
|
1168 |
by (simp add: bsimp_AALTs_fuse fuse_append) |
|
1169 |
||
1170 |
lemma bsimp_fuse_AALTs: |
|
1171 |
shows "fuse bs (bsimp (AALTs [] rs)) = bsimp (AALTs bs rs)" |
|
1172 |
apply(subst bsimp_fuse) |
|
1173 |
apply(simp) |
|
1174 |
done |
|
1175 |
||
1176 |
lemma bsimp_fuse_AALTs2: |
|
1177 |
shows "fuse bs (bsimp_AALTs [] rs) = bsimp_AALTs bs rs" |
|
1178 |
using bsimp_AALTs_fuse fuse_append by auto |
|
1179 |
||
1180 |
||
1181 |
lemma bsimp_ASEQ_idem: |
|
1182 |
assumes "bsimp (bsimp r1) = bsimp r1" "bsimp (bsimp r2) = bsimp r2" |
|
1183 |
shows "bsimp (bsimp_ASEQ x1 (bsimp r1) (bsimp r2)) = bsimp_ASEQ x1 (bsimp r1) (bsimp r2)" |
|
1184 |
using assms |
|
1185 |
apply(case_tac "bsimp r1 = AZERO") |
|
1186 |
apply(simp) |
|
1187 |
apply(case_tac "bsimp r2 = AZERO") |
|
1188 |
apply(simp) |
|
1189 |
apply (metis bnullable.elims(2) bnullable.elims(3) bsimp.simps(3) bsimp_ASEQ.simps(2) bsimp_ASEQ.simps(3) bsimp_ASEQ.simps(4) bsimp_ASEQ.simps(5) bsimp_ASEQ.simps(6)) |
|
1190 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
1191 |
apply(auto)[1] |
|
1192 |
apply(subst bsimp_ASEQ2) |
|
1193 |
apply(subst bsimp_ASEQ2) |
|
1194 |
apply (metis assms(2) bsimp_fuse) |
|
1195 |
apply(subst bsimp_ASEQ1) |
|
1196 |
apply(auto) |
|
1197 |
done |
|
1198 |
||
1199 |
||
1200 |
||
1201 |
lemma k0: |
|
1202 |
shows "flts (r # rs1) = flts [r] @ flts rs1" |
|
1203 |
apply(induct r arbitrary: rs1) |
|
1204 |
apply(auto) |
|
1205 |
done |
|
1206 |
||
1207 |
lemma k00: |
|
1208 |
shows "flts (rs1 @ rs2) = flts rs1 @ flts rs2" |
|
1209 |
apply(induct rs1 arbitrary: rs2) |
|
1210 |
apply(auto) |
|
1211 |
by (metis append.assoc k0) |
|
1212 |
||
1213 |
lemma k0a: |
|
1214 |
shows "flts [AALTs bs rs] = map (fuse bs) rs" |
|
1215 |
apply(simp) |
|
1216 |
done |
|
1217 |
||
1218 |
||
1219 |
lemma k0b: |
|
1220 |
assumes "nonalt r" "r \<noteq> AZERO" |
|
1221 |
shows "flts [r] = [r]" |
|
1222 |
using assms |
|
1223 |
apply(case_tac r) |
|
1224 |
apply(simp_all) |
|
1225 |
done |
|
1226 |
||
1227 |
lemma nn1: |
|
1228 |
assumes "nonnested (AALTs bs rs)" |
|
1229 |
shows "\<nexists>bs1 rs1. flts rs = [AALTs bs1 rs1]" |
|
1230 |
using assms |
|
1231 |
apply(induct rs rule: flts.induct) |
|
1232 |
apply(auto) |
|
1233 |
done |
|
1234 |
||
1235 |
lemma nn1q: |
|
1236 |
assumes "nonnested (AALTs bs rs)" |
|
1237 |
shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set (flts rs)" |
|
1238 |
using assms |
|
1239 |
apply(induct rs rule: flts.induct) |
|
1240 |
apply(auto) |
|
1241 |
done |
|
1242 |
||
1243 |
lemma nn1qq: |
|
1244 |
assumes "nonnested (AALTs bs rs)" |
|
1245 |
shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set rs" |
|
1246 |
using assms |
|
1247 |
apply(induct rs rule: flts.induct) |
|
1248 |
apply(auto) |
|
1249 |
done |
|
1250 |
||
1251 |
lemma nn10: |
|
1252 |
assumes "nonnested (AALTs cs rs)" |
|
1253 |
shows "nonnested (AALTs (bs @ cs) rs)" |
|
1254 |
using assms |
|
1255 |
apply(induct rs arbitrary: cs bs) |
|
1256 |
apply(simp_all) |
|
1257 |
apply(case_tac a) |
|
1258 |
apply(simp_all) |
|
1259 |
done |
|
1260 |
||
1261 |
lemma nn11a: |
|
1262 |
assumes "nonalt r" |
|
1263 |
shows "nonalt (fuse bs r)" |
|
1264 |
using assms |
|
1265 |
apply(induct r) |
|
1266 |
apply(auto) |
|
1267 |
done |
|
1268 |
||
1269 |
||
1270 |
lemma nn1a: |
|
1271 |
assumes "nonnested r" |
|
1272 |
shows "nonnested (fuse bs r)" |
|
1273 |
using assms |
|
1274 |
apply(induct bs r arbitrary: rule: fuse.induct) |
|
1275 |
apply(simp_all add: nn10) |
|
1276 |
done |
|
1277 |
||
1278 |
lemma n0: |
|
1279 |
shows "nonnested (AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. nonalt r)" |
|
1280 |
apply(induct rs arbitrary: bs) |
|
1281 |
apply(auto) |
|
1282 |
apply (metis list.set_intros(1) nn1qq nonalt.elims(3)) |
|
1283 |
apply (metis list.set_intros(2) nn1qq nonalt.elims(3)) |
|
1284 |
by (metis nonalt.elims(2) nonnested.simps(3) nonnested.simps(4) nonnested.simps(5) nonnested.simps(6) nonnested.simps(7)) |
|
1285 |
||
1286 |
||
1287 |
||
1288 |
||
1289 |
lemma nn1c: |
|
1290 |
assumes "\<forall>r \<in> set rs. nonnested r" |
|
1291 |
shows "\<forall>r \<in> set (flts rs). nonalt r" |
|
1292 |
using assms |
|
1293 |
apply(induct rs rule: flts.induct) |
|
1294 |
apply(auto) |
|
1295 |
apply(rule nn11a) |
|
1296 |
by (metis nn1qq nonalt.elims(3)) |
|
1297 |
||
1298 |
lemma nn1bb: |
|
1299 |
assumes "\<forall>r \<in> set rs. nonalt r" |
|
1300 |
shows "nonnested (bsimp_AALTs bs rs)" |
|
1301 |
using assms |
|
1302 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1303 |
apply(auto) |
|
1304 |
apply (metis nn11a nonalt.simps(1) nonnested.elims(3)) |
|
1305 |
using n0 by auto |
|
1306 |
||
1307 |
lemma nn1b: |
|
1308 |
shows "nonnested (bsimp r)" |
|
1309 |
apply(induct r) |
|
1310 |
apply(simp_all) |
|
1311 |
apply(case_tac "bsimp r1 = AZERO") |
|
1312 |
apply(simp) |
|
1313 |
apply(case_tac "bsimp r2 = AZERO") |
|
1314 |
apply(simp) |
|
1315 |
apply(subst bsimp_ASEQ0) |
|
1316 |
apply(simp) |
|
1317 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
1318 |
apply(auto)[1] |
|
1319 |
apply(subst bsimp_ASEQ2) |
|
1320 |
apply (simp add: nn1a) |
|
1321 |
apply(subst bsimp_ASEQ1) |
|
1322 |
apply(auto) |
|
1323 |
apply(rule nn1bb) |
|
1324 |
apply(auto) |
|
1325 |
by (metis (mono_tags, hide_lams) imageE nn1c set_map) |
|
1326 |
||
1327 |
lemma nn1d: |
|
1328 |
assumes "bsimp r = AALTs bs rs" |
|
1329 |
shows "\<forall>r1 \<in> set rs. \<forall> bs. r1 \<noteq> AALTs bs rs2" |
|
1330 |
using nn1b assms |
|
1331 |
by (metis nn1qq) |
|
1332 |
||
1333 |
lemma nn_flts: |
|
1334 |
assumes "nonnested (AALTs bs rs)" |
|
1335 |
shows "\<forall>r \<in> set (flts rs). nonalt r" |
|
1336 |
using assms |
|
1337 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1338 |
apply(auto) |
|
1339 |
done |
|
1340 |
||
1341 |
||
1342 |
||
1343 |
lemma rt: |
|
1344 |
shows "sum_list (map asize (flts (map bsimp rs))) \<le> sum_list (map asize rs)" |
|
1345 |
apply(induct rs) |
|
1346 |
apply(simp) |
|
1347 |
apply(simp) |
|
1348 |
apply(subst k0) |
|
1349 |
apply(simp) |
|
1350 |
by (smt add_le_cancel_right add_mono bsimp_size flts.simps(1) flts_size k0 le_iff_add list.simps(9) map_append sum_list.Cons sum_list.append trans_le_add1) |
|
1351 |
||
1352 |
lemma bsimp_AALTs_qq: |
|
1353 |
assumes "1 < length rs" |
|
1354 |
shows "bsimp_AALTs bs rs = AALTs bs rs" |
|
1355 |
using assms |
|
1356 |
apply(case_tac rs) |
|
1357 |
apply(simp) |
|
1358 |
apply(case_tac list) |
|
1359 |
apply(simp_all) |
|
1360 |
done |
|
1361 |
||
1362 |
||
1363 |
lemma bsimp_AALTs1: |
|
1364 |
assumes "nonalt r" |
|
1365 |
shows "bsimp_AALTs bs (flts [r]) = fuse bs r" |
|
1366 |
using assms |
|
1367 |
apply(case_tac r) |
|
1368 |
apply(simp_all) |
|
1369 |
done |
|
1370 |
||
1371 |
lemma bbbbs: |
|
1372 |
assumes "good r" "r = AALTs bs1 rs" |
|
1373 |
shows "bsimp_AALTs bs (flts [r]) = AALTs bs (map (fuse bs1) rs)" |
|
1374 |
using assms |
|
1375 |
by (metis (no_types, lifting) Nil_is_map_conv append.left_neutral append_butlast_last_id bsimp_AALTs.elims butlast.simps(2) good.simps(4) good.simps(5) k0a map_butlast) |
|
1376 |
||
1377 |
lemma bbbbs1: |
|
1378 |
shows "nonalt r \<or> (\<exists>bs rs. r = AALTs bs rs)" |
|
1379 |
using nonalt.elims(3) by auto |
|
1380 |
||
1381 |
||
1382 |
lemma good_fuse: |
|
1383 |
shows "good (fuse bs r) = good r" |
|
1384 |
apply(induct r arbitrary: bs) |
|
1385 |
apply(auto) |
|
1386 |
apply(case_tac r1) |
|
1387 |
apply(simp_all) |
|
1388 |
apply(case_tac r2) |
|
1389 |
apply(simp_all) |
|
1390 |
apply(case_tac r2) |
|
1391 |
apply(simp_all) |
|
1392 |
apply(case_tac r2) |
|
1393 |
apply(simp_all) |
|
1394 |
apply(case_tac r2) |
|
1395 |
apply(simp_all) |
|
1396 |
apply(case_tac r1) |
|
1397 |
apply(simp_all) |
|
1398 |
apply(case_tac r2) |
|
1399 |
apply(simp_all) |
|
1400 |
apply(case_tac r2) |
|
1401 |
apply(simp_all) |
|
1402 |
apply(case_tac r2) |
|
1403 |
apply(simp_all) |
|
1404 |
apply(case_tac r2) |
|
1405 |
apply(simp_all) |
|
1406 |
apply(case_tac x2a) |
|
1407 |
apply(simp_all) |
|
1408 |
apply(case_tac list) |
|
1409 |
apply(simp_all) |
|
1410 |
apply(case_tac x2a) |
|
1411 |
apply(simp_all) |
|
1412 |
apply(case_tac list) |
|
1413 |
apply(simp_all) |
|
1414 |
done |
|
1415 |
||
1416 |
lemma good0: |
|
1417 |
assumes "rs \<noteq> Nil" "\<forall>r \<in> set rs. nonalt r" |
|
1418 |
shows "good (bsimp_AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. good r)" |
|
1419 |
using assms |
|
1420 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1421 |
apply(auto simp add: good_fuse) |
|
1422 |
done |
|
1423 |
||
1424 |
lemma good0a: |
|
1425 |
assumes "flts (map bsimp rs) \<noteq> Nil" "\<forall>r \<in> set (flts (map bsimp rs)). nonalt r" |
|
1426 |
shows "good (bsimp (AALTs bs rs)) \<longleftrightarrow> (\<forall>r \<in> set (flts (map bsimp rs)). good r)" |
|
1427 |
using assms |
|
1428 |
apply(simp) |
|
1429 |
apply(auto) |
|
1430 |
apply(subst (asm) good0) |
|
1431 |
apply(simp) |
|
1432 |
apply(auto) |
|
1433 |
apply(subst good0) |
|
1434 |
apply(simp) |
|
1435 |
apply(auto) |
|
1436 |
done |
|
1437 |
||
1438 |
lemma flts0: |
|
1439 |
assumes "r \<noteq> AZERO" "nonalt r" |
|
1440 |
shows "flts [r] \<noteq> []" |
|
1441 |
using assms |
|
1442 |
apply(induct r) |
|
1443 |
apply(simp_all) |
|
1444 |
done |
|
1445 |
||
1446 |
lemma flts1: |
|
1447 |
assumes "good r" |
|
1448 |
shows "flts [r] \<noteq> []" |
|
1449 |
using assms |
|
1450 |
apply(induct r) |
|
1451 |
apply(simp_all) |
|
1452 |
apply(case_tac x2a) |
|
1453 |
apply(simp) |
|
1454 |
apply(simp) |
|
1455 |
done |
|
1456 |
||
1457 |
lemma flts2: |
|
1458 |
assumes "good r" |
|
1459 |
shows "\<forall>r' \<in> set (flts [r]). good r' \<and> nonalt r'" |
|
1460 |
using assms |
|
1461 |
apply(induct r) |
|
1462 |
apply(simp) |
|
1463 |
apply(simp) |
|
1464 |
apply(simp) |
|
1465 |
prefer 2 |
|
1466 |
apply(simp) |
|
1467 |
apply(auto)[1] |
|
1468 |
apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) good_fuse) |
|
1469 |
apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) nn11a) |
|
1470 |
apply fastforce |
|
1471 |
apply(simp) |
|
1472 |
done |
|
1473 |
||
1474 |
||
1475 |
lemma flts3: |
|
1476 |
assumes "\<forall>r \<in> set rs. good r \<or> r = AZERO" |
|
1477 |
shows "\<forall>r \<in> set (flts rs). good r" |
|
1478 |
using assms |
|
1479 |
apply(induct rs arbitrary: rule: flts.induct) |
|
1480 |
apply(simp_all) |
|
1481 |
by (metis UnE flts2 k0a set_map) |
|
1482 |
||
1483 |
lemma flts3b: |
|
1484 |
assumes "\<exists>r\<in>set rs. good r" |
|
1485 |
shows "flts rs \<noteq> []" |
|
1486 |
using assms |
|
1487 |
apply(induct rs arbitrary: rule: flts.induct) |
|
1488 |
apply(simp) |
|
1489 |
apply(simp) |
|
1490 |
apply(simp) |
|
1491 |
apply(auto) |
|
1492 |
done |
|
1493 |
||
1494 |
lemma flts4: |
|
1495 |
assumes "bsimp_AALTs bs (flts rs) = AZERO" |
|
1496 |
shows "\<forall>r \<in> set rs. \<not> good r" |
|
1497 |
using assms |
|
1498 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1499 |
apply(auto) |
|
1500 |
defer |
|
1501 |
apply (metis (no_types, lifting) Nil_is_append_conv append_self_conv2 bsimp_AALTs.elims butlast.simps(2) butlast_append flts3b nonalt.simps(1) nonalt.simps(2)) |
|
1502 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(2) good0 k0b list.distinct(1) list.inject nonalt.simps(3)) |
|
1503 |
apply (metis arexp.distinct(3) arexp.distinct(7) bsimp_AALTs.elims fuse.simps(3) list.distinct(1) list.inject) |
|
1504 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims good.simps(1) good_fuse list.distinct(1) list.inject) |
|
1505 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims list.distinct(1) list.inject) |
|
1506 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(33) good0 k0b list.distinct(1) list.inject nonalt.simps(6)) |
|
1507 |
by (metis (no_types, lifting) Nil_is_append_conv append_Nil2 arexp.distinct(7) bsimp_AALTs.elims butlast.simps(2) butlast_append flts1 flts2 good.simps(1) good0 k0a) |
|
1508 |
||
1509 |
||
1510 |
lemma flts_nil: |
|
1511 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> |
|
1512 |
good (bsimp y) \<or> bsimp y = AZERO" |
|
1513 |
and "\<forall>r\<in>set rs. \<not> good (bsimp r)" |
|
1514 |
shows "flts (map bsimp rs) = []" |
|
1515 |
using assms |
|
1516 |
apply(induct rs) |
|
1517 |
apply(simp) |
|
1518 |
apply(simp) |
|
1519 |
apply(subst k0) |
|
1520 |
apply(simp) |
|
1521 |
by force |
|
1522 |
||
1523 |
lemma flts_nil2: |
|
1524 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> |
|
1525 |
good (bsimp y) \<or> bsimp y = AZERO" |
|
1526 |
and "bsimp_AALTs bs (flts (map bsimp rs)) = AZERO" |
|
1527 |
shows "flts (map bsimp rs) = []" |
|
1528 |
using assms |
|
1529 |
apply(induct rs arbitrary: bs) |
|
1530 |
apply(simp) |
|
1531 |
apply(simp) |
|
1532 |
apply(subst k0) |
|
1533 |
apply(simp) |
|
1534 |
apply(subst (asm) k0) |
|
1535 |
apply(auto) |
|
1536 |
apply (metis flts.simps(1) flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1)) |
|
1537 |
by (metis flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1)) |
|
1538 |
||
1539 |
||
1540 |
||
1541 |
lemma good_SEQ: |
|
1542 |
assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs" |
|
1543 |
shows "good (ASEQ bs r1 r2) = (good r1 \<and> good r2)" |
|
1544 |
using assms |
|
1545 |
apply(case_tac r1) |
|
1546 |
apply(simp_all) |
|
1547 |
apply(case_tac r2) |
|
1548 |
apply(simp_all) |
|
1549 |
apply(case_tac r2) |
|
1550 |
apply(simp_all) |
|
1551 |
apply(case_tac r2) |
|
1552 |
apply(simp_all) |
|
1553 |
apply(case_tac r2) |
|
1554 |
apply(simp_all) |
|
1555 |
done |
|
1556 |
||
1557 |
lemma good1: |
|
1558 |
shows "good (bsimp a) \<or> bsimp a = AZERO" |
|
1559 |
apply(induct a taking: asize rule: measure_induct) |
|
1560 |
apply(case_tac x) |
|
1561 |
apply(simp) |
|
1562 |
apply(simp) |
|
1563 |
apply(simp) |
|
1564 |
prefer 3 |
|
1565 |
apply(simp) |
|
1566 |
prefer 2 |
|
1567 |
(* AALTs case *) |
|
1568 |
apply(simp only:) |
|
1569 |
apply(case_tac "x52") |
|
1570 |
apply(simp) |
|
1571 |
thm good0a |
|
1572 |
(* AALTs list at least one - case *) |
|
1573 |
apply(simp only: ) |
|
1574 |
apply(frule_tac x="a" in spec) |
|
1575 |
apply(drule mp) |
|
1576 |
apply(simp) |
|
1577 |
(* either first element is good, or AZERO *) |
|
1578 |
apply(erule disjE) |
|
1579 |
prefer 2 |
|
1580 |
apply(simp) |
|
1581 |
(* in the AZERO case, the size is smaller *) |
|
1582 |
apply(drule_tac x="AALTs x51 list" in spec) |
|
1583 |
apply(drule mp) |
|
1584 |
apply(simp add: asize0) |
|
1585 |
apply(subst (asm) bsimp.simps) |
|
1586 |
apply(subst (asm) bsimp.simps) |
|
1587 |
apply(assumption) |
|
1588 |
(* in the good case *) |
|
1589 |
apply(frule_tac x="AALTs x51 list" in spec) |
|
1590 |
apply(drule mp) |
|
1591 |
apply(simp add: asize0) |
|
1592 |
apply(erule disjE) |
|
1593 |
apply(rule disjI1) |
|
1594 |
apply(simp add: good0) |
|
1595 |
apply(subst good0) |
|
1596 |
apply (metis Nil_is_append_conv flts1 k0) |
|
1597 |
apply (metis ex_map_conv list.simps(9) nn1b nn1c) |
|
1598 |
apply(simp) |
|
1599 |
apply(subst k0) |
|
1600 |
apply(simp) |
|
1601 |
apply(auto)[1] |
|
1602 |
using flts2 apply blast |
|
1603 |
apply(subst (asm) good0) |
|
1604 |
prefer 3 |
|
1605 |
apply(auto)[1] |
|
1606 |
apply auto[1] |
|
1607 |
apply (metis ex_map_conv nn1b nn1c) |
|
1608 |
(* in the AZERO case *) |
|
1609 |
apply(simp) |
|
1610 |
apply(frule_tac x="a" in spec) |
|
1611 |
apply(drule mp) |
|
1612 |
apply(simp) |
|
1613 |
apply(erule disjE) |
|
1614 |
apply(rule disjI1) |
|
1615 |
apply(subst good0) |
|
1616 |
apply(subst k0) |
|
1617 |
using flts1 apply blast |
|
1618 |
apply(auto)[1] |
|
1619 |
apply (metis (no_types, hide_lams) ex_map_conv list.simps(9) nn1b nn1c) |
|
1620 |
apply(auto)[1] |
|
1621 |
apply(subst (asm) k0) |
|
1622 |
apply(auto)[1] |
|
1623 |
using flts2 apply blast |
|
1624 |
apply(frule_tac x="AALTs x51 list" in spec) |
|
1625 |
apply(drule mp) |
|
1626 |
apply(simp add: asize0) |
|
1627 |
apply(erule disjE) |
|
1628 |
apply(simp) |
|
1629 |
apply(simp) |
|
1630 |
apply (metis add.left_commute flts_nil2 less_add_Suc1 less_imp_Suc_add list.distinct(1) list.set_cases nat.inject) |
|
1631 |
apply(subst (2) k0) |
|
1632 |
apply(simp) |
|
1633 |
(* SEQ case *) |
|
1634 |
apply(simp) |
|
1635 |
apply(case_tac "bsimp x42 = AZERO") |
|
1636 |
apply(simp) |
|
1637 |
apply(case_tac "bsimp x43 = AZERO") |
|
1638 |
apply(simp) |
|
1639 |
apply(subst (2) bsimp_ASEQ0) |
|
1640 |
apply(simp) |
|
1641 |
apply(case_tac "\<exists>bs. bsimp x42 = AONE bs") |
|
1642 |
apply(auto)[1] |
|
1643 |
apply(subst bsimp_ASEQ2) |
|
1644 |
using good_fuse apply force |
|
1645 |
apply(subst bsimp_ASEQ1) |
|
1646 |
apply(auto) |
|
1647 |
apply(subst good_SEQ) |
|
1648 |
apply(simp) |
|
1649 |
apply(simp) |
|
1650 |
apply(simp) |
|
1651 |
using less_add_Suc1 less_add_Suc2 by blast |
|
1652 |
||
1653 |
lemma good1a: |
|
1654 |
assumes "L(erase a) \<noteq> {}" |
|
1655 |
shows "good (bsimp a)" |
|
1656 |
using good1 assms |
|
1657 |
using L_bsimp_erase by force |
|
1658 |
||
1659 |
||
1660 |
||
1661 |
lemma flts_append: |
|
1662 |
"flts (xs1 @ xs2) = flts xs1 @ flts xs2" |
|
1663 |
apply(induct xs1 arbitrary: xs2 rule: rev_induct) |
|
1664 |
apply(auto) |
|
1665 |
apply(case_tac xs) |
|
1666 |
apply(auto) |
|
1667 |
apply(case_tac x) |
|
1668 |
apply(auto) |
|
1669 |
apply(case_tac x) |
|
1670 |
apply(auto) |
|
1671 |
done |
|
1672 |
||
1673 |
lemma g1: |
|
1674 |
assumes "good (bsimp_AALTs bs rs)" |
|
1675 |
shows "bsimp_AALTs bs rs = AALTs bs rs \<or> (\<exists>r. rs = [r] \<and> bsimp_AALTs bs [r] = fuse bs r)" |
|
1676 |
using assms |
|
1677 |
apply(induct rs arbitrary: bs) |
|
1678 |
apply(simp) |
|
1679 |
apply(case_tac rs) |
|
1680 |
apply(simp only:) |
|
1681 |
apply(simp) |
|
1682 |
apply(case_tac list) |
|
1683 |
apply(simp) |
|
1684 |
by simp |
|
1685 |
||
1686 |
lemma flts_0: |
|
1687 |
assumes "nonnested (AALTs bs rs)" |
|
1688 |
shows "\<forall>r \<in> set (flts rs). r \<noteq> AZERO" |
|
1689 |
using assms |
|
1690 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1691 |
apply(simp) |
|
1692 |
apply(simp) |
|
1693 |
defer |
|
1694 |
apply(simp) |
|
1695 |
apply(simp) |
|
1696 |
apply(simp) |
|
1697 |
apply(simp) |
|
1698 |
apply(rule ballI) |
|
1699 |
apply(simp) |
|
1700 |
done |
|
1701 |
||
1702 |
lemma flts_0a: |
|
1703 |
assumes "nonnested (AALTs bs rs)" |
|
1704 |
shows "AZERO \<notin> set (flts rs)" |
|
1705 |
using assms |
|
1706 |
using flts_0 by blast |
|
1707 |
||
1708 |
lemma qqq1: |
|
1709 |
shows "AZERO \<notin> set (flts (map bsimp rs))" |
|
1710 |
by (metis ex_map_conv flts3 good.simps(1) good1) |
|
1711 |
||
1712 |
||
1713 |
fun nonazero :: "arexp \<Rightarrow> bool" |
|
1714 |
where |
|
1715 |
"nonazero AZERO = False" |
|
1716 |
| "nonazero r = True" |
|
1717 |
||
1718 |
lemma flts_concat: |
|
1719 |
shows "flts rs = concat (map (\<lambda>r. flts [r]) rs)" |
|
1720 |
apply(induct rs) |
|
1721 |
apply(auto) |
|
1722 |
apply(subst k0) |
|
1723 |
apply(simp) |
|
1724 |
done |
|
1725 |
||
1726 |
lemma flts_single1: |
|
1727 |
assumes "nonalt r" "nonazero r" |
|
1728 |
shows "flts [r] = [r]" |
|
1729 |
using assms |
|
1730 |
apply(induct r) |
|
1731 |
apply(auto) |
|
1732 |
done |
|
1733 |
||
1734 |
lemma flts_qq: |
|
1735 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" |
|
1736 |
"\<forall>r'\<in>set rs. good r' \<and> nonalt r'" |
|
1737 |
shows "flts (map bsimp rs) = rs" |
|
1738 |
using assms |
|
1739 |
apply(induct rs) |
|
1740 |
apply(simp) |
|
1741 |
apply(simp) |
|
1742 |
apply(subst k0) |
|
1743 |
apply(subgoal_tac "flts [bsimp a] = [a]") |
|
1744 |
prefer 2 |
|
1745 |
apply(drule_tac x="a" in spec) |
|
1746 |
apply(drule mp) |
|
1747 |
apply(simp) |
|
1748 |
apply(auto)[1] |
|
1749 |
using good.simps(1) k0b apply blast |
|
1750 |
apply(auto)[1] |
|
1751 |
done |
|
1752 |
||
1753 |
lemma test: |
|
1754 |
assumes "good r" |
|
1755 |
shows "bsimp r = r" |
|
1756 |
using assms |
|
1757 |
apply(induct r taking: "asize" rule: measure_induct) |
|
1758 |
apply(erule good.elims) |
|
1759 |
apply(simp_all) |
|
1760 |
apply(subst k0) |
|
1761 |
apply(subst (2) k0) |
|
1762 |
apply(subst flts_qq) |
|
1763 |
apply(auto)[1] |
|
1764 |
apply(auto)[1] |
|
1765 |
apply (metis append_Cons append_Nil bsimp_AALTs.simps(3) good.simps(1) k0b) |
|
1766 |
apply force+ |
|
1767 |
apply (metis (no_types, lifting) add_Suc add_Suc_right asize.simps(5) bsimp.simps(1) bsimp_ASEQ.simps(19) less_add_Suc1 less_add_Suc2) |
|
1768 |
apply (metis add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(21) good.simps(8) less_add_Suc1 less_add_Suc2) |
|
1769 |
apply force+ |
|
1770 |
apply (metis (no_types, lifting) add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(25) good.simps(8) less_add_Suc1 less_add_Suc2) |
|
1771 |
apply (metis add_Suc add_Suc_right arexp.distinct(7) asize.simps(4) bsimp.simps(2) bsimp_ASEQ1 good.simps(26) good.simps(8) less_add_Suc1 less_add_Suc2) |
|
1772 |
apply force+ |
|
1773 |
done |
|
1774 |
||
1775 |
lemma test2: |
|
1776 |
assumes "good r" |
|
1777 |
shows "bsimp r = r" |
|
1778 |
using assms |
|
1779 |
apply(induct r taking: "asize" rule: measure_induct) |
|
1780 |
apply(case_tac x) |
|
1781 |
apply(simp_all) |
|
1782 |
defer |
|
1783 |
(* AALT case *) |
|
1784 |
apply(subgoal_tac "1 < length x52") |
|
1785 |
prefer 2 |
|
1786 |
apply(case_tac x52) |
|
1787 |
apply(simp) |
|
1788 |
apply(simp) |
|
1789 |
apply(case_tac list) |
|
1790 |
apply(simp) |
|
1791 |
apply(simp) |
|
1792 |
apply(subst bsimp_AALTs_qq) |
|
1793 |
prefer 2 |
|
1794 |
apply(subst flts_qq) |
|
1795 |
apply(auto)[1] |
|
1796 |
apply(auto)[1] |
|
1797 |
apply(case_tac x52) |
|
1798 |
apply(simp) |
|
1799 |
apply(simp) |
|
1800 |
apply(case_tac list) |
|
1801 |
apply(simp) |
|
1802 |
apply(simp) |
|
1803 |
apply(auto)[1] |
|
1804 |
apply (metis (no_types, lifting) bsimp_AALTs.elims good.simps(6) length_Cons length_pos_if_in_set list.size(3) nat_neq_iff) |
|
1805 |
apply(simp) |
|
1806 |
apply(case_tac x52) |
|
1807 |
apply(simp) |
|
1808 |
apply(simp) |
|
1809 |
apply(case_tac list) |
|
1810 |
apply(simp) |
|
1811 |
apply(simp) |
|
1812 |
apply(subst k0) |
|
1813 |
apply(simp) |
|
1814 |
apply(subst (2) k0) |
|
1815 |
apply(simp) |
|
1816 |
apply (simp add: Suc_lessI flts1 one_is_add) |
|
1817 |
(* SEQ case *) |
|
1818 |
apply(case_tac "bsimp x42 = AZERO") |
|
1819 |
apply simp |
|
1820 |
apply (metis asize.elims good.simps(10) good.simps(11) good.simps(12) good.simps(2) good.simps(7) good.simps(9) good_SEQ less_add_Suc1) |
|
1821 |
apply(case_tac "\<exists>bs'. bsimp x42 = AONE bs'") |
|
1822 |
apply(auto)[1] |
|
1823 |
defer |
|
1824 |
apply(case_tac "bsimp x43 = AZERO") |
|
1825 |
apply(simp) |
|
1826 |
apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(12) good.simps(8) good.simps(9) good_SEQ less_add_Suc2) |
|
1827 |
apply(auto) |
|
1828 |
apply (subst bsimp_ASEQ1) |
|
1829 |
apply(auto)[3] |
|
1830 |
apply(auto)[1] |
|
1831 |
apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1) |
|
1832 |
apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1 less_add_Suc2) |
|
1833 |
apply (subst bsimp_ASEQ2) |
|
1834 |
apply(drule_tac x="x42" in spec) |
|
1835 |
apply(drule mp) |
|
1836 |
apply(simp) |
|
1837 |
apply(drule mp) |
|
1838 |
apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(2) good_SEQ) |
|
1839 |
apply(simp) |
|
1840 |
done |
|
1841 |
||
1842 |
||
1843 |
lemma bsimp_idem: |
|
1844 |
shows "bsimp (bsimp r) = bsimp r" |
|
1845 |
using test good1 |
|
1846 |
by force |
|
1847 |
||
1848 |
||
1849 |
lemma contains_ex1: |
|
1850 |
assumes "a = AALTs bs1 [AZERO, AONE bs2]" "a >> bs" |
|
1851 |
shows "bsimp a >> bs" |
|
1852 |
using assms |
|
1853 |
apply(simp) |
|
1854 |
apply(erule contains.cases) |
|
1855 |
apply(auto) |
|
1856 |
using contains.simps apply blast |
|
1857 |
apply(erule contains.cases) |
|
1858 |
apply(auto) |
|
1859 |
using contains0 apply fastforce |
|
1860 |
using contains.simps by blast |
|
1861 |
||
1862 |
lemma contains_ex2: |
|
1863 |
assumes "a = AALTs bs1 [AZERO, AONE bs2, AALTs bs5 [AONE bs3, AZERO, AONE bs4]]" "a >> bs" |
|
1864 |
shows "bsimp a >> bs" |
|
1865 |
using assms |
|
1866 |
apply(simp) |
|
1867 |
apply(erule contains.cases) |
|
1868 |
apply(auto) |
|
1869 |
using contains.simps apply blast |
|
1870 |
apply(erule contains.cases) |
|
1871 |
apply(auto) |
|
1872 |
using contains3b apply blast |
|
1873 |
apply(erule contains.cases) |
|
1874 |
apply(auto) |
|
1875 |
apply(erule contains.cases) |
|
1876 |
apply(auto) |
|
343 | 1877 |
apply (metis contains.intros(4) contains.intros(5) contains0 fuse.simps(2)) |
337 | 1878 |
apply(erule contains.cases) |
1879 |
apply(auto) |
|
1880 |
using contains.simps apply blast |
|
1881 |
apply(erule contains.cases) |
|
1882 |
apply(auto) |
|
343 | 1883 |
apply (metis contains.intros(4) contains.intros(5) contains0 fuse.simps(2)) |
337 | 1884 |
apply(erule contains.cases) |
1885 |
apply(auto) |
|
1886 |
apply(erule contains.cases) |
|
1887 |
apply(auto) |
|
1888 |
done |
|
1889 |
||
1890 |
lemma contains48: |
|
1891 |
assumes "\<And>x2aa bs bs1. \<lbrakk>x2aa \<in> set x2a; fuse bs x2aa >> bs @ bs1\<rbrakk> \<Longrightarrow> x2aa >> bs1" |
|
1892 |
"AALTs (bs @ x1) x2a >> bs @ bs1" |
|
1893 |
shows "AALTs x1 x2a >> bs1" |
|
1894 |
using assms |
|
1895 |
apply(induct x2a arbitrary: bs x1 bs1) |
|
1896 |
apply(auto) |
|
1897 |
apply(erule contains.cases) |
|
1898 |
apply(auto) |
|
1899 |
apply(erule contains.cases) |
|
1900 |
apply(auto) |
|
1901 |
apply (simp add: contains.intros(4)) |
|
1902 |
using contains.intros(5) by blast |
|
1903 |
||
1904 |
||
1905 |
lemma contains49: |
|
1906 |
assumes "fuse bs a >> bs @ bs1" |
|
1907 |
shows "a >> bs1" |
|
1908 |
using assms |
|
1909 |
apply(induct a arbitrary: bs bs1) |
|
1910 |
apply(auto) |
|
1911 |
using contains.simps apply blast |
|
1912 |
apply(erule contains.cases) |
|
1913 |
apply(auto) |
|
1914 |
apply(rule contains.intros) |
|
1915 |
apply(erule contains.cases) |
|
1916 |
apply(auto) |
|
1917 |
apply(rule contains.intros) |
|
1918 |
apply(erule contains.cases) |
|
1919 |
apply(auto) |
|
1920 |
apply(rule contains.intros) |
|
1921 |
apply(auto)[2] |
|
1922 |
prefer 2 |
|
1923 |
apply(erule contains.cases) |
|
1924 |
apply(auto) |
|
1925 |
apply (simp add: contains.intros(6)) |
|
1926 |
using contains.intros(7) apply blast |
|
1927 |
using contains48 by blast |
|
1928 |
||
1929 |
lemma contains50: |
|
1930 |
assumes "bsimp_AALTs bs rs2 >> bs @ bs1" |
|
1931 |
shows "bsimp_AALTs bs (rs1 @ rs2) >> bs @ bs1" |
|
1932 |
using assms |
|
1933 |
apply(induct rs1 arbitrary: bs rs2 bs1) |
|
1934 |
apply(simp) |
|
1935 |
apply(auto) |
|
1936 |
apply(case_tac rs1) |
|
1937 |
apply(simp) |
|
1938 |
apply(case_tac rs2) |
|
1939 |
apply(simp) |
|
1940 |
using contains.simps apply blast |
|
1941 |
apply(simp) |
|
1942 |
apply(case_tac list) |
|
1943 |
apply(simp) |
|
1944 |
apply(rule contains.intros) |
|
1945 |
back |
|
1946 |
apply(rule contains.intros) |
|
1947 |
using contains49 apply blast |
|
1948 |
apply(simp) |
|
1949 |
using contains.intros(5) apply blast |
|
1950 |
apply(simp) |
|
1951 |
by (metis bsimp_AALTs.elims contains.intros(4) contains.intros(5) contains49 list.distinct(1)) |
|
1952 |
||
1953 |
lemma contains51: |
|
1954 |
assumes "bsimp_AALTs bs [r] >> bs @ bs1" |
|
1955 |
shows "bsimp_AALTs bs ([r] @ rs2) >> bs @ bs1" |
|
1956 |
using assms |
|
1957 |
apply(induct rs2 arbitrary: bs r bs1) |
|
1958 |
apply(simp) |
|
1959 |
apply(auto) |
|
1960 |
using contains.intros(4) contains49 by blast |
|
1961 |
||
1962 |
lemma contains51a: |
|
1963 |
assumes "bsimp_AALTs bs rs2 >> bs @ bs1" |
|
1964 |
shows "bsimp_AALTs bs (rs2 @ [r]) >> bs @ bs1" |
|
1965 |
using assms |
|
1966 |
apply(induct rs2 arbitrary: bs r bs1) |
|
1967 |
apply(simp) |
|
1968 |
apply(auto) |
|
1969 |
using contains.simps apply blast |
|
1970 |
apply(case_tac rs2) |
|
1971 |
apply(auto) |
|
1972 |
using contains3b contains49 apply blast |
|
1973 |
apply(case_tac list) |
|
1974 |
apply(auto) |
|
1975 |
apply(erule contains.cases) |
|
1976 |
apply(auto) |
|
1977 |
using contains.intros(4) apply auto[1] |
|
1978 |
apply(erule contains.cases) |
|
1979 |
apply(auto) |
|
1980 |
apply (simp add: contains.intros(4) contains.intros(5)) |
|
1981 |
apply (simp add: contains.intros(5)) |
|
1982 |
apply(erule contains.cases) |
|
1983 |
apply(auto) |
|
1984 |
apply (simp add: contains.intros(4)) |
|
1985 |
apply(erule contains.cases) |
|
1986 |
apply(auto) |
|
1987 |
using contains.intros(4) contains.intros(5) apply blast |
|
1988 |
using contains.intros(5) by blast |
|
1989 |
||
1990 |
lemma contains51b: |
|
1991 |
assumes "bsimp_AALTs bs rs >> bs @ bs1" |
|
1992 |
shows "bsimp_AALTs bs (rs @ rs2) >> bs @ bs1" |
|
1993 |
using assms |
|
1994 |
apply(induct rs2 arbitrary: bs rs bs1) |
|
1995 |
apply(simp) |
|
1996 |
using contains51a by fastforce |
|
1997 |
||
1998 |
||
1999 |
lemma contains51c: |
|
2000 |
assumes "AALTs (bs @ bs2) rs >> bs @ bs1" |
|
2001 |
shows "bsimp_AALTs bs (map (fuse bs2) rs) >> bs @ bs1" |
|
2002 |
using assms |
|
2003 |
apply(induct rs arbitrary: bs bs1 bs2) |
|
2004 |
apply(auto) |
|
2005 |
apply(erule contains.cases) |
|
2006 |
apply(auto) |
|
2007 |
apply(erule contains.cases) |
|
2008 |
apply(auto) |
|
2009 |
using contains0 contains51 apply auto[1] |
|
2010 |
by (metis append.left_neutral append_Cons contains50 list.simps(9)) |
|
2011 |
||
2012 |
||
2013 |
lemma contains51d: |
|
2014 |
assumes "fuse bs r >> bs @ bs1" |
|
2015 |
shows "bsimp_AALTs bs (flts [r]) >> bs @ bs1" |
|
2016 |
using assms |
|
2017 |
apply(induct r arbitrary: bs bs1) |
|
2018 |
apply(auto) |
|
2019 |
by (simp add: contains51c) |
|
2020 |
||
2021 |
lemma contains52: |
|
2022 |
assumes "\<exists>r \<in> set rs. (fuse bs r) >> bs @ bs1" |
|
2023 |
shows "bsimp_AALTs bs (flts rs) >> bs @ bs1" |
|
2024 |
using assms |
|
2025 |
apply(induct rs arbitrary: bs bs1) |
|
2026 |
apply(simp) |
|
2027 |
apply(auto) |
|
2028 |
defer |
|
2029 |
apply (metis contains50 k0) |
|
2030 |
apply(subst k0) |
|
2031 |
apply(rule contains51b) |
|
2032 |
using contains51d by blast |
|
2033 |
||
2034 |
lemma contains55: |
|
2035 |
assumes "a >> bs" |
|
2036 |
shows "bsimp a >> bs" |
|
2037 |
using assms |
|
2038 |
apply(induct a bs arbitrary:) |
|
2039 |
apply(auto intro: contains.intros) |
|
2040 |
apply(case_tac "bsimp a1 = AZERO") |
|
2041 |
apply(simp) |
|
2042 |
using contains.simps apply blast |
|
2043 |
apply(case_tac "bsimp a2 = AZERO") |
|
2044 |
apply(simp) |
|
2045 |
using contains.simps apply blast |
|
2046 |
apply(case_tac "\<exists>bs. bsimp a1 = AONE bs") |
|
2047 |
apply(auto)[1] |
|
2048 |
apply(rotate_tac 1) |
|
2049 |
apply(erule contains.cases) |
|
2050 |
apply(auto) |
|
2051 |
apply (simp add: b1 contains0 fuse_append) |
|
2052 |
apply (simp add: bsimp_ASEQ1 contains.intros(3)) |
|
2053 |
prefer 2 |
|
2054 |
apply(case_tac rs) |
|
2055 |
apply(simp) |
|
2056 |
using contains.simps apply blast |
|
2057 |
apply (metis contains50 k0) |
|
2058 |
(* AALTS case *) |
|
2059 |
apply(rule contains52) |
|
2060 |
apply(rule_tac x="bsimp r" in bexI) |
|
2061 |
apply(auto) |
|
2062 |
using contains0 by blast |
|
2063 |
||
2064 |
||
2065 |
lemma q3a: |
|
2066 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
2067 |
shows "bmkeps (AALTs bs (map (fuse bs1) rs)) = bmkeps (AALTs (bs@bs1) rs)" |
|
2068 |
using assms |
|
2069 |
apply(induct rs arbitrary: bs bs1) |
|
2070 |
apply(simp) |
|
2071 |
apply(simp) |
|
2072 |
apply(auto) |
|
2073 |
apply (metis append_assoc b2 bnullable_correctness erase_fuse r0) |
|
2074 |
apply(case_tac "bnullable a") |
|
2075 |
apply (metis append.assoc b2 bnullable_correctness erase_fuse r0) |
|
2076 |
apply(case_tac rs) |
|
2077 |
apply(simp) |
|
2078 |
apply(simp) |
|
2079 |
apply(auto)[1] |
|
2080 |
apply (metis bnullable_correctness erase_fuse)+ |
|
2081 |
done |
|
2082 |
||
338 | 2083 |
|
2084 |
||
2085 |
lemma qq4a: |
|
337 | 2086 |
assumes "\<exists>x\<in>set list. bnullable x" |
2087 |
shows "\<exists>x\<in>set (flts list). bnullable x" |
|
2088 |
using assms |
|
2089 |
apply(induct list rule: flts.induct) |
|
2090 |
apply(auto) |
|
2091 |
by (metis UnCI bnullable_correctness erase_fuse imageI) |
|
2092 |
||
2093 |
||
2094 |
lemma qs3: |
|
2095 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
2096 |
shows "bmkeps (AALTs bs rs) = bmkeps (AALTs bs (flts rs))" |
|
2097 |
using assms |
|
2098 |
apply(induct rs arbitrary: bs taking: size rule: measure_induct) |
|
2099 |
apply(case_tac x) |
|
2100 |
apply(simp) |
|
2101 |
apply(simp) |
|
2102 |
apply(case_tac a) |
|
2103 |
apply(simp) |
|
2104 |
apply (simp add: r1) |
|
2105 |
apply(simp) |
|
2106 |
apply (simp add: r0) |
|
2107 |
apply(simp) |
|
2108 |
apply(case_tac "flts list") |
|
2109 |
apply(simp) |
|
2110 |
apply (metis L_erase_AALTs L_erase_flts L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(4) mkeps_nullable r2) |
|
2111 |
apply(simp) |
|
2112 |
apply (simp add: r1) |
|
2113 |
prefer 3 |
|
2114 |
apply(simp) |
|
2115 |
apply (simp add: r0) |
|
2116 |
prefer 2 |
|
2117 |
apply(simp) |
|
2118 |
apply(case_tac "\<exists>x\<in>set x52. bnullable x") |
|
2119 |
apply(case_tac "list") |
|
2120 |
apply(simp) |
|
2121 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
2122 |
apply(erule disjE) |
|
2123 |
apply(subst qq1) |
|
2124 |
apply(auto)[1] |
|
2125 |
apply (metis bnullable_correctness erase_fuse) |
|
2126 |
apply(simp) |
|
2127 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
2128 |
apply(simp) |
|
2129 |
apply(auto)[1] |
|
2130 |
apply(subst qq1) |
|
2131 |
apply (metis bnullable_correctness erase_fuse image_eqI set_map) |
|
2132 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
2133 |
apply(subst qq1) |
|
2134 |
apply (metis bnullable_correctness erase_fuse image_eqI set_map) |
|
2135 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
2136 |
apply(simp) |
|
2137 |
apply(subst qq2) |
|
2138 |
apply (metis bnullable_correctness erase_fuse imageE set_map) |
|
2139 |
prefer 2 |
|
2140 |
apply(case_tac "list") |
|
2141 |
apply(simp) |
|
2142 |
apply(simp) |
|
338 | 2143 |
apply (simp add: qq4a) |
337 | 2144 |
apply(simp) |
2145 |
apply(auto) |
|
2146 |
apply(case_tac list) |
|
2147 |
apply(simp) |
|
2148 |
apply(simp) |
|
2149 |
apply (simp add: r0) |
|
2150 |
apply(case_tac "bnullable (ASEQ x41 x42 x43)") |
|
2151 |
apply(case_tac list) |
|
2152 |
apply(simp) |
|
2153 |
apply(simp) |
|
2154 |
apply (simp add: r0) |
|
2155 |
apply(simp) |
|
338 | 2156 |
using qq4a r1 r2 by auto |
337 | 2157 |
|
2158 |
||
2159 |
||
2160 |
lemma k1: |
|
2161 |
assumes "\<And>x2aa. \<lbrakk>x2aa \<in> set x2a; bnullable x2aa\<rbrakk> \<Longrightarrow> bmkeps x2aa = bmkeps (bsimp x2aa)" |
|
2162 |
"\<exists>x\<in>set x2a. bnullable x" |
|
2163 |
shows "bmkeps (AALTs x1 (flts x2a)) = bmkeps (AALTs x1 (flts (map bsimp x2a)))" |
|
2164 |
using assms |
|
2165 |
apply(induct x2a) |
|
2166 |
apply fastforce |
|
2167 |
apply(simp) |
|
2168 |
apply(subst k0) |
|
2169 |
apply(subst (2) k0) |
|
2170 |
apply(auto)[1] |
|
2171 |
apply (metis b3 k0 list.set_intros(1) qs3 r0) |
|
2172 |
by (smt b3 imageI insert_iff k0 list.set(2) qq3 qs3 r0 r1 set_map) |
|
2173 |
||
2174 |
||
2175 |
||
2176 |
lemma bmkeps_simp: |
|
2177 |
assumes "bnullable r" |
|
2178 |
shows "bmkeps r = bmkeps (bsimp r)" |
|
2179 |
using assms |
|
2180 |
apply(induct r) |
|
2181 |
apply(simp) |
|
2182 |
apply(simp) |
|
2183 |
apply(simp) |
|
2184 |
apply(simp) |
|
2185 |
prefer 3 |
|
2186 |
apply(simp) |
|
2187 |
apply(case_tac "bsimp r1 = AZERO") |
|
2188 |
apply(simp) |
|
2189 |
apply(auto)[1] |
|
2190 |
apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable) |
|
2191 |
apply(case_tac "bsimp r2 = AZERO") |
|
2192 |
apply(simp) |
|
2193 |
apply(auto)[1] |
|
2194 |
apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable) |
|
2195 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
2196 |
apply(auto)[1] |
|
2197 |
apply(subst b1) |
|
2198 |
apply(subst b2) |
|
2199 |
apply(simp add: b3[symmetric]) |
|
2200 |
apply(simp) |
|
2201 |
apply(subgoal_tac "bsimp_ASEQ x1 (bsimp r1) (bsimp r2) = ASEQ x1 (bsimp r1) (bsimp r2)") |
|
2202 |
prefer 2 |
|
2203 |
apply (smt b3 bnullable.elims(2) bsimp_ASEQ.simps(17) bsimp_ASEQ.simps(19) bsimp_ASEQ.simps(20) bsimp_ASEQ.simps(21) bsimp_ASEQ.simps(22) bsimp_ASEQ.simps(24) bsimp_ASEQ.simps(25) bsimp_ASEQ.simps(26) bsimp_ASEQ.simps(27) bsimp_ASEQ.simps(29) bsimp_ASEQ.simps(30) bsimp_ASEQ.simps(31)) |
|
2204 |
apply(simp) |
|
2205 |
apply(simp) |
|
2206 |
thm q3 |
|
2207 |
apply(subst q3[symmetric]) |
|
2208 |
apply simp |
|
338 | 2209 |
using b3 qq4a apply auto[1] |
337 | 2210 |
apply(subst qs3) |
2211 |
apply simp |
|
2212 |
using k1 by blast |
|
2213 |
||
2214 |
thm bmkeps_retrieve bmkeps_simp bder_retrieve |
|
2215 |
||
2216 |
lemma bmkeps_bder_AALTs: |
|
2217 |
assumes "\<exists>r \<in> set rs. bnullable (bder c r)" |
|
2218 |
shows "bmkeps (bder c (bsimp_AALTs bs rs)) = bmkeps (bsimp_AALTs bs (map (bder c) rs))" |
|
2219 |
using assms |
|
2220 |
apply(induct rs) |
|
2221 |
apply(simp) |
|
2222 |
apply(simp) |
|
2223 |
apply(auto) |
|
2224 |
apply(case_tac rs) |
|
2225 |
apply(simp) |
|
2226 |
apply (metis (full_types) Prf_injval bder_retrieve bmkeps_retrieve bnullable_correctness erase_bder erase_fuse mkeps_nullable retrieve_fuse2) |
|
2227 |
apply(simp) |
|
2228 |
apply(case_tac rs) |
|
2229 |
apply(simp_all) |
|
2230 |
done |
|
2231 |
||
2232 |
lemma bbs0: |
|
2233 |
shows "blexer_simp r [] = blexer r []" |
|
2234 |
apply(simp add: blexer_def blexer_simp_def) |
|
2235 |
done |
|
2236 |
||
2237 |
lemma bbs1: |
|
2238 |
shows "blexer_simp r [c] = blexer r [c]" |
|
2239 |
apply(simp add: blexer_def blexer_simp_def) |
|
2240 |
apply(auto) |
|
2241 |
defer |
|
2242 |
using b3 apply auto[1] |
|
2243 |
using b3 apply auto[1] |
|
2244 |
apply(subst bmkeps_simp[symmetric]) |
|
2245 |
apply(simp) |
|
2246 |
apply(simp) |
|
2247 |
done |
|
2248 |
||
2249 |
lemma oo: |
|
2250 |
shows "(case (blexer (der c r) s) of None \<Rightarrow> None | Some v \<Rightarrow> Some (injval r c v)) = blexer r (c # s)" |
|
2251 |
apply(simp add: blexer_correctness) |
|
2252 |
done |
|
2253 |
||
2254 |
lemma XXX2_helper: |
|
2255 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" |
|
2256 |
"\<forall>r'\<in>set rs. good r' \<and> nonalt r'" |
|
2257 |
shows "flts (map (bsimp \<circ> bder c) (flts (map bsimp rs))) = flts (map (bsimp \<circ> bder c) rs)" |
|
2258 |
using assms |
|
2259 |
apply(induct rs arbitrary: c) |
|
2260 |
apply(simp) |
|
2261 |
apply(simp) |
|
2262 |
apply(subst k0) |
|
2263 |
apply(simp add: flts_append) |
|
2264 |
apply(subst (2) k0) |
|
2265 |
apply(simp add: flts_append) |
|
2266 |
apply(subgoal_tac "flts [a] = [a]") |
|
2267 |
prefer 2 |
|
2268 |
using good.simps(1) k0b apply blast |
|
2269 |
apply(simp) |
|
2270 |
done |
|
2271 |
||
2272 |
lemma bmkeps_good: |
|
2273 |
assumes "good a" |
|
2274 |
shows "bmkeps (bsimp a) = bmkeps a" |
|
2275 |
using assms |
|
2276 |
using test2 by auto |
|
2277 |
||
2278 |
||
2279 |
lemma xxx_bder: |
|
2280 |
assumes "good r" |
|
2281 |
shows "L (erase r) \<noteq> {}" |
|
2282 |
using assms |
|
2283 |
apply(induct r rule: good.induct) |
|
2284 |
apply(auto simp add: Sequ_def) |
|
2285 |
done |
|
2286 |
||
2287 |
lemma xxx_bder2: |
|
2288 |
assumes "L (erase (bsimp r)) = {}" |
|
2289 |
shows "bsimp r = AZERO" |
|
2290 |
using assms xxx_bder test2 good1 |
|
2291 |
by blast |
|
2292 |
||
2293 |
lemma XXX2aa: |
|
2294 |
assumes "good a" |
|
2295 |
shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
|
2296 |
using assms |
|
2297 |
by (simp add: test2) |
|
2298 |
||
2299 |
lemma XXX2aa_ders: |
|
2300 |
assumes "good a" |
|
2301 |
shows "bsimp (bders (bsimp a) s) = bsimp (bders a s)" |
|
2302 |
using assms |
|
2303 |
by (simp add: test2) |
|
2304 |
||
2305 |
lemma XXX4a: |
|
2306 |
shows "good (bders_simp (bsimp r) s) \<or> bders_simp (bsimp r) s = AZERO" |
|
2307 |
apply(induct s arbitrary: r rule: rev_induct) |
|
2308 |
apply(simp) |
|
2309 |
apply (simp add: good1) |
|
2310 |
apply(simp add: bders_simp_append) |
|
2311 |
apply (simp add: good1) |
|
2312 |
done |
|
2313 |
||
2314 |
lemma XXX4a_good: |
|
2315 |
assumes "good a" |
|
2316 |
shows "good (bders_simp a s) \<or> bders_simp a s = AZERO" |
|
2317 |
using assms |
|
2318 |
apply(induct s arbitrary: a rule: rev_induct) |
|
2319 |
apply(simp) |
|
2320 |
apply(simp add: bders_simp_append) |
|
2321 |
apply (simp add: good1) |
|
2322 |
done |
|
2323 |
||
2324 |
lemma XXX4a_good_cons: |
|
2325 |
assumes "s \<noteq> []" |
|
2326 |
shows "good (bders_simp a s) \<or> bders_simp a s = AZERO" |
|
2327 |
using assms |
|
2328 |
apply(case_tac s) |
|
2329 |
apply(auto) |
|
2330 |
using XXX4a by blast |
|
2331 |
||
2332 |
lemma XXX4b: |
|
2333 |
assumes "good a" "L (erase (bders_simp a s)) \<noteq> {}" |
|
2334 |
shows "good (bders_simp a s)" |
|
2335 |
using assms |
|
2336 |
apply(induct s arbitrary: a) |
|
2337 |
apply(simp) |
|
2338 |
apply(simp) |
|
2339 |
apply(subgoal_tac "L (erase (bder a aa)) = {} \<or> L (erase (bder a aa)) \<noteq> {}") |
|
2340 |
prefer 2 |
|
2341 |
apply(auto)[1] |
|
2342 |
apply(erule disjE) |
|
2343 |
apply(subgoal_tac "bsimp (bder a aa) = AZERO") |
|
2344 |
prefer 2 |
|
2345 |
using L_bsimp_erase xxx_bder2 apply auto[1] |
|
2346 |
apply(simp) |
|
2347 |
apply (metis L.simps(1) XXX4a erase.simps(1)) |
|
2348 |
apply(drule_tac x="bsimp (bder a aa)" in meta_spec) |
|
2349 |
apply(drule meta_mp) |
|
2350 |
apply simp |
|
2351 |
apply(rule good1a) |
|
2352 |
apply(auto) |
|
2353 |
done |
|
2354 |
||
2355 |
lemma bders_AZERO: |
|
2356 |
shows "bders AZERO s = AZERO" |
|
2357 |
and "bders_simp AZERO s = AZERO" |
|
2358 |
apply (induct s) |
|
2359 |
apply(auto) |
|
2360 |
done |
|
2361 |
||
2362 |
lemma LA: |
|
2363 |
assumes "\<Turnstile> v : ders s (erase r)" |
|
2364 |
shows "retrieve (bders r s) v = retrieve r (flex (erase r) id s v)" |
|
2365 |
using assms |
|
2366 |
apply(induct s arbitrary: r v rule: rev_induct) |
|
2367 |
apply(simp) |
|
2368 |
apply(simp add: bders_append ders_append) |
|
2369 |
apply(subst bder_retrieve) |
|
2370 |
apply(simp) |
|
2371 |
apply(drule Prf_injval) |
|
2372 |
by (simp add: flex_append) |
|
2373 |
||
2374 |
||
2375 |
lemma LB: |
|
2376 |
assumes "s \<in> (erase r) \<rightarrow> v" |
|
2377 |
shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (ders s (erase r))))" |
|
2378 |
using assms |
|
2379 |
apply(induct s arbitrary: r v rule: rev_induct) |
|
2380 |
apply(simp) |
|
2381 |
apply(subgoal_tac "v = mkeps (erase r)") |
|
2382 |
prefer 2 |
|
2383 |
apply (simp add: Posix1(1) Posix_determ Posix_mkeps nullable_correctness) |
|
2384 |
apply(simp) |
|
2385 |
apply(simp add: flex_append ders_append) |
|
2386 |
by (metis Posix_determ Posix_flex Posix_injval Posix_mkeps ders_snoc lexer_correctness(2) lexer_flex) |
|
2387 |
||
2388 |
lemma LB_sym: |
|
2389 |
assumes "s \<in> (erase r) \<rightarrow> v" |
|
2390 |
shows "retrieve r v = retrieve r (flex (erase r) id s (mkeps (erase (bders r s))))" |
|
2391 |
using assms |
|
2392 |
by (simp add: LB) |
|
2393 |
||
2394 |
||
2395 |
lemma LC: |
|
2396 |
assumes "s \<in> (erase r) \<rightarrow> v" |
|
2397 |
shows "retrieve r v = retrieve (bders r s) (mkeps (erase (bders r s)))" |
|
2398 |
apply(simp) |
|
2399 |
by (metis LA LB Posix1(1) assms lexer_correct_None lexer_flex mkeps_nullable) |
|
2400 |
||
2401 |
||
2402 |
lemma L0: |
|
2403 |
assumes "bnullable a" |
|
2404 |
shows "retrieve (bsimp a) (mkeps (erase (bsimp a))) = retrieve a (mkeps (erase a))" |
|
343 | 2405 |
using assms b3 bmkeps_retrieve bmkeps_simp bnullable_correctness |
337 | 2406 |
by (metis b3 bmkeps_retrieve bmkeps_simp bnullable_correctness) |
2407 |
||
2408 |
thm bmkeps_retrieve |
|
2409 |
||
2410 |
lemma L0a: |
|
2411 |
assumes "s \<in> L(erase a)" |
|
2412 |
shows "retrieve (bsimp (bders a s)) (mkeps (erase (bsimp (bders a s)))) = |
|
2413 |
retrieve (bders a s) (mkeps (erase (bders a s)))" |
|
2414 |
using assms |
|
2415 |
by (metis L0 bnullable_correctness erase_bders lexer_correct_None lexer_flex) |
|
2416 |
||
2417 |
lemma L0aa: |
|
2418 |
assumes "s \<in> L (erase a)" |
|
2419 |
shows "[] \<in> erase (bsimp (bders a s)) \<rightarrow> mkeps (erase (bsimp (bders a s)))" |
|
2420 |
using assms |
|
2421 |
by (metis Posix_mkeps b3 bnullable_correctness erase_bders lexer_correct_None lexer_flex) |
|
2422 |
||
2423 |
lemma L0aaa: |
|
2424 |
assumes "[c] \<in> L (erase a)" |
|
2425 |
shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bder c a)))" |
|
2426 |
using assms |
|
2427 |
by (metis bders.simps(1) bders.simps(2) erase_bders lexer_correct_None lexer_correct_Some lexer_flex option.inject) |
|
2428 |
||
2429 |
lemma L0aaaa: |
|
2430 |
assumes "[c] \<in> L (erase a)" |
|
2431 |
shows "[c] \<in> (erase a) \<rightarrow> flex (erase a) id [c] (mkeps (erase (bders a [c])))" |
|
2432 |
using assms |
|
2433 |
using L0aaa by auto |
|
2434 |
||
2435 |
||
2436 |
lemma L02: |
|
2437 |
assumes "bnullable (bder c a)" |
|
2438 |
shows "retrieve (bsimp a) (flex (erase (bsimp a)) id [c] (mkeps (erase (bder c (bsimp a))))) = |
|
2439 |
retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a))))" |
|
2440 |
using assms |
|
2441 |
apply(simp) |
|
2442 |
using bder_retrieve L0 bmkeps_simp bmkeps_retrieve L0 LA LB |
|
2443 |
apply(subst bder_retrieve[symmetric]) |
|
2444 |
apply (metis L_bsimp_erase bnullable_correctness der_correctness erase_bder mkeps_nullable nullable_correctness) |
|
2445 |
apply(simp) |
|
2446 |
done |
|
2447 |
||
2448 |
lemma L02_bders: |
|
2449 |
assumes "bnullable (bders a s)" |
|
2450 |
shows "retrieve (bsimp a) (flex (erase (bsimp a)) id s (mkeps (erase (bders (bsimp a) s)))) = |
|
2451 |
retrieve (bders (bsimp a) s) (mkeps (erase (bders (bsimp a) s)))" |
|
2452 |
using assms |
|
2453 |
by (metis LA L_bsimp_erase bnullable_correctness ders_correctness erase_bders mkeps_nullable nullable_correctness) |
|
2454 |
||
2455 |
||
2456 |
||
2457 |
||
2458 |
lemma L03: |
|
2459 |
assumes "bnullable (bder c a)" |
|
2460 |
shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) = |
|
2461 |
bmkeps (bsimp (bder c (bsimp a)))" |
|
2462 |
using assms |
|
2463 |
by (metis L0 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness) |
|
2464 |
||
2465 |
lemma L04: |
|
2466 |
assumes "bnullable (bder c a)" |
|
2467 |
shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) = |
|
2468 |
retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))" |
|
2469 |
using assms |
|
2470 |
by (metis L0 L_bsimp_erase bnullable_correctness der_correctness erase_bder nullable_correctness) |
|
2471 |
||
2472 |
lemma L05: |
|
2473 |
assumes "bnullable (bder c a)" |
|
2474 |
shows "retrieve (bder c (bsimp a)) (mkeps (erase (bder c (bsimp a)))) = |
|
2475 |
retrieve (bsimp (bder c (bsimp a))) (mkeps (erase (bsimp (bder c (bsimp a)))))" |
|
2476 |
using assms |
|
2477 |
using L04 by auto |
|
2478 |
||
2479 |
lemma L06: |
|
2480 |
assumes "bnullable (bder c a)" |
|
2481 |
shows "bmkeps (bder c (bsimp a)) = bmkeps (bsimp (bder c (bsimp a)))" |
|
2482 |
using assms |
|
2483 |
by (metis L03 L_bsimp_erase bmkeps_retrieve bnullable_correctness der_correctness erase_bder nullable_correctness) |
|
2484 |
||
2485 |
lemma L07: |
|
2486 |
assumes "s \<in> L (erase r)" |
|
2487 |
shows "retrieve r (flex (erase r) id s (mkeps (ders s (erase r)))) |
|
2488 |
= retrieve (bders r s) (mkeps (erase (bders r s)))" |
|
2489 |
using assms |
|
2490 |
using LB LC lexer_correct_Some by auto |
|
2491 |
||
2492 |
lemma L06_2: |
|
2493 |
assumes "bnullable (bders a [c,d])" |
|
2494 |
shows "bmkeps (bders (bsimp a) [c,d]) = bmkeps (bsimp (bders (bsimp a) [c,d]))" |
|
2495 |
using assms |
|
2496 |
apply(simp) |
|
2497 |
by (metis L_bsimp_erase bmkeps_simp bnullable_correctness der_correctness erase_bder nullable_correctness) |
|
2498 |
||
2499 |
lemma L06_bders: |
|
2500 |
assumes "bnullable (bders a s)" |
|
2501 |
shows "bmkeps (bders (bsimp a) s) = bmkeps (bsimp (bders (bsimp a) s))" |
|
2502 |
using assms |
|
2503 |
by (metis L_bsimp_erase bmkeps_simp bnullable_correctness ders_correctness erase_bders nullable_correctness) |
|
2504 |
||
2505 |
lemma LLLL: |
|
2506 |
shows "L (erase a) = L (erase (bsimp a))" |
|
2507 |
and "L (erase a) = {flat v | v. \<Turnstile> v: (erase a)}" |
|
2508 |
and "L (erase a) = {flat v | v. \<Turnstile> v: (erase (bsimp a))}" |
|
2509 |
using L_bsimp_erase apply(blast) |
|
2510 |
apply (simp add: L_flat_Prf) |
|
2511 |
using L_bsimp_erase L_flat_Prf apply(auto)[1] |
|
2512 |
done |
|
2513 |
||
2514 |
||
2515 |
||
2516 |
lemma L07XX: |
|
2517 |
assumes "s \<in> L (erase a)" |
|
2518 |
shows "s \<in> erase a \<rightarrow> flex (erase a) id s (mkeps (ders s (erase a)))" |
|
2519 |
using assms |
|
2520 |
by (meson lexer_correct_None lexer_correctness(1) lexer_flex) |
|
2521 |
||
2522 |
lemma LX0: |
|
2523 |
assumes "s \<in> L r" |
|
2524 |
shows "decode (bmkeps (bders (intern r) s)) r = Some(flex r id s (mkeps (ders s r)))" |
|
2525 |
by (metis assms blexer_correctness blexer_def lexer_correct_None lexer_flex) |
|
2526 |
||
2527 |
lemma L1: |
|
2528 |
assumes "s \<in> r \<rightarrow> v" |
|
2529 |
shows "decode (bmkeps (bders (intern r) s)) r = Some v" |
|
2530 |
using assms |
|
2531 |
by (metis blexer_correctness blexer_def lexer_correctness(1) option.distinct(1)) |
|
2532 |
||
2533 |
lemma L2: |
|
2534 |
assumes "s \<in> (der c r) \<rightarrow> v" |
|
2535 |
shows "decode (bmkeps (bders (intern r) (c # s))) r = Some (injval r c v)" |
|
2536 |
using assms |
|
2537 |
apply(subst bmkeps_retrieve) |
|
2538 |
using Posix1(1) lexer_correct_None lexer_flex apply fastforce |
|
2539 |
using MAIN_decode |
|
2540 |
apply(subst MAIN_decode[symmetric]) |
|
2541 |
apply(simp) |
|
2542 |
apply (meson Posix1(1) lexer_correct_None lexer_flex mkeps_nullable) |
|
2543 |
apply(simp) |
|
2544 |
apply(subgoal_tac "v = flex (der c r) id s (mkeps (ders s (der c r)))") |
|
2545 |
prefer 2 |
|
2546 |
apply (metis Posix_determ lexer_correctness(1) lexer_flex option.distinct(1)) |
|
2547 |
apply(simp) |
|
2548 |
apply(subgoal_tac "injval r c (flex (der c r) id s (mkeps (ders s (der c r)))) = |
|
2549 |
(flex (der c r) ((\<lambda>v. injval r c v) o id) s (mkeps (ders s (der c r))))") |
|
2550 |
apply(simp) |
|
2551 |
using flex_fun_apply by blast |
|
2552 |
||
2553 |
lemma L3: |
|
2554 |
assumes "s2 \<in> (ders s1 r) \<rightarrow> v" |
|
2555 |
shows "decode (bmkeps (bders (intern r) (s1 @ s2))) r = Some (flex r id s1 v)" |
|
2556 |
using assms |
|
2557 |
apply(induct s1 arbitrary: r s2 v rule: rev_induct) |
|
2558 |
apply(simp) |
|
2559 |
using L1 apply blast |
|
2560 |
apply(simp add: ders_append) |
|
2561 |
apply(drule_tac x="r" in meta_spec) |
|
2562 |
apply(drule_tac x="x # s2" in meta_spec) |
|
2563 |
apply(drule_tac x="injval (ders xs r) x v" in meta_spec) |
|
2564 |
apply(drule meta_mp) |
|
2565 |
defer |
|
2566 |
apply(simp) |
|
2567 |
apply(simp add: flex_append) |
|
2568 |
by (simp add: Posix_injval) |
|
2569 |
||
2570 |
||
2571 |
||
2572 |
lemma bders_snoc: |
|
2573 |
"bder c (bders a s) = bders a (s @ [c])" |
|
2574 |
apply(simp add: bders_append) |
|
2575 |
done |
|
2576 |
||
2577 |
||
2578 |
lemma QQ1: |
|
2579 |
shows "bsimp (bders (bsimp a) []) = bders_simp (bsimp a) []" |
|
2580 |
apply(simp) |
|
2581 |
apply(simp add: bsimp_idem) |
|
2582 |
done |
|
2583 |
||
2584 |
lemma QQ2: |
|
2585 |
shows "bsimp (bders (bsimp a) [c]) = bders_simp (bsimp a) [c]" |
|
2586 |
apply(simp) |
|
2587 |
done |
|
2588 |
||
2589 |
lemma XXX2a_long: |
|
2590 |
assumes "good a" |
|
2591 |
shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
|
2592 |
using assms |
|
2593 |
apply(induct a arbitrary: c taking: asize rule: measure_induct) |
|
2594 |
apply(case_tac x) |
|
2595 |
apply(simp) |
|
2596 |
apply(simp) |
|
2597 |
apply(simp) |
|
2598 |
prefer 3 |
|
2599 |
apply(simp) |
|
2600 |
apply(simp) |
|
2601 |
apply(auto)[1] |
|
2602 |
apply(case_tac "x42 = AZERO") |
|
2603 |
apply(simp) |
|
2604 |
apply(case_tac "x43 = AZERO") |
|
2605 |
apply(simp) |
|
2606 |
using test2 apply force |
|
2607 |
apply(case_tac "\<exists>bs. x42 = AONE bs") |
|
2608 |
apply(clarify) |
|
2609 |
apply(simp) |
|
2610 |
apply(subst bsimp_ASEQ1) |
|
2611 |
apply(simp) |
|
2612 |
using b3 apply force |
|
2613 |
using bsimp_ASEQ0 test2 apply force |
|
2614 |
thm good_SEQ test2 |
|
2615 |
apply (simp add: good_SEQ test2) |
|
2616 |
apply (simp add: good_SEQ test2) |
|
2617 |
apply(case_tac "x42 = AZERO") |
|
2618 |
apply(simp) |
|
2619 |
apply(case_tac "x43 = AZERO") |
|
2620 |
apply(simp) |
|
2621 |
apply (simp add: bsimp_ASEQ0) |
|
2622 |
apply(case_tac "\<exists>bs. x42 = AONE bs") |
|
2623 |
apply(clarify) |
|
2624 |
apply(simp) |
|
2625 |
apply(subst bsimp_ASEQ1) |
|
2626 |
apply(simp) |
|
2627 |
using bsimp_ASEQ0 test2 apply force |
|
2628 |
apply (simp add: good_SEQ test2) |
|
2629 |
apply (simp add: good_SEQ test2) |
|
2630 |
apply (simp add: good_SEQ test2) |
|
2631 |
(* AALTs case *) |
|
2632 |
apply(simp) |
|
2633 |
using test2 by fastforce |
|
2634 |
||
2635 |
||
2636 |
lemma bder_bsimp_AALTs: |
|
2637 |
shows "bder c (bsimp_AALTs bs rs) = bsimp_AALTs bs (map (bder c) rs)" |
|
2638 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
2639 |
apply(simp) |
|
2640 |
apply(simp) |
|
2641 |
apply (simp add: bder_fuse) |
|
2642 |
apply(simp) |
|
2643 |
done |
|
2644 |
||
2645 |
lemma flts_nothing: |
|
2646 |
assumes "\<forall>r \<in> set rs. r \<noteq> AZERO" "\<forall>r \<in> set rs. nonalt r" |
|
2647 |
shows "flts rs = rs" |
|
2648 |
using assms |
|
2649 |
apply(induct rs rule: flts.induct) |
|
2650 |
apply(auto) |
|
2651 |
done |
|
2652 |
||
2653 |
lemma flts_flts: |
|
2654 |
assumes "\<forall>r \<in> set rs. good r" |
|
2655 |
shows "flts (flts rs) = flts rs" |
|
2656 |
using assms |
|
2657 |
apply(induct rs taking: "\<lambda>rs. sum_list (map asize rs)" rule: measure_induct) |
|
2658 |
apply(case_tac x) |
|
2659 |
apply(simp) |
|
2660 |
apply(simp) |
|
2661 |
apply(case_tac a) |
|
2662 |
apply(simp_all add: bder_fuse flts_append) |
|
2663 |
apply(subgoal_tac "\<forall>r \<in> set x52. r \<noteq> AZERO") |
|
2664 |
prefer 2 |
|
2665 |
apply (metis Nil_is_append_conv bsimp_AALTs.elims good.simps(1) good.simps(5) good0 list.distinct(1) n0 nn1b split_list_last test2) |
|
2666 |
apply(subgoal_tac "\<forall>r \<in> set x52. nonalt r") |
|
2667 |
prefer 2 |
|
2668 |
apply (metis n0 nn1b test2) |
|
2669 |
by (metis flts_fuse flts_nothing) |
|
2670 |
||
2671 |
||
2672 |
lemma iii: |
|
2673 |
assumes "bsimp_AALTs bs rs \<noteq> AZERO" |
|
2674 |
shows "rs \<noteq> []" |
|
2675 |
using assms |
|
2676 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
2677 |
apply(auto) |
|
2678 |
done |
|
2679 |
||
2680 |
lemma CT1_SEQ: |
|
2681 |
shows "bsimp (ASEQ bs a1 a2) = bsimp (ASEQ bs (bsimp a1) (bsimp a2))" |
|
2682 |
apply(simp add: bsimp_idem) |
|
2683 |
done |
|
2684 |
||
2685 |
lemma CT1: |
|
2686 |
shows "bsimp (AALTs bs as) = bsimp (AALTs bs (map bsimp as))" |
|
2687 |
apply(induct as arbitrary: bs) |
|
2688 |
apply(simp) |
|
2689 |
apply(simp) |
|
2690 |
by (simp add: bsimp_idem comp_def) |
|
2691 |
||
2692 |
lemma CT1a: |
|
2693 |
shows "bsimp (AALT bs a1 a2) = bsimp(AALT bs (bsimp a1) (bsimp a2))" |
|
2694 |
by (metis CT1 list.simps(8) list.simps(9)) |
|
2695 |
||
2696 |
lemma WWW2: |
|
2697 |
shows "bsimp (bsimp_AALTs bs1 (flts (map bsimp as1))) = |
|
2698 |
bsimp_AALTs bs1 (flts (map bsimp as1))" |
|
2699 |
by (metis bsimp.simps(2) bsimp_idem) |
|
2700 |
||
2701 |
lemma CT1b: |
|
2702 |
shows "bsimp (bsimp_AALTs bs as) = bsimp (bsimp_AALTs bs (map bsimp as))" |
|
2703 |
apply(induct bs as rule: bsimp_AALTs.induct) |
|
2704 |
apply(auto simp add: bsimp_idem) |
|
2705 |
apply (simp add: bsimp_fuse bsimp_idem) |
|
2706 |
by (metis bsimp_idem comp_apply) |
|
2707 |
||
2708 |
||
2709 |
||
2710 |
||
2711 |
(* CT *) |
|
2712 |
||
2713 |
lemma CTa: |
|
2714 |
assumes "\<forall>r \<in> set as. nonalt r \<and> r \<noteq> AZERO" |
|
2715 |
shows "flts as = as" |
|
2716 |
using assms |
|
2717 |
apply(induct as) |
|
2718 |
apply(simp) |
|
2719 |
apply(case_tac as) |
|
2720 |
apply(simp) |
|
2721 |
apply (simp add: k0b) |
|
2722 |
using flts_nothing by auto |
|
2723 |
||
2724 |
lemma CT0: |
|
2725 |
assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" |
|
2726 |
shows "flts [bsimp_AALTs bs1 as1] = flts (map (fuse bs1) as1)" |
|
2727 |
using assms CTa |
|
2728 |
apply(induct as1 arbitrary: bs1) |
|
2729 |
apply(simp) |
|
2730 |
apply(simp) |
|
2731 |
apply(case_tac as1) |
|
2732 |
apply(simp) |
|
2733 |
apply(simp) |
|
2734 |
proof - |
|
2735 |
fix a :: arexp and as1a :: "arexp list" and bs1a :: "bit list" and aa :: arexp and list :: "arexp list" |
|
2736 |
assume a1: "nonalt a \<and> a \<noteq> AZERO \<and> nonalt aa \<and> aa \<noteq> AZERO \<and> (\<forall>r\<in>set list. nonalt r \<and> r \<noteq> AZERO)" |
|
2737 |
assume a2: "\<And>as. \<forall>r\<in>set as. nonalt r \<and> r \<noteq> AZERO \<Longrightarrow> flts as = as" |
|
2738 |
assume a3: "as1a = aa # list" |
|
2739 |
have "flts [a] = [a]" |
|
2740 |
using a1 k0b by blast |
|
2741 |
then show "fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list = flts (fuse bs1a a # fuse bs1a aa # map (fuse bs1a) list)" |
|
2742 |
using a3 a2 a1 by (metis (no_types) append.left_neutral append_Cons flts_fuse k00 k0b list.simps(9)) |
|
2743 |
qed |
|
2744 |
||
2745 |
||
2746 |
lemma CT01: |
|
2747 |
assumes "\<forall>r \<in> set as1. nonalt r \<and> r \<noteq> AZERO" "\<forall>r \<in> set as2. nonalt r \<and> r \<noteq> AZERO" |
|
2748 |
shows "flts [bsimp_AALTs bs1 as1, bsimp_AALTs bs2 as2] = flts ((map (fuse bs1) as1) @ (map (fuse bs2) as2))" |
|
2749 |
using assms CT0 |
|
2750 |
by (metis k0 k00) |
|
2751 |
||
2752 |
||
2753 |
||
2754 |
lemma CT_exp: |
|
2755 |
assumes "\<forall>a \<in> set as. bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
|
2756 |
shows "map bsimp (map (bder c) as) = map bsimp (map (bder c) (map bsimp as))" |
|
2757 |
using assms |
|
2758 |
apply(induct as) |
|
2759 |
apply(auto) |
|
2760 |
done |
|
2761 |
||
2762 |
lemma asize_set: |
|
2763 |
assumes "a \<in> set as" |
|
2764 |
shows "asize a < Suc (sum_list (map asize as))" |
|
2765 |
using assms |
|
2766 |
apply(induct as arbitrary: a) |
|
2767 |
apply(auto) |
|
2768 |
using le_add2 le_less_trans not_less_eq by blast |
|
2769 |
||
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2770 |
lemma L_erase_bder_simp: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2771 |
shows "L (erase (bsimp (bder a r))) = L (der a (erase (bsimp r)))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2772 |
using L_bsimp_erase der_correctness by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2773 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2774 |
lemma PPP0: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2775 |
assumes "s \<in> r \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2776 |
shows "(bders (intern r) s) >> code v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2777 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2778 |
by (smt L07 L1 LX0 Posix1(1) Posix_Prf contains6 erase_bders erase_intern lexer_correct_None lexer_flex mkeps_nullable option.inject retrieve_code) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2779 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2780 |
thm L07 L1 LX0 Posix1(1) Posix_Prf contains6 erase_bders erase_intern lexer_correct_None lexer_flex mkeps_nullable option.inject retrieve_code |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2781 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2782 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2783 |
lemma PPP0_isar: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2784 |
assumes "s \<in> r \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2785 |
shows "(bders (intern r) s) >> code v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2786 |
proof - |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2787 |
from assms have a1: "\<Turnstile> v : r" using Posix_Prf by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2788 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2789 |
from assms have "s \<in> L r" using Posix1(1) by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2790 |
then have "[] \<in> L (ders s r)" by (simp add: ders_correctness Ders_def) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2791 |
then have a2: "\<Turnstile> mkeps (ders s r) : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2792 |
by (simp add: mkeps_nullable nullable_correctness) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2793 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2794 |
have "retrieve (bders (intern r) s) (mkeps (ders s r)) = |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2795 |
retrieve (intern r) (flex r id s (mkeps (ders s r)))" using a2 LA LB bder_retrieve by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2796 |
also have "... = retrieve (intern r) v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2797 |
using LB assms by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2798 |
also have "... = code v" using a1 by (simp add: retrieve_code) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2799 |
finally have "retrieve (bders (intern r) s) (mkeps (ders s r)) = code v" by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2800 |
moreover |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2801 |
have "\<Turnstile> mkeps (ders s r) : erase (bders (intern r) s)" using a2 by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2802 |
then have "bders (intern r) s >> retrieve (bders (intern r) s) (mkeps (ders s r))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2803 |
by (rule contains6) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2804 |
ultimately |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2805 |
show "(bders (intern r) s) >> code v" by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2806 |
qed |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2807 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2808 |
lemma PPP0b: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2809 |
assumes "s \<in> r \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2810 |
shows "(intern r) >> code v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2811 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2812 |
using Posix_Prf contains2 by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2813 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2814 |
lemma PPP0_eq: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2815 |
assumes "s \<in> r \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2816 |
shows "(intern r >> code v) = (bders (intern r) s >> code v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2817 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2818 |
using PPP0_isar PPP0b by blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2819 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2820 |
lemma f_cont1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2821 |
assumes "fuse bs1 a >> bs" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2822 |
shows "\<exists>bs2. bs = bs1 @ bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2823 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2824 |
apply(induct a arbitrary: bs1 bs) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2825 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2826 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2827 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2828 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2829 |
lemma f_cont2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2830 |
assumes "bsimp_AALTs bs1 as >> bs" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2831 |
shows "\<exists>bs2. bs = bs1 @ bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2832 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2833 |
apply(induct bs1 as arbitrary: bs rule: bsimp_AALTs.induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2834 |
apply(auto elim: contains.cases f_cont1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2835 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2836 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2837 |
lemma contains_SEQ1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2838 |
assumes "bsimp_ASEQ bs r1 r2 >> bsX" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2839 |
shows "\<exists>bs1 bs2. r1 >> bs1 \<and> r2 >> bs2 \<and> bsX = bs @ bs1 @ bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2840 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2841 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2842 |
apply(case_tac "r1 = AZERO") |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2843 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2844 |
using contains.simps apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2845 |
apply(case_tac "r2 = AZERO") |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2846 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2847 |
apply(simp add: bsimp_ASEQ0) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2848 |
using contains.simps apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2849 |
apply(case_tac "\<exists>bsX. r1 = AONE bsX") |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2850 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2851 |
apply(simp add: bsimp_ASEQ2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2852 |
apply (metis append_assoc contains.intros(1) contains49 f_cont1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2853 |
apply(simp add: bsimp_ASEQ1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2854 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2855 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2856 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2857 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2858 |
lemma contains59: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2859 |
assumes "AALTs bs rs >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2860 |
shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2861 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2862 |
apply(induct rs arbitrary: bs bs2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2863 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2864 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2865 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2866 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2867 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2868 |
using contains0 by blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2869 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2870 |
lemma contains60: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2871 |
assumes "\<exists>r \<in> set rs. fuse bs r >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2872 |
shows "AALTs bs rs >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2873 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2874 |
apply(induct rs arbitrary: bs bs2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2875 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2876 |
apply (metis contains3b contains49 f_cont1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2877 |
using contains.intros(5) f_cont1 by blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2878 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2879 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2880 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2881 |
lemma contains61: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2882 |
assumes "bsimp_AALTs bs rs >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2883 |
shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2884 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2885 |
apply(induct arbitrary: bs2 rule: bsimp_AALTs.induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2886 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2887 |
using contains.simps apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2888 |
using contains59 by fastforce |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2889 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2890 |
lemma contains61b: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2891 |
assumes "bsimp_AALTs bs rs >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2892 |
shows "\<exists>r \<in> set (flts rs). (fuse bs r) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2893 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2894 |
apply(induct bs rs arbitrary: bs2 rule: bsimp_AALTs.induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2895 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2896 |
using contains.simps apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2897 |
using contains51d contains61 f_cont1 apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2898 |
by (metis bsimp_AALTs.simps(3) contains52 contains61 f_cont2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2899 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2900 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2901 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2902 |
lemma contains61a: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2903 |
assumes "\<exists>r \<in> set rs. (fuse bs r) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2904 |
shows "bsimp_AALTs bs rs >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2905 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2906 |
apply(induct rs arbitrary: bs2 bs) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2907 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2908 |
apply (metis bsimp_AALTs.elims contains60 list.distinct(1) list.inject list.set_intros(1)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2909 |
by (metis append_Cons append_Nil contains50 f_cont2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2910 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2911 |
lemma contains62: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2912 |
assumes "bsimp_AALTs bs (rs1 @ rs2) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2913 |
shows "bsimp_AALTs bs rs1 >> bs2 \<or> bsimp_AALTs bs rs2 >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2914 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2915 |
apply - |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2916 |
apply(drule contains61) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2917 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2918 |
apply(case_tac rs1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2919 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2920 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2921 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2922 |
apply (simp add: contains60) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2923 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2924 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2925 |
apply (simp add: contains60) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2926 |
apply (meson contains60 list.set_intros(2)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2927 |
apply(case_tac rs2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2928 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2929 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2930 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2931 |
apply (simp add: contains60) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2932 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2933 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2934 |
apply (simp add: contains60) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2935 |
apply (meson contains60 list.set_intros(2)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2936 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2937 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2938 |
lemma contains63: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2939 |
assumes "AALTs bs (map (fuse bs1) rs) >> bs3" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2940 |
shows "AALTs (bs @ bs1) rs >> bs3" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2941 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2942 |
apply(induct rs arbitrary: bs bs1 bs3) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2943 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2944 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2945 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2946 |
apply (simp add: contains0 contains60 fuse_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2947 |
by (metis contains.intros(5) contains59 f_cont1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2948 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2949 |
lemma contains64: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2950 |
assumes "bsimp_AALTs bs (flts rs1 @ flts rs2) >> bs2" "\<forall>r \<in> set rs2. \<not> fuse bs r >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2951 |
shows "bsimp_AALTs bs (flts rs1) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2952 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2953 |
apply(induct rs2 arbitrary: rs1 bs bs2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2954 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2955 |
apply(drule_tac x="rs1" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2956 |
apply(drule_tac x="bs" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2957 |
apply(drule_tac x="bs2" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2958 |
apply(drule meta_mp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2959 |
apply(drule contains61) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2960 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2961 |
using contains51b contains61a f_cont1 apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2962 |
apply(subst (asm) k0) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2963 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2964 |
prefer 2 |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2965 |
using contains50 contains61a f_cont1 apply blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2966 |
apply(case_tac a) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2967 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2968 |
by (metis contains60 fuse_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2969 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2970 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2971 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2972 |
lemma contains65: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2973 |
assumes "bsimp_AALTs bs (flts rs) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2974 |
shows "\<exists>r \<in> set rs. (fuse bs r) >> bs2" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2975 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2976 |
apply(induct rs arbitrary: bs bs2 taking: "\<lambda>rs. sum_list (map asize rs)" rule: measure_induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2977 |
apply(case_tac x) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2978 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2979 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2980 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2981 |
apply(case_tac a) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2982 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2983 |
apply(drule contains61) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2984 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2985 |
apply (metis contains60 fuse_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2986 |
apply(case_tac lista) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2987 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2988 |
apply(subst (asm) k0) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2989 |
apply(drule contains62) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2990 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2991 |
apply(case_tac a) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2992 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2993 |
apply(case_tac x52) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2994 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2995 |
apply(case_tac list) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2996 |
apply(auto elim: contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2997 |
apply (simp add: contains60 fuse_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2998 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
2999 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3000 |
apply (metis append.left_neutral contains0 contains60 fuse.simps(4) in_set_conv_decomp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3001 |
apply(erule contains.cases) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3002 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3003 |
apply (metis contains0 contains60 fuse.simps(4) list.set_intros(1) list.set_intros(2)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3004 |
apply (simp add: contains.intros(5) contains63) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3005 |
apply(case_tac aa) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3006 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3007 |
apply (meson contains60 contains61 contains63) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3008 |
apply(subst (asm) k0) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3009 |
apply(drule contains64) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3010 |
apply(auto)[1] |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3011 |
by (metis append_Nil2 bsimp_AALTs.simps(2) contains50 contains61a contains64 f_cont2 flts.simps(1)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3012 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3013 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3014 |
lemma contains55a: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3015 |
assumes "bsimp r >> bs" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3016 |
shows "r >> bs" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3017 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3018 |
apply(induct r arbitrary: bs) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3019 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3020 |
apply(frule contains_SEQ1) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3021 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3022 |
apply (simp add: contains.intros(3)) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3023 |
apply(frule f_cont2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3024 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3025 |
apply(drule contains65) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3026 |
apply(auto) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3027 |
using contains0 contains49 contains60 by blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3028 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3029 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3030 |
lemma PPP1_eq: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3031 |
shows "bsimp r >> bs \<longleftrightarrow> r >> bs" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3032 |
using contains55 contains55a by blast |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3033 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3034 |
lemma retrieve_code_bder: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3035 |
assumes "\<Turnstile> v : der c r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3036 |
shows "code (injval r c v) = retrieve (bder c (intern r)) v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3037 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3038 |
by (simp add: Prf_injval bder_retrieve retrieve_code) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3039 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3040 |
lemma Etrans: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3041 |
assumes "a >> s" "s = t" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3042 |
shows "a >> t" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3043 |
using assms by simp |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3044 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3045 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3046 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3047 |
lemma retrieve_code_bders: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3048 |
assumes "\<Turnstile> v : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3049 |
shows "code (flex r id s v) = retrieve (bders (intern r) s) v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3050 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3051 |
apply(induct s arbitrary: v r rule: rev_induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3052 |
apply(auto simp add: ders_append flex_append bders_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3053 |
apply (simp add: retrieve_code) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3054 |
apply(frule Prf_injval) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3055 |
apply(drule_tac meta_spec)+ |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3056 |
apply(drule meta_mp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3057 |
apply(assumption) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3058 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3059 |
apply(subst bder_retrieve) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3060 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3061 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3062 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3063 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3064 |
lemma contains70: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3065 |
assumes "s \<in> L(r)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3066 |
shows "bders (intern r) s >> code (flex r id s (mkeps (ders s r)))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3067 |
apply(subst PPP0_eq[symmetric]) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3068 |
apply (meson assms lexer_correct_None lexer_correctness(1) lexer_flex) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3069 |
by (metis L07XX PPP0b assms erase_intern) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3070 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3071 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3072 |
|
343 | 3073 |
|
3074 |
||
3075 |
||
3076 |
||
3077 |
||
3078 |
||
3079 |
definition FC where |
|
3080 |
"FC a s v = retrieve a (flex (erase a) id s v)" |
|
3081 |
||
3082 |
definition FE where |
|
3083 |
"FE a s = retrieve a (flex (erase a) id s (mkeps (ders s (erase a))))" |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3084 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3085 |
definition PV where |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3086 |
"PV r s v = flex r id s v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3087 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3088 |
definition PX where |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3089 |
"PX r s = PV r s (mkeps (ders s r))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3090 |
|
343 | 3091 |
lemma FE_PX: |
3092 |
shows "FE r s = retrieve r (PX (erase r) s)" |
|
3093 |
unfolding FE_def PX_def PV_def by(simp) |
|
3094 |
||
3095 |
lemma FE_PX_code: |
|
3096 |
assumes "s \<in> L r" |
|
3097 |
shows "FE (intern r) s = code (PX r s)" |
|
3098 |
unfolding FE_def PX_def PV_def |
|
3099 |
using assms |
|
3100 |
by (metis L07XX Posix_Prf erase_intern retrieve_code) |
|
3101 |
||
3102 |
||
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3103 |
lemma PV_id[simp]: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3104 |
shows "PV r [] v = v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3105 |
by (simp add: PV_def) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3106 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3107 |
lemma PX_id[simp]: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3108 |
shows "PX r [] = mkeps r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3109 |
by (simp add: PX_def) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3110 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3111 |
lemma PV_cons: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3112 |
shows "PV r (c # s) v = injval r c (PV (der c r) s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3113 |
apply(simp add: PV_def flex_fun_apply) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3114 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3115 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3116 |
lemma PX_cons: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3117 |
shows "PX r (c # s) = injval r c (PX (der c r) s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3118 |
apply(simp add: PX_def PV_cons) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3119 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3120 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3121 |
lemma PV_append: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3122 |
shows "PV r (s1 @ s2) v = PV r s1 (PV (ders s1 r) s2 v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3123 |
apply(simp add: PV_def flex_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3124 |
by (simp add: flex_fun_apply2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3125 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3126 |
lemma PX_append: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3127 |
shows "PX r (s1 @ s2) = PV r s1 (PX (ders s1 r) s2)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3128 |
by (simp add: PV_append PX_def ders_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3129 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3130 |
lemma code_PV0: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3131 |
shows "PV r (c # s) v = injval r c (PV (der c r) s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3132 |
unfolding PX_def PV_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3133 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3134 |
by (simp add: flex_injval) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3135 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3136 |
lemma code_PX0: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3137 |
shows "PX r (c # s) = injval r c (PX (der c r) s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3138 |
unfolding PX_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3139 |
apply(simp add: code_PV0) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3140 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3141 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3142 |
lemma Prf_PV: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3143 |
assumes "\<Turnstile> v : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3144 |
shows "\<Turnstile> PV r s v : r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3145 |
using assms unfolding PX_def PV_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3146 |
apply(induct s arbitrary: v r) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3147 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3148 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3149 |
by (simp add: Prf_injval flex_injval) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3150 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3151 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3152 |
lemma Prf_PX: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3153 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3154 |
shows "\<Turnstile> PX r s : r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3155 |
using assms unfolding PX_def PV_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3156 |
using L1 LX0 Posix_Prf lexer_correct_Some by fastforce |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3157 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3158 |
lemma PV1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3159 |
assumes "\<Turnstile> v : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3160 |
shows "(intern r) >> code (PV r s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3161 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3162 |
by (simp add: Prf_PV contains2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3163 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3164 |
lemma PX1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3165 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3166 |
shows "(intern r) >> code (PX r s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3167 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3168 |
by (simp add: Prf_PX contains2) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3169 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3170 |
lemma PX2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3171 |
assumes "s \<in> L (der c r)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3172 |
shows "bder c (intern r) >> code (injval r c (PX (der c r) s))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3173 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3174 |
by (simp add: Prf_PX contains6 retrieve_code_bder) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3175 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3176 |
lemma PX2a: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3177 |
assumes "c # s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3178 |
shows "bder c (intern r) >> code (injval r c (PX (der c r) s))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3179 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3180 |
using PX2 lexer_correct_None by force |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3181 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3182 |
lemma PX2b: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3183 |
assumes "c # s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3184 |
shows "bder c (intern r) >> code (PX r (c # s))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3185 |
using assms unfolding PX_def PV_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3186 |
by (metis Der_def L07XX PV_def PX2a PX_def Posix_determ Posix_injval der_correctness erase_intern mem_Collect_eq) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3187 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3188 |
lemma PV3: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3189 |
assumes "\<Turnstile> v : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3190 |
shows "bders (intern r) s >> code (PV r s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3191 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3192 |
using PX_def PV_def contains70 |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3193 |
by (simp add: contains6 retrieve_code_bders) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3194 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3195 |
lemma PX3: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3196 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3197 |
shows "bders (intern r) s >> code (PX r s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3198 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3199 |
using PX_def PV_def contains70 by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3200 |
|
343 | 3201 |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3202 |
lemma PV_bders_iff: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3203 |
assumes "\<Turnstile> v : ders s r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3204 |
shows "bders (intern r) s >> code (PV r s v) \<longleftrightarrow> (intern r) >> code (PV r s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3205 |
by (simp add: PV1 PV3 assms) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3206 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3207 |
lemma PX_bders_iff: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3208 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3209 |
shows "bders (intern r) s >> code (PX r s) \<longleftrightarrow> (intern r) >> code (PX r s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3210 |
by (simp add: PX1 PX3 assms) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3211 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3212 |
lemma PX4: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3213 |
assumes "(s1 @ s2) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3214 |
shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3215 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3216 |
by (simp add: PX3) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3217 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3218 |
lemma PX_bders_iff2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3219 |
assumes "(s1 @ s2) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3220 |
shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2)) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3221 |
(intern r) >> code (PX r (s1 @ s2))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3222 |
by (simp add: PX1 PX3 assms) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3223 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3224 |
lemma PV_bders_iff3: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3225 |
assumes "\<Turnstile> v : ders (s1 @ s2) r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3226 |
shows "bders (intern r) (s1 @ s2) >> code (PV r (s1 @ s2) v) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3227 |
bders (intern r) s1 >> code (PV r (s1 @ s2) v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3228 |
by (metis PV3 PV_append Prf_PV assms ders_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3229 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3230 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3231 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3232 |
lemma PX_bders_iff3: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3233 |
assumes "(s1 @ s2) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3234 |
shows "bders (intern r) (s1 @ s2) >> code (PX r (s1 @ s2)) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3235 |
bders (intern r) s1 >> code (PX r (s1 @ s2))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3236 |
by (metis Ders_def L07XX PV_append PV_def PX4 PX_def Posix_Prf assms contains6 ders_append ders_correctness erase_bders erase_intern mem_Collect_eq retrieve_code_bders) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3237 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3238 |
lemma PV_bder_iff: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3239 |
assumes "\<Turnstile> v : ders (s1 @ [c]) r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3240 |
shows "bder c (bders (intern r) s1) >> code (PV r (s1 @ [c]) v) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3241 |
bders (intern r) s1 >> code (PV r (s1 @ [c]) v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3242 |
by (simp add: PV_bders_iff3 assms bders_snoc) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3243 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3244 |
lemma PV_bder_IFF: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3245 |
assumes "\<Turnstile> v : ders (s1 @ c # s2) r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3246 |
shows "bder c (bders (intern r) s1) >> code (PV r (s1 @ c # s2) v) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3247 |
bders (intern r) s1 >> code (PV r (s1 @ c # s2) v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3248 |
by (metis LA PV3 PV_def Prf_PV assms bders_append code_PV0 contains7 ders.simps(2) erase_bders erase_intern retrieve_code_bders) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3249 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3250 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3251 |
lemma PX_bder_iff: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3252 |
assumes "(s1 @ [c]) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3253 |
shows "bder c (bders (intern r) s1) >> code (PX r (s1 @ [c])) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3254 |
bders (intern r) s1 >> code (PX r (s1 @ [c]))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3255 |
by (simp add: PX_bders_iff3 assms bders_snoc) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3256 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3257 |
lemma PV_bder_iff2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3258 |
assumes "\<Turnstile> v : ders (c # s1) r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3259 |
shows "bders (bder c (intern r)) s1 >> code (PV r (c # s1) v) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3260 |
bder c (intern r) >> code (PV r (c # s1) v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3261 |
by (metis PV3 Prf_PV assms bders.simps(2) code_PV0 contains7 ders.simps(2) erase_intern retrieve_code) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3262 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3263 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3264 |
lemma PX_bder_iff2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3265 |
assumes "(c # s1) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3266 |
shows "bders (bder c (intern r)) s1 >> code (PX r (c # s1)) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3267 |
bder c (intern r) >> code (PX r (c # s1))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3268 |
using PX2b PX3 assms by force |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3269 |
|
343 | 3270 |
|
3271 |
lemma FC_id: |
|
3272 |
shows "FC r [] v = retrieve r v" |
|
3273 |
by (simp add: FC_def) |
|
3274 |
||
3275 |
lemma FC_char: |
|
3276 |
shows "FC r [c] v = retrieve r (injval (erase r) c v)" |
|
3277 |
by (simp add: FC_def) |
|
3278 |
||
3279 |
lemma FC_char2: |
|
3280 |
assumes "\<Turnstile> v : der c (erase r)" |
|
3281 |
shows "FC r [c] v = FC (bder c r) [] v" |
|
3282 |
using assms |
|
3283 |
by (simp add: FC_char FC_id bder_retrieve) |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3284 |
|
343 | 3285 |
|
3286 |
lemma FC_bders_iff: |
|
3287 |
assumes "\<Turnstile> v : ders s (erase r)" |
|
3288 |
shows "bders r s >> FC r s v \<longleftrightarrow> r >> FC r s v" |
|
3289 |
unfolding FC_def |
|
3290 |
by (simp add: assms contains8_iff) |
|
3291 |
||
3292 |
||
3293 |
lemma FC_bder_iff: |
|
3294 |
assumes "\<Turnstile> v : der c (erase r)" |
|
3295 |
shows "bder c r >> FC r [c] v \<longleftrightarrow> r >> FC r [c] v" |
|
3296 |
apply(subst FC_bders_iff[symmetric]) |
|
3297 |
apply(simp add: assms) |
|
3298 |
apply(simp) |
|
3299 |
done |
|
3300 |
||
3301 |
lemma FC_bnullable0: |
|
3302 |
assumes "bnullable r" |
|
3303 |
shows "FC r [] (mkeps (erase r)) = FC (bsimp r) [] (mkeps (erase (bsimp r)))" |
|
3304 |
unfolding FC_def |
|
3305 |
by (simp add: L0 assms) |
|
3306 |
||
3307 |
||
3308 |
lemma FC_nullable2: |
|
3309 |
assumes "bnullable (bders a s)" |
|
3310 |
shows "FC (bsimp a) s (mkeps (erase (bders (bsimp a) s))) = |
|
3311 |
FC (bders (bsimp a) s) [] (mkeps (erase (bders (bsimp a) s)))" |
|
3312 |
unfolding FC_def |
|
3313 |
using L02_bders assms by auto |
|
3314 |
||
3315 |
lemma FC_nullable3: |
|
3316 |
assumes "bnullable (bders a s)" |
|
3317 |
shows "FC a s (mkeps (erase (bders a s))) = |
|
3318 |
FC (bders a s) [] (mkeps (erase (bders a s)))" |
|
3319 |
unfolding FC_def |
|
3320 |
using LA assms bnullable_correctness mkeps_nullable by fastforce |
|
3321 |
||
3322 |
||
3323 |
lemma FE_contains0: |
|
3324 |
assumes "bnullable r" |
|
3325 |
shows "r >> FE r []" |
|
3326 |
by (simp add: FE_def assms bnullable_correctness contains6 mkeps_nullable) |
|
3327 |
||
3328 |
lemma FE_contains1: |
|
3329 |
assumes "bnullable (bders r s)" |
|
3330 |
shows "r >> FE r s" |
|
3331 |
by (metis FE_def Prf_flex assms bnullable_correctness contains6 erase_bders mkeps_nullable) |
|
3332 |
||
3333 |
lemma FE_bnullable0: |
|
3334 |
assumes "bnullable r" |
|
3335 |
shows "FE r [] = FE (bsimp r) []" |
|
3336 |
unfolding FE_def |
|
3337 |
by (simp add: L0 assms) |
|
3338 |
||
3339 |
||
3340 |
lemma FE_nullable1: |
|
3341 |
assumes "bnullable (bders r s)" |
|
3342 |
shows "FE r s = FE (bders r s) []" |
|
3343 |
unfolding FE_def |
|
3344 |
using LA assms bnullable_correctness mkeps_nullable by fastforce |
|
3345 |
||
3346 |
lemma FE_contains2: |
|
3347 |
assumes "bnullable (bders r s)" |
|
3348 |
shows "r >> FE (bders r s) []" |
|
3349 |
by (metis FE_contains1 FE_nullable1 assms) |
|
3350 |
||
3351 |
lemma FE_contains3: |
|
3352 |
assumes "bnullable (bder c r)" |
|
3353 |
shows "r >> FE (bsimp (bder c r)) []" |
|
3354 |
by (metis FE_def L0 assms bder_retrieve bders.simps(1) bnullable_correctness contains7a erase_bder erase_bders flex.simps(1) id_apply mkeps_nullable) |
|
3355 |
||
3356 |
lemma FE_contains4: |
|
3357 |
assumes "bnullable (bders r s)" |
|
3358 |
shows "r >> FE (bsimp (bders r s)) []" |
|
3359 |
using FE_bnullable0 FE_contains2 assms by auto |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3360 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3361 |
|
343 | 3362 |
(* |
3363 |
lemma FE_bnullable2: |
|
3364 |
assumes "bnullable (bder c r)" |
|
3365 |
shows "FE r [c] = FE (bsimp r) [c]" |
|
3366 |
unfolding FE_def |
|
3367 |
apply(simp) |
|
3368 |
using L0 |
|
3369 |
||
3370 |
apply(subst FE_nullable1) |
|
3371 |
using assms apply(simp) |
|
3372 |
apply(subst FE_bnullable0) |
|
3373 |
using assms apply(simp) |
|
3374 |
unfolding FE_def |
|
3375 |
apply(simp) |
|
3376 |
apply(subst L0) |
|
3377 |
using assms apply(simp) |
|
3378 |
apply(subst bder_retrieve[symmetric]) |
|
3379 |
using LLLL(1) L_erase_bder_simp assms bnullable_correctness mkeps_nullable nullable_correctness apply b last |
|
3380 |
apply(simp) |
|
3381 |
find_theorems "retrieve _ (injval _ _ _)" |
|
3382 |
find_theorems "retrieve (bsimp _) _" |
|
3383 |
||
3384 |
lemma FE_nullable3: |
|
3385 |
assumes "bnullable (bders a s)" |
|
3386 |
shows "FE (bsimp a) s = FE a s" |
|
3387 |
||
3388 |
unfolding FE_def |
|
3389 |
using LA assms bnullable_correctness mkeps_nullable by fas tforce |
|
3390 |
*) |
|
3391 |
||
3392 |
||
3393 |
lemma FC4: |
|
3394 |
assumes "\<Turnstile> v : ders s (erase a)" |
|
3395 |
shows "FC a s v = FC (bders a s) [] v" |
|
3396 |
unfolding FC_def by (simp add: LA assms) |
|
3397 |
||
3398 |
lemma FC5: |
|
3399 |
assumes "nullable (erase a)" |
|
3400 |
shows "FC a [] (mkeps (erase a)) = FC (bsimp a) [] (mkeps (erase (bsimp a)))" |
|
3401 |
unfolding FC_def |
|
3402 |
using L0 assms bnullable_correctness by auto |
|
3403 |
||
3404 |
||
3405 |
lemma FC6: |
|
3406 |
assumes "nullable (erase (bders a s))" |
|
3407 |
shows "FC (bsimp a) s (mkeps (erase (bders (bsimp a) s))) = FC a s (mkeps (erase (bders a s)))" |
|
3408 |
apply(subst (2) FC4) |
|
3409 |
using assms mkeps_nullable apply auto[1] |
|
3410 |
apply(subst FC_nullable2) |
|
3411 |
using assms bnullable_correctness apply blast |
|
3412 |
oops |
|
3413 |
(* |
|
3414 |
lemma FC_bnullable: |
|
3415 |
assumes "bnullable (bders r s)" |
|
3416 |
shows "FC r s (mkeps (erase r)) = FC (bsimp r) s (mkeps (erase (bsimp r)))" |
|
3417 |
using assms |
|
3418 |
unfolding FC_def |
|
3419 |
using L0 L0a bder_retrieve L02_bders L04 |
|
3420 |
||
3421 |
apply(induct s arbitrary: r) |
|
3422 |
apply(simp add: FC_id) |
|
3423 |
apply (simp add: L0 assms) |
|
3424 |
apply(simp add: bders_append) |
|
3425 |
apply(drule_tac x="bder a r" in meta_spec) |
|
3426 |
apply(drule meta_mp) |
|
3427 |
apply(simp) |
|
3428 |
||
3429 |
apply(subst bder_retrieve[symmetric]) |
|
3430 |
apply(simp) |
|
3431 |
*) |
|
3432 |
||
3433 |
||
3434 |
lemma FC_bnullable: |
|
3435 |
assumes "bnullable (bders r s)" |
|
3436 |
shows "FC r s (mkeps (ders s (erase r))) = FC (bsimp r) s (mkeps (ders s (erase (bsimp r))))" |
|
3437 |
unfolding FC_def |
|
3438 |
oops |
|
3439 |
||
3440 |
lemma AA0: |
|
3441 |
assumes "bnullable (bders r s)" |
|
3442 |
assumes "bders r s >> FC r s (mkeps (erase (bders r s)))" |
|
3443 |
shows "bders (bsimp r) s >> FC (bsimp r) s (mkeps (erase (bders (bsimp r) s)))" |
|
3444 |
using assms |
|
3445 |
apply(subst (asm) FC_bders_iff) |
|
3446 |
apply(simp) |
|
3447 |
using bnullable_correctness mkeps_nullable apply fastforce |
|
3448 |
apply(subst FC_bders_iff) |
|
3449 |
apply(simp) |
|
3450 |
apply (metis LLLL(1) bnullable_correctness ders_correctness erase_bders mkeps_nullable nullable_correctness) |
|
3451 |
apply(simp add: PPP1_eq) |
|
3452 |
unfolding FC_def |
|
3453 |
find_theorems "retrieve (bsimp _) _" |
|
3454 |
using contains7b |
|
3455 |
oops |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3456 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3457 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3458 |
lemma AA1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3459 |
|
343 | 3460 |
assumes "\<Turnstile> v : der c (erase r)" "\<Turnstile> v : der c (erase (bsimp r))" |
3461 |
assumes "bder c r >> FC r [c] v" |
|
3462 |
shows "bder c (bsimp r) >> FC (bsimp r) [c] v" |
|
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3463 |
using assms |
343 | 3464 |
apply(subst (asm) FC_bder_iff) |
3465 |
apply(rule assms) |
|
3466 |
apply(subst FC_bder_iff) |
|
3467 |
apply(rule assms) |
|
3468 |
apply(simp add: PPP1_eq) |
|
3469 |
unfolding FC_def |
|
3470 |
find_theorems "retrieve (bsimp _) _" |
|
3471 |
using contains7b |
|
3472 |
oops |
|
3473 |
||
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3474 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3475 |
lemma PX_bder_simp_iff: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3476 |
assumes "\<Turnstile> v: ders (s1 @ s2) r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3477 |
shows "bders (bsimp (bders (intern r) s1)) s2 >> code (PV r (s1 @ s2) v) \<longleftrightarrow> |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3478 |
bders (intern r) s1 >> code (PV r (s1 @ s2) v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3479 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3480 |
apply(induct s2 arbitrary: r s1 v) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3481 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3482 |
apply (simp add: PV3 contains55) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3483 |
apply(drule_tac x="r" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3484 |
apply(drule_tac x="s1 @ [a]" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3485 |
apply(drule_tac x="v" in meta_spec) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3486 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3487 |
apply(simp add: bders_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3488 |
apply(subst (asm) PV_bder_IFF) |
343 | 3489 |
oops |
3490 |
||
3491 |
lemma in1: |
|
3492 |
assumes "AALTs bsX rsX \<in> set rs" |
|
3493 |
shows "\<forall>r \<in> set rsX. fuse bsX r \<in> set (flts rs)" |
|
3494 |
using assms |
|
3495 |
apply(induct rs arbitrary: bsX rsX) |
|
3496 |
apply(auto) |
|
3497 |
by (metis append_assoc in_set_conv_decomp k0) |
|
3498 |
||
3499 |
lemma in2a: |
|
3500 |
assumes "nonnested (bsimp r)" "\<not>nonalt(bsimp r)" |
|
3501 |
shows "(\<exists>bsX rsX. r = AALTs bsX rsX) \<or> (\<exists>bsX rX1 rX2. r = ASEQ bsX rX1 rX2 \<and> bnullable rX1)" |
|
3502 |
using assms |
|
3503 |
apply(induct r) |
|
3504 |
apply(auto) |
|
3505 |
by (metis arexp.distinct(25) b3 bnullable.simps(2) bsimp_ASEQ.simps(1) bsimp_ASEQ0 bsimp_ASEQ1 nonalt.elims(3) nonalt.simps(2)) |
|
3506 |
||
3507 |
||
3508 |
lemma in2: |
|
3509 |
assumes "bder c r >> bs2" and |
|
3510 |
"AALTs bsX rsX = bsimp r" and |
|
3511 |
"XX \<in> set rsX" "nonnested (bsimp r)" |
|
3512 |
shows "bder c (fuse bsX XX) >> bs2" |
|
350 | 3513 |
|
3514 |
sorry |
|
343 | 3515 |
|
3516 |
||
3517 |
lemma |
|
3518 |
assumes "bder c a >> bs" |
|
3519 |
shows "bder c (bsimp a) >> bs" |
|
3520 |
using assms |
|
3521 |
apply(induct a arbitrary: c bs) |
|
3522 |
apply(auto elim: contains.cases) |
|
3523 |
apply(case_tac "bnullable a1") |
|
3524 |
apply(simp) |
|
3525 |
prefer 2 |
|
3526 |
apply(simp) |
|
3527 |
apply(erule contains.cases) |
|
3528 |
apply(auto) |
|
3529 |
apply(case_tac "(bsimp a1) = AZERO") |
|
3530 |
apply(simp) |
|
3531 |
apply (metis append_Nil2 contains0 contains49 fuse.simps(1)) |
|
3532 |
apply(case_tac "(bsimp a2a) = AZERO") |
|
3533 |
apply(simp) |
|
3534 |
apply (metis bder.simps(1) bsimp.simps(1) bsimp_ASEQ0 contains.intros(3) contains55) |
|
3535 |
apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX") |
|
3536 |
apply(auto)[1] |
|
3537 |
using b3 apply fastforce |
|
3538 |
apply(subst bsimp_ASEQ1) |
|
3539 |
apply(auto)[3] |
|
3540 |
apply(simp) |
|
3541 |
apply(subgoal_tac "\<not> bnullable (bsimp a1)") |
|
3542 |
prefer 2 |
|
3543 |
using b3 apply blast |
|
3544 |
apply(simp) |
|
3545 |
apply (simp add: contains.intros(3) contains55) |
|
3546 |
(* SEQ nullable case *) |
|
3547 |
apply(erule contains.cases) |
|
3548 |
apply(auto) |
|
3549 |
apply(erule contains.cases) |
|
3550 |
apply(auto) |
|
3551 |
apply(case_tac "(bsimp a1) = AZERO") |
|
3552 |
apply(simp) |
|
3553 |
apply (metis append_Nil2 contains0 contains49 fuse.simps(1)) |
|
3554 |
apply(case_tac "(bsimp a2a) = AZERO") |
|
3555 |
apply(simp) |
|
3556 |
apply (metis bder.simps(1) bsimp.simps(1) bsimp_ASEQ0 contains.intros(3) contains55) |
|
3557 |
apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX") |
|
3558 |
apply(auto)[1] |
|
3559 |
using contains.simps apply blast |
|
3560 |
apply(subst bsimp_ASEQ1) |
|
3561 |
apply(auto)[3] |
|
3562 |
apply(simp) |
|
3563 |
apply(subgoal_tac "bnullable (bsimp a1)") |
|
3564 |
prefer 2 |
|
3565 |
using b3 apply blast |
|
3566 |
apply(simp) |
|
3567 |
apply (metis contains.intros(3) contains.intros(4) contains55 self_append_conv2) |
|
3568 |
apply(erule contains.cases) |
|
3569 |
apply(auto) |
|
3570 |
apply(case_tac "(bsimp a1) = AZERO") |
|
3571 |
apply(simp) |
|
3572 |
using b3 apply force |
|
3573 |
apply(case_tac "(bsimp a2) = AZERO") |
|
3574 |
apply(simp) |
|
3575 |
apply (metis bder.simps(1) bsimp_ASEQ0 bsimp_ASEQ_fuse contains0 contains49 f_cont1) |
|
3576 |
apply(case_tac "\<exists>bsX. (bsimp a1) = AONE bsX") |
|
3577 |
apply(auto)[1] |
|
3578 |
apply (metis append_assoc bder_fuse bmkeps.simps(1) bmkeps_simp bsimp_ASEQ2 contains0 contains49 f_cont1) |
|
3579 |
apply(subst bsimp_ASEQ1) |
|
3580 |
apply(auto)[3] |
|
3581 |
apply(simp) |
|
3582 |
apply(subgoal_tac "bnullable (bsimp a1)") |
|
3583 |
prefer 2 |
|
3584 |
using b3 apply blast |
|
3585 |
apply(simp) |
|
3586 |
apply (metis bmkeps_simp contains.intros(4) contains.intros(5) contains0 contains49 f_cont1) |
|
3587 |
apply(erule contains.cases) |
|
3588 |
apply(auto) |
|
3589 |
(* ALT case *) |
|
3590 |
apply(drule contains59) |
|
3591 |
apply(auto) |
|
3592 |
apply(subst bder_bsimp_AALTs) |
|
3593 |
apply(rule contains61a) |
|
3594 |
apply(auto) |
|
3595 |
apply(subgoal_tac "bsimp r \<in> set (map bsimp x2a)") |
|
3596 |
prefer 2 |
|
3597 |
apply simp |
|
3598 |
apply(case_tac "bsimp r = AZERO") |
|
3599 |
apply (metis Nil_is_append_conv bder.simps(1) bsimp_AALTs.elims bsimp_AALTs.simps(2) contains49 contains61 f_cont2 list.distinct(1) split_list_last) |
|
3600 |
apply(subgoal_tac "nonnested (bsimp r)") |
|
3601 |
prefer 2 |
|
3602 |
using nn1b apply blast |
|
3603 |
apply(case_tac "nonalt (bsimp r)") |
|
3604 |
apply(rule_tac x="bsimp r" in bexI) |
|
3605 |
apply (metis contains0 contains49 f_cont1) |
|
3606 |
apply (metis append_Cons flts_append in_set_conv_decomp k0 k0b) |
|
3607 |
(* AALTS case *) |
|
3608 |
apply(subgoal_tac "\<exists>rsX bsX. (bsimp r) = AALTs bsX rsX \<and> (\<forall>r \<in> set rsX. nonalt r)") |
|
3609 |
prefer 2 |
|
3610 |
apply (metis n0 nonalt.elims(3)) |
|
3611 |
apply(auto) |
|
3612 |
apply(subgoal_tac "bsimp r \<in> set (map bsimp x2a)") |
|
3613 |
prefer 2 |
|
3614 |
apply (metis imageI list.set_map) |
|
3615 |
apply(simp) |
|
3616 |
apply(simp add: image_def) |
|
3617 |
apply(erule bexE) |
|
3618 |
apply(subgoal_tac "AALTs bsX rsX \<in> set (map bsimp x2a)") |
|
3619 |
prefer 2 |
|
3620 |
apply simp |
|
3621 |
apply(drule in1) |
|
3622 |
apply(subgoal_tac "rsX \<noteq> []") |
|
3623 |
prefer 2 |
|
3624 |
apply (metis arexp.distinct(7) good.simps(4) good1) |
|
350 | 3625 |
by (metis contains0 contains49 f_cont1 in2 list.exhaust list.set_intros(1)) |
343 | 3626 |
|
3627 |
lemma CONTAINS1: |
|
3628 |
assumes "a >> bs" |
|
3629 |
shows "a >>2 bs" |
|
3630 |
using assms |
|
3631 |
apply(induct a bs) |
|
3632 |
apply(auto intro: contains2.intros) |
|
3633 |
done |
|
3634 |
||
3635 |
lemma CONTAINS2: |
|
3636 |
assumes "a >>2 bs" |
|
3637 |
shows "a >> bs" |
|
3638 |
using assms |
|
3639 |
apply(induct a bs) |
|
3640 |
apply(auto intro: contains.intros) |
|
3641 |
using contains55 by auto |
|
3642 |
||
3643 |
lemma CONTAINS2_IFF: |
|
3644 |
shows "a >> bs \<longleftrightarrow> a >>2 bs" |
|
3645 |
using CONTAINS1 CONTAINS2 by blast |
|
3646 |
||
3647 |
lemma |
|
3648 |
assumes "bders (intern r) s >>2 bs" |
|
3649 |
shows "bders_simp (intern r) s >>2 bs" |
|
3650 |
using assms |
|
3651 |
apply(induct s arbitrary: r bs) |
|
3652 |
apply(simp) |
|
3653 |
apply(simp) |
|
3654 |
oops |
|
3655 |
||
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3656 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3657 |
lemma |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3658 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3659 |
shows "(bders_simp (intern r) s >> code (PX r s)) \<longleftrightarrow> ((intern r) >> code (PX r s))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3660 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3661 |
apply(induct s arbitrary: r rule: rev_induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3662 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3663 |
apply(simp add: bders_simp_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3664 |
apply(simp add: PPP1_eq) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3665 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3666 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3667 |
find_theorems "retrieve (bders _ _) _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3668 |
find_theorems "_ >> retrieve _ _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3669 |
find_theorems "bsimp _ >> _" |
343 | 3670 |
oops |
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3671 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3672 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3673 |
lemma PX4a: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3674 |
assumes "(s1 @ s2) \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3675 |
shows "bders (intern r) (s1 @ s2) >> code (PV r s1 (PX (ders s1 r) s2))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3676 |
using PX4[OF assms] |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3677 |
apply(simp add: PX_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3678 |
done |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3679 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3680 |
lemma PV5: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3681 |
assumes "s2 \<in> (ders s1 r) \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3682 |
shows "bders (intern r) (s1 @ s2) >> code (PV r s1 v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3683 |
by (simp add: PPP0_isar PV_def Posix_flex assms) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3684 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3685 |
lemma PV6: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3686 |
assumes "s2 \<in> (ders s1 r) \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3687 |
shows "bders (bders (intern r) s1) s2 >> code (PV r s1 v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3688 |
using PV5 assms bders_append by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3689 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3690 |
find_theorems "retrieve (bders _ _) _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3691 |
find_theorems "_ >> retrieve _ _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3692 |
find_theorems "bder _ _ >> _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3693 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3694 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3695 |
lemma OO0_PX: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3696 |
assumes "s \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3697 |
shows "bders (intern r) s >> code (PX r s)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3698 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3699 |
by (simp add: PX3) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3700 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3701 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3702 |
lemma OO1: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3703 |
assumes "[c] \<in> r \<rightarrow> v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3704 |
shows "bder c (intern r) >> code v" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3705 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3706 |
using PPP0_isar by force |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3707 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3708 |
lemma OO1a: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3709 |
assumes "[c] \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3710 |
shows "bder c (intern r) >> code (PX r [c])" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3711 |
using assms unfolding PX_def PV_def |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3712 |
using contains70 by fastforce |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3713 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3714 |
lemma OO12: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3715 |
assumes "[c1, c2] \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3716 |
shows "bders (intern r) [c1, c2] >> code (PX r [c1, c2])" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3717 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3718 |
using PX_def PV_def contains70 by presburger |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3719 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3720 |
lemma OO2: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3721 |
assumes "[c] \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3722 |
shows "bders_simp (intern r) [c] >> code (PX r [c])" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3723 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3724 |
using OO1a Posix1(1) contains55 by auto |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3725 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3726 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3727 |
lemma OO22: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3728 |
assumes "[c1, c2] \<in> L r" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3729 |
shows "bders_simp (intern r) [c1, c2] >> code (PX r [c1, c2])" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3730 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3731 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3732 |
apply(rule contains55) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3733 |
apply(rule Etrans) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3734 |
thm contains7 |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3735 |
apply(rule contains7) |
343 | 3736 |
oops |
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3737 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3738 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3739 |
lemma contains70: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3740 |
assumes "s \<in> L(r)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3741 |
shows "bders_simp (intern r) s >> code (flex r id s (mkeps (ders s r)))" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3742 |
using assms |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3743 |
apply(induct s arbitrary: r rule: rev_induct) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3744 |
apply(simp) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3745 |
apply (simp add: contains2 mkeps_nullable nullable_correctness) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3746 |
apply(simp add: bders_simp_append flex_append) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3747 |
apply(simp add: PPP1_eq) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3748 |
apply(rule Etrans) |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3749 |
apply(rule_tac v="flex r id xs (mkeps (ders (xs @ [x]) r))" in contains7) |
343 | 3750 |
oops |
339
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3751 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3752 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3753 |
thm L07XX PPP0b erase_intern |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3754 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3755 |
find_theorems "retrieve (bders _ _) _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3756 |
find_theorems "_ >> retrieve _ _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3757 |
find_theorems "bder _ _ >> _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3758 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3759 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3760 |
lemma PPP3: |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3761 |
assumes "\<Turnstile> v : ders s (erase a)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3762 |
shows "bders a s >> retrieve a (flex (erase a) id s v)" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3763 |
using LA[OF assms] contains6 erase_bders assms by metis |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3764 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3765 |
|
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3766 |
find_theorems "bder _ _ >> _" |
9d466b27b054
added progress with the contains relation
Christian Urban <urbanc@in.tum.de>
parents:
338
diff
changeset
|
3767 |
|
337 | 3768 |
|
3769 |
lemma |
|
3770 |
fixes n :: nat |
|
3771 |
shows "(\<Sum>i \<in> {0..n}. i) = n * (n + 1) div 2" |
|
3772 |
apply(induct n) |
|
3773 |
apply(simp) |
|
3774 |
apply(simp) |
|
3775 |
done |
|
3776 |
||
344
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3777 |
lemma COUNTEREXAMPLE: |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3778 |
assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3779 |
shows "bsimp (bder c (bsimp r)) = bsimp (bder c r)" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3780 |
apply(simp_all add: assms) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3781 |
oops |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3782 |
|
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3783 |
lemma COUNTEREXAMPLE: |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3784 |
assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3785 |
shows "bsimp r = r" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3786 |
apply(simp_all add: assms) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3787 |
oops |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3788 |
|
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3789 |
lemma COUNTEREXAMPLE: |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3790 |
assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3791 |
shows "bsimp r = XXX" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3792 |
and "bder c r = XXX" |
345
c7fd85daa1d7
updated with the proof of bder
Christian Urban <urbanc@in.tum.de>
parents:
344
diff
changeset
|
3793 |
and "bder c (bsimp r) = XXX" |
344
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3794 |
and "bsimp (bder c (bsimp r)) = XXX" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3795 |
and "bsimp (bder c r) = XXX" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3796 |
apply(simp_all add: assms) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3797 |
oops |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3798 |
|
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3799 |
lemma COUNTEREXAMPLE_contains1: |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3800 |
assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3801 |
and "bsimp (bder c r) >> bs" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3802 |
shows "bsimp (bder c (bsimp r)) >> bs" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3803 |
using assms |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3804 |
apply(auto elim!: contains.cases) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3805 |
apply(rule Etrans) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3806 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3807 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3808 |
apply(simp) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3809 |
apply(rule Etrans) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3810 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3811 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3812 |
apply(simp) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3813 |
done |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3814 |
|
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3815 |
lemma COUNTEREXAMPLE_contains2: |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3816 |
assumes "r = AALTs [S] [ASEQ [S] (AALTs [S] [AONE [S], ACHAR [S] c]) (ACHAR [S] c)]" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3817 |
and "bsimp (bder c (bsimp r)) >> bs" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3818 |
shows "bsimp (bder c r) >> bs" |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3819 |
using assms |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3820 |
apply(auto elim!: contains.cases) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3821 |
apply(rule Etrans) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3822 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3823 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3824 |
apply(simp) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3825 |
apply(rule Etrans) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3826 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3827 |
apply(rule contains.intros) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3828 |
apply(simp) |
4e73568b9cf6
added some lemmas about the counter example.
Christian Urban <urbanc@in.tum.de>
parents:
343
diff
changeset
|
3829 |
done |
337 | 3830 |
|
3831 |
||
3832 |
end |