diff --git a/thys/Ordinal_Partitions/Partitions.thy b/thys/Ordinal_Partitions/Partitions.thy --- a/thys/Ordinal_Partitions/Partitions.thy +++ b/thys/Ordinal_Partitions/Partitions.thy @@ -1,938 +1,926 @@ section \Ordinal Partitions\ text \Material from Jean A. Larson, A short proof of a partition theorem for the ordinal $\omega^\omega$. \emph{Annals of Mathematical Logic}, 6:129--145, 1973. Also from ``Partition Relations'' by A. Hajnal and J. A. Larson, in \emph{Handbook of Set Theory}, edited by Matthew Foreman and Akihiro Kanamori (Springer, 2010).\ theory Partitions imports Library_Additions "ZFC_in_HOL.ZFC_Typeclasses" "ZFC_in_HOL.Cantor_NF" begin abbreviation tp :: "V set \ V" where "tp A \ ordertype A VWF" subsection \Ordinal Partitions: Definitions\ definition partn_lst :: "[('a \ 'a) set, 'a set, V list, nat] \ bool" where "partn_lst r B \ n \ \f \ [B]\<^bsup>n\<^esup> \ {..}. \i < length \. \H. H \ B \ ordertype H r = (\!i) \ f ` (nsets H n) \ {i}" abbreviation partn_lst_VWF :: "V \ V list \ nat \ bool" where "partn_lst_VWF \ \ partn_lst VWF (elts \)" lemma partn_lst_E: assumes "partn_lst r B \ n" "f \ nsets B n \ {.." obtains i H where "i < l" "H \ B" "ordertype H r = \!i" "f ` (nsets H n) \ {i}" using assms by (auto simp: partn_lst_def) lemma partn_lst_VWF_nontriv: assumes "partn_lst_VWF \ \ n" "l = length \" "Ord \" "l > 0" obtains i where "i < l" "\!i \ \" proof - have "{.. {}" by (simp add: \l > 0\ lessThan_empty_iff) then obtain f where "f \ nsets (elts \) n \ {.. elts \" and eq: "tp H = \!i" using assms by (metis partn_lst_E) then have "\!i \ \" by (metis \H \ elts \\ \Ord \\ eq ordertype_le_Ord) then show thesis using \i < l\ that by auto qed lemma partn_lst_triv0: assumes "\!i = 0" "i < length \" "n \ 0" shows "partn_lst r B \ n" by (metis partn_lst_def assms bot_least image_empty nsets_empty_iff ordertype_empty) lemma partn_lst_triv1: assumes "\!i \ 1" "i < length \" "n > 1" "B \ {}" "wf r" shows "partn_lst r B \ n" unfolding partn_lst_def proof clarsimp obtain \ where "\ \ B" "\ \ []" using assms mem_0_Ord by fastforce have 01: "\!i = 0 \ \!i = 1" using assms by (fastforce simp: one_V_def) fix f assume f: "f \ [B]\<^bsup>n\<^esup> \ {..}" with assms have "ordertype {\} r = 1 \ f ` [{\}]\<^bsup>n\<^esup> \ {i}" "ordertype {} r = 0 \ f ` [{}]\<^bsup>n\<^esup> \ {i}" by (auto simp: one_V_def ordertype_insert nsets_eq_empty) with assms 01 show "\i. \H\B. ordertype H r = \ ! i \ f ` [H]\<^bsup>n\<^esup> \ {i}" using \\ \ B\ by auto qed lemma partn_lst_two_swap: assumes "partn_lst r B [x,y] n" shows "partn_lst r B [y,x] n" proof - { fix f :: "'a set \ nat" assume f: "f \ [B]\<^bsup>n\<^esup> \ {..<2}" then have f': "(\i. 1 - i) \ f \ [B]\<^bsup>n\<^esup> \ {..<2}" by (auto simp: Pi_def) obtain i H where "i<2" "H \ B" "ordertype H r = ([x,y]!i)" "((\i. 1 - i) \ f) ` (nsets H n) \ {i}" by (auto intro: partn_lst_E [OF assms f']) moreover have "f x = Suc 0" if "Suc 0 \ f x" "x\[H]\<^bsup>n\<^esup>" for x using f that \H \ B\ nsets_mono by (fastforce simp: Pi_iff) ultimately have "ordertype H r = [y,x] ! (1-i) \ f ` [H]\<^bsup>n\<^esup> \ {1-i}" by (force simp: eval_nat_numeral less_Suc_eq) then have "\i H. i<2 \ H\B \ ordertype H r = [y,x] ! i \ f ` [H]\<^bsup>n\<^esup> \ {i}" by (metis Suc_1 \H \ B\ diff_less_Suc) } then show ?thesis by (auto simp: partn_lst_def eval_nat_numeral) qed lemma partn_lst_greater_resource: assumes M: "partn_lst r B \ n" and "B \ C" shows "partn_lst r C \ n" proof (clarsimp simp: partn_lst_def) fix f assume "f \ [C]\<^bsup>n\<^esup> \ {..}" then have "f \ [B]\<^bsup>n\<^esup> \ {..}" by (metis \B \ C\ part_fn_def part_fn_subset) then obtain i H where "i < length \" and "H \ B" "ordertype H r = (\!i)" and "f ` nsets H n \ {i}" using M partn_lst_def by metis then show "\i. \H\C. ordertype H r = \ ! i \ f ` [H]\<^bsup>n\<^esup> \ {i}" using \B \ C\ by blast qed lemma partn_lst_less: assumes M: "partn_lst r B \ n" and eq: "length \' = length \" and "List.set \' \ ON" and le: "\i. i < length \ \ \'!i \ \!i " and r: "wf r" "trans r" "total_on B r" and "small B" shows "partn_lst r B \' n" proof (clarsimp simp: partn_lst_def) fix f assume "f \ [B]\<^bsup>n\<^esup> \ {..'}" then obtain i H where "i < length \" and "H \ B" "small H" and H: "ordertype H r = (\!i)" and fi: "f ` nsets H n \ {i}" using assms by (auto simp: partn_lst_def smaller_than_small) then have bij: "bij_betw (ordermap H r) H (elts (\!i))" using ordermap_bij [of r H] by (smt assms(8) in_mono r(1) r(3) smaller_than_small total_on_def) define H' where "H' = inv_into H (ordermap H r) ` (elts (\'!i))" have "H' \ H" using bij \i < length \\ bij_betw_imp_surj_on le by (force simp: H'_def image_subset_iff intro: inv_into_into) moreover have ot: "ordertype H' r = (\'!i)" proof (subst ordertype_eq_iff) show "Ord (\' ! i)" using assms by (simp add: \i < length \\ subset_eq) show "small H'" by (simp add: H'_def) show "\f. bij_betw f H' (elts (\' ! i)) \ (\x\H'. \y\H'. (f x < f y) = ((x, y) \ r))" proof (intro exI conjI ballI) show "bij_betw (ordermap H r) H' (elts (\' ! i))" using \H' \ H\ by (metis H'_def \i < length \\ bij bij_betw_inv_into_RIGHT bij_betw_subset le less_eq_V_def) show "(ordermap H r x < ordermap H r y) = ((x, y) \ r)" if "x \ H'" "y \ H'" for x y proof (intro iffI ordermap_mono_less) assume "ordermap H r x < ordermap H r y" then show "(x, y) \ r" by (metis \H \ B\ assms(8) calculation in_mono leD ordermap_mono_le r smaller_than_small that total_on_def) qed (use assms that \H' \ H\ \small H\ in auto) qed show "total_on H' r" using r by (meson \H \ B\ \H' \ H\ subsetD total_on_def) qed (use r in auto) ultimately show "\i'. \H\B. ordertype H r = \' ! i \ f ` [H]\<^bsup>n\<^esup> \ {i}" using \H \ B\ \i < length \\ fi assms by (metis image_mono nsets_mono subset_trans) qed text \Holds because no $n$-sets exist!\ lemma partn_lst_VWF_degenerate: assumes "k < n" shows "partn_lst_VWF \ (ord_of_nat k # \s) n" proof (clarsimp simp: partn_lst_def) fix f :: "V set \ nat" have "[elts (ord_of_nat k)]\<^bsup>n\<^esup> = {}" by (simp add: nsets_eq_empty assms finite_Ord_omega) then have "f ` [elts (ord_of_nat k)]\<^bsup>n\<^esup> \ {0}" by auto then show "\i < Suc (length \s). \H\elts \. tp H = (ord_of_nat k # \s) ! i \ f ` [H]\<^bsup>n\<^esup> \ {i}" using assms ordertype_eq_Ord [of "ord_of_nat k"] elts_ord_of_nat less_Suc_eq_0_disj by fastforce qed lemma partn_lst_VWF_\_2: assumes "Ord \" shows "partn_lst_VWF (\ \ (1+\)) [2, \ \ (1+\)] 2" (is "partn_lst_VWF ?\ _ _") proof (clarsimp simp: partn_lst_def) fix f assume f: "f \ [elts ?\]\<^bsup>2\<^esup> \ {..iH\elts ?\. tp H = [2, ?\] ! i \ f ` [H]\<^bsup>2\<^esup> \ {i}" proof (cases "\x \ elts ?\. \y \ elts ?\. x \ y \ f{x,y} = 0") case True then obtain x y where "x \ elts ?\" "y \ elts ?\" "x \ y" "f {x, y} = 0" by auto then have "{x,y} \ elts ?\" "tp {x,y} = 2" "f ` [{x, y}]\<^bsup>2\<^esup> \ {0}" by auto (simp add: eval_nat_numeral ordertype_VWF_finite_nat) with \x \ y\ show ?thesis by (metis nth_Cons_0 zero_less_Suc) next case False with f have "\x\elts ?\. \y\elts ?\. x \ y \ f {x, y} = 1" unfolding Pi_iff using lessThan_Suc by force then have "tp (elts ?\) = ?\" "f ` [elts ?\]\<^bsup>2\<^esup> \ {Suc 0}" by (auto simp: assms nsets_2_eq) then show ?thesis by (metis lessI nth_Cons_0 nth_Cons_Suc subsetI) qed qed subsection \Relating partition properties on @{term VWF} to the general case\ text \Two very similar proofs here!\ lemma partn_lst_imp_partn_lst_VWF_eq: assumes part: "partn_lst r U \ n" and \: "ordertype U r = \" "small U" and r: "wf r" "trans r" "total_on U r" shows "partn_lst_VWF \ \ n" unfolding partn_lst_def proof clarsimp fix f assume f: "f \ [elts \]\<^bsup>n\<^esup> \ {..}" define cv where "cv \ \X. ordermap U r ` X" have bij: "bij_betw (ordermap U r) U (elts \)" using ordermap_bij [of "r" U] assms by blast then have bij_cv: "bij_betw cv ([U]\<^bsup>n\<^esup>) ([elts \]\<^bsup>n\<^esup>)" using bij_betw_nsets cv_def by blast then have func: "f \ cv \ [U]\<^bsup>n\<^esup> \ {..}" and "inj_on (ordermap U r) U" using bij bij_betw_def bij_betw_apply f by fastforce+ then have cv_part: "\\x\[X]\<^bsup>n\<^esup>. f (cv x) = i; X \ U; a \ [cv X]\<^bsup>n\<^esup>\ \ f a = i" for a X i n by (force simp: cv_def nsets_def subset_image_iff inj_on_subset finite_image_iff card_image) have ot_eq [simp]: "tp (cv X) = ordertype X r" if "X \ U" for X unfolding cv_def proof (rule ordertype_inc_eq) fix u v assume "u \ X" "v \ X" and "(u,v) \ r" with that have "ordermap U r u < ordermap U r v" by (simp add: assms ordermap_mono_less subset_eq) then show "(ordermap U r u, ordermap U r v) \ VWF" by (simp add: r) next show "total_on X r" using that r by (auto simp: total_on_def) show "small X" by (meson \small U\ smaller_than_small that) qed (use assms in auto) obtain X i where "X \ U" and X: "ordertype X r = \!i" "(f \ cv) ` [X]\<^bsup>n\<^esup> \ {i}" and "i < length \" using part func by (auto simp: partn_lst_def) show "\i < length \. \H\elts \. tp H = \!i \ f ` [H]\<^bsup>n\<^esup> \ {i}" proof (intro exI conjI) show "i < length \" by (simp add: \i < length \\) show "cv X \ elts \" using \X \ U\ bij bij_betw_imp_surj_on cv_def by blast show "tp (cv X) = \ ! i" by (simp add: X(1) \X \ U\) show "f ` [cv X]\<^bsup>n\<^esup> \ {i}" using X \X \ U\ cv_part unfolding image_subset_iff cv_def by (metis comp_apply insertCI singletonD) qed qed lemma partn_lst_imp_partn_lst_VWF: assumes part: "partn_lst r U \ n" and \: "ordertype U r \ \" "small U" and r: "wf r" "trans r" "total_on U r" shows "partn_lst_VWF \ \ n" by (metis assms less_eq_V_def partn_lst_imp_partn_lst_VWF_eq partn_lst_greater_resource) lemma partn_lst_VWF_imp_partn_lst_eq: assumes part: "partn_lst_VWF \ \ n" and \: "ordertype U r = \" "small U" and r: "wf r" "trans r" "total_on U r" shows "partn_lst r U \ n" unfolding partn_lst_def proof clarsimp fix f assume f: "f \ [U]\<^bsup>n\<^esup> \ {..}" define cv where "cv \ \X. inv_into U (ordermap U r) ` X" have bij: "bij_betw (ordermap U r) U (elts \)" using ordermap_bij [of "r" U] assms by blast then have bij_cv: "bij_betw cv ([elts \]\<^bsup>n\<^esup>) ([U]\<^bsup>n\<^esup>)" using bij_betw_nsets bij_betw_inv_into unfolding cv_def by blast then have func: "f \ cv \ [elts \]\<^bsup>n\<^esup> \ {..}" using bij_betw_apply f by fastforce have "inj_on (ordermap U r) U" using bij bij_betw_def by blast then have cv_part: "\\x\[X]\<^bsup>n\<^esup>. f (cv x) = i; X \ elts \; a \ [cv X]\<^bsup>n\<^esup>\ \ f a = i" for a X i n apply ( simp add: cv_def nsets_def subset_image_iff inj_on_subset finite_image_iff card_image) by (metis bij bij_betw_def card_image inj_on_finite inj_on_inv_into subset_eq) have ot_eq [simp]: "ordertype (cv X) r = tp X" if "X \ elts \" for X unfolding cv_def proof (rule ordertype_inc_eq) show "small X" using down that by auto show "(inv_into U (ordermap U r) x, inv_into U (ordermap U r) y) \ r" if "x \ X" "y \ X" and "(x,y) \ VWF" for x y proof - have xy: "x \ ordermap U r ` U" "y \ ordermap U r ` U" using \X \ elts \\ \x \ X\ \y \ X\ bij bij_betw_imp_surj_on by blast+ then have eq: "ordermap U r (inv_into U (ordermap U r) x) = x" "ordermap U r (inv_into U (ordermap U r) y) = y" by (meson f_inv_into_f)+ then have "y \ elts x" by (metis (no_types) VWF_non_refl mem_imp_VWF that(3) trans_VWF trans_def) then show ?thesis by (metis (no_types) VWF_non_refl xy eq assms(3) inv_into_into ordermap_mono r(1) r(3) that(3) total_on_def) qed qed (use r in auto) obtain X i where "X \ elts \" and X: "tp X = \!i" "(f \ cv) ` [X]\<^bsup>n\<^esup> \ {i}" and "i < length \" using part func by (auto simp: partn_lst_def) show "\i < length \. \H\U. ordertype H r = \!i \ f ` [H]\<^bsup>n\<^esup> \ {i}" proof (intro exI conjI) show "i < length \" by (simp add: \i < length \\) show "cv X \ U" using \X \ elts \\ bij bij_betw_imp_surj_on bij_betw_inv_into cv_def by blast show "ordertype (cv X) r = \ ! i" by (simp add: X(1) \X \ elts \\) show "f ` [cv X]\<^bsup>n\<^esup> \ {i}" using X \X \ elts \\ cv_part unfolding image_subset_iff cv_def by (metis comp_apply insertCI singletonD) qed qed corollary partn_lst_VWF_imp_partn_lst: assumes "partn_lst_VWF \ \ n" and \: "ordertype U r \ \" "small U" "wf r" "trans r" "total_on U r" shows "partn_lst r U \ n" by (metis assms less_eq_V_def partn_lst_VWF_imp_partn_lst_eq partn_lst_greater_resource) subsection \Simple consequences of the definitions\ text \A restatement of the infinite Ramsey theorem using partition notation\ lemma Ramsey_partn: "partn_lst_VWF \ [\,\] 2" proof (clarsimp simp: partn_lst_def) fix f assume "f \ [elts \]\<^bsup>2\<^esup> \ {..x\elts \. \y\elts \. x \ y \ f {x, y} < 2" by (auto simp: nsets_def eval_nat_numeral) obtain H i where H: "H \ elts \" and "infinite H" and t: "i < Suc (Suc 0)" and teq: "\x\H. \y\H. x \ y \ f {x, y} = i" using Ramsey2 [OF infinite_\ *] by (auto simp: eval_nat_numeral) then have "tp H = [\, \] ! i" using less_2_cases eval_nat_numeral ordertype_infinite_\ by force moreover have "f ` {N. N \ H \ finite N \ card N = 2} \ {i}" by (force simp: teq card_2_iff) ultimately have "f ` [H]\<^bsup>2\<^esup> \ {i}" by (metis (no_types) nsets_def numeral_2_eq_2) then show "\iH\elts \. tp H = [\,\] ! i \ f ` [H]\<^bsup>2\<^esup> \ {i}" using H \tp H = [\, \] ! i\ t by blast qed text \This is the counterexample sketched in Hajnal and Larson, section 9.1.\ proposition omega_basic_counterexample: assumes "Ord \" shows "\ partn_lst_VWF \ [succ (vcard \), \] 2" proof - obtain \ where fun\: "\ \ elts \ \ elts (vcard \)" and inj\: "inj_on \ (elts \)" using inj_into_vcard by auto have Ord\: "Ord (\ x)" if "x \ elts \" for x using Ord_in_Ord fun\ that by fastforce define f where "f A \ @i::nat. \x y. A = {x,y} \ x < y \ (\ x < \ y \ i=0 \ \ y < \ x \ i=1)" for A have f_Pi: "f \ [elts \]\<^bsup>2\<^esup> \ {.. [elts \]\<^bsup>2\<^esup>" then obtain x y where xy: "x \ elts \" "y \ elts \" "x < y" and A: "A = {x,y}" apply (clarsimp simp: nsets_2_eq) by (metis Ord_in_Ord Ord_linear_lt assms insert_commute) consider "\ x < \ y" | "\ y < \ x" by (metis Ord\ Ord_linear_lt inj\ inj_onD less_imp_not_eq2 xy) then show "f A \ {..x < y\ A exE_some [OF _ f_def]) qed have fiff: "\ x < \ y \ i=0 \ \ y < \ x \ i=1" if f: "f {x,y} = i" and xy: "x \ elts \" "y \ elts \" "x x < \ y" | "\ y < \ x" using xy by (metis Ord\ Ord_linear_lt inj\ inj_onD less_V_def) then show ?thesis proof cases case 1 then have "f{x,y} = 0" using \x by (force simp: f_def Set.doubleton_eq_iff) then show ?thesis using "1" f by auto next case 2 then have "f{x,y} = 1" using \x by (force simp: f_def Set.doubleton_eq_iff) then show ?thesis using "2" f by auto qed qed have False if eq: "tp H = succ (vcard \)" and H: "H \ elts \" and 0: "\A. A \ [H]\<^bsup>2\<^esup> \ f A = 0" for H proof - have [simp]: "small H" using H down by auto have OH: "Ord x" if "x \ H" for x using H Ord_in_Ord \Ord \\ that by blast have \: "\ x < \ y" if "x\H" "y\H" "x ` H \ elts (vcard \)" using H fun\ by auto have "tp H = tp (\ ` H)" proof (rule ordertype_VWF_inc_eq [symmetric]) show "\ ` H \ ON" using H Ord\ by blast qed (auto simp: \ OH subsetI) also have "\ \ vcard \" by (simp add: H sub_vcard assms ordertype_le_Ord) finally show False by (simp add: eq succ_le_iff) qed moreover have False if eq: "tp H = \" and H: "H \ elts \" and 1: "\A. A \ [H]\<^bsup>2\<^esup> \ f A = Suc 0" for H proof - have [simp]: "small H" using H down by auto define \ where "\ \ inv_into H (ordermap H VWF) \ ord_of_nat" have bij: "bij_betw (ordermap H VWF) H (elts \)" by (metis ordermap_bij \small H\ eq total_on_VWF wf_VWF) then have "bij_betw (inv_into H (ordermap H VWF)) (elts \) H" by (simp add: bij_betw_inv_into) then have \: "bij_betw \ UNIV H" unfolding \_def by (metis \_def bij_betw_comp_iff2 bij_betw_def elts_of_set inf inj_ord_of_nat order_refl) - have Ord\: "Ord (\ k)" for k + moreover have Ord\: "Ord (\ k)" for k by (meson H Ord_in_Ord UNIV_I \ assms bij_betw_apply subsetD) - obtain k where k: "((\ \ \)(Suc k), (\ \ \) k) \ VWF" - using wf_VWF wf_iff_no_infinite_down_chain by blast - have \: "\ y < \ x" if "x\H" "y\H" "x (\(Suc k)), \ (\ k)) \ VWF" + by (meson wf_VWF wf_iff_no_infinite_down_chain) + moreover have \: "\ y < \ x" if "x\H" "y\H" "x (Suc k) \ \ k" - proof - - have "(\ (Suc k), \ k) \ VWF \ \ (Suc k) = \ k" - using that Ord\ Ord_mem_iff_lt by auto - then have "ordermap H VWF (\ (Suc k)) \ ordermap H VWF (\ k)" - by (metis \ \small H\ bij_betw_imp_surj_on ordermap_mono_le rangeI trans_VWF wf_VWF) - moreover have "ordermap H VWF (\ (Suc k)) = succ (ord_of_nat k)" - unfolding \_def using bij bij_betw_inv_into_right by force - moreover have "ordermap H VWF (\ k) = ord_of_nat k" - apply (simp add: \_def) - by (meson bij bij_betw_inv_into_right ord_of_nat_\) - ultimately have "succ (ord_of_nat k) \ ord_of_nat k" - by simp - then show False - by (simp add: less_eq_V_def) - qed - then have "\ k < \ (Suc k)" - by (metis Ord\ Ord_linear_lt dual_order.strict_implies_order eq_refl) - then have "(\ \ \)(Suc k) < (\ \ \)k" - using \ \ bij_betw_apply by force - then show False - using k - apply (simp add: subset_iff) - by (metis H Ord\ UNIV_I VWF_iff_Ord_less \ bij_betw_imp_surj_on image_subset_iff) + ultimately have "\ (Suc k) \ \ k" + by (metis H Ord\ Ord_linear2 VWF_iff_Ord_less bij_betw_def rangeI subset_iff) + then have "(\ (Suc k), \ k) \ VWF \ \ (Suc k) = \ k" + using Ord\ Ord_mem_iff_lt by auto + then have "ordermap H VWF (\ (Suc k)) \ ordermap H VWF (\ k)" + by (metis \ \small H\ bij_betw_imp_surj_on ordermap_mono_le rangeI trans_VWF wf_VWF) + moreover have "ordermap H VWF (\ (Suc k)) = succ (ord_of_nat k)" + unfolding \_def using bij bij_betw_inv_into_right by force + moreover have "ordermap H VWF (\ k) = ord_of_nat k" + using \_def bij bij_betw_inv_into_right by force + ultimately show False + by (simp add: less_eq_V_def) qed ultimately show ?thesis apply (simp add: partn_lst_def image_subset_iff) by (metis f_Pi less_2_cases nth_Cons_0 nth_Cons_Suc numeral_2_eq_2) qed subsection \Specker's theorem\ definition form_split :: "[nat,nat,nat,nat,nat] \ bool" where "form_split a b c d i \ a \ c \ (i=0 \ a b c i=1 \ a c b i=2 \ a c d i=3 \ a=c \ b\d)" definition form :: "[(nat*nat)set, nat] \ bool" where "form u i \ \a b c d. u = {(a,b),(c,d)} \ form_split a b c d i" definition scheme :: "[(nat*nat)set] \ nat set" where "scheme u \ fst ` u \ snd ` u" definition UU :: "(nat*nat) set" where "UU \ {(a,b). a < b}" lemma ordertype_UNIV_\2: "ordertype UNIV pair_less = \\2" using ordertype_Times [of concl: UNIV UNIV less_than less_than] by (simp add: total_less_than pair_less_def ordertype_nat_\ numeral_2_eq_2) lemma ordertype_UU_ge_\2: "ordertype UNIV pair_less \ ordertype UU pair_less" proof (rule ordertype_inc_le) define \ where "\ \ \(m,n). (m, Suc (m+n))" show "(\ (x::nat \ nat), \ y) \ pair_less" if "(x, y) \ pair_less" for x y using that by (auto simp: \_def pair_less_def split: prod.split) show "range \ \ UU" by (auto simp: \_def UU_def) qed auto lemma ordertype_UU_\2: "ordertype UU pair_less = \\2" by (metis eq_iff ordertype_UNIV_\2 ordertype_UU_ge_\2 ordertype_mono small top_greatest trans_pair_less wf_pair_less) text \Lemma 2.3 of Jean A. Larson, A short proof of a partition theorem for the ordinal $\omega^\omega$. \emph{Annals of Mathematical Logic}, 6:129--145, 1973.\ lemma lemma_2_3: fixes f :: "(nat \ nat) set \ nat" assumes "f \ [UU]\<^bsup>2\<^esup> \ {..k u. \k < 4; u \ [UU]\<^bsup>2\<^esup>; form u k; scheme u \ N\ \ f u = js!k" proof - have f_less2: "f {p,q} < Suc (Suc 0)" if "p \ q" "p \ UU" "q \ UU" for p q proof - have "{p,q} \ [UU]\<^bsup>2\<^esup>" using that by (simp add: nsets_def) then show ?thesis using assms by (simp add: Pi_iff) qed define f0 where "f0 \ (\A::nat set. THE x. \a b c d. A = {a,b,c,d} \ a b c x = f {(a,b),(c,d)})" have f0: "f0 {a,b,c,d} = f {(a,b),(c,d)}" if "a [X]\<^bsup>4\<^esup>" using that by (auto simp: nsets_def) then obtain a b c d where "X = {a,b,c,d} \ a b cN t. infinite N \ t < Suc (Suc 0) \ (\X. X \ N \ finite X \ card X = 4 \ f0 X = t)" using Ramsey [of UNIV 4 f0 2] by (simp add: eval_nat_numeral) then obtain N0 j0 where "infinite N0" and j0: "j0 < Suc (Suc 0)" and N0: "\A. A \ [N0]\<^bsup>4\<^esup> \ f0 A = j0" by (auto simp: nsets_def) define f1 where "f1 \ (\A::nat set. THE x. \a b c d. A = {a,b,c,d} \ a b c x = f {(a,c),(b,d)})" have f1: "f1 {a,b,c,d} = f {(a,c),(b,d)}" if "a [X]\<^bsup>4\<^esup>" using that by (auto simp: nsets_def) then obtain a b c d where "X = {a,b,c,d} \ a b cN t. N \ N0 \ infinite N \ t < Suc (Suc 0) \ (\X. X \ N \ finite X \ card X = 4 \ f1 X = t)" using \infinite N0\ Ramsey [of N0 4 f1 2] by (simp add: eval_nat_numeral) then obtain N1 j1 where "N1 \ N0" "infinite N1" and j1: "j1 < Suc (Suc 0)" and N1: "\A. A \ [N1]\<^bsup>4\<^esup> \ f1 A = j1" by (auto simp: nsets_def) define f2 where "f2 \ (\A::nat set. THE x. \a b c d. A = {a,b,c,d} \ a b c x = f {(a,d),(b,c)})" have f2: "f2 {a,b,c,d} = f {(a,d),(b,c)}" if "a [X]\<^bsup>4\<^esup>" using that by (auto simp: nsets_def) then obtain a b c d where "X = {a,b,c,d} \ a b cN t. N \ N1 \ infinite N \ t < Suc (Suc 0) \ (\X. X \ N \ finite X \ card X = 4 \ f2 X = t)" using \infinite N1\ Ramsey [of N1 4 f2 2] by (simp add: eval_nat_numeral) then obtain N2 j2 where "N2 \ N1" "infinite N2" and j2: "j2 < Suc (Suc 0)" and N2: "\A. A \ [N2]\<^bsup>4\<^esup> \ f2 A = j2" by (auto simp: nsets_def) define f3 where "f3 \ (\A::nat set. THE x. \a b c. A = {a,b,c} \ a b x = f {(a,b),(a,c)})" have f3: "f3 {a,b,c} = f {(a,b),(a,c)}" if "a [X]\<^bsup>3\<^esup>" using that by (auto simp: nsets_def) then obtain a b c where "X = {a,b,c} \ a bN t. N \ N2 \ infinite N \ t < Suc (Suc 0) \ (\X. X \ N \ finite X \ card X = 3 \ f3 X = t)" using \infinite N2\ Ramsey [of N2 3 f3 2] by (simp add: eval_nat_numeral) then obtain N3 j3 where "N3 \ N2" "infinite N3" and j3: "j3 < Suc (Suc 0)" and N3: "\A. A \ [N3]\<^bsup>3\<^esup> \ f3 A = j3" by (auto simp: nsets_def) show thesis proof fix k u assume "k < 4" and u: "form u k" "scheme u \ N3" and UU: "u \ [UU]\<^bsup>2\<^esup>" then consider (0) "k=0" | (1) "k=1" | (2) "k=2" | (3) "k=3" by linarith then show "f u = [j0,j1,j2,j3] ! k" proof cases case 0 have "N3 \ N0" using \N1 \ N0\ \N2 \ N1\ \N3 \ N2\ by auto then show ?thesis using u 0 apply (auto simp: form_def form_split_def scheme_def simp flip: f0) apply (force simp: nsets_def intro: N0) done next case 1 have "N3 \ N1" using \N2 \ N1\ \N3 \ N2\ by auto then show ?thesis using u 1 apply (auto simp: form_def form_split_def scheme_def simp flip: f1) apply (force simp: nsets_def intro: N1) done next case 2 then show ?thesis using u \N3 \ N2\ apply (auto simp: form_def form_split_def scheme_def nsets_def simp flip: f2) apply (force simp: nsets_def intro: N2) done next case 3 { fix a b d assume "{(a, b), (a, d)} \ [UU]\<^bsup>2\<^esup>" and *: "a \ N3" "b \ N3" "d \ N3" "b \ d" then have "ainfinite N3\) qed text \Lemma 2.4 of Jean A. Larson, ibid.\ lemma lemma_2_4: assumes "infinite N" "k < 4" obtains M where "M \ [UU]\<^bsup>m\<^esup>" "\u. u \ [M]\<^bsup>2\<^esup> \ form u k" "\u. u \ [M]\<^bsup>2\<^esup> \ scheme u \ N" proof - obtain f:: "nat \ nat" where "bij_betw f UNIV N" "strict_mono f" using assms by (meson bij_enumerate enumerate_mono strict_monoI) then have iff[simp]: "f x = f y \ x=y" "f x < f y \ x N" for x using bij_betw_apply [OF \bij_betw f UNIV N\] by blast define M0 where "M0 = (\i. (f(2*i), f(Suc(2*i)))) ` {..i. (f i, f(m+i))) ` {..i. (f i, f(2*m-i))) ` {..i. (f 0, f (Suc i))) ` {..i. (f (2 * i), f (Suc (2 * i)))) {.. [UU]\<^bsup>m\<^esup>" by (simp add: M0_def nsets_def card_image UU_def image_subset_iff) next fix u assume u: "(u::(nat \ nat) set) \ [M0]\<^bsup>2\<^esup>" then obtain x y where "u = {x,y}" "x \ y" "x \ M0" "y \ M0" by (auto simp: nsets_2_eq) then obtain i j where "i f (2 * j)" by (simp add: \i less_imp_le_nat) ultimately show "form u k" apply (simp add: 0 form_def form_split_def nsets_def) apply (rule_tac x="f (2 * i)" in exI) apply (rule_tac x="f (Suc (2 * i))" in exI) apply (rule_tac x="f (2 * j)" in exI) apply (rule_tac x="f (Suc (2 * j))" in exI) apply auto done show "scheme u \ N" using ueq by (auto simp: scheme_def) qed next case 1 show ?thesis proof have "inj_on (\i. (f i, f(m+i))) {.. [UU]\<^bsup>m\<^esup>" by (simp add: M1_def nsets_def card_image UU_def image_subset_iff) next fix u assume u: "(u::(nat \ nat) set) \ [M1]\<^bsup>2\<^esup>" then obtain x y where "u = {x,y}" "x \ y" "x \ M1" "y \ M1" by (auto simp: nsets_2_eq) then obtain i j where "i N" using ueq by (auto simp: scheme_def) qed next case 2 show ?thesis proof have "inj_on (\i. (f i, f(2*m-i))) {.. [UU]\<^bsup>m\<^esup>" by (auto simp: M2_def nsets_def card_image UU_def image_subset_iff) next fix u assume u: "(u::(nat \ nat) set) \ [M2]\<^bsup>2\<^esup>" then obtain x y where "u = {x,y}" "x \ y" "x \ M2" "y \ M2" by (auto simp: nsets_2_eq) then obtain i j where "i N" using ueq by (auto simp: scheme_def) qed next case 3 show ?thesis proof have "inj_on (\i. (f 0, f (Suc i))) {.. [UU]\<^bsup>m\<^esup>" by (auto simp: M3_def nsets_def card_image UU_def image_subset_iff) next fix u assume u: "(u::(nat \ nat) set) \ [M3]\<^bsup>2\<^esup>" then obtain x y where "u = {x,y}" "x \ y" "x \ M3" "y \ M3" by (auto simp: nsets_2_eq) then obtain i j where "i N" using ueq by (auto simp: scheme_def) qed qed qed text \Lemma 2.5 of Jean A. Larson, ibid.\ lemma lemma_2_5: assumes "infinite N" obtains X where "X \ UU" "ordertype X pair_less = \\2" "\u. u \ [X]\<^bsup>2\<^esup> \ (\k<4. form u k) \ scheme u \ N" proof - obtain C where dis: "pairwise (\i j. disjnt (C i) (C j)) UNIV" and N: "(\i. C i) \ N" and infC: "\i::nat. infinite (C i)" using assms infinite_infinite_partition by blast then have "\\::nat \ nat. inj \ \ range \ = C i \ strict_mono \" for i by (metis bij_betw_imp_inj_on bij_betw_imp_surj_on bij_enumerate enumerate_mono infC strict_mono_def) then obtain \:: "[nat,nat] \ nat" where \: "\i. inj (\ i) \ range (\ i) = C i \ strict_mono (\ i)" by metis then have \_in_C [simp]: "\ i j \ C i' \ i'=i" for i i' j using dis by (fastforce simp: pairwise_def disjnt_def) have less_iff [simp]: "\ i j' < \ i j \ j' < j" for i j' j by (simp add: \ strict_mono_less) let ?a = "\ 0" define X where "X \ {(?a i, b) | i b. ?a i < b \ b \ C (Suc i)}" show thesis proof show "X \ UU" by (auto simp: X_def UU_def) show "ordertype X pair_less = \\2" proof (rule antisym) have "ordertype X pair_less \ ordertype UU pair_less" by (simp add: \X \ UU\ ordertype_mono) then show "ordertype X pair_less \ \\2" using ordertype_UU_\2 by auto define \ where "\ \ \(i,j::nat). (?a i, \ (Suc i) (?a j))" have "\i j. i < j \ \ 0 i < \ (Suc i) (\ 0 j)" by (meson \ le_less_trans less_iff strict_mono_imp_increasing) then have subX: "\ ` UU \ X" by (auto simp: UU_def \_def X_def) then have "ordertype (\ ` UU) pair_less \ ordertype X pair_less" by (simp add: ordertype_mono) moreover have "ordertype (\ ` UU) pair_less = ordertype UU pair_less" proof (rule ordertype_inc_eq) show "(\ x, \ y) \ pair_less" if "x \ UU" "y \ UU" and "(x, y) \ pair_less" for x y using that by (auto simp: UU_def \_def pair_less_def) qed auto ultimately show "\\2 \ ordertype X pair_less" using ordertype_UU_\2 by simp qed next fix U assume "U \ [X]\<^bsup>2\<^esup>" then obtain a b c d where Ueq: "U = {(a,b),(c,d)}" and ne: "(a,b) \ (c,d)" and inX: "(a,b) \ X" "(c,d) \ X" and "a \ c" apply (auto simp: nsets_def subset_iff eval_nat_numeral card_Suc_eq Set.doubleton_eq_iff) apply (metis nat_le_linear)+ done show "(\k<4. form U k) \ scheme U \ N" proof show "scheme U \ N" using inX N \ by (fastforce simp: scheme_def Ueq X_def) next consider "a < c" | "a = c \ b \ d" using \a \ c\ ne nat_less_le by blast then show "\k<4. form U k" proof cases case 1 have *: "a < b" "b \ c" "c < d" using inX by (auto simp: X_def) moreover have "\a < c; c < b; \ d < b\ \ b < d" using inX apply (clarsimp simp: X_def not_less) by (metis \ \_in_C imageE nat.inject nat_less_le) ultimately consider (k0) "a b c c b c da \ c\ by blast then show ?thesis by force next case k1 then have "form U 1" unfolding form_def form_split_def using Ueq \a \ c\ by blast then show ?thesis by force next case k2 then have "form U 2" unfolding form_def form_split_def using Ueq \a \ c\ by blast then show ?thesis by force qed next case 2 then have "form_split a b c d 3" by (auto simp: form_split_def) then show ?thesis using Ueq form_def leI by force qed qed qed qed text \Theorem 2.1 of Jean A. Larson, ibid.\ lemma Specker_aux: assumes "\ \ elts \" shows "partn_lst pair_less UU [\\2,\] 2" unfolding partn_lst_def proof clarsimp fix f assume f: "f \ [UU]\<^bsup>2\<^esup> \ {..: "?P0 \ ?P1" proof (rule disjCI) assume "\ ?P1" then have not1: "\M. \M \ UU; ordertype M pair_less = \\ \ \x\[M]\<^bsup>2\<^esup>. f x \ Suc 0" by auto obtain m where m: "\ = ord_of_nat m" using assms elts_\ by auto then have f_eq_0: "M \ [UU]\<^bsup>m\<^esup> \ \x\[M]\<^bsup>2\<^esup>. f x = 0" for M using not1 [of M] finite_ordertype_eq_card [of M pair_less m] f apply (clarsimp simp: nsets_def eval_nat_numeral Pi_def) by (meson less_Suc0 not_less_less_Suc_eq subset_trans) obtain N js where "infinite N" and N: "\k u. \k < 4; u \ [UU]\<^bsup>2\<^esup>; form u k; scheme u \ N\ \ f u = js!k" using f lemma_2_3 by blast obtain M0 where M0: "M0 \ [UU]\<^bsup>m\<^esup>" "\u. u \ [M0]\<^bsup>2\<^esup> \ form u 0" "\u. u \ [M0]\<^bsup>2\<^esup> \ scheme u \ N" by (rule lemma_2_4 [OF \infinite N\]) auto obtain M1 where M1: "M1 \ [UU]\<^bsup>m\<^esup>" "\u. u \ [M1]\<^bsup>2\<^esup> \ form u 1" "\u. u \ [M1]\<^bsup>2\<^esup> \ scheme u \ N" by (rule lemma_2_4 [OF \infinite N\]) auto obtain M2 where M2: "M2 \ [UU]\<^bsup>m\<^esup>" "\u. u \ [M2]\<^bsup>2\<^esup> \ form u 2" "\u. u \ [M2]\<^bsup>2\<^esup> \ scheme u \ N" by (rule lemma_2_4 [OF \infinite N\]) auto obtain M3 where M3: "M3 \ [UU]\<^bsup>m\<^esup>" "\u. u \ [M3]\<^bsup>2\<^esup> \ form u 3" "\u. u \ [M3]\<^bsup>2\<^esup> \ scheme u \ N" by (rule lemma_2_4 [OF \infinite N\]) auto have "js!0 = 0" using N [of 0 ] M0 f_eq_0 [of M0] by (force simp: nsets_def eval_nat_numeral) moreover have "js!1 = 0" using N [of 1] M1 f_eq_0 [of M1] by (force simp: nsets_def eval_nat_numeral) moreover have "js!2 = 0" using N [of 2 ] M2 f_eq_0 [of M2] by (force simp: nsets_def eval_nat_numeral) moreover have "js!3 = 0" using N [of 3 ] M3 f_eq_0 [of M3] by (force simp: nsets_def eval_nat_numeral) ultimately have js0: "js!k = 0" if "k < 4" for k using that by (auto simp: eval_nat_numeral less_Suc_eq) obtain X where "X \ UU" and otX: "ordertype X pair_less = \\2" and X: "\u. u \ [X]\<^bsup>2\<^esup> \ (\k<4. form u k) \ scheme u \ N" using \infinite N\ lemma_2_5 by auto moreover have "f ` [X]\<^bsup>2\<^esup> \ {0}" proof (clarsimp simp: image_subset_iff) fix u assume u: "u \ [X]\<^bsup>2\<^esup>" then have u_UU2: "u \ [UU]\<^bsup>2\<^esup>" using \X \ UU\ nsets_mono by blast show "f u = 0" using X u N [OF _ u_UU2] js0 by auto qed ultimately show "\X \ UU. ordertype X pair_less = \\2 \ f ` [X]\<^bsup>2\<^esup> \ {0}" by blast qed then show "\iH\UU. ordertype H pair_less = [\\2, \] ! i \ f ` [H]\<^bsup>2\<^esup> \ {i}" proof show "?P0 \ ?thesis" by (metis nth_Cons_0 numeral_2_eq_2 pos2) show "?P1 \ ?thesis" by (metis One_nat_def lessI nth_Cons_0 nth_Cons_Suc) qed qed theorem Specker: "\ \ elts \ \ partn_lst_VWF (\\2) [\\2,\] 2" using partn_lst_imp_partn_lst_VWF_eq [OF Specker_aux] ordertype_UU_\2 wf_pair_less by blast end