diff -r 7a016eeb118d -r 4aded96b3923 thys2/ClosedFormsBounds.thy --- a/thys2/ClosedFormsBounds.thy Tue Mar 15 16:37:41 2022 +0000 +++ b/thys2/ClosedFormsBounds.thy Sat Mar 19 09:53:48 2022 +0000 @@ -493,7 +493,7 @@ by (metis empty_iff flts_vs_nflts sup_bot_left) also have "... \ Suc (sum_list (map rsize (rdistinct rs {})))" by (simp add: larger_acc_smaller_distinct_res0) - finally show ?thesis sledgehammer + finally show ?thesis by blast qed @@ -515,13 +515,11 @@ shows "rsize (rsimp (RALTS rs)) \ Suc (sum_list (map rsize (rdistinct rs {})))" proof - have "rsize (rsimp (RALTS rs)) \ Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {})))" - - using alts_simp_ineq_unfold by auto - then have "\ \ Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))" + using alts_simp_ineq_unfold by auto + moreover have "\ \ Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))" using without_flts_ineq by blast - - show "rsize (rsimp (RALTS rs)) \ Suc (sum_list (map rsize (rdistinct rs {})))" - by (meson \Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {}))) \ Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))\ \rsize (rsimp (RALTS rs)) \ Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {})))\ distinct_simp_ineq order_trans) + ultimately show "rsize (rsimp (RALTS rs)) \ Suc (sum_list (map rsize (rdistinct rs {})))" + by (meson distinct_simp_ineq order.trans) qed @@ -739,37 +737,47 @@ using assms(2) map_ders_is_list_of_ders by blast -lemma seq_closed_form_bounded: shows -"\\s. rsize (rders_simp r1 s) \ N1 ; \s. rsize (rders_simp r2 s) \ N2\ \ -rsize (rders_simp (RSEQ r1 r2) s) \ -max (Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))) (rsize (RSEQ r1 r2)) " - apply(case_tac s) - apply simp - apply(subgoal_tac " (rders_simp (RSEQ r1 r2) s) = -rsimp (RALTS ((RSEQ (rders_simp r1 s) r2) # (map (rders_simp r2) (vsuf s r1))))") - prefer 2 - using seq_closed_form_variant apply blast - apply(subgoal_tac "rsize (rsimp (RALTS (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)))) - \ -Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {})))") - apply(subgoal_tac "Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {}))) -\ Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))") - prefer 2 - using seq_estimate_bounded apply blast - apply(subgoal_tac "rsize (rders_simp (RSEQ r1 r2) s) \ Suc (Suc (N1 + rsize r2) + N2 * card (sizeNregex N2))") - using le_max_iff_disj apply blast - apply auto[1] - using seq_list_estimate_control by presburger + +lemma seq_closed_form_bounded2: + assumes "\s. rsize (rders_simp r1 s) \ N1" + and "\s. rsize (rders_simp r2 s) \ N2" + shows "rsize (rders_simp (RSEQ r1 r2) s) \ max (Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))) (rsize (RSEQ r1 r2))" +proof(cases s) + case Nil + then show "rsize (rders_simp (RSEQ r1 r2) s) + \ max (Suc (Suc (N1 + rsize r2) + N2 * card (sizeNregex N2))) (rsize (RSEQ r1 r2))" + by simp +next + case (Cons a list) + then have "rsize (rders_simp (RSEQ r1 r2) s) = + rsize (rsimp (RALTS ((RSEQ (rders_simp r1 s) r2) # (map (rders_simp r2) (vsuf s r1)))))" + using seq_closed_form_variant by (metis list.discI) + also have "... \ Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {})))" + using alts_simp_control by blast + (*or using seq_list_estimate_control by blast*) + also have "... \ Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))" + using assms seq_estimate_bounded by blast + ultimately show "rsize (rders_simp (RSEQ r1 r2) s) + \ max (Suc (Suc (N1 + rsize r2) + N2 * card (sizeNregex N2))) (rsize (RSEQ r1 r2))" + by auto +qed + +thm seq_closed_form_bounded2 -lemma rders_simp_bounded: shows -"\N. \s. rsize (rders_simp r s) \ N" +lemma rders_simp_bounded: + shows "\N. \s. rsize (rders_simp r s) \ N" apply(induct r) - apply(rule_tac x = "Suc 0 " in exI) + apply(rule_tac x = "Suc 0 " in exI) using three_easy_cases0 apply force using three_easy_cases1 apply blast using three_easy_casesC apply blast - using seq_closed_form_bounded apply blast + apply(erule exE)+ + apply(rule exI) + apply(rule allI) + apply(rule seq_closed_form_bounded2) + apply(assumption) + apply(assumption) apply (metis alts_closed_form_bounded size_list_estimation') using star_closed_form_bounded by blast