diff -r 0fa636821349 -r 9fd41f224e8d thys/Re.thy --- a/thys/Re.thy Thu Sep 22 00:40:03 2016 +0100 +++ b/thys/Re.thy Sat Oct 08 12:16:17 2016 +0100 @@ -5,7 +5,7 @@ section {* Sequential Composition of Sets *} - +m definition Sequ :: "string set \ string set \ string set" ("_ ;; _" [100,100] 100) where @@ -1027,7 +1027,7 @@ apply metis done -section (* tryout with all-mkeps *) +section {* tryout with all-mkeps *} fun alleps :: "rexp \ val set" @@ -1038,12 +1038,21 @@ | "alleps(SEQ r1 r2) = {Seq v1 v2 | v1 v2. v1 \ alleps r1 \ v2 \ alleps r2}" | "alleps(ALT r1 r2) = {Left v1 | v1. v1 \ alleps r1} \ {Right v2 | v2. v2 \ alleps r2}" +fun injall :: "rexp \ char \ val \ val set" +where + "injall (EMPTY) c Void = {}" +| "injall (CHAR d) c Void = (if c = d then {Char d} else {})" +| "injall (ALT r1 r2) c (Left v1) = {Left v | v. v \ injall r1 c v1}" +| "injall (ALT r1 r2) c (Right v2) = {Right v | v. v \ injall r2 c v2}" +| "injall (SEQ r1 r2) c (Seq v1 v2) = {Seq v v2 | v. v \ injall r1 c v1}" +| "injall (SEQ r1 r2) c (Left (Seq v1 v2)) = {Seq v v2 | v. v \ injall r1 c v1}" +| "injall (SEQ r1 r2) c (Right v2) = {Seq v v' | v v'. v \ alleps r1 \ v' \ injall r2 c v2}" + fun allvals :: "rexp \ string \ val set" where "allvals r [] = alleps r" -| "allvals r (c#s) = {injval r c v | v. v \ allvals (der c r) s}" - +| "allvals r (c#s) = {v | v v'. v \ injall r c v' \ v' \ allvals (der c r) s}" lemma q1: assumes "v \ alleps r" @@ -1053,6 +1062,87 @@ apply(auto intro: Prf.intros) done + +lemma allvals_NULL: + shows "allvals (NULL) s = {}" +apply(induct_tac s) +apply(simp) +apply(simp) +done + +lemma allvals_EMPTY: + shows "allvals (EMPTY) [] = {Void}" + and "s \ [] \ allvals (EMPTY) s = {}" +apply(simp) +apply(case_tac s) +apply(simp) +apply(simp add: allvals_NULL) +done + +lemma allvals_CHAR: + shows "allvals (CHAR c) [c] = {Char c}" + and "s \ [c] \ allvals (CHAR c) s = {}" +apply(simp) +apply(case_tac s) +apply(simp) +apply(case_tac "c = a") +apply(simp add: allvals_EMPTY) +apply(simp add: allvals_NULL) +done + +lemma allvals_ALT: + shows "allvals (ALT r1 r2) s = {Left v1 | v1. v1 \ allvals r1 s} \ + {Right v2 | v2. v2 \ allvals r2 s}" +apply(induct s arbitrary: r1 r2) +apply(simp) +apply(simp) +apply(auto) +apply blast +apply(rule_tac x="Left v'" in exI) +apply(simp) +apply(rule_tac x="Right v'" in exI) +apply(simp) +done + +lemma allvals_SEQ_Nil: + "allvals (SEQ r1 r2) [] = {Seq v1 v2 | v1 v2. v1 \ allvals r1 [] \ v2 \ allvals r2 []}" +by simp + +lemma allvals_SEQ: + shows "allvals (SEQ r1 r2) s = {Seq v1 v2 | v1 v2 s1 s2. + s = s1 @ s2 \ v1 \ allvals r1 s1 \ v2 \ allvals r2 s2}" +using assms +apply(induct s arbitrary: r1 r2) +apply(simp) +apply(simp) +apply(auto) +apply(simp_all add: allvals_ALT) +apply(auto) +apply (metis (mono_tags, lifting) allvals.simps(2) append_Cons mem_Collect_eq) +apply fastforce +prefer 2 +apply(rule_tac x="a#s1" in exI) +apply(rule_tac x="s2" in exI) +apply(simp) +apply(fastforce) +prefer 2 +apply(subst (asm) Cons_eq_append_conv) +apply(auto)[1] +using Prf_flat_L nullable_correctness q1 apply fastforce +apply(rule_tac x="Seq v' v2" in exI) +apply(simp) +apply(rule_tac x="ys'" in exI) +apply(rule_tac x="s2" in exI) +apply(simp) +apply(subst (asm) Cons_eq_append_conv) +apply(auto)[1] +apply(rule_tac x="Right v'" in exI) +apply(simp) +apply(rule_tac x="Left (Seq v' v2)" in exI) +apply(simp) +apply(auto)[1] +done + lemma q11: assumes "nullable r" "\ v : r" "flat v = []" shows "v \ alleps r" @@ -1081,10 +1171,81 @@ assumes "nullable r" shows "alleps r = {v. \ v : r \ flat v = []}" using assms -apply(auto) +apply(auto) apply (simp_all add: q1) by (simp add: q11) + +lemma k0: + assumes "\ v : der a r" "v' \ injall r a v" + shows "flat v' = a # flat v" +using assms +apply(induct a r arbitrary: v v' rule: der.induct) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(case_tac "c = c'") +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(auto)[1] +apply(auto)[1] +apply(case_tac "nullable r1") +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +using q1 apply blast +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +done + +lemma k: + assumes "\ v' : der a r" "v \ injall r a v'" + shows "\ v : r" +using assms +apply(induct a r arbitrary: v v' rule: der.induct) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(case_tac "c = c'") +apply(erule Prf.cases) +apply(simp_all) +apply(rule Prf.intros) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(auto intro: Prf.intros)[1] +apply(auto intro: Prf.intros)[1] +apply(case_tac "nullable r1") +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +apply(auto intro: Prf.intros)[1] +using Prf.intros(1) q1 apply blast +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +using Prf.intros(1) by auto + + + lemma q22: assumes "v \ allvals r s" shows "\ v : r \ s \ L (r) \ flat v = s" @@ -1093,154 +1254,213 @@ apply(auto) apply(simp_all add: q1) using Prf_flat_L q1 apply fastforce -apply (simp add: v3) -apply (metis Prf_flat_L v3 v4) -by (simp add: v4) +apply(drule_tac x="v'" in meta_spec) +apply(drule_tac x="der a r" in meta_spec) +apply(simp) +apply(clarify) +apply(rule k) +apply(assumption) +apply(assumption) +apply(drule_tac x="v'" in meta_spec) +apply(drule_tac x="der a r" in meta_spec) +apply(simp) +apply(clarify) +using Prf_flat_L v3 v4 apply fastforce +apply(drule_tac x="v'" in meta_spec) +apply(drule_tac x="der a r" in meta_spec) +apply(simp) +apply(clarify) +using k0 by blast - -lemma qa_oops: - assumes "\ v : r" "\s. flat v = a # s \ a # s \ L r" "\ projval r a v : der a r" - shows "injval r a (projval r a v) = v" +lemma ra: + assumes "v \ allvals r1 s" + shows "Left v \ allvals (ALT r1 r2) s" using assms -apply(induct v r arbitrary: ) -defer -defer +apply(induct s arbitrary: r1 r2 v) +apply(simp) +apply(auto) +apply(rule_tac x="Left v'" in exI) apply(simp) -apply(erule Prf.cases) -apply(simp_all)[4] -apply(auto simp only:) +done + +lemma rb: + assumes "v \ allvals r2 s" + shows "Right v \ allvals (ALT r1 r2) s" +using assms +apply(induct s arbitrary: r1 r2 v) apply(simp) -apply(erule Prf.cases) -apply(simp_all)[5] - +apply(auto) +apply(rule_tac x="Right v'" in exI) +apply(simp) done -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) + +lemma r1: + assumes "v1 \ alleps r1" "v2 \ allvals r2 s2" + shows "Seq v1 v2 \ allvals (SEQ r1 r2) s2" +using assms +apply(induct s2 arbitrary: r1 r2 v1 v2) +apply(simp) +apply(simp) +apply(auto) +apply(rule_tac x="Right v'" in exI) +apply(simp) +apply(rule rb) +apply(simp) +using not_nullable_flat q1 by blast + +lemma r2: + assumes "v1 \ allvals r1 s1" "v2 \ allvals r2 s2" + shows "Seq v1 v2 \ allvals (SEQ r1 r2) (s1 @ s2)" +using assms +apply(induct s1 arbitrary: r1 r2 v1 v2 s2) +apply(simp) +apply(rule r1) +apply(simp) +apply(simp) +apply(simp) apply(auto) -using Prf_flat_L apply fastforce -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -using Prf_flat_L apply force -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -apply(erule Prf.cases) -apply(simp_all) -apply(auto)[1] -apply(case_tac "nullable r1a") +apply(drule_tac x="der a r1" in meta_spec) +apply(drule_tac x="r2" in meta_spec) +apply(drule_tac x="v'" in meta_spec) +apply(drule_tac x="v2" in meta_spec) +apply(drule_tac x="s2" in meta_spec) +apply(simp) +apply(rule_tac x="Left (Seq v' v2)" in exI) +apply(simp) +apply(rule ra) +apply(simp) +apply(drule_tac x="der a r1" in meta_spec) +apply(drule_tac x="r2" in meta_spec) +apply(drule_tac x="v'" in meta_spec) +apply(drule_tac x="v2" in meta_spec) +apply(drule_tac x="s2" in meta_spec) +apply(simp) +apply(rule_tac x="Seq v' v2" in exI) apply(simp) -apply(erule Prf.cases) -apply(simp_all) -apply(auto simp add: Sequ_def)[1] -apply(simp add: Cons_eq_append_conv) -apply(auto) +done +lemma q22a: + assumes " s \ L (r)" + shows "\v. v \ allvals r s \ flat v = s" +using assms +apply(induct r arbitrary: s) +apply(auto) +apply(simp add: Sequ_def) +apply(auto) +apply(drule_tac x="s1" in meta_spec) +apply(drule_tac x="s2" in meta_spec) +apply(auto) +apply(rule_tac x="Seq v va" in exI) +apply(simp) +apply(rule r2) +apply(simp) +apply(simp) +apply(drule_tac x="s" in meta_spec) +apply(simp) +apply(auto) +apply(rule_tac x="Left v" in exI) +apply(simp) +apply(rule ra) +apply(simp) +apply(drule_tac x="s" in meta_spec) +apply(drule_tac x="s" in meta_spec) +apply(simp) +apply(auto) +apply(rule_tac x="Right v" in exI) +apply(simp) +apply(rule rb) +apply(simp) +done -using Prf_flat_L -apply(erule Prf.cases) -apply(simp_all) -using Prf_flat_L +lemma q22b: + assumes " s \ L (r)" "\ v : r" "flat v = s" + shows "v \ allvals r s" +using assms +apply(induct r arbitrary: s v) +apply(auto) apply(erule Prf.cases) apply(simp_all) apply(erule Prf.cases) apply(simp_all) apply(simp add: Sequ_def) -apply(auto)[1] -apply(simp add: Cons_eq_append_conv) -apply(auto)[1] -sorry +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +apply(simp add: append_eq_append_conv2) +apply(auto) +apply (metis Prf_flat_L append_assoc r2) +apply (metis Prf_flat_L r2) +apply(erule Prf.cases) +apply(simp_all) +apply(auto intro: ra rb)[2] +apply(rule rb) +apply (simp add: Prf_flat_L) +apply(erule Prf.cases) +apply(simp_all) +apply(auto intro: ra rb)[2] +apply(rule ra) +by (simp add: Prf_flat_L) lemma q2: assumes "s \ L(r)" shows "allvals r s = {v. \ v : r \ s \ L (r) \ flat v = s}" using assms -apply(induct s arbitrary: r) -apply(simp) -apply(subst q33) -using nullable_correctness apply blast -apply(simp) -apply(simp) -apply(drule_tac x="der a r" in meta_spec) -apply(drule meta_mp) -using lex_correct1 lex_correct3 apply fastforce -apply(simp) apply(auto) -using v3 apply blast -apply (simp add: v4) -apply(rule_tac x="projval r a x" in exI) +apply (simp add: q22) +apply (simp add: q22) +by (simp add: q22b) + +lemma r3a: + assumes "v' \ allvals (SEQ r1 r2) (s1 @ s2)" + "(s1 @ s2) \ L (SEQ r1 r2)" + shows "\v1 v2. v' = Seq v1 v2 \ v1 \ allvals r1 s1 \ v2 \ allvals r2 s2" +using assms +apply(subst (asm) q2) +apply(auto) +apply(erule_tac Prf.cases) +apply(simp_all) apply(rule conjI) -defer -apply(rule conjI) -apply (simp add: v3_proj) -apply (simp add: v4_proj2) -apply(subgoal_tac "projval r a x \ allvals (der a r) s") -apply(simp) -apply(subst qa_oops) -apply(simp) -apply(blast) - -lemma q2: - assumes "\ v : r" "s \ L (r)" "flat v = s" - shows "v \ allvals r s" -using assms -apply(induct s arbitrary: r v) +apply(simp add: append_eq_append_conv2) apply(auto) -apply(subgoal_tac "nullable r") -apply(simp add: q11) -using not_nullable_flat apply fastforce -apply(drule sym) -apply(simp) -apply(case_tac s) -apply(simp) +apply(subst q2) +oops -apply(drule_tac x="projval r a v" in meta_spec) -apply(drule_tac x="der a r" in meta_spec) -apply(drule meta_mp) -defer -apply(drule meta_mp) -using v3_proj apply blast -apply(rule_tac x="projval r a v" in exI) +lemma r3: + assumes "Seq v1 v2 \ allvals (SEQ r1 r2) (s1 @ s2)" + "flat v1 = s1" "flat v2 = s2" + "(s1 @ s2) \ L (SEQ r1 r2)" + shows "v1 \ allvals r1 s1" "v2 \ allvals r2 s2" +using assms +apply(subst (asm) q2) apply(auto) -defer -apply(subst (asm) v4_proj2) -apply(assumption) -apply(assumption) -apply(simp) -apply(subst v4_proj2) -apply(assumption) -apply(assumption) -apply(simp) -apply(subst (asm) v4_proj2) -apply(assumption) -apply(assumption) -sorry - - - -lemma - "{v. \ v : r \ flat v = s} = allvals r s" +apply(erule_tac Prf.cases) +apply(simp_all) +apply(subst q2) apply(auto) -apply(rule q2) -apply(simp) +using Prf_flat_L apply blast +using Prf_flat_L apply blast +using assms +apply(subst (asm) q2) +apply(auto) +apply(erule_tac Prf.cases) +apply(simp_all) +apply(subst q2) +apply(auto) +using Prf_flat_L apply blast +using Prf_flat_L apply blast +done definition POSIX2 :: "val \ rexp \ string \ bool" where - "POSIX2 v r s \ (\ v : r \ (\v'\allvals r s. v \r v'))" + "POSIX2 v r s \ (\ v : r \ flat v = s \ (\v'\allvals r s. v \r v'))" + + + lemma k1: + assumes "nullable r" shows "POSIX2 v r [] \ \v' \ alleps r. v \r v'" using assms apply(induct r arbitrary: v) @@ -1255,21 +1475,713 @@ done lemma k2: + assumes "s \ L r" shows "POSIX2 v r s \ \v' \ allvals r s. v \r v'" using assms apply(induct s arbitrary: r v) -apply(simp add: k1) +apply(simp) +apply(rule k1) +apply (simp add: nullable_correctness) +apply(simp) +apply(simp) apply(auto) apply(simp only: POSIX2_def) apply(simp) apply(clarify) -apply(drule_tac x="injval r a va" in spec) +apply(drule_tac x="x" in spec) apply(drule mp) -defer +apply(auto) +done + +lemma pos: + assumes "s \ r \ v" + shows "v \ allvals r s" +using assms +apply(subst q2) +using PMatch1(1) PMatch1(2) Prf_flat_L apply blast +apply(simp) +using PMatch1(1) PMatch1(2) Prf_flat_L by blast + +lemma mkeps_val: + assumes "nullable r" + shows "mkeps r \ alleps r" +using assms +apply(induct r) +apply(auto) +done + +lemma injval_injall: + assumes "\ v : der a r" + shows "injval r a v \ injall r a v" +using assms +apply(induct a r arbitrary: v rule: der.induct) +apply(simp) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(case_tac "c = c'") +apply(simp) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(erule Prf.cases) +apply(simp_all) +apply(case_tac "nullable r1") +apply(simp) +apply(erule Prf.cases) +apply(simp_all) +apply(auto) +apply(erule Prf.cases) +apply(simp_all) +using mkeps_val apply blast +apply(erule Prf.cases) +apply(simp_all) +done + + +lemma mkeps_val1: + assumes "nullable r" "v \r mkeps r" "flat v = []" "\ v : r" + shows "v = mkeps r" +using assms +apply(induct r arbitrary: v) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule Prf.cases) +apply(auto) +apply(erule Prf.cases) +apply(auto) +apply(erule Prf.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule Prf.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply(erule Prf.cases) +apply(auto) +apply(erule ValOrd.cases) +apply(auto) +apply (simp add: not_nullable_flat) +apply(erule ValOrd.cases) apply(auto) done + +lemma sulzmann_our: + assumes "v \ alleps r" "nullable r" + shows "mkeps r \r v" +using assms +apply(induct r arbitrary: v) +apply(simp_all) +apply(rule ValOrd.intros) +apply(auto)[1] +apply(case_tac "mkeps r1 = v1") +apply(simp) +apply(rule ValOrd.intros) +apply(blast) +apply(rule ValOrd.intros) +apply(blast) +apply(simp) +apply(auto) +apply(rule ValOrd.intros) +apply(blast) +apply(rule ValOrd.intros) +apply(blast) +apply(rule ValOrd.intros) +using not_nullable_flat q1 apply blast +apply(rule ValOrd.intros) +using q1 apply auto[1] +apply(rule ValOrd.intros) +apply (simp add: q1) +apply(rule ValOrd.intros) +apply(blast) done +lemma destruct: + assumes "\s3. s1 @ s3 \ L r1 \ s3 = [] \ (\s4. s3 @ s4 = s2 \ s4 \ L r2)" + and "s1 \ L r1" "s2 \ L r2" "(s1' @ s2') \ (s1 @ s2)" + and "s1'@ s2' \ L (SEQ r1 r2)" "s1' \ L r1" + shows "s1' \ s1" +using assms +apply(simp add: prefix_def) +apply(auto) +apply(simp add: append_eq_append_conv2) +apply(auto) +apply(simp add: Sequ_def) +apply(auto) +apply(drule_tac x="us" in spec) +apply(simp) +apply(auto) +apply(simp add: append_eq_append_conv2) +apply(auto) +oops + +lemma inj_ord: + assumes "v1 \(der a r) v2" "s \ (der a r) \ v1" "s' \ L (der a r)" + "v1 \ allvals (der a r) s" "v2 \ allvals (der a r) s'" "s' \ s" + shows "injval r a v1 \r injval r a v2" +using assms +apply(induct a r arbitrary: s s' v1 v2 rule: der.induct) +apply(simp_all) +(*apply(simp add: allvals_NULL) +apply(simp add: allvals_NULL)*) +apply(case_tac "c = c'") +apply(simp) +apply(case_tac "s = []") +apply(subgoal_tac "s' = []") +prefer 2 +using allvals_EMPTY(2) apply blast +apply(simp add: allvals_EMPTY) +apply(rule ValOrd.intros) +apply(simp add: allvals_EMPTY) +apply(simp) +(*apply(simp add: allvals_NULL)*) +(* ALT case *) +apply(simp add: allvals_ALT) +apply(auto)[1] +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(erule PMatch.cases) +apply(simp_all) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(subst v4) +apply(simp) +apply (simp add: q22) +apply(subst v4) +apply(simp) +apply (simp add: q22) +apply(simp) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(subst v4) +apply (simp add: q22) +apply(subst v4) +apply (simp add: q22) +apply(simp) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(erule PMatch.cases) +apply(simp_all) +using q22 apply auto[1] +apply(erule PMatch.cases) +apply(simp_all) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +using q22 apply auto[1] +apply(erule PMatch.cases) +apply(simp_all) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(subst v4) +apply (simp add: q22) +apply(subst v4) +apply (simp add: q22) +apply(simp) +apply(erule PMatch.cases) +apply(simp_all) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(subst v4) +apply (simp add: q22) +apply(subst v4) +apply (simp add: q22) +apply(simp) +using q22 apply auto[1] +apply(erule PMatch.cases) +apply(simp_all) +apply(erule ValOrd.cases) +apply(simp_all) +apply(rule ValOrd.intros) +using q22 apply auto[1] +(* seq case *) +apply(case_tac "nullable r1") +apply(simp) +prefer 2 +apply(simp) +apply(simp add: allvals_SEQ) +apply(auto)[1] +apply(erule ValOrd.cases) +apply(simp_all) +apply(clarify) +apply(rule ValOrd.intros) +apply(simp) +apply(rule ValOrd.intros) +apply(erule PMatch.cases) +apply(simp_all) +apply(clarify) +apply(rotate_tac 1) +apply(drule_tac x="s1b" in meta_spec) +apply(rotate_tac 13) +apply(drule_tac x="s1a" in meta_spec) +apply(drule_tac x="v1c" in meta_spec) +apply(drule_tac x="v1'" in meta_spec) +apply(simp) +apply(subgoal_tac "s1 = s1b") +prefer 2 +apply (metis PMatch1(2) q22) +apply(simp) +apply(clarify) +apply(drule destruct) +apply (metis PMatch1(2) q22) +apply (metis PMatch1(2) q22) +apply(assumption) +apply (metis PMatch1(2) q22) +apply (metis PMatch1(2) q22) +apply(subgoal_tac "s2a = s2b") +prefer 2 +apply (metis PMatch1(2) q22) +apply(drule destruct) +apply (metis PMatch1(2) q22) +apply (metis PMatch1(2) q22) +apply(assumption) +back +apply (metis PMatch1(2) q22) +apply (metis PMatch1(2) q22) + + + +apply(simp add: allvals_ALT) +apply(auto) +apply(erule ValOrd.cases) +apply(simp_all) +apply(clarify) +apply(erule ValOrd.cases) +apply(simp_all) +apply(clarify) +apply(rule ValOrd.intros) +apply(blast) +apply(rule ValOrd.intros) +apply(clarify) +apply(simp add: allvals_SEQ) +apply(auto)[1] +apply(erule PMatch.cases) +apply(simp_all) +apply(clarify) +apply(erule PMatch.cases) +apply(simp_all) +apply(auto) +apply(drule_tac x="s1b" in meta_spec) +apply(drule_tac x="v1" in meta_spec) +apply(drule_tac x="v1'a" in meta_spec) +apply(simp) +apply(drule_tac meta_mp) +apply(subgoal_tac "s1 = s1b") +apply(simp) +apply (metis PMatch1(2) q22) +apply(drule_tac meta_mp) +apply(subgoal_tac "s1a = s1b") +apply(simp) +apply(simp add: append_eq_append_conv2) +apply(auto)[1] +apply(subgoal_tac "s2 = s2a") +apply(simp) +apply(clarify) +prefer 2 +using q22 apply blast +using q22 apply blast +using q22 apply blast +apply(subgoal_tac "usa = []") +apply(simp) +prefer 2 +using q22 apply blast +prefer 3 +apply(simp) +prefer 4 +apply(erule PMatch.cases) +apply(simp_all) +apply(clarify) +apply(erule PMatch.cases) +apply(simp_all) +apply(auto) +apply(erule ValOrd.cases) +apply(simp_all) +apply(clarify) +apply(simp) +prefer 5 +apply(erule PMatch.cases) +apply(simp_all) +apply(clarify) +apply(erule ValOrd.cases) +apply(simp_all) +apply(clarify) +apply(simp add: allvals_SEQ) +apply(auto)[1] +apply (simp add: q22) +apply(simp add: allvals_SEQ) +apply(auto)[1] +apply(simp add: append_eq_append_conv2) +apply(auto)[1] +apply (simp add: q22) +thm PMatch2 +apply(drule PMatch2) + + +lemma sulzmann_our: + assumes "\v' \ allvals r s. v \r v'" "s \ L r" "\ v : r" "flat v = s" + shows "s \ r \ v" +using assms +apply(induct s arbitrary: r v) +apply(simp_all) +apply(subst (asm) q33) +apply (simp add: nullable_correctness) +apply(simp) +apply(drule_tac x="mkeps r" in spec) +apply(drule mp) +apply(rule conjI) +using mkeps_val not_nullable_flat q1 apply blast +using mkeps_flat not_nullable_flat apply blast +apply(subgoal_tac "nullable r") +apply(drule mkeps_val1) +apply(assumption) +apply(simp) +apply(simp) +apply(simp) +using PMatch_mkeps not_nullable_flat apply blast +using not_nullable_flat apply blast +apply(drule_tac x="der a r" in meta_spec) +apply(drule_tac x="projval r a v" in meta_spec) +apply(drule meta_mp) +defer +apply(drule meta_mp) +using Prf_flat_L v3_proj v4_proj2 apply blast +apply(drule meta_mp) +using v3_proj apply blast +apply(drule meta_mp) +apply (simp add: v4_proj2) +defer +apply(rule ballI) +apply(drule_tac x="injval r a x" in spec) +apply(auto) +apply(drule_tac x="x" in spec) +apply(drule mp) +apply(rule injval_injall) +using q22 apply blast +apply(simp) +(* HERE *) + + +lemma our_sulzmann: + assumes "s \ r \ v" "v' \ allvals r s" + shows "v \r v'" +using assms +apply(induct r arbitrary: s v v') +apply(erule PMatch.cases) +apply(simp_all)[5] +apply(erule PMatch.cases) +apply(simp_all)[5] +apply(rule ValOrd.intros) +apply(erule PMatch.cases) +apply(simp_all)[5] +apply(rule ValOrd.intros) +(* SEQ - case *) +apply(erule PMatch.cases) +apply(simp_all)[5] +apply(clarify) +apply(subst (asm) (3) q2) +apply(simp add: Sequ_def) +apply(rule_tac x="s1" in exI) +apply(rule_tac x="s2" in exI) +apply(simp) +apply(rule conjI) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply (metis PMatch1(1) PMatch1(2) Prf_flat_L) +apply(simp) +apply(clarify) +apply(erule Prf.cases) +apply(simp_all)[5] +apply(case_tac "v1 = v1a") +apply(simp) +apply(rule ValOrd.intros) +apply(rotate_tac 1) +apply(drule_tac x="s2" in meta_spec) +apply(drule_tac x="v2" in meta_spec) +apply(drule_tac x="v2a" in meta_spec) +apply(simp) +apply(drule_tac meta_mp) +apply(subst q2) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(rule conjI) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply (simp add: PMatch1(2)) +apply(simp) +apply(rule ValOrd.intros) +prefer 2 +apply(simp) +apply(drule_tac x="s1" in meta_spec) +apply(drule_tac x="v1" in meta_spec) +apply(drule_tac x="v1a" in meta_spec) +apply(simp) +apply(drule_tac meta_mp) +apply(subst q2) +apply (metis PMatch1(1) PMatch1(2) Prf_flat_L) +apply(simp) +apply(rule conjI) +apply (metis PMatch1(1) PMatch1(2) Prf_flat_L) +apply(subst (asm) append_eq_append_conv2) +apply(auto)[1] +using Prf_flat_L apply fastforce + +apply(drule_tac x="us" in spec) +apply(auto)[1] + +using Prf_flat_L apply fastforce +using Prf_flat_L apply blast +apply(drule_tac meta_mp) +apply(subst q2) +using Prf_flat_L apply fastforce +apply(simp) +using Prf_flat_L apply fastforce +apply(simp) +apply(drule_tac x="flat v1a" in meta_spec) +apply(drule_tac x="v1" in meta_spec) +apply(drule_tac x="v1a" in meta_spec) +apply(drule_tac meta_mp) +apply(simp) +apply(drule meta_mp) +apply(subst q2) +apply (metis PMatch1(1) PMatch1(2) Prf_flat_L) +apply(simp) +apply(rule conjI) +apply (metis PMatch1(1) PMatch1(2) Prf_flat_L) +apply(drule_tac x="[]" in spec) +apply(auto)[1] + +using Prf_flat_L apply fast +apply(drule_tac x="us" in spec) +apply(simp) + +apply (simp add: Prf_flat_L) +apply(simp) +thm PMatch1 +qed +done +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(clarify) +apply(erule Prf.cases) +apply(simp_all) +apply(rule ValOrd.intros) +apply(drule_tac x="v1" in meta_spec) +apply(drule meta_mp) +apply(subst q2) +apply (simp add: Prf_flat_L) +apply(simp) +apply (simp add: Prf_flat_L) +apply(simp) +apply(rule ValOrd.intros) +apply(auto)[1] +apply (simp add: PMatch1(2)) +apply (simp add: PMatch1(2)) +apply(subst (asm) (2) q2) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(clarify) +apply(erule Prf.cases) +apply(simp_all) +prefer 2 +apply(rule ValOrd.intros) +using q22b apply blast +apply(rule ValOrd.intros) +apply(auto) +using Prf_flat_L apply blast +apply(subst (asm) (3) q2) +apply(simp add: Sequ_def) +apply(rule_tac x="s1" in exI) +apply(rule_tac x="s2" in exI) +apply(simp) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(clarify) +apply(erule Prf.cases) +apply(simp_all) +apply(auto simp add: Sequ_def)[1] +apply(case_tac "v1 = v1a") +apply(simp) +apply(rule ValOrd.intros) +apply(rotate_tac 3) +apply(drule_tac x="v2a" in meta_spec) +apply(drule_tac meta_mp) +apply(subst q2) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(rule conjI) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply (metis PMatch1(2) same_append_eq) +apply(simp) +apply(rule ValOrd.intros) +apply(drule_tac x="v1a" in meta_spec) +apply(drule_tac meta_mp) +apply(subst q2) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +apply(simp) +apply(rule conjI) +using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce +prefer 2 +apply(simp) +prefer 2 +apply(simp) +apply(rotate_tac 7) +apply(drule sym) +apply(simp) +apply(subst (asm) (2) append_eq_append_conv2) +apply(auto)[1] +apply(frule_tac x="us" in spec) +apply(auto)[1] +prefer 2 +apply(drule_tac x="flat v2a" in spec) +apply(auto)[1] + +apply(subgoal_tac "flat v2a = s2") +apply(simp) + +apply(simp add: append_eq_append_conv2) +apply(auto) +prefer 2 +apply blast +prefer 2 +apply (metis Prf_flat_L append_self_conv2) +prefer 4 + + + +lemma our_sulzmann: + assumes "s \ r \ v" + shows "POSIX2 v r s" +using assms +apply(induct s r v) +apply(auto) +apply(simp add: POSIX2_def) +using Prf.intros(4) ValOrd.intros(7) apply blast +apply(simp add: POSIX2_def) +apply (simp add: Prf.intros(5) ValOrd.intros(8)) +apply(simp add: POSIX2_def) +apply(auto) +apply(rule Prf.intros) +apply(simp) +apply(subgoal_tac "(\x1. x = Left x1) \ (\x1. x = Right x1)") +apply(auto)[1] +apply(rule ValOrd.intros) +apply(drule_tac x="x1" in bspec) +apply(subst (asm) q2) +apply (simp add: Prf_flat_L) +apply(simp) +apply(subst q2) +apply (simp add: Prf_flat_L) +apply(auto)[1] +apply(rotate_tac 2) +apply(erule Prf.cases) +apply(simp_all) +apply(rotate_tac 2) +apply(erule Prf.cases) +apply(simp_all) +apply (simp add: Prf_flat_L) +apply(rule ValOrd.intros) +apply(subst (asm) (2) q2) +apply (simp add: Prf_flat_L) +apply(auto)[1] +defer +apply(simp add: POSIX2_def) +apply(auto)[1] +apply(rule Prf.intros) +apply (simp add: Prf_flat_L) +apply(subgoal_tac "(\x1. x = Left x1) \ (\x1. x = Right x1)") +apply(auto)[1] +apply(rule ValOrd.intros) +apply(subst (asm) (2) q2) +apply (simp add: Prf_flat_L) +apply(auto)[1] +apply(rotate_tac 4) +apply(erule Prf.cases) +apply(simp_all) +apply(auto)[1] +using Prf_flat_L apply force +apply(rule ValOrd.intros) +apply(drule_tac x="x1" in bspec) +apply(subst (asm) q2) +apply (simp add: Prf_flat_L) +apply(auto)[1] +apply(subst q2) +apply(rotate_tac 3) +apply(erule Prf.cases) +apply(simp_all) +apply(rotate_tac 3) +apply(erule Prf.cases) +apply(simp_all) +defer +apply(auto)[1] +apply(simp add: POSIX2_def) +apply(auto intro: Prf.intros)[1] +apply(subgoal_tac "(\x1 x2. x = Seq x1 x2 \ flat v1 @ flat v2 = flat x1 @ flat x2)") +apply(auto)[1] +apply(case_tac "v1 = x1") +apply(simp) +apply(rule ValOrd.intros) +apply(rotate_tac 6) +apply(drule_tac x="x2" in bspec) +apply(subst (asm) q2) +apply (simp add: Sequ_def Prf_flat_L) + +using Prf_flat_L apply blast +apply(auto)[1] +apply(rotate_tac 6) +apply(erule Prf.cases) +apply(simp_all) +apply(subst q2) +apply (simp add: Prf_flat_L) +apply(auto)[1] +apply(auto simp add: Sequ_def) +using Prf_flat_L apply blast +apply(rule ValOrd.intros) +apply(rotate_tac 5) +apply(drule_tac x="x1" in bspec) +apply(rotate_tac 1) +apply(subst (asm) q2) +apply (simp add: Sequ_def Prf_flat_L) +using Prf_flat_L apply blast +apply(auto)[1] +apply(subst q2) +apply (simp add: Sequ_def Prf_flat_L) +apply(auto)[1] +apply(rotate_tac 7) +apply(erule Prf.cases) +apply(simp_all) +apply (simp add: Sequ_def Prf_flat_L) +apply(rotate_tac 7) +apply(erule Prf.cases) +apply(simp_all) +apply(auto)[1] +apply(simp add: append_eq_append_conv2) +apply(auto simp add: Sequ_def)[1] +using Prf_flat_L apply fastforce +apply(simp add: append_eq_append_conv2) +apply(auto simp add: Sequ_def)[1] + +apply(auto)[1] + +apply(simp add: POSIX2_def) +apply(simp add: POSIX2_def) +apply(simp add: POSIX2_def) +apply(simp add: POSIX2_def) +apply(simp add: POSIX2_def) + lemma "s \ L(r) \ \v. POSIX2 v r s" apply(induct r arbitrary: s) apply(auto) @@ -1286,6 +2198,7 @@ apply(simp add: POSIX2_def) apply(auto)[1] using Prf.intros(2) apply blast + apply(case_tac s) apply(simp) apply(auto)[1]