19 | "Pos (Char c) = {[]}" |
19 | "Pos (Char c) = {[]}" |
20 | "Pos (Left v) = {[]} \<union> {0#ps | ps. ps \<in> Pos v}" |
20 | "Pos (Left v) = {[]} \<union> {0#ps | ps. ps \<in> Pos v}" |
21 | "Pos (Right v) = {[]} \<union> {1#ps | ps. ps \<in> Pos v}" |
21 | "Pos (Right v) = {[]} \<union> {1#ps | ps. ps \<in> Pos v}" |
22 | "Pos (Seq v1 v2) = {[]} \<union> {0#ps | ps. ps \<in> Pos v1} \<union> {1#ps | ps. ps \<in> Pos v2}" |
22 | "Pos (Seq v1 v2) = {[]} \<union> {0#ps | ps. ps \<in> Pos v1} \<union> {1#ps | ps. ps \<in> Pos v2}" |
23 | "Pos (Stars []) = {[]}" |
23 | "Pos (Stars []) = {[]}" |
24 | "Pos (Stars (v#vs)) = {[]} \<union> {0#ps | ps. ps \<in> Pos v} \<union> {(Suc n)#ps | n ps. n#ps \<in> Pos (Stars vs)}" |
24 | "Pos (Stars (v#vs)) = {[]} \<union> {0#ps | ps. ps \<in> Pos v} \<union> {Suc n#ps | n ps. n#ps \<in> Pos (Stars vs)}" |
25 |
25 |
26 lemma Pos_empty: |
26 lemma Pos_empty: |
27 shows "[] \<in> Pos v" |
27 shows "[] \<in> Pos v" |
28 apply(induct v rule: Pos.induct) |
28 by (induct v rule: Pos.induct)(auto) |
29 apply(auto) |
|
30 done |
|
31 |
29 |
32 fun intlen :: "'a list \<Rightarrow> int" |
30 fun intlen :: "'a list \<Rightarrow> int" |
33 where |
31 where |
34 "intlen [] = 0" |
32 "intlen [] = 0" |
35 | "intlen (x#xs) = 1 + intlen xs" |
33 | "intlen (x#xs) = 1 + intlen xs" |
36 |
34 |
37 lemma inlen_bigger: |
35 lemma inlen_bigger: |
38 shows "0 \<le> intlen xs" |
36 shows "0 \<le> intlen xs" |
39 apply(induct xs) |
37 by (induct xs)(auto) |
40 apply(auto) |
|
41 done |
|
42 |
38 |
43 lemma intlen_append: |
39 lemma intlen_append: |
44 shows "intlen (xs @ ys) = intlen xs + intlen ys" |
40 shows "intlen (xs @ ys) = intlen xs + intlen ys" |
45 apply(induct xs arbitrary: ys) |
41 by (induct xs arbitrary: ys) (auto) |
46 apply(auto) |
|
47 done |
|
48 |
42 |
49 lemma intlen_length: |
43 lemma intlen_length: |
50 assumes "length xs < length ys" |
44 assumes "length xs < length ys" |
51 shows "intlen xs < intlen ys" |
45 shows "intlen xs < intlen ys" |
52 using assms |
46 using assms |
67 and "pflat_len (Seq v1 v2) (Suc 0#p) = pflat_len v2 p" |
61 and "pflat_len (Seq v1 v2) (Suc 0#p) = pflat_len v2 p" |
68 and "pflat_len (Left v) (0#p) = pflat_len v p" |
62 and "pflat_len (Left v) (0#p) = pflat_len v p" |
69 and "pflat_len (Left v) (Suc 0#p) = -1" |
63 and "pflat_len (Left v) (Suc 0#p) = -1" |
70 and "pflat_len (Right v) (Suc 0#p) = pflat_len v p" |
64 and "pflat_len (Right v) (Suc 0#p) = pflat_len v p" |
71 and "pflat_len (Right v) (0#p) = -1" |
65 and "pflat_len (Right v) (0#p) = -1" |
|
66 and "pflat_len (Stars (v#vs)) (Suc n#p) = pflat_len (Stars vs) (n#p)" |
|
67 and "pflat_len (Stars (v#vs)) (0#p) = pflat_len v p" |
72 and "pflat_len v [] = intlen (flat v)" |
68 and "pflat_len v [] = intlen (flat v)" |
73 apply(auto simp add: pflat_len_def Pos_empty) |
69 by (auto simp add: pflat_len_def Pos_empty) |
74 done |
|
75 |
70 |
76 lemma pflat_len_Stars_simps: |
71 lemma pflat_len_Stars_simps: |
77 assumes "n < length vs" |
72 assumes "n < length vs" |
78 shows "pflat_len (Stars vs) (n#p) = pflat_len (vs!n) p" |
73 shows "pflat_len (Stars vs) (n#p) = pflat_len (vs!n) p" |
79 using assms |
74 using assms |
80 apply(induct vs arbitrary: n p) |
75 apply(induct vs arbitrary: n p) |
81 apply(simp) |
76 apply(auto simp add: less_Suc_eq_0_disj pflat_len_simps) |
82 apply(simp) |
|
83 apply(simp add: pflat_len_def) |
|
84 apply(auto)[1] |
|
85 apply (metis at.simps(6)) |
|
86 apply (metis Suc_less_eq Suc_pred) |
|
87 by (metis diff_Suc_1 less_Suc_eq_0_disj nth_Cons') |
|
88 |
|
89 |
|
90 lemma pflat_len_Stars_simps2: |
|
91 shows "pflat_len (Stars (v#vs)) (Suc n # p) = pflat_len (Stars vs) (n#p)" |
|
92 and "pflat_len (Stars (v#vs)) (0 # p) = pflat_len v p" |
|
93 using assms |
|
94 apply(simp_all add: pflat_len_def) |
|
95 done |
77 done |
96 |
78 |
97 lemma Two_to_Three_aux: |
79 lemma Two_to_Three_aux: |
98 assumes "p \<in> Pos v1 \<union> Pos v2" "pflat_len v1 p = pflat_len v2 p" |
80 assumes "p \<in> Pos v1 \<union> Pos v2" "pflat_len v1 p = pflat_len v2 p" |
99 shows "p \<in> Pos v1 \<inter> Pos v2" |
81 shows "p \<in> Pos v1 \<inter> Pos v2" |
100 using assms |
82 using assms |
101 apply(simp add: pflat_len_def) |
83 apply(simp add: pflat_len_def) |
102 apply(auto split: if_splits) |
84 apply(auto split: if_splits) |
103 apply (smt inlen_bigger)+ |
85 apply (smt inlen_bigger)+ |
104 done |
86 done |
105 |
|
106 |
87 |
107 lemma Two_to_Three_orig: |
88 lemma Two_to_Three_orig: |
108 assumes "\<forall>p \<in> Pos v1 \<union> Pos v2. pflat_len v1 p = pflat_len v2 p" |
89 assumes "\<forall>p \<in> Pos v1 \<union> Pos v2. pflat_len v1 p = pflat_len v2 p" |
109 shows "Pos v1 = Pos v2" |
90 shows "Pos v1 = Pos v2" |
110 using assms |
91 using assms |
306 |
287 |
307 definition sprefix_list:: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" ("_ \<sqsubset>spre _") |
288 definition sprefix_list:: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" ("_ \<sqsubset>spre _") |
308 where |
289 where |
309 "ps1 \<sqsubset>spre ps2 \<equiv> (ps1 \<sqsubseteq>pre ps2 \<and> ps1 \<noteq> ps2)" |
290 "ps1 \<sqsubset>spre ps2 \<equiv> (ps1 \<sqsubseteq>pre ps2 \<and> ps1 \<noteq> ps2)" |
310 |
291 |
311 inductive lex_lists :: "nat list \<Rightarrow> nat list \<Rightarrow> bool" ("_ \<sqsubset>lex _") |
292 inductive lex_list :: "nat list \<Rightarrow> nat list \<Rightarrow> bool" ("_ \<sqsubset>lex _") |
312 where |
293 where |
313 "[] \<sqsubset>lex p#ps" |
294 "[] \<sqsubset>lex p#ps" |
314 | "ps1 \<sqsubset>lex ps2 \<Longrightarrow> (p#ps1) \<sqsubset>lex (p#ps2)" |
295 | "ps1 \<sqsubset>lex ps2 \<Longrightarrow> (p#ps1) \<sqsubset>lex (p#ps2)" |
315 | "p1 < p2 \<Longrightarrow> (p1#ps1) \<sqsubset>lex (p2#ps2)" |
296 | "p1 < p2 \<Longrightarrow> (p1#ps1) \<sqsubset>lex (p2#ps2)" |
316 |
297 |
317 lemma lex_irrfl: |
298 lemma lex_irrfl: |
318 fixes ps1 ps2 :: "nat list" |
299 fixes ps1 ps2 :: "nat list" |
319 assumes "ps1 \<sqsubset>lex ps2" |
300 assumes "ps1 \<sqsubset>lex ps2" |
320 shows "ps1 \<noteq> ps2" |
301 shows "ps1 \<noteq> ps2" |
321 using assms |
302 using assms |
322 apply(induct rule: lex_lists.induct) |
303 apply(induct rule: lex_list.induct) |
323 apply(auto) |
304 apply(auto) |
324 done |
305 done |
325 |
306 |
326 lemma lex_append: |
307 lemma lex_simps [simp]: |
327 assumes "ps2 \<noteq> []" |
|
328 shows "ps \<sqsubset>lex ps @ ps2" |
|
329 using assms |
|
330 apply(induct ps) |
|
331 apply(auto intro: lex_lists.intros) |
|
332 apply(case_tac ps2) |
|
333 apply(simp) |
|
334 apply(simp) |
|
335 apply(auto intro: lex_lists.intros) |
|
336 done |
|
337 |
|
338 lemma lexordp_simps [simp]: |
|
339 fixes xs ys :: "nat list" |
308 fixes xs ys :: "nat list" |
340 shows "[] \<sqsubset>lex ys = (ys \<noteq> [])" |
309 shows "[] \<sqsubset>lex ys \<longleftrightarrow> ys \<noteq> []" |
341 and "xs \<sqsubset>lex [] = False" |
310 and "xs \<sqsubset>lex [] \<longleftrightarrow> False" |
342 and "(x # xs) \<sqsubset>lex (y # ys) \<longleftrightarrow> (x < y \<or> (\<not> y < x \<and> xs \<sqsubset>lex ys))" |
311 and "(x # xs) \<sqsubset>lex (y # ys) \<longleftrightarrow> (x < y \<or> (\<not> y < x \<and> xs \<sqsubset>lex ys))" |
343 apply - |
312 apply - |
344 apply (metis lex_append lex_lists.simps list.simps(3)) |
313 apply (metis lex_irrfl lex_list.intros(1) list.exhaust) |
345 using lex_lists.cases apply blast |
314 using lex_list.cases apply blast |
346 using lex_lists.cases lex_lists.intros(2) lex_lists.intros(3) not_less_iff_gr_or_eq by fastforce |
315 using lex_list.cases lex_list.intros(2) lex_list.intros(3) not_less_iff_gr_or_eq by fastforce |
347 |
316 |
348 lemma lex_append_cancel [simp]: |
|
349 fixes ps ps1 ps2 :: "nat list" |
|
350 shows "ps @ ps1 \<sqsubset>lex ps @ ps2 \<longleftrightarrow> ps1 \<sqsubset>lex ps2" |
|
351 apply(induct ps) |
|
352 apply(auto) |
|
353 done |
|
354 |
317 |
355 lemma lex_trans: |
318 lemma lex_trans: |
356 fixes ps1 ps2 ps3 :: "nat list" |
319 fixes ps1 ps2 ps3 :: "nat list" |
357 assumes "ps1 \<sqsubset>lex ps2" "ps2 \<sqsubset>lex ps3" |
320 assumes "ps1 \<sqsubset>lex ps2" "ps2 \<sqsubset>lex ps3" |
358 shows "ps1 \<sqsubset>lex ps3" |
321 shows "ps1 \<sqsubset>lex ps3" |
359 using assms |
322 using assms |
360 apply(induct arbitrary: ps3 rule: lex_lists.induct) |
323 apply(induct arbitrary: ps3 rule: lex_list.induct) |
361 apply(erule lex_lists.cases) |
324 apply(erule lex_list.cases) |
362 apply(simp_all) |
325 apply(simp_all) |
363 apply(rotate_tac 2) |
326 apply(rotate_tac 2) |
364 apply(erule lex_lists.cases) |
327 apply(erule lex_list.cases) |
365 apply(simp_all) |
328 apply(simp_all) |
366 apply(erule lex_lists.cases) |
329 apply(erule lex_list.cases) |
367 apply(simp_all) |
330 apply(simp_all) |
368 done |
331 done |
369 |
332 |
370 lemma trichotomous_aux: |
|
371 fixes p q :: "nat list" |
|
372 assumes "p \<sqsubset>lex q" "p \<noteq> q" |
|
373 shows "\<not>(q \<sqsubset>lex p)" |
|
374 using assms |
|
375 apply(induct rule: lex_lists.induct) |
|
376 apply(auto) |
|
377 done |
|
378 |
|
379 lemma trichotomous_aux2: |
|
380 fixes p q :: "nat list" |
|
381 assumes "p \<sqsubset>lex q" "q \<sqsubset>lex p" |
|
382 shows "False" |
|
383 using assms |
|
384 apply(induct rule: lex_lists.induct) |
|
385 apply(auto) |
|
386 done |
|
387 |
333 |
388 lemma trichotomous: |
334 lemma trichotomous: |
389 fixes p q :: "nat list" |
335 fixes p q :: "nat list" |
390 shows "p = q \<or> p \<sqsubset>lex q \<or> q \<sqsubset>lex p" |
336 shows "p = q \<or> p \<sqsubset>lex q \<or> q \<sqsubset>lex p" |
391 apply(induct p arbitrary: q) |
337 apply(induct p arbitrary: q) |
392 apply(auto) |
338 apply(auto) |
393 apply(case_tac q) |
339 apply(case_tac q) |
394 apply(auto) |
340 apply(auto) |
395 done |
341 done |
396 |
342 |
397 (* |
|
398 definition dpos :: "val \<Rightarrow> val \<Rightarrow> nat list \<Rightarrow> bool" |
|
399 where |
|
400 "dpos v1 v2 p \<equiv> (p \<in> Pos v1 \<union> Pos v2) \<and> (p \<notin> Pos v1 \<inter> Pos v2)" |
|
401 *) |
|
402 |
|
403 lemma outside_lemma: |
343 lemma outside_lemma: |
404 assumes "p \<notin> Pos v1 \<union> Pos v2" |
344 assumes "p \<notin> Pos v1 \<union> Pos v2" |
405 shows "pflat_len v1 p = pflat_len v2 p" |
345 shows "pflat_len v1 p = pflat_len v2 p" |
406 using assms |
346 using assms |
407 apply(auto simp add: pflat_len_def) |
347 apply(auto simp add: pflat_len_def) |
408 done |
348 done |
409 |
|
410 (* |
|
411 lemma dpos_lemma_aux: |
|
412 assumes "p \<in> Pos v1 \<union> Pos v2" |
|
413 and "pflat_len v1 p = pflat_len v2 p" |
|
414 shows "p \<in> Pos v1 \<inter> Pos v2" |
|
415 using assms |
|
416 apply(auto simp add: pflat_len_def) |
|
417 apply (smt inlen_bigger) |
|
418 apply (smt inlen_bigger) |
|
419 done |
|
420 |
|
421 lemma dpos_lemma: |
|
422 assumes "p \<in> Pos v1 \<union> Pos v2" |
|
423 and "pflat_len v1 p = pflat_len v2 p" |
|
424 shows "\<not>dpos v1 v2 p" |
|
425 using assms |
|
426 apply(auto simp add: dpos_def dpos_lemma_aux) |
|
427 using dpos_lemma_aux apply auto[1] |
|
428 using dpos_lemma_aux apply auto[1] |
|
429 done |
|
430 |
|
431 lemma dpos_lemma2: |
|
432 assumes "p \<in> Pos v1 \<union> Pos v2" |
|
433 and "dpos v1 v2 p" |
|
434 shows "pflat_len v1 p \<noteq> pflat_len v2 p" |
|
435 using assms |
|
436 using dpos_lemma by blast |
|
437 *) |
|
438 |
349 |
439 definition val_ord:: "val \<Rightarrow> nat list \<Rightarrow> val \<Rightarrow> bool" ("_ \<sqsubset>val _ _") |
350 definition val_ord:: "val \<Rightarrow> nat list \<Rightarrow> val \<Rightarrow> bool" ("_ \<sqsubset>val _ _") |
440 where |
351 where |
441 "v1 \<sqsubset>val p v2 \<equiv> (p \<in> Pos v1 \<and> pflat_len v1 p > pflat_len v2 p \<and> |
352 "v1 \<sqsubset>val p v2 \<equiv> (p \<in> Pos v1 \<and> pflat_len v1 p > pflat_len v2 p \<and> |
442 (\<forall>q \<in> Pos v1 \<union> Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q))" |
353 (\<forall>q \<in> Pos v1 \<union> Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q))" |
451 "v1 :\<sqsubseteq>val v2 \<equiv> v1 :\<sqsubset>val v2 \<or> v1 = v2" |
362 "v1 :\<sqsubseteq>val v2 \<equiv> v1 :\<sqsubset>val v2 \<or> v1 = v2" |
452 |
363 |
453 lemma val_ord_shorterI: |
364 lemma val_ord_shorterI: |
454 assumes "length (flat v') < length (flat v)" |
365 assumes "length (flat v') < length (flat v)" |
455 shows "v :\<sqsubset>val v'" |
366 shows "v :\<sqsubset>val v'" |
456 using assms(1) |
367 using assms |
457 apply(subst val_ord_ex_def) |
368 unfolding val_ord_ex_def |
458 apply(rule_tac x="[]" in exI) |
369 by (metis Pos_empty intlen_length lex_simps(2) pflat_len_simps(9) val_ord_def) |
459 apply(subst val_ord_def) |
370 |
460 apply(rule conjI) |
371 lemma val_ord_spreI: |
461 apply (simp add: Pos_empty) |
|
462 apply(rule conjI) |
|
463 apply(simp add: pflat_len_simps) |
|
464 apply (simp add: intlen_length) |
|
465 apply(simp) |
|
466 done |
|
467 |
|
468 lemma val_ord_spre: |
|
469 assumes "(flat v') \<sqsubset>spre (flat v)" |
372 assumes "(flat v') \<sqsubset>spre (flat v)" |
470 shows "v :\<sqsubset>val v'" |
373 shows "v :\<sqsubset>val v'" |
|
374 using assms |
|
375 apply(rule_tac val_ord_shorterI) |
|
376 by (metis append_eq_conv_conj le_less_linear prefix_list_def sprefix_list_def take_all) |
|
377 |
|
378 lemma val_ord_LeftI: |
|
379 assumes "v :\<sqsubset>val v'" "flat v = flat v'" |
|
380 shows "(Left v) :\<sqsubset>val (Left v')" |
471 using assms(1) |
381 using assms(1) |
472 apply(rule_tac val_ord_shorterI) |
382 unfolding val_ord_ex_def |
473 apply(simp add: sprefix_list_def prefix_list_def) |
|
474 apply(auto) |
383 apply(auto) |
475 apply(case_tac ps') |
384 apply(rule_tac x="0#p" in exI) |
|
385 using assms(2) |
|
386 apply(auto simp add: val_ord_def pflat_len_simps) |
|
387 done |
|
388 |
|
389 lemma val_ord_RightI: |
|
390 assumes "v :\<sqsubset>val v'" "flat v = flat v'" |
|
391 shows "(Right v) :\<sqsubset>val (Right v')" |
|
392 using assms(1) |
|
393 unfolding val_ord_ex_def |
476 apply(auto) |
394 apply(auto) |
477 by (metis append_eq_conv_conj drop_all le_less_linear neq_Nil_conv) |
395 apply(rule_tac x="Suc 0#p" in exI) |
478 |
|
479 |
|
480 lemma val_ord_ALTI: |
|
481 assumes "v \<sqsubset>val p v'" "flat v = flat v'" |
|
482 shows "(Left v) \<sqsubset>val (0#p) (Left v')" |
|
483 using assms(1) |
|
484 apply(subst (asm) val_ord_def) |
|
485 apply(erule conjE) |
|
486 apply(subst val_ord_def) |
|
487 apply(rule conjI) |
|
488 apply(simp) |
|
489 apply(rule conjI) |
|
490 apply(simp add: pflat_len_simps) |
|
491 apply(rule ballI) |
|
492 apply(rule impI) |
|
493 apply(simp only: Pos.simps) |
|
494 apply(auto)[1] |
|
495 using assms(2) |
396 using assms(2) |
496 apply(simp add: pflat_len_simps) |
397 apply(auto simp add: val_ord_def pflat_len_simps) |
497 apply(auto simp add: pflat_len_simps)[2] |
398 done |
498 done |
399 |
499 |
|
500 lemma val_ord_ALTI2: |
|
501 assumes "v \<sqsubset>val p v'" "flat v = flat v'" |
|
502 shows "(Right v) \<sqsubset>val (1#p) (Right v')" |
|
503 using assms(1) |
|
504 apply(subst (asm) val_ord_def) |
|
505 apply(erule conjE) |
|
506 apply(subst val_ord_def) |
|
507 apply(rule conjI) |
|
508 apply(simp) |
|
509 apply(rule conjI) |
|
510 apply(simp add: pflat_len_simps) |
|
511 apply(rule ballI) |
|
512 apply(rule impI) |
|
513 apply(simp only: Pos.simps) |
|
514 apply(auto)[1] |
|
515 using assms(2) |
|
516 apply(simp add: pflat_len_simps) |
|
517 apply(auto simp add: pflat_len_simps)[2] |
|
518 done |
|
519 |
400 |
520 lemma val_ord_ALTE: |
401 lemma val_ord_ALTE: |
521 assumes "(Left v1) \<sqsubset>val (p # ps) (Left v2)" |
402 assumes "(Left v1) \<sqsubset>val (p # ps) (Left v2)" |
522 shows "p = 0 \<and> v1 \<sqsubset>val ps v2" |
403 shows "p = 0 \<and> v1 \<sqsubset>val ps v2" |
523 using assms(1) |
404 using assms(1) |
524 apply(simp add: val_ord_def) |
405 apply(simp add: val_ord_def) |
525 apply(auto simp add: pflat_len_simps) |
406 apply(auto simp add: pflat_len_simps) |
526 apply (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
407 apply (metis (no_types, hide_lams) assms lex_list.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
527 by (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
408 by (metis (no_types, hide_lams) assms lex_list.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
528 |
409 |
529 lemma val_ord_ALTE2: |
410 lemma val_ord_ALTE2: |
530 assumes "(Right v1) \<sqsubset>val (p # ps) (Right v2)" |
411 assumes "(Right v1) \<sqsubset>val (p # ps) (Right v2)" |
531 shows "p = 1 \<and> v1 \<sqsubset>val ps v2" |
412 shows "p = 1 \<and> v1 \<sqsubset>val ps v2" |
532 using assms(1) |
413 using assms(1) |
533 apply(simp add: val_ord_def) |
414 apply(simp add: val_ord_def) |
534 apply(auto simp add: pflat_len_simps) |
415 apply(auto simp add: pflat_len_simps) |
535 apply (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
416 apply (metis (no_types, hide_lams) assms lex_list.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
536 by (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
417 by (metis (no_types, hide_lams) assms lex_list.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
537 |
418 |
538 lemma val_ord_STARI: |
419 lemma val_ord_STARI: |
539 assumes "v1 \<sqsubset>val p v2" "flat (Stars (v1#vs1)) = flat (Stars (v2#vs2))" |
420 assumes "v1 \<sqsubset>val p v2" "flat (Stars (v1#vs1)) = flat (Stars (v2#vs2))" |
540 shows "(Stars (v1#vs1)) \<sqsubset>val (0#p) (Stars (v2#vs2))" |
421 shows "(Stars (v1#vs1)) \<sqsubset>val (0#p) (Stars (v2#vs2))" |
541 using assms(1) |
422 using assms(1) |
793 apply(simp add: val_ord_def) |
674 apply(simp add: val_ord_def) |
794 apply(auto)[1] |
675 apply(auto)[1] |
795 by (metis IntE Two_to_Three_aux UnCI lex_trans outside_lemma) |
676 by (metis IntE Two_to_Three_aux UnCI lex_trans outside_lemma) |
796 |
677 |
797 |
678 |
798 lemma Pos_pre: |
|
799 assumes "p \<in> Pos v" "q \<sqsubseteq>pre p" |
|
800 shows "q \<in> Pos v" |
|
801 using assms |
|
802 apply(induct v arbitrary: p q rule: Pos.induct) |
|
803 apply(simp_all add: prefix_list_def) |
|
804 apply (meson append_eq_Cons_conv append_is_Nil_conv) |
|
805 apply (meson append_eq_Cons_conv append_is_Nil_conv) |
|
806 apply (metis (no_types, lifting) Cons_eq_append_conv append_is_Nil_conv) |
|
807 apply(auto) |
|
808 apply (meson append_eq_Cons_conv) |
|
809 apply(simp add: append_eq_Cons_conv) |
|
810 apply(auto) |
|
811 done |
|
812 |
|
813 lemma lex_lists_order: |
|
814 assumes "q' \<sqsubset>lex q" "\<not>(q' \<sqsubseteq>pre q)" |
|
815 shows "\<not>(q \<sqsubset>lex q')" |
|
816 using assms |
|
817 apply(induct rule: lex_lists.induct) |
|
818 apply(simp add: prefix_list_def) |
|
819 apply(auto) |
|
820 using trichotomous_aux2 by auto |
|
821 |
|
822 lemma lex_appendL: |
|
823 assumes "q \<sqsubset>lex p" |
|
824 shows "q \<sqsubset>lex p @ q'" |
|
825 using assms |
|
826 apply(induct arbitrary: q' rule: lex_lists.induct) |
|
827 apply(auto) |
|
828 done |
|
829 |
|
830 |
|
831 inductive |
679 inductive |
832 CPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100) |
680 CPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100) |
833 where |
681 where |
834 "\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2" |
682 "\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2" |
835 | "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2" |
683 | "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2" |
1281 apply(simp(no_asm) add: val_ord_def) |
1116 apply(simp(no_asm) add: val_ord_def) |
1282 apply(rule conjI) |
1117 apply(rule conjI) |
1283 apply(simp add: val_ord_def) |
1118 apply(simp add: val_ord_def) |
1284 apply(rule conjI) |
1119 apply(rule conjI) |
1285 apply(simp add: val_ord_def) |
1120 apply(simp add: val_ord_def) |
1286 apply(auto simp add: pflat_len_simps pflat_len_Stars_simps2)[1] |
1121 apply(auto simp add: pflat_len_simps)[1] |
1287 apply(rule ballI) |
1122 apply(rule ballI) |
1288 apply(rule impI) |
1123 apply(rule impI) |
1289 apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
1124 apply(simp add: val_ord_def pflat_len_simps intlen_append) |
1290 apply(clarify) |
1125 apply(clarify) |
1291 apply(case_tac q) |
1126 apply(case_tac q) |
1292 apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
1127 apply(simp add: val_ord_def pflat_len_simps intlen_append) |
1293 apply(clarify) |
1128 apply(clarify) |
1294 apply(erule disjE) |
1129 apply(erule disjE) |
1295 prefer 2 |
1130 prefer 2 |
1296 apply(drule_tac x="Suc a # list" in bspec) |
1131 apply(drule_tac x="Suc a # list" in bspec) |
1297 apply(simp) |
1132 apply(simp) |
1298 apply(drule mp) |
1133 apply(drule mp) |
1299 apply(simp) |
1134 apply(simp) |
1300 apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
1135 apply(simp add: val_ord_def pflat_len_simps intlen_append) |
1301 apply(drule_tac x="Suc a # list" in bspec) |
1136 apply(drule_tac x="Suc a # list" in bspec) |
1302 apply(simp) |
1137 apply(simp) |
1303 apply(drule mp) |
1138 apply(drule mp) |
1304 apply(simp) |
1139 apply(simp) |
1305 apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
1140 apply(simp add: val_ord_def pflat_len_simps intlen_append) |
1306 done |
1141 done |
1307 |
1142 |
1308 |
1143 |
1309 lemma Posix_val_ord_reverse: |
1144 lemma Posix_val_ord_reverse: |
1310 assumes "s \<in> r \<rightarrow> v1" |
1145 assumes "s \<in> r \<rightarrow> v1" |
1311 shows "\<not>(\<exists>v2 \<in> CPT r s. v2 :\<sqsubset>val v1)" |
1146 shows "\<not>(\<exists>v2 \<in> CPT r s. v2 :\<sqsubset>val v1)" |
1312 using assms |
1147 using assms |
1313 by (metis Posix_val_ord_stronger less_irrefl val_ord_def |
1148 by (metis Posix_val_ord_stronger less_irrefl val_ord_def |
1314 val_ord_ex1_def val_ord_ex_def val_ord_ex_trans) |
1149 val_ord_ex1_def val_ord_ex_def val_ord_ex_trans) |
1315 |
1150 |
1316 thm Posix.intros(6) |
|
1317 |
|
1318 inductive Prop :: "rexp \<Rightarrow> val list \<Rightarrow> bool" |
|
1319 where |
|
1320 "Prop r []" |
|
1321 | "\<lbrakk>Prop r vs; |
|
1322 \<not> (\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = concat (map flat vs) \<and> flat v @ s\<^sub>3 \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk> |
|
1323 \<Longrightarrow> Prop r (v # vs)" |
|
1324 |
1151 |
1325 lemma STAR_val_ord_ex: |
1152 lemma STAR_val_ord_ex: |
1326 assumes "Stars (v # vs1) :\<sqsubset>val Stars (v # vs2)" |
1153 assumes "Stars (v # vs1) :\<sqsubset>val Stars (v # vs2)" |
1327 shows "Stars vs1 :\<sqsubset>val Stars vs2" |
1154 shows "Stars vs1 :\<sqsubset>val Stars vs2" |
1328 using assms |
1155 using assms |