# HG changeset patch # User Christian Urban # Date 1488325237 0 # Node ID 77d5181490ae1dd00c07126b3eefe9fa479b1714 # Parent 624b4154325b593614c2253e4167ac2974233973 FROMNTIMES now done diff -r 624b4154325b -r 77d5181490ae thys/LexerExt.thy --- a/thys/LexerExt.thy Tue Feb 28 13:47:36 2017 +0000 +++ b/thys/LexerExt.thy Tue Feb 28 23:40:37 2017 +0000 @@ -207,7 +207,7 @@ | "der c (UPNTIMES r (Suc n)) = SEQ (der c r) (UPNTIMES r n)" | "der c (NTIMES r 0) = ZERO" | "der c (NTIMES r (Suc n)) = SEQ (der c r) (NTIMES r n)" -| "der c (FROMNTIMES r 0) = SEQ (der c r) (STAR r)" +| "der c (FROMNTIMES r 0) = SEQ (der c r) (FROMNTIMES r 0)" | "der c (FROMNTIMES r (Suc n)) = SEQ (der c r) (FROMNTIMES r n)" fun @@ -313,9 +313,8 @@ (* FROMNTIMES *) apply(simp only: der.simps) apply(simp only: L.simps) -apply(subst Der_star[symmetric]) -apply(subst Star_def2) -apply(auto)[1] +apply(simp) +using Der_star Star_def2 apply auto[1] apply(simp only: der.simps) apply(simp only: L.simps) apply(simp add: Der_UNION) @@ -683,7 +682,8 @@ | Posix_FROMNTIMES1: "\s1 \ r \ v; s2 \ FROMNTIMES r n \ Stars vs; \(\s\<^sub>3 s\<^sub>4. s\<^sub>3 \ [] \ s\<^sub>3 @ s\<^sub>4 = s2 \ (s1 @ s\<^sub>3) \ L r \ s\<^sub>4 \ L (FROMNTIMES r n))\ \ (s1 @ s2) \ FROMNTIMES r (Suc n) \ Stars (v # vs)" -| Posix_FROMNTIMES2: "[] \ FROMNTIMES r 0 \ Stars []" +| Posix_FROMNTIMES2: "s \ STAR r \ Stars vs \ s \ FROMNTIMES r 0 \ Stars vs" + inductive_cases Posix_elims: "s \ ZERO \ v" @@ -703,7 +703,7 @@ apply(auto simp add: Sequ_def) apply(rule_tac x="Suc x" in bexI) apply(auto simp add: Sequ_def) -done +by (simp add: Star_in_Pow) lemma Posix1a: @@ -734,7 +734,8 @@ apply(rotate_tac 3) apply(erule Prf.cases) apply(simp_all) -using Prf.simps by blast +using Prf.simps apply blast +by (smt Prf.simps le0 rexp.distinct(61) rexp.distinct(63) rexp.distinct(65) rexp.inject(4) val.distinct(17) val.distinct(9) val.simps(29) val.simps(33) val.simps(35)) lemma Posix_NTIMES_mkeps: assumes "[] \ r \ mkeps r" @@ -755,6 +756,7 @@ apply(induct n) apply(simp) apply (rule Posix_FROMNTIMES2) +apply (rule Posix.intros) apply(simp) apply(subst append_Nil[symmetric]) apply (rule Posix_FROMNTIMES1) @@ -781,9 +783,12 @@ apply(auto) apply(rule Posix_NTIMES_mkeps) apply(simp) +apply(rule Posix.intros) +apply(rule Posix.intros) apply(case_tac n) apply(simp) -apply (simp add: Posix_FROMNTIMES2) +apply(rule Posix.intros) +apply(rule Posix.intros) apply(simp) apply(subst append.simps(1)[symmetric]) apply(rule Posix.intros) @@ -894,9 +899,13 @@ "\v2. s2 \ NTIMES r n \ v2 \ Stars vs = v2" by fact+ ultimately show "Stars (v # vs) = v2" by auto next - case (Posix_FROMNTIMES2 r v2) - have "[] \ FROMNTIMES r 0 \ v2" by fact - then show "Stars [] = v2" by cases (auto simp add: Posix1) + case (Posix_FROMNTIMES2 s r v1 v2) + have "s \ FROMNTIMES r 0 \ v2" "s \ STAR r \ Stars v1" + "\v3. s \ STAR r \ v3 \ Stars v1 = v3" by fact+ + then show ?case + apply(cases) + apply(auto) + done next case (Posix_FROMNTIMES1 s1 r v s2 n vs v2) have "(s1 @ s2) \ FROMNTIMES r (Suc n) \ v2" @@ -1177,7 +1186,7 @@ (null) v1 vs s1 s2 where "n = 0" "v = Seq v1 (Stars vs)" "s = s1 @ s2" - "s1 \ der c r \ v1" "s2 \ (STAR r) \ (Stars vs)" + "s1 \ der c r \ v1" "s2 \ (FROMNTIMES r 0) \ (Stars vs)" "\ (\s\<^sub>3 s\<^sub>4. s\<^sub>3 \ [] \ s\<^sub>3 @ s\<^sub>4 = s2 \ s1 @ s\<^sub>3 \ L (der c r) \ s\<^sub>4 \ L (FROMNTIMES r 0))" | (cons) m v1 vs s1 s2 where "n = Suc m" @@ -1190,24 +1199,10 @@ defer apply (metis FROMNTIMES_Stars Posix1a) apply(rotate_tac 5) - apply(erule_tac Posix_elims(6)) - apply(auto) - apply(drule_tac x="v1" in meta_spec) - apply(simp) - apply(drule_tac x="v # vs" in meta_spec) - apply(simp) - apply(drule_tac x="s1" in meta_spec) - apply(simp) - apply(drule_tac x="s1a @ s2a" in meta_spec) - apply(simp) - apply(drule meta_mp) - apply(rule Posix.intros) - apply(simp) - apply(simp) - apply(simp) - apply(simp) - using Pow_in_Star apply blast - by (meson Posix_STAR2 append_is_Nil_conv self_append_conv) + apply(erule Posix.cases) + apply(simp_all) + apply(clarify) + by (simp add: Posix_FROMNTIMES2) then show "(c # s) \ FROMNTIMES r n \ injval (FROMNTIMES r n) c v" proof (cases) case cons @@ -1229,9 +1224,20 @@ then show "(c # s) \ FROMNTIMES r n \ injval (FROMNTIMES r n) c v" using cons by(simp) next case null - then show ?thesis + then have "((c # s1) @ s2) \ FROMNTIMES r 0 \ Stars (injval r c v1 # vs)" + apply(rule_tac Posix.intros) + apply(rule_tac Posix.intros) + apply(rule IH) apply(simp) - sorry + apply(rotate_tac 4) + apply(erule Posix.cases) + apply(simp_all) + apply (simp add: Posix1a Prf_injval_flat) + apply(simp only: Star_def2) + apply(simp only: der_correctness Der_def) + apply(simp) + done + then show "(c # s) \ FROMNTIMES r n \ injval (FROMNTIMES r n) c v" using null by simp qed qed