Commit 2c00efee by Lawrence Paulson

### just a few more tweaks

parent f4ec023a9857
 ... ... @@ -1551,18 +1551,6 @@ qed subsection \Larson's Lemma 3.7\ lemma 1: "\A \ B; B \ C; B \ {}\ \ A \ B \ C" using less_sets_Un2 less_sets_trans by blast lemma 2: "\A \ B; B \ C; B \ {}\ \ A \ B \ C" using less_sets_Un1 less_sets_trans by blast lemma 3: "\A \ {b}; {b} \ B\ \ A \ insert b B" using less_sets_def by fastforce lemma 4: "\A \ {b}; {b} \ B\ \ insert b A \ B" using less_sets_def by fastforce subsubsection \Preliminaries\ text \Analogous to @{thm [source] ordered_nsets_2_eq}, but without type classes\ ... ... @@ -2469,12 +2457,8 @@ lemma pair_less_prev: shows "prev j i = Some u \ (\x. (u, x) \ pair_less \ prev j i = Some x)" proof (cases "prev j i") case None show ?thesis proof (cases u) case (Pair j' i') then show ?thesis using assms None by (simp add: prev_eq_None_iff pair_less_def IJ_def) qed then show ?thesis using assms by (force simp: prev_eq_None_iff pair_less_def IJ_def split: prod.split) next case (Some a) then show ?thesis ... ... @@ -2482,11 +2466,10 @@ next qed subsubsection \Special primitives for the ordertype proof\ definition USigma :: "'a set set \ ('a set \ 'a set) \ 'a set set" where "USigma \ B \ \X\\. \y\B X. {insert y X}" where "USigma \ B \ \X\\. \y \ B X. {insert y X}" definition usplit where "usplit f A \ f (A - {Max A}) (Max A)" ... ... @@ -2496,26 +2479,24 @@ lemma USigma_empty [simp]: "USigma {} B = {}" lemma USigma_iff: assumes "\I j. I \ \ \ I \ J I \ finite I" shows "x \ USigma \ J \ usplit (\I j. I\\ \ j\J I \ x = insert j I) x" shows "x \ USigma \ J \ usplit (\I j. I \ \ \ j \ J I \ x = insert j I) x" proof - have [simp]: "\I j. \I \ \; j \ J I\ \ Max (insert j I) = j" by (meson Max_insert2 assms less_imp_le less_sets_def) show ?thesis proof - have "I - {j} \ \" if "I \ \" "j \ J I" for I j using that by (metis Diff_empty Diff_insert0 assms less_irrefl less_sets_def) moreover have "j \ J (I - {j})" if "I \ \" "j \ J I" for I j using that by (metis Diff_empty Diff_insert0 assms less_irrefl less_setsD) moreover have "\I\\. \j\J I. x = insert j I" have \
: "j \ I" if "I \ \" "j \ J I" for I j using that by (metis assms less_irrefl less_sets_def) have "\I\\. \j\J I. x = insert j I" if "x - {Max x} \ \" and "Max x \ J (x - {Max x})" "x \ {}" using that by (metis Max_in assms infinite_remove insert_Diff) ultimately show ?thesis by (auto simp: USigma_def usplit_def) then show ?thesis by (auto simp: USigma_def usplit_def \
) qed qed lemma ordertype_append_image_IJ: proposition ordertype_append_image_IJ: assumes lenB [simp]: "\i j. i \ \ \ j \ J i \ length (B j) = c" and AB: "\i j. i \ \ \ j \ J i \ A i < B j" and IJ: "\i. i \ \ \ i \ J i \ finite i" ... ... @@ -2525,7 +2506,6 @@ lemma ordertype_append_image_IJ: = \ * ordertype (A ` \) (lenlex less_than)" (is "ordertype ?AB ?R = _ * ?\") proof (cases "\ = {}") next case False have "Ord \" using \ False wf_Ord_ordertype by fastforce ... ... @@ -2568,7 +2548,7 @@ next show "f ` ?AB \ elts (\ * ?\)" using \Ord \\ apply (clarsimp simp add: f_def split_def USigma_iff IJ usplit_def) by (metis Ord_mem_iff_less_TC TC_small add_mult_less image_eqI oB ordermap_in_ordertype trans_llt wf_Ord_ordertype wf_llt) by (metis TC_small \ add_mult_less image_eqI ordermap_in_ordertype trans_llt wf_Ord_ordertype wf_llt) show "elts (\ * ?\) \ f ` ?AB" proof (clarsimp simp: f_def split_def image_iff USigma_iff IJ usplit_def Bex_def elim!: elts_multE split: prod.split) fix \ \ ... ... @@ -2585,10 +2565,8 @@ next by (meson IJ Max_insert2 \i \ \\ less_imp_le less_sets_def) have [simp]: "i - {j} = i" using IJ \i \ \\ \j \ J i\ less_setsD by fastforce show "\l. (\K. K - {Max K} \ \ \ Max K \ J (K - {Max K}) \ K = insert (Max K) K \ l = A (K - {Max K}) @ B (Max K)) \ \ * \ + \ = show "\l. (\K. K - {Max K} \ \ \ Max K \ J (K - {Max K}) \ K = insert (Max K) K \ l = A (K - {Max K}) @ B (Max K)) \ \ * \ + \ = \ * ordermap (A ` \) ?R (take (length l - c) l) + ordermap (B ` J (inv_into \ A (take (length l - c) l))) ... ... @@ -2625,8 +2603,7 @@ next proof cases case 1 then have "(A ?mx, A ?my) \ ?R" using x y by (force simp: Ord_mem_iff_lt intro: converse_ordermap_mono) using x y by (force simp: Ord_mem_iff_lt intro: converse_ordermap_mono) then show ?thesis using x y mx my lenB lenlex_append1 by blast next ... ... @@ -2636,8 +2613,7 @@ next then have eq: "?mx = ?my" by (metis \?my \ \\ \?mx \ \\ inv_into_IA) then have "(B (Max x), B (Max y)) \ ?R" using mx my 2 by (force simp: Ord_mem_iff_lt intro: converse_ordermap_mono) using mx my 2 by (force simp: Ord_mem_iff_lt intro: converse_ordermap_mono) with 2 show ?thesis by (simp add: eq irrefl_less_than) qed ... ... @@ -2658,7 +2634,7 @@ next using "\
" irrefl_less_than that(2) by auto qed (use that in blast) then have "\ * ordermap (A`\) ?R (A ?mx) + ordermap (B`J ?mx) ?R (B (Max x)) < \ * ordermap (A`\) ?R (A ?my) + ordermap (B`J ?my) ?R (B (Max y))" < \ * ordermap (A`\) ?R (A ?my) + ordermap (B`J ?my) ?R (B (Max y))" proof cases case 1 show ?thesis ... ... @@ -2666,7 +2642,7 @@ next show "ordermap (A`\) (lenlex less_than) (A ?mx) < ordermap (A`\) (lenlex less_than) (A ?my)" by (simp add: "1" \?my \ \\ \?mx \ \\ ordermap_mono_less) show "Ord (ordertype (A`\) ?R)" using wf_Ord_ordertype by blast+ using wf_Ord_ordertype by blast show "ordermap (B ` J ?mx) ?R (B (Max x)) \ elts \" using Ord_less_TC_mem \Ord \\ \?mx \ \\ \(Max x) \ J ?mx\ oB by blast show "ordermap (B ` J ?my) ?R (B (Max y)) \ elts \" ... ... @@ -2736,7 +2712,7 @@ lemma merge_length_less2: proof induction case (App as1 bs1 as2 bs2 as bs) then show ?case by simp (metis One_nat_def Suc_eq_plus1 Suc_leI add.commute add_mono length_greater_0_conv) using length_greater_0_conv [of as1] by (simp, presburger) qed auto lemma merge_preserves: ... ... @@ -2751,12 +2727,11 @@ lemma merge_interact: using assms proof induction case (App as1 bs1 as2 bs2 as bs) then have "concat bs1 < concat bs" "concat bs1 < concat as" and xx: "concat bs1 \ []" then have bs: "concat bs1 < concat bs" "concat bs1 < concat as" and xx: "concat bs1 \ []" using merge_preserves strict_sorted_append_iff by fastforce+ then have "concat bs1 < interact as bs" using App apply (simp add: less_list_def del: concat_eq_Nil_conv) by (metis (full_types) Un_iff \concat bs1 < concat as\ \concat bs1 < concat bs\ last_in_set list.set_sel(1) set_interact sorted_wrt_append strict_sorted_append_iff strict_sorted_interact_imp_concat strict_sorted_sorted_wrt xx) unfolding less_list_def using App bs by (metis (no_types, lifting) Un_iff concat_append hd_in_set last_in_set merge_preserves set_interact sorted_wrt_append strict_sorted_append_iff strict_sorted_sorted_wrt) with App show ?case apply (simp add: strict_sorted_append_iff del: concat_eq_Nil_conv) by (metis hd_append2 less_list_def xx) ... ... @@ -2801,12 +2776,12 @@ lemma merge_less_sets_hd: proof induction case (App as1 bs1 as2 bs2 as bs) then have \
: "list.set (concat bs1) \ list.set (concat bs2)" by (force simp: dest: strict_sorted_imp_less_sets)+ by (force simp: dest: strict_sorted_imp_less_sets) have *: "list.set (concat as1) \ list.set (concat bs1)" using App by (metis concat_append strict_sorted_append_iff strict_sorted_imp_less_sets) then have "list.set (concat as1) \ list.set (concat bs)" using App \
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!