diff -r 42268a284ea6 -r 424bdcd01016 thys/SpecExt.thy --- a/thys/SpecExt.thy Sun Oct 08 14:21:24 2017 +0100 +++ b/thys/SpecExt.thy Tue Oct 10 10:40:44 2017 +0100 @@ -1173,9 +1173,12 @@ \ (s1 @ s2) \ FROMNTIMES r 0 \ Stars (v # vs)" | Posix_NMTIMES2: "\\v \ set vs. [] \ r \ v; length vs = n; n \ m\ \ [] \ NMTIMES r n m \ Stars vs" -| Posix_NMTIMES1: "\s1 \ r \ v; s2 \ NMTIMES r n m \ Stars vs; flat v \ []; n \ m; - \(\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 (NMTIMES r n m))\ - \ (s1 @ s2) \ NMTIMES r (Suc n) (Suc m) \ Stars (v # vs)" +| Posix_NMTIMES1: "\s1 \ r \ v; s2 \ NMTIMES r (n - 1) (m - 1) \ Stars vs; flat v \ []; 0 < n; n \ m; + \(\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 (NMTIMES r (n - 1) (m - 1)))\ + \ (s1 @ s2) \ NMTIMES r n m \ Stars (v # vs)" +| Posix_NMTIMES3: "\s1 \ r \ v; s2 \ UPNTIMES r (m - 1) \ Stars vs; flat v \ []; 0 < m; + \(\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 (UPNTIMES r (m - 1)))\ + \ (s1 @ s2) \ NMTIMES r 0 m \ Stars (v # vs)" inductive_cases Posix_elims: "s \ ZERO \ v" @@ -1220,9 +1223,14 @@ apply(rule_tac x="Suc x" in bexI) apply(auto simp add: Sequ_def)[2] apply(simp) - apply(simp) - by (simp add: Star.step Star_Pow) - + apply(simp) + apply(clarify) + apply(rule_tac x="Suc x" in bexI) + apply(auto simp add: Sequ_def)[2] + apply(simp) + apply(simp add: Star.step Star_Pow) +done + text {* Our Posix definition determines a unique value. *} @@ -1396,12 +1404,59 @@ ultimately show "Stars (v # vs) = v2" by auto next case (Posix_NMTIMES1 s1 r v s2 n m vs v2) - then show "Stars (v # vs) = v2" - sorry + have "(s1 @ s2) \ NMTIMES r n m \ v2" + "s1 \ r \ v" "s2 \ NMTIMES r (n - 1) (m - 1) \ Stars vs" "flat v \ []" + "0 < n" "n \ m" + "\ (\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 (NMTIMES r (n - 1) (m - 1)))" by fact+ + then obtain v' vs' where "v2 = Stars (v' # vs')" "s1 \ r \ v'" + "s2 \ (NMTIMES r (n - 1) (m - 1)) \ (Stars vs')" + apply(cases) apply (auto simp add: append_eq_append_conv2) + using Posix1(1) Posix1(2) apply blast + apply(case_tac n) + apply(simp) + apply(simp) + apply(case_tac m) + apply(simp) + apply(simp) + apply(drule_tac x="va" in meta_spec) + apply(drule_tac x="vs" in meta_spec) + apply(simp) + apply(drule meta_mp) + apply (smt L.simps(10) Posix1(1) Posix1(2) Posix_NMTIMES1.hyps(4) UN_E append.right_neutral + append_eq_append_conv2 diff_Suc_1 val.inject(5)) + apply (metis L.simps(10) Posix1(1) UN_E append_Nil2 append_self_conv2) + by (metis One_nat_def Posix1(1) Posix_NMTIMES1.hyps(8) append.right_neutral append_Nil) + moreover + have IHs: "\v2. s1 \ r \ v2 \ v = v2" + "\v2. s2 \ NMTIMES r (n - 1) (m - 1) \ v2 \ Stars vs = v2" by fact+ + ultimately show "Stars (v # vs) = v2" by auto next case (Posix_NMTIMES2 vs r n m v2) then show "Stars vs = v2" - sorry + apply(erule_tac Posix_elims) + apply(simp) + apply(rule List_eq_zipI) + apply(auto) + apply (meson in_set_zipE) + apply (simp add: Posix1(2)) + apply(erule_tac Posix_elims) + apply(auto) + apply (simp add: Posix1(2))+ + done +next + case (Posix_NMTIMES3 s1 r v s2 m vs v2) + have "(s1 @ s2) \ NMTIMES r 0 m \ v2" + "s1 \ r \ v" "s2 \ UPNTIMES r (m - 1) \ Stars vs" "flat v \ []" "0 < m" + "\ (\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 (UPNTIMES r (m - 1 )))" by fact+ + then obtain v' vs' where "v2 = Stars (v' # vs')" "s1 \ r \ v'" "s2 \ (UPNTIMES r (m - 1)) \ (Stars vs')" + apply(cases) apply (auto simp add: append_eq_append_conv2) + using Posix1(2) apply blast + apply (smt L.simps(7) Posix1(1) UN_E append_eq_append_conv2) + by (metis One_nat_def Posix1(1) Posix_NMTIMES3.hyps(7) append.right_neutral append_Nil) + moreover + have IHs: "\v2. s1 \ r \ v2 \ v = v2" + "\v2. s2 \ UPNTIMES r (m - 1) \ v2 \ Stars vs = v2" by fact+ + ultimately show "Stars (v # vs) = v2" by auto qed @@ -1441,9 +1496,52 @@ apply(simp) apply(rule Prf.intros) apply(simp) + apply(simp) + (* NTIMES *) + prefer 4 + apply(simp) + apply(case_tac n) apply(simp) + apply(simp) + apply(clarify) + apply(rotate_tac 5) + apply(erule Prf_elims) + apply(simp) + apply(subst append.simps(2)[symmetric]) + apply(rule Prf.intros) + apply(simp) + apply(simp) + apply(simp) + prefer 4 + apply(simp) + apply (metis Prf.intros(8) length_removeAll_less less_irrefl_nat removeAll.simps(1) self_append_conv2) (* NMTIMES *) - sorry - + apply(simp) + apply (metis Prf.intros(11) append_Nil empty_iff list.set(1)) + apply(simp) + apply(clarify) + apply(rotate_tac 6) + apply(erule Prf_elims) + apply(simp) + apply(subst append.simps(2)[symmetric]) + apply(rule Prf.intros) + apply(simp) + apply(simp) + apply(simp) + apply(simp) + apply(rule Prf.intros) + apply(simp) + apply(simp) + apply(simp) + apply(simp) + apply(clarify) + apply(rotate_tac 6) + apply(erule Prf_elims) + apply(simp) + apply(rule Prf.intros) + apply(simp) + apply(simp) + apply(simp) +done end \ No newline at end of file