# HG changeset patch # User paulson # Date 1554899695 -3600 # Node ID 4005298550a69e1af773eb4da784ede61b3e7037 # Parent c4f2cac288d27da17567dbc75ef8b96504695efe The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Analysis/Abstract_Euclidean_Space.thy --- a/src/HOL/Analysis/Abstract_Euclidean_Space.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Analysis/Abstract_Euclidean_Space.thy Wed Apr 10 13:34:55 2019 +0100 @@ -90,19 +90,19 @@ by (fastforce simp add: continuous_map_componentwise_UNIV continuous_map_diff) lemma continuous_map_Euclidean_space_iff: - "continuous_map (Euclidean_space m) euclideanreal g + "continuous_map (Euclidean_space m) euclidean g = continuous_on (topspace (Euclidean_space m)) g" proof - assume "continuous_map (Euclidean_space m) euclideanreal g" - then have "continuous_map (top_of_set {f. \n\m. f n = 0}) euclideanreal g" + assume "continuous_map (Euclidean_space m) euclidean g" + then have "continuous_map (top_of_set {f. \n\m. f n = 0}) euclidean g" by (simp add: Euclidean_space_def euclidean_product_topology) then show "continuous_on (topspace (Euclidean_space m)) g" by (metis continuous_map_subtopology_eu subtopology_topspace topspace_Euclidean_space) next assume "continuous_on (topspace (Euclidean_space m)) g" - then have "continuous_map (top_of_set {f. \n\m. f n = 0}) euclideanreal g" + then have "continuous_map (top_of_set {f. \n\m. f n = 0}) euclidean g" by (metis (lifting) continuous_map_into_fulltopology continuous_map_subtopology_eu order_refl topspace_Euclidean_space) - then show "continuous_map (Euclidean_space m) euclideanreal g" + then show "continuous_map (Euclidean_space m) euclidean g" by (simp add: Euclidean_space_def euclidean_product_topology) qed @@ -201,6 +201,21 @@ by (simp add: nsphere subtopology_subtopology) qed +lemma topspace_nsphere_minus1: + assumes x: "x \ topspace (nsphere n)" and "x n = 0" + shows "x \ topspace (nsphere (n - Suc 0))" +proof (cases "n = 0") + case True + then show ?thesis + using x by auto +next + case False + have subt_eq: "nsphere (n - Suc 0) = subtopology (nsphere n) {x. x n = 0}" + by (metis False Suc_pred le_zero_eq not_le subtopology_nsphere_equator) + with x show ?thesis + by (simp add: assms) +qed + lemma continuous_map_nsphere_reflection: "continuous_map (nsphere n) (nsphere n) (\x i. if i = k then -x i else x i)" proof - diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Analysis/Convex.thy --- a/src/HOL/Analysis/Convex.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Analysis/Convex.thy Wed Apr 10 13:34:55 2019 +0100 @@ -272,8 +272,8 @@ with *[rule_format, of "2" ?u ?x] have s: "(\j \ {1..2}. ?u j *\<^sub>R ?x j) \ s" using mu xy by auto have grarr: "(\j \ {Suc (Suc 0)..2}. ?u j *\<^sub>R ?x j) = (1 - \) *\<^sub>R y" - using sum_head_Suc[of "Suc (Suc 0)" 2 "\ j. (1 - \) *\<^sub>R y"] by auto - from sum_head_Suc[of "Suc 0" 2 "\ j. ?u j *\<^sub>R ?x j", simplified this] + using sum.atLeast_Suc_atMost[of "Suc (Suc 0)" 2 "\ j. (1 - \) *\<^sub>R y"] by auto + from sum.atLeast_Suc_atMost[of "Suc 0" 2 "\ j. ?u j *\<^sub>R ?x j", simplified this] have "(\j \ {1..2}. ?u j *\<^sub>R ?x j) = \ *\<^sub>R x + (1 - \) *\<^sub>R y" by auto then have "(1 - \) *\<^sub>R y + \ *\<^sub>R x \ s" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Analysis/Convex_Euclidean_Space.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Analysis/Convex_Euclidean_Space.thy Wed Apr 10 13:34:55 2019 +0100 @@ -2090,6 +2090,14 @@ lemma is_interval_cball_1[intro, simp]: "is_interval (cball a b)" for a b::real by (simp add: is_interval_convex_1) +lemma [simp]: + fixes r s::real + shows is_interval_io: "is_interval {..Another intermediate value theorem formulation\ diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy Wed Apr 10 13:34:55 2019 +0100 @@ -1142,7 +1142,7 @@ unfolding nn_integral_sum[OF f] .. also have "\ = \\<^sup>+x. (SUP n. \iM" using f all_pos by (intro nn_integral_monotone_convergence_SUP_AE[symmetric]) - (elim AE_mp, auto simp: sum_nonneg simp del: sum_lessThan_Suc intro!: AE_I2 sum_mono2) + (elim AE_mp, auto simp: sum_nonneg simp del: sum.lessThan_Suc intro!: AE_I2 sum_mono2) also have "\ = \\<^sup>+x. (\i. f i x) \M" using all_pos by (intro nn_integral_cong_AE) (auto simp: suminf_eq_SUP) finally show ?thesis by simp diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Wed Apr 10 13:34:55 2019 +0100 @@ -221,14 +221,9 @@ by (simp add: cbox_interval) lemma [simp]: - fixes a b::"'a::ordered_euclidean_space" and r s::real - shows is_interval_io: "is_interval {.. a = b" by fast @@ -814,7 +814,7 @@ by (auto simp: fps_pow_nth_below_subdegree) with False Suc show ?thesis using fps_mult_nth_conv_inside_subdegrees[of f "f^n" "Suc n * subdegree f"] - sum_head_Suc[of + sum.atLeast_Suc_atMost[of "subdegree f" "Suc n * subdegree f - subdegree (f ^ n)" "\i. f $ i * f ^ n $ (Suc n * subdegree f - i)" @@ -857,7 +857,7 @@ proof (cases m) case 0 thus ?thesis using fps_mult_nth_1[of "fps_X" f] by (simp add: fps_X_def) next - case (Suc k) thus ?thesis by (simp add: fps_mult_nth fps_X_def sum_head_Suc) + case (Suc k) thus ?thesis by (simp add: fps_mult_nth fps_X_def sum.atLeast_Suc_atMost) qed ultimately show ?thesis by simp qed (simp add: fps_X_def) @@ -949,7 +949,7 @@ lemma fps_X_power_mult_nth: "(fps_X^k * f) $ n = (if n < k then 0 else f $ (n - k))" by (cases "n subdegree a" hence "fps_shift 1 (a*b) $ n = (\i=Suc 0..Suc n. a$i * b$(n+1-i))" - using sum_head_Suc[of 0 "n+1" "\i. a$i * b$(n+1-i)"] + using sum.atLeast_Suc_atMost[of 0 "n+1" "\i. a$i * b$(n+1-i)"] by (simp add: fps_mult_nth nth_less_subdegree_zero) thus "fps_shift 1 (a*b) $ n = (fps_shift 1 a * b) $ n" using sum_shift_bounds_cl_Suc_ivl[of "\i. a$i * b$(n+1-i)" 0 n] @@ -1763,7 +1763,7 @@ "(f * fps_right_inverse f y) $ n = - 1 * sum (\i. f$i * fps_right_inverse_constructor f y (n - i)) {1..n} + sum (\i. f$i * (fps_right_inverse_constructor f y (n - i))) {1..n}" - by (simp add: fps_mult_nth sum_head_Suc mult.assoc f0[symmetric]) + by (simp add: fps_mult_nth sum.atLeast_Suc_atMost mult.assoc f0[symmetric]) thus "(f * fps_right_inverse f y) $ n = 1 $ n" by (simp add: Suc) qed (simp add: f0 fps_inverse_def) qed @@ -1935,7 +1935,7 @@ using 1 by auto hence "fps_right_inverse f (g$0) $ Suc k = 1 * g $ Suc k - g$0 * 1 $ Suc k" - by (simp add: fps_mult_nth fg(1)[symmetric] algebra_simps fg(2)[symmetric] sum_head_Suc) + by (simp add: fps_mult_nth fg(1)[symmetric] algebra_simps fg(2)[symmetric] sum.atLeast_Suc_atMost) with Suc show ?thesis by simp qed simp qed @@ -2116,7 +2116,7 @@ moreover have "fps_left_inverse ones 1 $ Suc m = ones_inv $ Suc m" proof (cases m) case (Suc k) thus ?thesis - using Suc m 1 by (simp add: ones_def ones_inv_def sum_head_Suc) + using Suc m 1 by (simp add: ones_def ones_inv_def sum.atLeast_Suc_atMost) qed (simp add: ones_def ones_inv_def) ultimately show ?thesis by simp qed (simp add: ones_inv_def) @@ -2183,7 +2183,7 @@ have f2_nth_simps: "f^2 $ 1 = - of_nat 2" "f^2 $ 2 = 1" "\n. n>2 \ f^2 $ n = 0" - by (simp_all add: power2_eq_square f_def fps_mult_nth sum_head_Suc) + by (simp_all add: power2_eq_square f_def fps_mult_nth sum.atLeast_Suc_atMost) show "fps_left_inverse (f^2) 1 = invf2" proof (intro fps_ext) @@ -3086,7 +3086,7 @@ of_nat (Suc n) * f$0 * g$(Suc n) + (\i=1..n. (of_nat (n - i + 1) + of_nat i) * f $ i * g $ (n - i + 1)) + of_nat (Suc n) * f$(Suc n) * g$0" - by (simp add: fps_mult_nth algebra_simps mult_of_nat_commute sum_head_Suc sum.distrib) + by (simp add: fps_mult_nth algebra_simps mult_of_nat_commute sum.atLeast_Suc_atMost sum.distrib) moreover have "\i\{1..n}. (of_nat (n - i + 1) + of_nat i) * f $ i * g $ (n - i + 1) = @@ -3103,7 +3103,7 @@ ultimately have "(f * fps_deriv g + fps_deriv f * g) $ n = (\i=0..Suc n. of_nat (Suc n) * f $ i * g $ (Suc n - i))" - by (simp add: sum_head_Suc) + by (simp add: sum.atLeast_Suc_atMost) with LHS show "fps_deriv (f * g) $ n = (f * fps_deriv g + fps_deriv f * g) $ n" by simp qed @@ -3413,7 +3413,7 @@ next case (Suc i) with 1 j have "\m\{0<..j}. a ^ i $ (j - m) = 0" by auto - with Suc a0 show ?thesis by (simp add: fps_mult_nth sum_head_Suc) + with Suc a0 show ?thesis by (simp add: fps_mult_nth sum.atLeast_Suc_atMost) qed qed @@ -3436,8 +3436,8 @@ have "\i\{Suc 1..Suc n}. a ^ n $ (Suc n - i) = 0" using a0 startsby_zero_power_prefix[of a n] by auto thus ?case - using a0 Suc sum_head_Suc[of 0 "Suc n" "\i. a $ i * a ^ n $ (Suc n - i)"] - sum_head_Suc[of 1 "Suc n" "\i. a $ i * a ^ n $ (Suc n - i)"] + using a0 Suc sum.atLeast_Suc_atMost[of 0 "Suc n" "\i. a $ i * a ^ n $ (Suc n - i)"] + sum.atLeast_Suc_atMost[of 1 "Suc n" "\i. a $ i * a ^ n $ (Suc n - i)"] by (simp add: fps_mult_nth) qed simp @@ -3806,8 +3806,8 @@ case (Suc m) hence "(f * g) $ n = g $ Suc m - g $ m" using fps_mult_nth[of f g "Suc m"] - sum_head_Suc[of 0 "Suc m" "\i. f $ i * g $ (Suc m - i)"] - sum_head_Suc[of 1 "Suc m" "\i. f $ i * g $ (Suc m - i)"] + sum.atLeast_Suc_atMost[of 0 "Suc m" "\i. f $ i * g $ (Suc m - i)"] + sum.atLeast_Suc_atMost[of 1 "Suc m" "\i. f $ i * g $ (Suc m - i)"] by (simp add: f_def) with Suc show ?thesis by (simp add: g_def) qed (simp add: f_def g_def) @@ -6368,7 +6368,7 @@ lemma sum_eq_if: "sum f {(n::nat) .. m} = (if m < n then 0 else f n + sum f {n+1 .. m})" apply simp apply (subst sum.insert[symmetric]) - apply (auto simp add: not_less sum_head_Suc) + apply (auto simp add: not_less sum.atLeast_Suc_atMost) done lemma pochhammer_rec_if: "pochhammer a n = (if n = 0 then 1 else a * pochhammer (a + 1) (n - 1))" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Computational_Algebra/Polynomial.thy --- a/src/HOL/Computational_Algebra/Polynomial.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Computational_Algebra/Polynomial.thy Wed Apr 10 13:34:55 2019 +0100 @@ -1000,7 +1000,7 @@ next case (pCons a p n) then show ?case - by (cases n) (simp_all add: sum_atMost_Suc_shift del: sum_atMost_Suc) + by (cases n) (simp_all add: sum_atMost_Suc_shift del: sum.atMost_Suc) qed lemma degree_mult_le: "degree (p * q) \ degree p + degree q" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Decision_Procs/Approximation.thy --- a/src/HOL/Decision_Procs/Approximation.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Decision_Procs/Approximation.thy Wed Apr 10 13:34:55 2019 +0100 @@ -1183,7 +1183,7 @@ by auto have sum_move0: "\k F. sum F {0.. k. F (Suc k)) {0.. n. (-1)^n *a n * x^n"] by auto qed diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Groups_Big.thy --- a/src/HOL/Groups_Big.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Groups_Big.thy Wed Apr 10 13:34:55 2019 +0100 @@ -106,6 +106,11 @@ ultimately show ?thesis by simp qed +lemma Int_Diff: + assumes "finite A" + shows "F g A = F g (A \ B) \<^bold>* F g (A - B)" + by (subst subset_diff [where B = "A - B"]) (auto simp: Diff_Diff_Int assms) + lemma setdiff_irrelevant: assumes "finite A" shows "F g (A - {x. g x = z}) = F g A" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Hilbert_Choice.thy --- a/src/HOL/Hilbert_Choice.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Hilbert_Choice.thy Wed Apr 10 13:34:55 2019 +0100 @@ -43,6 +43,11 @@ subsection \Hilbert's Epsilon-operator\ +lemma Eps_cong: + assumes "\x. P x = Q x" + shows "Eps P = Eps Q" + using ext[of P Q, OF assms] by simp + text \ Easier to apply than \someI\ if the witness comes from an existential formula. diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Homology/Brouwer_Degree.thy --- a/src/HOL/Homology/Brouwer_Degree.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Homology/Brouwer_Degree.thy Wed Apr 10 13:34:55 2019 +0100 @@ -5,11 +5,6 @@ begin -lemma Eps_cong: - assumes "\x. P x = Q x" - shows "Eps P = Eps Q" - using ext[of P Q, OF assms] by simp - subsection\Reduced Homology\ definition reduced_homology_group :: "int \ 'a topology \ 'a chain set monoid" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Homology/Invariance_of_Domain.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Homology/Invariance_of_Domain.thy Wed Apr 10 13:34:55 2019 +0100 @@ -0,0 +1,2429 @@ +section\Invariance of Domain\ + +theory Invariance_of_Domain + imports Brouwer_Degree + +begin + +subsection\Degree invariance mod 2 for map between pairs\ + +theorem Borsuk_odd_mapping_degree_step: + assumes cmf: "continuous_map (nsphere n) (nsphere n) f" + and f: "\x. x \ topspace(nsphere n) \ (f \ (\x i. -x i)) x = ((\x i. -x i) \ f) x" + and fim: "f ` (topspace(nsphere(n - Suc 0))) \ topspace(nsphere(n - Suc 0))" + shows "even (Brouwer_degree2 n f - Brouwer_degree2 (n - Suc 0) f)" +proof (cases "n = 0") + case False + define neg where "neg \ \x::nat\real. \i. -x i" + define upper where "upper \ \n. {x::nat\real. x n \ 0}" + define lower where "lower \ \n. {x::nat\real. x n \ 0}" + define equator where "equator \ \n. {x::nat\real. x n = 0}" + define usphere where "usphere \ \n. subtopology (nsphere n) (upper n)" + define lsphere where "lsphere \ \n. subtopology (nsphere n) (lower n)" + have [simp]: "neg x i = -x i" for x i + by (force simp: neg_def) + have equator_upper: "equator n \ upper n" + by (force simp: equator_def upper_def) + have upper_usphere: "subtopology (nsphere n) (upper n) = usphere n" + by (simp add: usphere_def) + let ?rhgn = "relative_homology_group n (nsphere n)" + let ?hi_ee = "hom_induced n (nsphere n) (equator n) (nsphere n) (equator n)" + interpret GE: comm_group "?rhgn (equator n)" + by simp + interpret HB: group_hom "?rhgn (equator n)" + "homology_group (int n - 1) (subtopology (nsphere n) (equator n))" + "hom_boundary n (nsphere n) (equator n)" + by (simp add: group_hom_axioms_def group_hom_def hom_boundary_hom) + interpret HIU: group_hom "?rhgn (equator n)" + "?rhgn (upper n)" + "hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id" + by (simp add: group_hom_axioms_def group_hom_def hom_induced_hom) + have subt_eq: "subtopology (nsphere n) {x. x n = 0} = nsphere (n - Suc 0)" + by (metis False Suc_pred le_zero_eq not_le subtopology_nsphere_equator) + then have equ: "subtopology (nsphere n) (equator n) = nsphere(n - Suc 0)" + "subtopology (lsphere n) (equator n) = nsphere(n - Suc 0)" + "subtopology (usphere n) (equator n) = nsphere(n - Suc 0)" + using False by (auto simp: lsphere_def usphere_def equator_def lower_def upper_def subtopology_subtopology simp flip: Collect_conj_eq cong: rev_conj_cong) + have cmr: "continuous_map (nsphere(n - Suc 0)) (nsphere(n - Suc 0)) f" + by (metis (no_types, lifting) IntE cmf fim continuous_map_from_subtopology continuous_map_in_subtopology equ(1) image_subset_iff topspace_subtopology) + + have "f x n = 0" if "x \ topspace (nsphere n)" "x n = 0" for x + proof - + have "x \ topspace (nsphere (n - Suc 0))" + by (simp add: that topspace_nsphere_minus1) + moreover have "topspace (nsphere n) \ {f. f n = 0} = topspace (nsphere (n - Suc 0))" + by (metis subt_eq topspace_subtopology) + ultimately show ?thesis + using cmr continuous_map_def by fastforce + qed + then have fimeq: "f ` (topspace (nsphere n) \ equator n) \ topspace (nsphere n) \ equator n" + using fim cmf by (auto simp: equator_def continuous_map_def image_subset_iff) + have "\k. continuous_map (powertop_real UNIV) euclideanreal (\x. - x k)" + by (metis UNIV_I continuous_map_product_projection continuous_map_minus) + then have cm_neg: "continuous_map (nsphere m) (nsphere m) neg" for m + by (force simp: nsphere continuous_map_in_subtopology neg_def continuous_map_componentwise_UNIV intro: continuous_map_from_subtopology) + then have cm_neg_lu: "continuous_map (lsphere n) (usphere n) neg" + by (auto simp: lsphere_def usphere_def lower_def upper_def continuous_map_from_subtopology continuous_map_in_subtopology) + have neg_in_top_iff: "neg x \ topspace(nsphere m) \ x \ topspace(nsphere m)" for m x + by (simp add: nsphere_def neg_def topspace_Euclidean_space) + obtain z where zcarr: "z \ carrier (reduced_homology_group (int n - 1) (nsphere (n - Suc 0)))" + and zeq: "subgroup_generated (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) {z} + = reduced_homology_group (int n - 1) (nsphere (n - Suc 0))" + using cyclic_reduced_homology_group_nsphere [of "int n - 1" "n - Suc 0"] by (auto simp: cyclic_group_def) + have "hom_boundary n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0} + \ Group.iso (relative_homology_group n + (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + (reduced_homology_group (int n - 1) (nsphere (n - Suc 0)))" + using iso_lower_hemisphere_reduced_homology_group [of "int n - 1" "n - Suc 0"] False by simp + then obtain gp where g: "group_isomorphisms + (relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) + (hom_boundary n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + gp" + by (auto simp: group.iso_iff_group_isomorphisms) + then interpret gp: group_hom "reduced_homology_group (int n - 1) (nsphere (n - Suc 0))" + "relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}" gp + by (simp add: group_hom_axioms_def group_hom_def group_isomorphisms_def) + obtain zp where zpcarr: "zp \ carrier(relative_homology_group n (lsphere n) (equator n))" + and zp_z: "hom_boundary n (lsphere n) (equator n) zp = z" + and zp_sg: "subgroup_generated (relative_homology_group n (lsphere n) (equator n)) {zp} + = relative_homology_group n (lsphere n) (equator n)" + proof + show "gp z \ carrier (relative_homology_group n (lsphere n) (equator n))" + "hom_boundary n (lsphere n) (equator n) (gp z) = z" + using g zcarr by (auto simp: lsphere_def equator_def lower_def group_isomorphisms_def) + have giso: "gp \ Group.iso (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) + (relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0})" + by (metis (mono_tags, lifting) g group_isomorphisms_imp_iso group_isomorphisms_sym) + show "subgroup_generated (relative_homology_group n (lsphere n) (equator n)) {gp z} = + relative_homology_group n (lsphere n) (equator n)" + apply (rule monoid.equality) + using giso gp.subgroup_generated_by_image [of "{z}"] zcarr + by (auto simp: lsphere_def equator_def lower_def zeq gp.iso_iff) + qed + have hb_iso: "hom_boundary n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0} + \ iso (relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + (reduced_homology_group (int n - 1) (nsphere (n - Suc 0)))" + using iso_upper_hemisphere_reduced_homology_group [of "int n - 1" "n - Suc 0"] False by simp + then obtain gn where g: "group_isomorphisms + (relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) + (hom_boundary n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}) + gn" + by (auto simp: group.iso_iff_group_isomorphisms) + then interpret gn: group_hom "reduced_homology_group (int n - 1) (nsphere (n - Suc 0))" + "relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0}" gn + by (simp add: group_hom_axioms_def group_hom_def group_isomorphisms_def) + obtain zn where zncarr: "zn \ carrier(relative_homology_group n (usphere n) (equator n))" + and zn_z: "hom_boundary n (usphere n) (equator n) zn = z" + and zn_sg: "subgroup_generated (relative_homology_group n (usphere n) (equator n)) {zn} + = relative_homology_group n (usphere n) (equator n)" + proof + show "gn z \ carrier (relative_homology_group n (usphere n) (equator n))" + "hom_boundary n (usphere n) (equator n) (gn z) = z" + using g zcarr by (auto simp: usphere_def equator_def upper_def group_isomorphisms_def) + have giso: "gn \ Group.iso (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) + (relative_homology_group n (subtopology (nsphere n) {x. x n \ 0}) {x. x n = 0})" + by (metis (mono_tags, lifting) g group_isomorphisms_imp_iso group_isomorphisms_sym) + show "subgroup_generated (relative_homology_group n (usphere n) (equator n)) {gn z} = + relative_homology_group n (usphere n) (equator n)" + apply (rule monoid.equality) + using giso gn.subgroup_generated_by_image [of "{z}"] zcarr + by (auto simp: usphere_def equator_def upper_def zeq gn.iso_iff) + qed + let ?hi_lu = "hom_induced n (lsphere n) (equator n) (nsphere n) (upper n) id" + interpret gh_lu: group_hom "relative_homology_group n (lsphere n) (equator n)" "?rhgn (upper n)" ?hi_lu + by (simp add: group_hom_axioms_def group_hom_def hom_induced_hom) + interpret gh_eef: group_hom "?rhgn (equator n)" "?rhgn (equator n)" "?hi_ee f" + by (simp add: group_hom_axioms_def group_hom_def hom_induced_hom) + define wp where "wp \ ?hi_lu zp" + then have wpcarr: "wp \ carrier(?rhgn (upper n))" + by (simp add: hom_induced_carrier) + have "hom_induced n (nsphere n) {} (nsphere n) {x. x n \ 0} id + \ iso (reduced_homology_group n (nsphere n)) + (?rhgn {x. x n \ 0})" + using iso_reduced_homology_group_upper_hemisphere [of n n n] by auto + then have "carrier(?rhgn {x. x n \ 0}) + \ (hom_induced n (nsphere n) {} (nsphere n) {x. x n \ 0} id) + ` carrier(reduced_homology_group n (nsphere n))" + by (simp add: iso_iff) + then obtain vp where vpcarr: "vp \ carrier(reduced_homology_group n (nsphere n))" + and eqwp: "hom_induced n (nsphere n) {} (nsphere n) (upper n) id vp = wp" + using wpcarr by (auto simp: upper_def) + define wn where "wn \ hom_induced n (usphere n) (equator n) (nsphere n) (lower n) id zn" + then have wncarr: "wn \ carrier(?rhgn (lower n))" + by (simp add: hom_induced_carrier) + have "hom_induced n (nsphere n) {} (nsphere n) {x. x n \ 0} id + \ iso (reduced_homology_group n (nsphere n)) + (?rhgn {x. x n \ 0})" + using iso_reduced_homology_group_lower_hemisphere [of n n n] by auto + then have "carrier(?rhgn {x. x n \ 0}) + \ (hom_induced n (nsphere n) {} (nsphere n) {x. x n \ 0} id) + ` carrier(reduced_homology_group n (nsphere n))" + by (simp add: iso_iff) + then obtain vn where vpcarr: "vn \ carrier(reduced_homology_group n (nsphere n))" + and eqwp: "hom_induced n (nsphere n) {} (nsphere n) (lower n) id vn = wn" + using wncarr by (auto simp: lower_def) + define up where "up \ hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id zp" + then have upcarr: "up \ carrier(?rhgn (equator n))" + by (simp add: hom_induced_carrier) + define un where "un \ hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id zn" + then have uncarr: "un \ carrier(?rhgn (equator n))" + by (simp add: hom_induced_carrier) + have *: "(\(x, y). + hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id x + \\<^bsub>?rhgn (equator n)\<^esub> + hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id y) + \ Group.iso + (relative_homology_group n (lsphere n) (equator n) \\ + relative_homology_group n (usphere n) (equator n)) + (?rhgn (equator n))" + proof (rule conjunct1 [OF exact_sequence_sum_lemma [OF abelian_relative_homology_group]]) + show "hom_induced n (lsphere n) (equator n) (nsphere n) (upper n) id + \ Group.iso (relative_homology_group n (lsphere n) (equator n)) + (?rhgn (upper n))" + apply (simp add: lsphere_def usphere_def equator_def lower_def upper_def) + using iso_relative_homology_group_lower_hemisphere by blast + show "hom_induced n (usphere n) (equator n) (nsphere n) (lower n) id + \ Group.iso (relative_homology_group n (usphere n) (equator n)) + (?rhgn (lower n))" + apply (simp_all add: lsphere_def usphere_def equator_def lower_def upper_def) + using iso_relative_homology_group_upper_hemisphere by blast+ + show "exact_seq + ([?rhgn (lower n), + ?rhgn (equator n), + relative_homology_group n (lsphere n) (equator n)], + [hom_induced n (nsphere n) (equator n) (nsphere n) (lower n) id, + hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id])" + unfolding lsphere_def usphere_def equator_def lower_def upper_def + by (rule homology_exactness_triple_3) force + show "exact_seq + ([?rhgn (upper n), + ?rhgn (equator n), + relative_homology_group n (usphere n) (equator n)], + [hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id, + hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id])" + unfolding lsphere_def usphere_def equator_def lower_def upper_def + by (rule homology_exactness_triple_3) force + next + fix x + assume "x \ carrier (relative_homology_group n (lsphere n) (equator n))" + show "hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id + (hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id x) = + hom_induced n (lsphere n) (equator n) (nsphere n) (upper n) id x" + by (simp add: hom_induced_compose' subset_iff lsphere_def usphere_def equator_def lower_def upper_def) + next + fix x + assume "x \ carrier (relative_homology_group n (usphere n) (equator n))" + show "hom_induced n (nsphere n) (equator n) (nsphere n) (lower n) id + (hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id x) = + hom_induced n (usphere n) (equator n) (nsphere n) (lower n) id x" + by (simp add: hom_induced_compose' subset_iff lsphere_def usphere_def equator_def lower_def upper_def) + qed + then have sb: "carrier (?rhgn (equator n)) + \ (\(x, y). + hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id x + \\<^bsub>?rhgn (equator n)\<^esub> + hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id y) + ` carrier (relative_homology_group n (lsphere n) (equator n) \\ + relative_homology_group n (usphere n) (equator n))" + by (simp add: iso_iff) + obtain a b::int + where up_ab: "?hi_ee f up + = up [^]\<^bsub>?rhgn (equator n)\<^esub> a\\<^bsub>?rhgn (equator n)\<^esub> un [^]\<^bsub>?rhgn (equator n)\<^esub> b" + proof - + have hiupcarr: "?hi_ee f up \ carrier(?rhgn (equator n))" + by (simp add: hom_induced_carrier) + obtain u v where u: "u \ carrier (relative_homology_group n (lsphere n) (equator n))" + and v: "v \ carrier (relative_homology_group n (usphere n) (equator n))" + and eq: "?hi_ee f up = + hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id u + \\<^bsub>?rhgn (equator n)\<^esub> + hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id v" + using subsetD [OF sb hiupcarr] by auto + have "u \ carrier (subgroup_generated (relative_homology_group n (lsphere n) (equator n)) {zp})" + by (simp_all add: u zp_sg) + then obtain a::int where a: "u = zp [^]\<^bsub>relative_homology_group n (lsphere n) (equator n)\<^esub> a" + by (metis group.carrier_subgroup_generated_by_singleton group_relative_homology_group rangeE zpcarr) + have ae: "hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id + (pow (relative_homology_group n (lsphere n) (equator n)) zp a) + = pow (?rhgn (equator n)) (hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id zp) a" + by (meson group_hom.hom_int_pow group_hom_axioms_def group_hom_def group_relative_homology_group hom_induced zpcarr) + have "v \ carrier (subgroup_generated (relative_homology_group n (usphere n) (equator n)) {zn})" + by (simp_all add: v zn_sg) + then obtain b::int where b: "v = zn [^]\<^bsub>relative_homology_group n (usphere n) (equator n)\<^esub> b" + by (metis group.carrier_subgroup_generated_by_singleton group_relative_homology_group rangeE zncarr) + have be: "hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id + (zn [^]\<^bsub>relative_homology_group n (usphere n) (equator n)\<^esub> b) + = hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id + zn [^]\<^bsub>relative_homology_group n (nsphere n) (equator n)\<^esub> b" + by (meson group_hom.hom_int_pow group_hom_axioms_def group_hom_def group_relative_homology_group hom_induced zncarr) + show thesis + proof + show "?hi_ee f up + = up [^]\<^bsub>?rhgn (equator n)\<^esub> a \\<^bsub>?rhgn (equator n)\<^esub> un [^]\<^bsub>?rhgn (equator n)\<^esub> b" + using a ae b be eq local.up_def un_def by auto + qed + qed + have "(hom_boundary n (nsphere n) (equator n) + \ hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id) zp = z" + using zp_z equ apply (simp add: lsphere_def naturality_hom_induced) + by (metis hom_boundary_carrier hom_induced_id) + then have up_z: "hom_boundary n (nsphere n) (equator n) up = z" + by (simp add: up_def) + have "(hom_boundary n (nsphere n) (equator n) + \ hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id) zn = z" + using zn_z equ apply (simp add: usphere_def naturality_hom_induced) + by (metis hom_boundary_carrier hom_induced_id) + then have un_z: "hom_boundary n (nsphere n) (equator n) un = z" + by (simp add: un_def) + have Bd_ab: "Brouwer_degree2 (n - Suc 0) f = a + b" + proof (rule Brouwer_degree2_unique_generator; use False int_ops in simp_all) + show "continuous_map (nsphere (n - Suc 0)) (nsphere (n - Suc 0)) f" + using cmr by auto + show "subgroup_generated (reduced_homology_group (int n - 1) (nsphere (n - Suc 0))) {z} = + reduced_homology_group (int n - 1) (nsphere (n - Suc 0))" + using zeq by blast + have "(hom_induced (int n - 1) (nsphere (n - Suc 0)) {} (nsphere (n - Suc 0)) {} f + \ hom_boundary n (nsphere n) (equator n)) up + = (hom_boundary n (nsphere n) (equator n) \ + ?hi_ee f) up" + using naturality_hom_induced [OF cmf fimeq, of n, symmetric] + by (simp add: subtopology_restrict equ fun_eq_iff) + also have "\ = hom_boundary n (nsphere n) (equator n) + (up [^]\<^bsub>relative_homology_group n (nsphere n) (equator n)\<^esub> + a \\<^bsub>relative_homology_group n (nsphere n) (equator n)\<^esub> + un [^]\<^bsub>relative_homology_group n (nsphere n) (equator n)\<^esub> b)" + by (simp add: o_def up_ab) + also have "\ = z [^]\<^bsub>reduced_homology_group (int n - 1) (nsphere (n - Suc 0))\<^esub> (a + b)" + using zcarr + apply (simp add: HB.hom_int_pow reduced_homology_group_def group.int_pow_subgroup_generated upcarr uncarr) + by (metis equ(1) group.int_pow_mult group_relative_homology_group hom_boundary_carrier un_z up_z) + finally show "hom_induced (int n - 1) (nsphere (n - Suc 0)) {} (nsphere (n - Suc 0)) {} f z = + z [^]\<^bsub>reduced_homology_group (int n - 1) (nsphere (n - Suc 0))\<^esub> (a + b)" + by (simp add: up_z) + qed + define u where "u \ up \\<^bsub>?rhgn (equator n)\<^esub> inv\<^bsub>?rhgn (equator n)\<^esub> un" + have ucarr: "u \ carrier (?rhgn (equator n))" + by (simp add: u_def uncarr upcarr) + then have "u [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 n f = u [^]\<^bsub>?rhgn (equator n)\<^esub> (a - b) + \ (GE.ord u) dvd a - b - Brouwer_degree2 n f" + by (simp add: GE.int_pow_eq) + moreover + have "GE.ord u = 0" + proof (clarsimp simp add: GE.ord_eq_0 ucarr) + fix d :: nat + assume "0 < d" + and "u [^]\<^bsub>?rhgn (equator n)\<^esub> d = singular_relboundary_set n (nsphere n) (equator n)" + then have "hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id u [^]\<^bsub>?rhgn (upper n)\<^esub> d + = \\<^bsub>?rhgn (upper n)\<^esub>" + by (metis HIU.hom_one HIU.hom_nat_pow one_relative_homology_group ucarr) + moreover + have "?hi_lu + = hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id \ + hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id" + by (simp add: lsphere_def image_subset_iff equator_upper flip: hom_induced_compose) + then have p: "wp = hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id up" + by (simp add: local.up_def wp_def) + have n: "hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id un = \\<^bsub>?rhgn (upper n)\<^esub>" + using homology_exactness_triple_3 [OF equator_upper, of n "nsphere n"] + using un_def zncarr by (auto simp: upper_usphere kernel_def) + have "hom_induced n (nsphere n) (equator n) (nsphere n) (upper n) id u = wp" + unfolding u_def + using p n HIU.inv_one HIU.r_one uncarr upcarr by auto + ultimately have "(wp [^]\<^bsub>?rhgn (upper n)\<^esub> d) = \\<^bsub>?rhgn (upper n)\<^esub>" + by simp + moreover have "infinite (carrier (subgroup_generated (?rhgn (upper n)) {wp}))" + proof - + have "?rhgn (upper n) \ reduced_homology_group n (nsphere n)" + unfolding upper_def + using iso_reduced_homology_group_upper_hemisphere [of n n n] + by (blast intro: group.iso_sym group_reduced_homology_group is_isoI) + also have "\ \ integer_group" + by (simp add: reduced_homology_group_nsphere) + finally have iso: "?rhgn (upper n) \ integer_group" . + have "carrier (subgroup_generated (?rhgn (upper n)) {wp}) = carrier (?rhgn (upper n))" + using gh_lu.subgroup_generated_by_image [of "{zp}"] zpcarr HIU.carrier_subgroup_generated_subset + gh_lu.iso_iff iso_relative_homology_group_lower_hemisphere zp_sg + by (auto simp: lower_def lsphere_def upper_def equator_def wp_def) + then show ?thesis + using infinite_UNIV_int iso_finite [OF iso] by simp + qed + ultimately show False + using HIU.finite_cyclic_subgroup \0 < d\ wpcarr by blast + qed + ultimately have iff: "u [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 n f = u [^]\<^bsub>?rhgn (equator n)\<^esub> (a - b) + \ Brouwer_degree2 n f = a - b" + by auto + have "u [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 n f = ?hi_ee f u" + proof - + have ne: "topspace (nsphere n) \ equator n \ {}" + by (metis equ(1) nonempty_nsphere topspace_subtopology) + have eq1: "hom_boundary n (nsphere n) (equator n) u + = \\<^bsub>reduced_homology_group (int n - 1) (subtopology (nsphere n) (equator n))\<^esub>" + using one_reduced_homology_group u_def un_z uncarr up_z upcarr by force + then have uhom: "u \ hom_induced n (nsphere n) {} (nsphere n) (equator n) id ` + carrier (reduced_homology_group (int n) (nsphere n))" + using homology_exactness_reduced_1 [OF ne, of n] eq1 ucarr by (auto simp: kernel_def) + then obtain v where vcarr: "v \ carrier (reduced_homology_group (int n) (nsphere n))" + and ueq: "u = hom_induced n (nsphere n) {} (nsphere n) (equator n) id v" + by blast + interpret GH_hi: group_hom "homology_group n (nsphere n)" + "?rhgn (equator n)" + "hom_induced n (nsphere n) {} (nsphere n) (equator n) id" + by (simp add: group_hom_axioms_def group_hom_def hom_induced_hom) + have poweq: "pow (homology_group n (nsphere n)) x i = pow (reduced_homology_group n (nsphere n)) x i" + for x and i::int + by (simp add: False un_reduced_homology_group) + have vcarr': "v \ carrier (homology_group n (nsphere n))" + using carrier_reduced_homology_group_subset vcarr by blast + have "u [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 n f + = hom_induced n (nsphere n) {} (nsphere n) (equator n) f v" + using vcarr vcarr' + by (simp add: ueq poweq hom_induced_compose' cmf flip: GH_hi.hom_int_pow Brouwer_degree2) + also have "\ = hom_induced n (nsphere n) (topspace(nsphere n) \ equator n) (nsphere n) (equator n) f + (hom_induced n (nsphere n) {} (nsphere n) (topspace(nsphere n) \ equator n) id v)" + using fimeq by (simp add: hom_induced_compose' cmf) + also have "\ = ?hi_ee f u" + by (metis hom_induced inf.left_idem ueq) + finally show ?thesis . + qed + moreover + interpret gh_een: group_hom "?rhgn (equator n)" "?rhgn (equator n)" "?hi_ee neg" + by (simp add: group_hom_axioms_def group_hom_def hom_induced_hom) + have hi_up_eq_un: "?hi_ee neg up = un [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" + proof - + have "?hi_ee neg (hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) id zp) + = hom_induced n (lsphere n) (equator n) (nsphere n) (equator n) (neg \ id) zp" + by (intro hom_induced_compose') (auto simp: lsphere_def equator_def cm_neg) + also have "\ = hom_induced n (usphere n) (equator n) (nsphere n) (equator n) id + (hom_induced n (lsphere n) (equator n) (usphere n) (equator n) neg zp)" + by (subst hom_induced_compose' [OF cm_neg_lu]) (auto simp: usphere_def equator_def) + also have "hom_induced n (lsphere n) (equator n) (usphere n) (equator n) neg zp + = zn [^]\<^bsub>relative_homology_group n (usphere n) (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" + proof - + let ?hb = "hom_boundary n (usphere n) (equator n)" + have eq: "subtopology (nsphere n) {x. x n \ 0} = usphere n \ {x. x n = 0} = equator n" + by (auto simp: usphere_def upper_def equator_def) + with hb_iso have inj: "inj_on (?hb) (carrier (relative_homology_group n (usphere n) (equator n)))" + by (simp add: iso_iff) + interpret hb_hom: group_hom "relative_homology_group n (usphere n) (equator n)" + "reduced_homology_group (int n - 1) (nsphere (n - Suc 0))" + "?hb" + using hb_iso iso_iff eq group_hom_axioms_def group_hom_def by fastforce + show ?thesis + proof (rule inj_onD [OF inj]) + have *: "hom_induced (int n - 1) (nsphere (n - Suc 0)) {} (nsphere (n - Suc 0)) {} neg z + = z [^]\<^bsub>homology_group (int n - 1) (nsphere (n - Suc 0))\<^esub> Brouwer_degree2 (n - Suc 0) neg" + using Brouwer_degree2 [of z "n - Suc 0" neg] False zcarr + by (simp add: int_ops group.int_pow_subgroup_generated reduced_homology_group_def) + have "?hb \ + hom_induced n (lsphere n) (equator n) (usphere n) (equator n) neg + = hom_induced (int n - 1) (nsphere (n - Suc 0)) {} (nsphere (n - Suc 0)) {} neg \ + hom_boundary n (lsphere n) (equator n)" + apply (subst naturality_hom_induced [OF cm_neg_lu]) + apply (force simp: equator_def neg_def) + by (simp add: equ) + then have "?hb + (hom_induced n (lsphere n) (equator n) (usphere n) (equator n) neg zp) + = (z [^]\<^bsub>homology_group (int n - 1) (nsphere (n - Suc 0))\<^esub> Brouwer_degree2 (n - Suc 0) neg)" + by (metis "*" comp_apply zp_z) + also have "\ = ?hb (zn [^]\<^bsub>relative_homology_group n (usphere n) (equator n)\<^esub> + Brouwer_degree2 (n - Suc 0) neg)" + by (metis group.int_pow_subgroup_generated group_relative_homology_group hb_hom.hom_int_pow reduced_homology_group_def zcarr zn_z zncarr) + finally show "?hb (hom_induced n (lsphere n) (equator n) (usphere n) (equator n) neg zp) = + ?hb (zn [^]\<^bsub>relative_homology_group n (usphere n) (equator n)\<^esub> + Brouwer_degree2 (n - Suc 0) neg)" by simp + qed (auto simp: hom_induced_carrier group.int_pow_closed zncarr) + qed + finally show ?thesis + by (metis (no_types, lifting) group_hom.hom_int_pow group_hom_axioms_def group_hom_def group_relative_homology_group hom_induced local.up_def un_def zncarr) + qed + have "continuous_map (nsphere (n - Suc 0)) (nsphere (n - Suc 0)) neg" + using cm_neg by blast + then have "homeomorphic_map (nsphere (n - Suc 0)) (nsphere (n - Suc 0)) neg" + apply (auto simp: homeomorphic_map_maps homeomorphic_maps_def) + apply (rule_tac x=neg in exI, auto) + done + then have Brouwer_degree2_21: "Brouwer_degree2 (n - Suc 0) neg ^ 2 = 1" + using Brouwer_degree2_homeomorphic_map power2_eq_1_iff by force + have hi_un_eq_up: "?hi_ee neg un = up [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" (is "?f un = ?y") + proof - + have [simp]: "neg \ neg = id" + by force + have "?f (?f ?y) = ?y" + apply (subst hom_induced_compose' [OF cm_neg _ cm_neg]) + apply(force simp: equator_def) + apply (simp add: upcarr hom_induced_id_gen) + done + moreover have "?f ?y = un" + using upcarr apply (simp only: gh_een.hom_int_pow hi_up_eq_un) + by (metis (no_types, lifting) Brouwer_degree2_21 GE.group_l_invI GE.l_inv_ex group.int_pow_1 group.int_pow_pow power2_eq_1_iff uncarr zmult_eq_1_iff) + ultimately show "?f un = ?y" + by simp + qed + have "?hi_ee f un = un [^]\<^bsub>?rhgn (equator n)\<^esub> a \\<^bsub>?rhgn (equator n)\<^esub> up [^]\<^bsub>?rhgn (equator n)\<^esub> b" + proof - + let ?TE = "topspace (nsphere n) \ equator n" + have fneg: "(f \ neg) x = (neg \ f) x" if "x \ topspace (nsphere n)" for x + using f [OF that] by (force simp: neg_def) + have neg_im: "neg ` (topspace (nsphere n) \ equator n) \ topspace (nsphere n) \ equator n" + by (metis cm_neg continuous_map_image_subset_topspace equ(1) topspace_subtopology) + have 1: "hom_induced n (nsphere n) ?TE (nsphere n) ?TE f \ hom_induced n (nsphere n) ?TE (nsphere n) ?TE neg + = hom_induced n (nsphere n) ?TE (nsphere n) ?TE neg \ hom_induced n (nsphere n) ?TE (nsphere n) ?TE f" + using neg_im fimeq cm_neg cmf + apply (simp add: flip: hom_induced_compose del: hom_induced_restrict) + using fneg by (auto intro: hom_induced_eq) + have "(un [^]\<^bsub>?rhgn (equator n)\<^esub> a) \\<^bsub>?rhgn (equator n)\<^esub> (up [^]\<^bsub>?rhgn (equator n)\<^esub> b) + = un [^]\<^bsub>?rhgn (equator n)\<^esub> (Brouwer_degree2 (n - 1) neg * a * Brouwer_degree2 (n - 1) neg) + \\<^bsub>?rhgn (equator n)\<^esub> + up [^]\<^bsub>?rhgn (equator n)\<^esub> (Brouwer_degree2 (n - 1) neg * b * Brouwer_degree2 (n - 1) neg)" + proof - + have "Brouwer_degree2 (n - Suc 0) neg = 1 \ Brouwer_degree2 (n - Suc 0) neg = - 1" + using Brouwer_degree2_21 power2_eq_1_iff by blast + then show ?thesis + by fastforce + qed + also have "\ = ((un [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - 1) neg) [^]\<^bsub>?rhgn (equator n)\<^esub> a \\<^bsub>?rhgn (equator n)\<^esub> + (up [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - 1) neg) [^]\<^bsub>?rhgn (equator n)\<^esub> b) [^]\<^bsub>?rhgn (equator n)\<^esub> + Brouwer_degree2 (n - 1) neg" + by (simp add: GE.int_pow_distrib GE.int_pow_pow uncarr upcarr) + also have "\ = ?hi_ee neg (?hi_ee f up) [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" + by (simp add: gh_een.hom_int_pow hi_un_eq_up hi_up_eq_un uncarr up_ab upcarr) + finally have 2: "(un [^]\<^bsub>?rhgn (equator n)\<^esub> a) \\<^bsub>?rhgn (equator n)\<^esub> (up [^]\<^bsub>?rhgn (equator n)\<^esub> b) + = ?hi_ee neg (?hi_ee f up) [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" . + have "un = ?hi_ee neg up [^]\<^bsub>?rhgn (equator n)\<^esub> Brouwer_degree2 (n - Suc 0) neg" + by (metis (no_types, hide_lams) Brouwer_degree2_21 GE.int_pow_1 GE.int_pow_pow hi_up_eq_un power2_eq_1_iff uncarr zmult_eq_1_iff) + moreover have "?hi_ee f ((?hi_ee neg up) [^]\<^bsub>?rhgn (equator n)\<^esub> (Brouwer_degree2 (n - Suc 0) neg)) + = un [^]\<^bsub>?rhgn (equator n)\<^esub> a \\<^bsub>?rhgn (equator n)\<^esub> up [^]\<^bsub>?rhgn (equator n)\<^esub> b" + using 1 2 by (simp add: hom_induced_carrier gh_eef.hom_int_pow fun_eq_iff) + ultimately show ?thesis + by blast + qed + then have "?hi_ee f u = u [^]\<^bsub>?rhgn (equator n)\<^esub> (a - b)" + by (simp add: u_def upcarr uncarr up_ab GE.int_pow_diff GE.m_ac GE.int_pow_distrib GE.int_pow_inv GE.inv_mult_group) + ultimately + have "Brouwer_degree2 n f = a - b" + using iff by blast + with Bd_ab show ?thesis + by simp +qed simp + + +subsection \General Jordan-Brouwer separation theorem and invariance of dimension\ + +proposition relative_homology_group_Euclidean_complement_step: + assumes "closedin (Euclidean_space n) S" + shows "relative_homology_group p (Euclidean_space n) (topspace(Euclidean_space n) - S) + \ relative_homology_group (p + k) (Euclidean_space (n+k)) (topspace(Euclidean_space (n+k)) - S)" +proof - + have *: "relative_homology_group p (Euclidean_space n) (topspace(Euclidean_space n) - S) + \ relative_homology_group (p + 1) (Euclidean_space (Suc n)) (topspace(Euclidean_space (Suc n)) - {x \ S. x n = 0})" + (is "?lhs \ ?rhs") + if clo: "closedin (Euclidean_space (Suc n)) S" and cong: "\x y. \x \ S; \i. i \ n \ x i = y i\ \ y \ S" + for p n S + proof - + have Ssub: "S \ topspace (Euclidean_space (Suc n))" + by (meson clo closedin_def) + define lo where "lo \ {x \ topspace(Euclidean_space (Suc n)). x n < (if x \ S then 0 else 1)}" + define hi where "hi = {x \ topspace(Euclidean_space (Suc n)). x n > (if x \ S then 0 else -1)}" + have lo_hi_Int: "lo \ hi = {x \ topspace(Euclidean_space (Suc n)) - S. x n \ {-1<..<1}}" + by (auto simp: hi_def lo_def) + have lo_hi_Un: "lo \ hi = topspace(Euclidean_space (Suc n)) - {x \ S. x n = 0}" + by (auto simp: hi_def lo_def) + define ret where "ret \ \c::real. \x i. if i = n then c else x i" + have cm_ret: "continuous_map (powertop_real UNIV) (powertop_real UNIV) (ret t)" for t + by (auto simp: ret_def continuous_map_componentwise_UNIV intro: continuous_map_product_projection) + let ?ST = "\t. subtopology (Euclidean_space (Suc n)) {x. x n = t}" + define squashable where + "squashable \ \t S. \x t'. x \ S \ (x n \ t' \ t' \ t \ t \ t' \ t' \ x n) \ ret t' x \ S" + have squashable: "squashable t (topspace(Euclidean_space(Suc n)))" for t + by (simp add: squashable_def topspace_Euclidean_space ret_def) + have squashableD: "\squashable t S; x \ S; x n \ t' \ t' \ t \ t \ t' \ t' \ x n\ \ ret t' x \ S" for x t' t S + by (auto simp: squashable_def) + have "squashable 1 hi" + by (force simp: squashable_def hi_def ret_def topspace_Euclidean_space intro: cong) + have "squashable t UNIV" for t + by (force simp: squashable_def hi_def ret_def topspace_Euclidean_space intro: cong) + have squashable_0_lohi: "squashable 0 (lo \ hi)" + using Ssub + by (auto simp: squashable_def hi_def lo_def ret_def topspace_Euclidean_space intro: cong) + have rm_ret: "retraction_maps (subtopology (Euclidean_space (Suc n)) U) + (subtopology (Euclidean_space (Suc n)) {x. x \ U \ x n = t}) + (ret t) id" + if "squashable t U" for t U + unfolding retraction_maps_def + proof (intro conjI ballI) + show "continuous_map (subtopology (Euclidean_space (Suc n)) U) + (subtopology (Euclidean_space (Suc n)) {x \ U. x n = t}) (ret t)" + apply (simp add: cm_ret continuous_map_in_subtopology continuous_map_from_subtopology Euclidean_space_def) + using that by (fastforce simp: squashable_def ret_def) + next + show "continuous_map (subtopology (Euclidean_space (Suc n)) {x \ U. x n = t}) + (subtopology (Euclidean_space (Suc n)) U) id" + using continuous_map_in_subtopology by fastforce + show "ret t (id x) = x" + if "x \ topspace (subtopology (Euclidean_space (Suc n)) {x \ U. x n = t})" for x + using that by (simp add: topspace_Euclidean_space ret_def fun_eq_iff) + qed + have cm_snd: "continuous_map (prod_topology (top_of_set {0..1}) (subtopology (powertop_real UNIV) S)) + euclideanreal (\x. snd x k)" for k::nat and S + using continuous_map_componentwise_UNIV continuous_map_into_fulltopology continuous_map_snd by fastforce + have cm_fstsnd: "continuous_map (prod_topology (top_of_set {0..1}) (subtopology (powertop_real UNIV) S)) + euclideanreal (\x. fst x * snd x k)" for k::nat and S + by (intro continuous_intros continuous_map_into_fulltopology [OF continuous_map_fst] cm_snd) + have hw_sub: "homotopic_with (\k. k ` V \ V) (subtopology (Euclidean_space (Suc n)) U) + (subtopology (Euclidean_space (Suc n)) U) (ret t) id" + if "squashable t U" "squashable t V" for U V t + unfolding homotopic_with_def + proof (intro exI conjI allI ballI) + let ?h = "\(z,x). ret ((1 - z) * t + z * x n) x" + show "(\x. ?h (u, x)) ` V \ V" if "u \ {0..1}" for u + using that + by clarsimp (metis squashableD [OF \squashable t V\] convex_bound_le diff_ge_0_iff_ge eq_diff_eq' le_cases less_eq_real_def segment_bound_lemma) + have 1: "?h ` ({0..1} \ ({x. \i\Suc n. x i = 0} \ U)) \ U" + by clarsimp (metis squashableD [OF \squashable t U\] convex_bound_le diff_ge_0_iff_ge eq_diff_eq' le_cases less_eq_real_def segment_bound_lemma) + show "continuous_map (prod_topology (top_of_set {0..1}) (subtopology (Euclidean_space (Suc n)) U)) + (subtopology (Euclidean_space (Suc n)) U) ?h" + apply (simp add: continuous_map_in_subtopology Euclidean_space_def subtopology_subtopology 1) + apply (auto simp: case_prod_unfold ret_def continuous_map_componentwise_UNIV) + apply (intro continuous_map_into_fulltopology [OF continuous_map_fst] cm_snd continuous_intros) + by (auto simp: cm_snd) + qed (auto simp: ret_def) + have cs_hi: "contractible_space(subtopology (Euclidean_space(Suc n)) hi)" + proof - + have "homotopic_with (\x. True) (?ST 1) (?ST 1) id (\x. (\i. if i = n then 1 else 0))" + apply (subst homotopic_with_sym) + apply (simp add: homotopic_with) + apply (rule_tac x="(\(z,x) i. if i=n then 1 else z * x i)" in exI) + apply (auto simp: Euclidean_space_def subtopology_subtopology continuous_map_in_subtopology case_prod_unfold continuous_map_componentwise_UNIV cm_fstsnd) + done + then have "contractible_space (?ST 1)" + unfolding contractible_space_def by metis + moreover have "?thesis = contractible_space (?ST 1)" + proof (intro deformation_retract_imp_homotopy_equivalent_space homotopy_equivalent_space_contractibility) + have "{x. \i\Suc n. x i = 0} \ {x \ hi. x n = 1} = {x. \i\Suc n. x i = 0} \ {x. x n = 1}" + by (auto simp: hi_def topspace_Euclidean_space) + then have eq: "subtopology (Euclidean_space (Suc n)) {x. x \ hi \ x n = 1} = ?ST 1" + by (simp add: Euclidean_space_def subtopology_subtopology) + show "homotopic_with (\x. True) (subtopology (Euclidean_space (Suc n)) hi) (subtopology (Euclidean_space (Suc n)) hi) (ret 1) id" + using hw_sub [OF \squashable 1 hi\ \squashable 1 UNIV\] eq by simp + show "retraction_maps (subtopology (Euclidean_space (Suc n)) hi) (?ST 1) (ret 1) id" + using rm_ret [OF \squashable 1 hi\] eq by simp + qed + ultimately show ?thesis by metis + qed + have "?lhs \ relative_homology_group p (Euclidean_space (Suc n)) (lo \ hi)" + proof (rule group.iso_sym [OF _ deformation_retract_imp_isomorphic_relative_homology_groups]) + have "{x. \i\Suc n. x i = 0} \ {x. x n = 0} = {x. \i\n. x i = (0::real)}" + by auto (metis le_less_Suc_eq not_le) + then have "?ST 0 = Euclidean_space n" + by (simp add: Euclidean_space_def subtopology_subtopology) + then show "retraction_maps (Euclidean_space (Suc n)) (Euclidean_space n) (ret 0) id" + using rm_ret [OF \squashable 0 UNIV\] by auto + then have "ret 0 x \ topspace (Euclidean_space n)" + if "x \ topspace (Euclidean_space (Suc n))" "-1 < x n" "x n < 1" for x + using that by (simp add: continuous_map_def retraction_maps_def) + then show "(ret 0) ` (lo \ hi) \ topspace (Euclidean_space n) - S" + by (auto simp: local.cong ret_def hi_def lo_def) + show "homotopic_with (\h. h ` (lo \ hi) \ lo \ hi) (Euclidean_space (Suc n)) (Euclidean_space (Suc n)) (ret 0) id" + using hw_sub [OF squashable squashable_0_lohi] by simp + qed (auto simp: lo_def hi_def Euclidean_space_def) + also have "\ \ relative_homology_group p (subtopology (Euclidean_space (Suc n)) hi) (lo \ hi)" + proof (rule group.iso_sym [OF _ isomorphic_relative_homology_groups_inclusion_contractible]) + show "contractible_space (subtopology (Euclidean_space (Suc n)) hi)" + by (simp add: cs_hi) + show "topspace (Euclidean_space (Suc n)) \ hi \ {}" + apply (simp add: hi_def topspace_Euclidean_space set_eq_iff) + apply (rule_tac x="\i. if i = n then 1 else 0" in exI, auto) + done + qed auto + also have "\ \ relative_homology_group p (subtopology (Euclidean_space (Suc n)) (lo \ hi)) lo" + proof - + have oo: "openin (Euclidean_space (Suc n)) {x \ topspace (Euclidean_space (Suc n)). x n \ A}" + if "open A" for A + proof (rule openin_continuous_map_preimage) + show "continuous_map (Euclidean_space (Suc n)) euclideanreal (\x. x n)" + proof - + have "\n f. continuous_map (product_topology f UNIV) (f (n::nat)) (\f. f n::real)" + by (simp add: continuous_map_product_projection) + then show ?thesis + using Euclidean_space_def continuous_map_from_subtopology + by (metis (mono_tags)) + qed + qed (auto intro: that) + have "openin (Euclidean_space(Suc n)) lo" + apply (simp add: openin_subopen [of _ lo]) + apply (simp add: lo_def, safe) + apply (force intro: oo [of "lessThan 0", simplified] open_Collect_less) + apply (rule_tac x="{x \ topspace(Euclidean_space(Suc n)). x n < 1} + \ (topspace(Euclidean_space(Suc n)) - S)" in exI) + using clo apply (force intro: oo [of "lessThan 1", simplified] open_Collect_less) + done + moreover have "openin (Euclidean_space(Suc n)) hi" + apply (simp add: openin_subopen [of _ hi]) + apply (simp add: hi_def, safe) + apply (force intro: oo [of "greaterThan 0", simplified] open_Collect_less) + apply (rule_tac x="{x \ topspace(Euclidean_space(Suc n)). x n > -1} + \ (topspace(Euclidean_space(Suc n)) - S)" in exI) + using clo apply (force intro: oo [of "greaterThan (-1)", simplified] open_Collect_less) + done + ultimately + have *: "subtopology (Euclidean_space (Suc n)) (lo \ hi) closure_of + (topspace (subtopology (Euclidean_space (Suc n)) (lo \ hi)) - hi) + \ subtopology (Euclidean_space (Suc n)) (lo \ hi) interior_of lo" + by (metis (no_types, lifting) Diff_idemp Diff_subset_conv Un_commute Un_upper2 closure_of_interior_of interior_of_closure_of interior_of_complement interior_of_eq lo_hi_Un openin_Un openin_open_subtopology topspace_subtopology_subset) + have eq: "((lo \ hi) \ (lo \ hi - (topspace (Euclidean_space (Suc n)) \ (lo \ hi) - hi))) = hi" + "(lo - (topspace (Euclidean_space (Suc n)) \ (lo \ hi) - hi)) = lo \ hi" + by (auto simp: lo_def hi_def Euclidean_space_def) + show ?thesis + using homology_excision_axiom [OF *, of "lo \ hi" p] + by (force simp: subtopology_subtopology eq is_iso_def) + qed + also have "\ \ relative_homology_group (p + 1 - 1) (subtopology (Euclidean_space (Suc n)) (lo \ hi)) lo" + by simp + also have "\ \ relative_homology_group (p + 1) (Euclidean_space (Suc n)) (lo \ hi)" + proof (rule group.iso_sym [OF _ isomorphic_relative_homology_groups_relboundary_contractible]) + have proj: "continuous_map (powertop_real UNIV) euclideanreal (\f. f n)" + by (metis UNIV_I continuous_map_product_projection) + have hilo: "\x. x \ hi \ (\i. if i = n then - x i else x i) \ lo" + "\x. x \ lo \ (\i. if i = n then - x i else x i) \ hi" + using local.cong + by (auto simp: hi_def lo_def topspace_Euclidean_space split: if_split_asm) + have "subtopology (Euclidean_space (Suc n)) hi homeomorphic_space subtopology (Euclidean_space (Suc n)) lo" + unfolding homeomorphic_space_def + apply (rule_tac x="\x i. if i = n then -(x i) else x i" in exI)+ + using proj + apply (auto simp: homeomorphic_maps_def Euclidean_space_def continuous_map_in_subtopology + hilo continuous_map_componentwise_UNIV continuous_map_from_subtopology continuous_map_minus + intro: continuous_map_from_subtopology continuous_map_product_projection) + done + then have "contractible_space(subtopology (Euclidean_space(Suc n)) hi) + \ contractible_space (subtopology (Euclidean_space (Suc n)) lo)" + by (rule homeomorphic_space_contractibility) + then show "contractible_space (subtopology (Euclidean_space (Suc n)) lo)" + using cs_hi by auto + show "topspace (Euclidean_space (Suc n)) \ lo \ {}" + apply (simp add: lo_def Euclidean_space_def set_eq_iff) + apply (rule_tac x="\i. if i = n then -1 else 0" in exI, auto) + done + qed auto + also have "\ \ ?rhs" + by (simp flip: lo_hi_Un) + finally show ?thesis . + qed + show ?thesis + proof (induction k) + case (Suc m) + with assms obtain T where cloT: "closedin (powertop_real UNIV) T" + and SeqT: "S = T \ {x. \i\n. x i = 0}" + by (auto simp: Euclidean_space_def closedin_subtopology) + then have "closedin (Euclidean_space (m + n)) S" + apply (simp add: Euclidean_space_def closedin_subtopology) + apply (rule_tac x="T \ topspace(Euclidean_space n)" in exI) + using closedin_Euclidean_space topspace_Euclidean_space by force + moreover have "relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) + \ relative_homology_group (p + 1) (Euclidean_space (Suc n)) (topspace (Euclidean_space (Suc n)) - S)" + if "closedin (Euclidean_space n) S" for p n + proof - + define S' where "S' \ {x \ topspace(Euclidean_space(Suc n)). (\i. if i < n then x i else 0) \ S}" + have Ssub_n: "S \ topspace (Euclidean_space n)" + by (meson that closedin_def) + have "relative_homology_group p (Euclidean_space n) (topspace(Euclidean_space n) - S') + \ relative_homology_group (p + 1) (Euclidean_space (Suc n)) (topspace(Euclidean_space (Suc n)) - {x \ S'. x n = 0})" + proof (rule *) + have cm: "continuous_map (powertop_real UNIV) euclideanreal (\f. f u)" for u + by (metis UNIV_I continuous_map_product_projection) + have "continuous_map (subtopology (powertop_real UNIV) {x. \i>n. x i = 0}) euclideanreal + (\x. if k \ n then x k else 0)" for k + by (simp add: continuous_map_from_subtopology [OF cm]) + moreover have "\i\n. (if i < n then x i else 0) = 0" + if "x \ topspace (subtopology (powertop_real UNIV) {x. \i>n. x i = 0})" for x + using that by simp + ultimately have "continuous_map (Euclidean_space (Suc n)) (Euclidean_space n) (\x i. if i < n then x i else 0)" + by (simp add: Euclidean_space_def continuous_map_in_subtopology continuous_map_componentwise_UNIV + continuous_map_from_subtopology [OF cm] image_subset_iff) + then show "closedin (Euclidean_space (Suc n)) S'" + unfolding S'_def using that by (rule closedin_continuous_map_preimage) + next + fix x y + assume xy: "\i. i \ n \ x i = y i" "x \ S'" + then have "(\i. if i < n then x i else 0) = (\i. if i < n then y i else 0)" + by (simp add: S'_def Euclidean_space_def fun_eq_iff) + with xy show "y \ S'" + by (simp add: S'_def Euclidean_space_def) + qed + moreover + have abs_eq: "(\i. if i < n then x i else 0) = x" if "\i. i \ n \ x i = 0" for x :: "nat \ real" and n + using that by auto + then have "topspace (Euclidean_space n) - S' = topspace (Euclidean_space n) - S" + by (simp add: S'_def Euclidean_space_def set_eq_iff cong: conj_cong) + moreover + have "topspace (Euclidean_space (Suc n)) - {x \ S'. x n = 0} = topspace (Euclidean_space (Suc n)) - S" + using Ssub_n + apply (auto simp: S'_def subset_iff Euclidean_space_def set_eq_iff abs_eq cong: conj_cong) + by (metis abs_eq le_antisym not_less_eq_eq) + ultimately show ?thesis + by simp + qed + ultimately have "relative_homology_group (p + m)(Euclidean_space (m + n))(topspace (Euclidean_space (m + n)) - S) + \ relative_homology_group (p + m + 1) (Euclidean_space (Suc (m + n))) (topspace (Euclidean_space (Suc (m + n))) - S)" + by (metis \closedin (Euclidean_space (m + n)) S\) + then show ?case + using Suc.IH iso_trans by (force simp: algebra_simps) + qed (simp add: iso_refl) +qed + +lemma iso_Euclidean_complements_lemma1: + assumes S: "closedin (Euclidean_space m) S" and cmf: "continuous_map(subtopology (Euclidean_space m) S) (Euclidean_space n) f" + obtains g where "continuous_map (Euclidean_space m) (Euclidean_space n) g" + "\x. x \ S \ g x = f x" +proof - + have cont: "continuous_on (topspace (Euclidean_space m) \ S) (\x. f x i)" for i + by (metis (no_types) continuous_on_product_then_coordinatewise + cm_Euclidean_space_iff_continuous_on cmf topspace_subtopology) + have "f ` (topspace (Euclidean_space m) \ S) \ topspace (Euclidean_space n)" + using cmf continuous_map_image_subset_topspace by fastforce + then + have "\g. continuous_on (topspace (Euclidean_space m)) g \ (\x \ S. g x = f x i)" for i + using S Tietze_unbounded [OF cont [of i]] + by (metis closedin_Euclidean_space_iff closedin_closed_Int topspace_subtopology topspace_subtopology_subset) + then obtain g where cmg: "\i. continuous_map (Euclidean_space m) euclideanreal (g i)" + and gf: "\i x. x \ S \ g i x = f x i" + unfolding continuous_map_Euclidean_space_iff by metis + let ?GG = "\x i. if i < n then g i x else 0" + show thesis + proof + show "continuous_map (Euclidean_space m) (Euclidean_space n) ?GG" + unfolding Euclidean_space_def [of n] + by (auto simp: continuous_map_in_subtopology continuous_map_componentwise cmg) + show "?GG x = f x" if "x \ S" for x + proof - + have "S \ topspace (Euclidean_space m)" + by (meson S closedin_def) + then have "f x \ topspace (Euclidean_space n)" + using cmf that unfolding continuous_map_def topspace_subtopology by blast + then show ?thesis + by (force simp: topspace_Euclidean_space gf that) + qed + qed +qed + + +lemma iso_Euclidean_complements_lemma2: + assumes S: "closedin (Euclidean_space m) S" + and T: "closedin (Euclidean_space n) T" + and hom: "homeomorphic_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f" + obtains g where "homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) + (prod_topology (Euclidean_space n) (Euclidean_space m)) g" + "\x. x \ S \ g(x,(\i. 0)) = (f x,(\i. 0))" +proof - + obtain g where cmf: "continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f" + and cmg: "continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g" + and gf: "\x. x \ S \ g (f x) = x" + and fg: "\y. y \ T \ f (g y) = y" + using hom S T closedin_subset unfolding homeomorphic_map_maps homeomorphic_maps_def + by fastforce + obtain f' where cmf': "continuous_map (Euclidean_space m) (Euclidean_space n) f'" + and f'f: "\x. x \ S \ f' x = f x" + using iso_Euclidean_complements_lemma1 S cmf continuous_map_into_fulltopology by metis + obtain g' where cmg': "continuous_map (Euclidean_space n) (Euclidean_space m) g'" + and g'g: "\x. x \ T \ g' x = g x" + using iso_Euclidean_complements_lemma1 T cmg continuous_map_into_fulltopology by metis + define p where "p \ \(x,y). (x,(\i. y i + f' x i))" + define p' where "p' \ \(x,y). (x,(\i. y i - f' x i))" + define q where "q \ \(x,y). (x,(\i. y i + g' x i))" + define q' where "q' \ \(x,y). (x,(\i. y i - g' x i))" + have "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) + (prod_topology (Euclidean_space m) (Euclidean_space n)) + p p'" + "homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) + (prod_topology (Euclidean_space n) (Euclidean_space m)) + q q'" + "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) + (prod_topology (Euclidean_space n) (Euclidean_space m)) (\(x,y). (y,x)) (\(x,y). (y,x))" + apply (simp_all add: p_def p'_def q_def q'_def homeomorphic_maps_def continuous_map_pairwise) + apply (force simp: case_prod_unfold continuous_map_of_fst [unfolded o_def] cmf' cmg' intro: continuous_intros)+ + done + then have "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) + (prod_topology (Euclidean_space n) (Euclidean_space m)) + (q' \ (\(x,y). (y,x)) \ p) (p' \ ((\(x,y). (y,x)) \ q))" + using homeomorphic_maps_compose homeomorphic_maps_sym by (metis (no_types, lifting)) + moreover + have "\x. x \ S \ (q' \ (\(x,y). (y,x)) \ p) (x, \i. 0) = (f x, \i. 0)" + apply (simp add: q'_def p_def f'f) + apply (simp add: fun_eq_iff) + by (metis S T closedin_subset g'g gf hom homeomorphic_imp_surjective_map image_eqI topspace_subtopology_subset) + ultimately + show thesis + using homeomorphic_map_maps that by blast +qed + + +proposition isomorphic_relative_homology_groups_Euclidean_complements: + assumes S: "closedin (Euclidean_space n) S" and T: "closedin (Euclidean_space n) T" + and hom: "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "relative_homology_group p (Euclidean_space n) (topspace(Euclidean_space n) - S) + \ relative_homology_group p (Euclidean_space n) (topspace(Euclidean_space n) - T)" +proof - + have subST: "S \ topspace(Euclidean_space n)" "T \ topspace(Euclidean_space n)" + by (meson S T closedin_def)+ + have "relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) + \ relative_homology_group (p + int n) (Euclidean_space (n + n)) (topspace (Euclidean_space (n + n)) - S)" + using relative_homology_group_Euclidean_complement_step [OF S] by blast + moreover have "relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T) + \ relative_homology_group (p + int n) (Euclidean_space (n + n)) (topspace (Euclidean_space (n + n)) - T)" + using relative_homology_group_Euclidean_complement_step [OF T] by blast + moreover have "relative_homology_group (p + int n) (Euclidean_space (n + n)) (topspace (Euclidean_space (n + n)) - S) + \ relative_homology_group (p + int n) (Euclidean_space (n + n)) (topspace (Euclidean_space (n + n)) - T)" + proof - + obtain f where f: "homeomorphic_map (subtopology (Euclidean_space n) S) + (subtopology (Euclidean_space n) T) f" + using hom unfolding homeomorphic_space by blast + obtain g where g: "homeomorphic_map (prod_topology (Euclidean_space n) (Euclidean_space n)) + (prod_topology (Euclidean_space n) (Euclidean_space n)) g" + and gf: "\x. x \ S \ g(x,(\i. 0)) = (f x,(\i. 0))" + using S T f iso_Euclidean_complements_lemma2 by blast + define h where "h \ \x::nat \real. ((\i. if i < n then x i else 0), (\j. if j < n then x(n + j) else 0))" + define k where "k \ \(x,y) i. if i < 2 * n then if i < n then x i else y(i - n) else (0::real)" + have hk: "homeomorphic_maps (Euclidean_space(2 * n)) (prod_topology (Euclidean_space n) (Euclidean_space n)) h k" + unfolding homeomorphic_maps_def + proof safe + show "continuous_map (Euclidean_space (2 * n)) + (prod_topology (Euclidean_space n) (Euclidean_space n)) h" + apply (simp add: h_def continuous_map_pairwise o_def continuous_map_componentwise_Euclidean_space) + unfolding Euclidean_space_def + by (metis (mono_tags) UNIV_I continuous_map_from_subtopology continuous_map_product_projection) + have "continuous_map (prod_topology (Euclidean_space n) (Euclidean_space n)) euclideanreal (\p. fst p i)" for i + using Euclidean_space_def continuous_map_into_fulltopology continuous_map_fst by fastforce + moreover + have "continuous_map (prod_topology (Euclidean_space n) (Euclidean_space n)) euclideanreal (\p. snd p (i - n))" for i + using Euclidean_space_def continuous_map_into_fulltopology continuous_map_snd by fastforce + ultimately + show "continuous_map (prod_topology (Euclidean_space n) (Euclidean_space n)) + (Euclidean_space (2 * n)) k" + by (simp add: k_def continuous_map_pairwise o_def continuous_map_componentwise_Euclidean_space case_prod_unfold) + qed (auto simp: k_def h_def fun_eq_iff topspace_Euclidean_space) + define kgh where "kgh \ k \ g \ h" + let ?i = "hom_induced (p + n) (Euclidean_space(2 * n)) (topspace(Euclidean_space(2 * n)) - S) + (Euclidean_space(2 * n)) (topspace(Euclidean_space(2 * n)) - T) kgh" + have "?i \ iso (relative_homology_group (p + int n) (Euclidean_space (2 * n)) + (topspace (Euclidean_space (2 * n)) - S)) + (relative_homology_group (p + int n) (Euclidean_space (2 * n)) + (topspace (Euclidean_space (2 * n)) - T))" + proof (rule homeomorphic_map_relative_homology_iso) + show hm: "homeomorphic_map (Euclidean_space (2 * n)) (Euclidean_space (2 * n)) kgh" + unfolding kgh_def by (meson hk g homeomorphic_map_maps homeomorphic_maps_compose homeomorphic_maps_sym) + have Teq: "T = f ` S" + using f homeomorphic_imp_surjective_map subST(1) subST(2) topspace_subtopology_subset by blast + have khf: "\x. x \ S \ k(h(f x)) = f x" + by (metis (no_types, lifting) Teq hk homeomorphic_maps_def image_subset_iff le_add1 mult_2 subST(2) subsetD subset_Euclidean_space) + have gh: "g(h x) = h(f x)" if "x \ S" for x + proof - + have [simp]: "(\i. if i < n then x i else 0) = x" + using subST(1) that topspace_Euclidean_space by (auto simp: fun_eq_iff) + have "f x \ topspace(Euclidean_space n)" + using Teq subST(2) that by blast + moreover have "(\j. if j < n then x (n + j) else 0) = (\j. 0::real)" + using Euclidean_space_def subST(1) that by force + ultimately show ?thesis + by (simp add: topspace_Euclidean_space h_def gf \x \ S\ fun_eq_iff) + qed + have *: "\S \ U; T \ U; kgh ` U = U; inj_on kgh U; kgh ` S = T\ \ kgh ` (U - S) = U - T" for U + unfolding inj_on_def set_eq_iff by blast + show "kgh ` (topspace (Euclidean_space (2 * n)) - S) = topspace (Euclidean_space (2 * n)) - T" + proof (rule *) + show "kgh ` topspace (Euclidean_space (2 * n)) = topspace (Euclidean_space (2 * n))" + by (simp add: hm homeomorphic_imp_surjective_map) + show "inj_on kgh (topspace (Euclidean_space (2 * n)))" + using hm homeomorphic_map_def by auto + show "kgh ` S = T" + by (simp add: Teq kgh_def gh khf) + qed (use subST topspace_Euclidean_space in \fastforce+\) + qed auto + then show ?thesis + by (simp add: is_isoI mult_2) + qed + ultimately show ?thesis + by (meson group.iso_sym iso_trans group_relative_homology_group) +qed + +lemma lemma_iod: + assumes "S \ T" "S \ {}" and Tsub: "T \ topspace(Euclidean_space n)" + and S: "\a b u. \a \ S; b \ T; 0 < u; u < 1\ \ (\i. (1 - u) * a i + u * b i) \ S" + shows "path_connectedin (Euclidean_space n) T" +proof - + obtain a where "a \ S" + using assms by blast + have "path_component_of (subtopology (Euclidean_space n) T) a b" if "b \ T" for b + unfolding path_component_of_def + proof (intro exI conjI) + have [simp]: "\i\n. a i = 0" + using Tsub \a \ S\ assms(1) topspace_Euclidean_space by auto + have [simp]: "\i\n. b i = 0" + using Tsub that topspace_Euclidean_space by auto + have inT: "(\i. (1 - x) * a i + x * b i) \ T" if "0 \ x" "x \ 1" for x + proof (cases "x = 0 \ x = 1") + case True + with \a \ S\ \b \ T\ \S \ T\ show ?thesis + by force + next + case False + then show ?thesis + using subsetD [OF \S \ T\ S] \a \ S\ \b \ T\ that by auto + qed + have "continuous_on {0..1} (\x. (1 - x) * a k + x * b k)" for k + by (intro continuous_intros) + then show "pathin (subtopology (Euclidean_space n) T) (\t i. (1 - t) * a i + t * b i)" + apply (simp add: Euclidean_space_def subtopology_subtopology pathin_subtopology) + apply (simp add: pathin_def continuous_map_componentwise_UNIV inT) + done + qed auto + then have "path_connected_space (subtopology (Euclidean_space n) T)" + by (metis Tsub path_component_of_equiv path_connected_space_iff_path_component topspace_subtopology_subset) + then show ?thesis + by (simp add: Tsub path_connectedin_def) +qed + + +lemma invariance_of_dimension_closedin_Euclidean_space: + assumes "closedin (Euclidean_space n) S" + shows "subtopology (Euclidean_space n) S homeomorphic_space Euclidean_space n + \ S = topspace(Euclidean_space n)" + (is "?lhs = ?rhs") +proof + assume L: ?lhs + have Ssub: "S \ topspace (Euclidean_space n)" + by (meson assms closedin_def) + moreover have False if "a \ S" and "a \ topspace (Euclidean_space n)" for a + proof - + have cl_n: "closedin (Euclidean_space (Suc n)) (topspace(Euclidean_space n))" + using Euclidean_space_def closedin_Euclidean_space closedin_subtopology by fastforce + then have sub: "subtopology (Euclidean_space(Suc n)) (topspace(Euclidean_space n)) = Euclidean_space n" + by (metis (no_types, lifting) Euclidean_space_def closedin_subset subtopology_subtopology topspace_Euclidean_space topspace_subtopology topspace_subtopology_subset) + then have cl_S: "closedin (Euclidean_space(Suc n)) S" + using cl_n assms closedin_closed_subtopology by fastforce + have sub_SucS: "subtopology (Euclidean_space (Suc n)) S = subtopology (Euclidean_space n) S" + by (metis Ssub sub subtopology_subtopology topspace_subtopology topspace_subtopology_subset) + have non0: "{y. \x::nat\real. (\i\Suc n. x i = 0) \ (\i\n. x i \ 0) \ y = x n} = -{0}" + proof safe + show "False" if "\i\Suc n. f i = 0" "0 = f n" "n \ i" "f i \ 0" for f::"nat\real" and i + by (metis that le_antisym not_less_eq_eq) + show "\f::nat\real. (\i\Suc n. f i = 0) \ (\i\n. f i \ 0) \ a = f n" if "a \ 0" for a + by (rule_tac x="(\i. 0)(n:= a)" in exI) (force simp: that) + qed + have "homology_group 0 (subtopology (Euclidean_space (Suc n)) (topspace (Euclidean_space (Suc n)) - S)) + \ homology_group 0 (subtopology (Euclidean_space (Suc n)) (topspace (Euclidean_space (Suc n)) - topspace (Euclidean_space n)))" + proof (rule isomorphic_relative_contractible_space_imp_homology_groups) + show "(topspace (Euclidean_space (Suc n)) - S = {}) = + (topspace (Euclidean_space (Suc n)) - topspace (Euclidean_space n) = {})" + using cl_n closedin_subset that by auto + next + fix p + show "relative_homology_group p (Euclidean_space (Suc n)) + (topspace (Euclidean_space (Suc n)) - S) \ + relative_homology_group p (Euclidean_space (Suc n)) + (topspace (Euclidean_space (Suc n)) - topspace (Euclidean_space n))" + by (simp add: L sub_SucS cl_S cl_n isomorphic_relative_homology_groups_Euclidean_complements sub) + qed (auto simp: L) + moreover + have "continuous_map (powertop_real UNIV) euclideanreal (\x. x n)" + by (metis (no_types) UNIV_I continuous_map_product_projection) + then have cm: "continuous_map (subtopology (Euclidean_space (Suc n)) (topspace (Euclidean_space (Suc n)) - topspace (Euclidean_space n))) + euclideanreal (\x. x n)" + by (simp add: Euclidean_space_def continuous_map_from_subtopology) + have False if "path_connected_space + (subtopology (Euclidean_space (Suc n)) + (topspace (Euclidean_space (Suc n)) - topspace (Euclidean_space n)))" + using path_connectedin_continuous_map_image [OF cm that [unfolded path_connectedin_topspace [symmetric]]] + bounded_path_connected_Compl_real [of "{0}"] + by (simp add: topspace_Euclidean_space image_def Bex_def non0 flip: path_connectedin_topspace) + moreover + have eq: "T = T \ {x. x n \ 0} \ T \ {x. x n \ 0}" for T :: "(nat \ real) set" + by auto + have "path_connectedin (Euclidean_space (Suc n)) (topspace (Euclidean_space (Suc n)) - S)" + proof (subst eq, rule path_connectedin_Un) + have "topspace(Euclidean_space(Suc n)) \ {x. x n = 0} = topspace(Euclidean_space n)" + apply (auto simp: topspace_Euclidean_space) + by (metis Suc_leI inf.absorb_iff2 inf.orderE leI) + let ?S = "topspace(Euclidean_space(Suc n)) \ {x. x n < 0}" + show "path_connectedin (Euclidean_space (Suc n)) + ((topspace (Euclidean_space (Suc n)) - S) \ {x. x n \ 0})" + proof (rule lemma_iod) + show "?S \ (topspace (Euclidean_space (Suc n)) - S) \ {x. x n \ 0}" + using Ssub topspace_Euclidean_space by auto + show "?S \ {}" + apply (simp add: topspace_Euclidean_space set_eq_iff) + apply (rule_tac x="(\i. 0)(n:= -1)" in exI) + apply auto + done + fix a b and u::real + assume + "a \ ?S" "0 < u" "u < 1" + "b \ (topspace (Euclidean_space (Suc n)) - S) \ {x. x n \ 0}" + then show "(\i. (1 - u) * a i + u * b i) \ ?S" + by (simp add: topspace_Euclidean_space add_neg_nonpos less_eq_real_def mult_less_0_iff) + qed (simp add: topspace_Euclidean_space subset_iff) + let ?T = "topspace(Euclidean_space(Suc n)) \ {x. x n > 0}" + show "path_connectedin (Euclidean_space (Suc n)) + ((topspace (Euclidean_space (Suc n)) - S) \ {x. 0 \ x n})" + proof (rule lemma_iod) + show "?T \ (topspace (Euclidean_space (Suc n)) - S) \ {x. 0 \ x n}" + using Ssub topspace_Euclidean_space by auto + show "?T \ {}" + apply (simp add: topspace_Euclidean_space set_eq_iff) + apply (rule_tac x="(\i. 0)(n:= 1)" in exI) + apply auto + done + fix a b and u::real + assume "a \ ?T" "0 < u" "u < 1" "b \ (topspace (Euclidean_space (Suc n)) - S) \ {x. 0 \ x n}" + then show "(\i. (1 - u) * a i + u * b i) \ ?T" + by (simp add: topspace_Euclidean_space add_pos_nonneg) + qed (simp add: topspace_Euclidean_space subset_iff) + show "(topspace (Euclidean_space (Suc n)) - S) \ {x. x n \ 0} \ + ((topspace (Euclidean_space (Suc n)) - S) \ {x. 0 \ x n}) \ {}" + using that + apply (auto simp: Set.set_eq_iff topspace_Euclidean_space) + by (metis Suc_leD order_refl) + qed + then have "path_connected_space (subtopology (Euclidean_space (Suc n)) + (topspace (Euclidean_space (Suc n)) - S))" + apply (simp add: path_connectedin_subtopology flip: path_connectedin_topspace) + by (metis Int_Diff inf_idem) + ultimately + show ?thesis + using isomorphic_homology_imp_path_connectedness by blast + qed + ultimately show ?rhs + by blast +qed (simp add: homeomorphic_space_refl) + + + +lemma isomorphic_homology_groups_Euclidean_complements: + assumes "closedin (Euclidean_space n) S" "closedin (Euclidean_space n) T" + "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "homology_group p (subtopology (Euclidean_space n) (topspace(Euclidean_space n) - S)) + \ homology_group p (subtopology (Euclidean_space n) (topspace(Euclidean_space n) - T))" +proof (rule isomorphic_relative_contractible_space_imp_homology_groups) + show "topspace (Euclidean_space n) - S \ topspace (Euclidean_space n)" + using assms homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subtopology_superset by fastforce + show "topspace (Euclidean_space n) - T \ topspace (Euclidean_space n)" + using assms invariance_of_dimension_closedin_Euclidean_space subtopology_superset by force + show "(topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})" + by (metis Diff_eq_empty_iff assms closedin_subset homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subset_antisym subtopology_topspace) + show "relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \ + relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)" for p + using assms isomorphic_relative_homology_groups_Euclidean_complements by blast +qed auto + +lemma eqpoll_path_components_Euclidean_complements: + assumes "closedin (Euclidean_space n) S" "closedin (Euclidean_space n) T" + "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "path_components_of + (subtopology (Euclidean_space n) + (topspace(Euclidean_space n) - S)) + \ path_components_of + (subtopology (Euclidean_space n) + (topspace(Euclidean_space n) - T))" + by (simp add: assms isomorphic_homology_groups_Euclidean_complements isomorphic_homology_imp_path_components) + +lemma path_connectedin_Euclidean_complements: + assumes "closedin (Euclidean_space n) S" "closedin (Euclidean_space n) T" + "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "path_connectedin (Euclidean_space n) (topspace(Euclidean_space n) - S) + \ path_connectedin (Euclidean_space n) (topspace(Euclidean_space n) - T)" + by (meson Diff_subset assms isomorphic_homology_groups_Euclidean_complements isomorphic_homology_imp_path_connectedness path_connectedin_def) + +lemma eqpoll_connected_components_Euclidean_complements: + assumes S: "closedin (Euclidean_space n) S" and T: "closedin (Euclidean_space n) T" + and ST: "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "connected_components_of + (subtopology (Euclidean_space n) + (topspace(Euclidean_space n) - S)) + \ connected_components_of + (subtopology (Euclidean_space n) + (topspace(Euclidean_space n) - T))" + using eqpoll_path_components_Euclidean_complements [OF assms] + by (metis S T closedin_def locally_path_connected_Euclidean_space locally_path_connected_space_open_subset path_components_eq_connected_components_of) + +lemma connected_in_Euclidean_complements: + assumes "closedin (Euclidean_space n) S" "closedin (Euclidean_space n) T" + "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)" + shows "connectedin (Euclidean_space n) (topspace(Euclidean_space n) - S) + \ connectedin (Euclidean_space n) (topspace(Euclidean_space n) - T)" + apply (simp add: connectedin_def connected_space_iff_components_subset_singleton subset_singleton_iff_lepoll) + using eqpoll_connected_components_Euclidean_complements [OF assms] + by (meson eqpoll_sym lepoll_trans1) + + +theorem invariance_of_dimension_Euclidean_space: + "Euclidean_space m homeomorphic_space Euclidean_space n \ m = n" +proof (cases m n rule: linorder_cases) + case less + then have *: "topspace (Euclidean_space m) \ topspace (Euclidean_space n)" + by (meson le_cases not_le subset_Euclidean_space) + then have "Euclidean_space m = subtopology (Euclidean_space n) (topspace(Euclidean_space m))" + by (simp add: Euclidean_space_def inf.absorb_iff2 subtopology_subtopology) + then show ?thesis + by (metis (no_types, lifting) * Euclidean_space_def closedin_Euclidean_space closedin_closed_subtopology eq_iff invariance_of_dimension_closedin_Euclidean_space subset_Euclidean_space topspace_Euclidean_space) +next + case equal + then show ?thesis + by (simp add: homeomorphic_space_refl) +next + case greater + then have *: "topspace (Euclidean_space n) \ topspace (Euclidean_space m)" + by (meson le_cases not_le subset_Euclidean_space) + then have "Euclidean_space n = subtopology (Euclidean_space m) (topspace(Euclidean_space n))" + by (simp add: Euclidean_space_def inf.absorb_iff2 subtopology_subtopology) + then show ?thesis + by (metis (no_types, lifting) "*" Euclidean_space_def closedin_Euclidean_space closedin_closed_subtopology eq_iff homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subset_Euclidean_space topspace_Euclidean_space) +qed + + + +lemma biglemma: + assumes "n \ 0" and S: "compactin (Euclidean_space n) S" + and cmh: "continuous_map (subtopology (Euclidean_space n) S) (Euclidean_space n) h" + and "inj_on h S" + shows "path_connectedin (Euclidean_space n) (topspace(Euclidean_space n) - h ` S) + \ path_connectedin (Euclidean_space n) (topspace(Euclidean_space n) - S)" +proof (rule path_connectedin_Euclidean_complements) + have hS_sub: "h ` S \ topspace(Euclidean_space n)" + by (metis (no_types) S cmh compactin_subspace continuous_map_image_subset_topspace topspace_subtopology_subset) + show clo_S: "closedin (Euclidean_space n) S" + using assms by (simp add: continuous_map_in_subtopology Hausdorff_Euclidean_space compactin_imp_closedin) + show clo_hS: "closedin (Euclidean_space n) (h ` S)" + using Hausdorff_Euclidean_space S cmh compactin_absolute compactin_imp_closedin image_compactin by blast + have "homeomorphic_map (subtopology (Euclidean_space n) S) (subtopology (Euclidean_space n) (h ` S)) h" + proof (rule continuous_imp_homeomorphic_map) + show "compact_space (subtopology (Euclidean_space n) S)" + by (simp add: S compact_space_subtopology) + show "Hausdorff_space (subtopology (Euclidean_space n) (h ` S))" + using hS_sub + by (simp add: Hausdorff_Euclidean_space Hausdorff_space_subtopology) + show "continuous_map (subtopology (Euclidean_space n) S) (subtopology (Euclidean_space n) (h ` S)) h" + using cmh continuous_map_in_subtopology by fastforce + show "h ` topspace (subtopology (Euclidean_space n) S) = topspace (subtopology (Euclidean_space n) (h ` S))" + using clo_hS clo_S closedin_subset by auto + show "inj_on h (topspace (subtopology (Euclidean_space n) S))" + by (metis \inj_on h S\ clo_S closedin_def topspace_subtopology_subset) + qed + then show "subtopology (Euclidean_space n) (h ` S) homeomorphic_space subtopology (Euclidean_space n) S" + using homeomorphic_space homeomorphic_space_sym by blast +qed + + +lemma lemmaIOD: + assumes + "\T. T \ U \ c \ T" "\T. T \ U \ d \ T" "\U = c \ d" "\T. T \ U \ T \ {}" + "pairwise disjnt U" "~(\T. U \ {T})" + shows "c \ U" + using assms + apply safe + subgoal for C' D' + proof (cases "C'=D'") + show "c \ U" + if UU: "\ U = c \ d" + and U: "\T. T \ U \ T \ {}" "disjoint U" and "\T. U \ {T}" "c \ C'" "D' \ U" "d \ D'" "C' = D'" + proof - + have "c \ d = D'" + using Union_upper sup_mono UU that(5) that(6) that(7) that(8) by auto + then have "\U = D'" + by (simp add: UU) + with U have "U = {D'}" + by (metis (no_types, lifting) disjnt_Union1 disjnt_self_iff_empty insertCI pairwiseD subset_iff that(4) that(6)) + then show ?thesis + using that(4) by auto + qed + show "c \ U" + if "\ U = c \ d""disjoint U" "C' \ U" "c \ C'""D' \ U" "d \ D'" "C' \ D'" + proof - + have "C' \ D' = {}" + using \disjoint U\ \C' \ U\ \D' \ U\ \C' \ D'\unfolding disjnt_iff pairwise_def + by blast + then show ?thesis + using subset_antisym that(1) \C' \ U\ \c \ C'\ \d \ D'\ by fastforce + qed + qed + done + + + + +theorem invariance_of_domain_Euclidean_space: + assumes U: "openin (Euclidean_space n) U" + and cmf: "continuous_map (subtopology (Euclidean_space n) U) (Euclidean_space n) f" + and "inj_on f U" + shows "openin (Euclidean_space n) (f ` U)" (is "openin ?E (f ` U)") +proof (cases "n = 0") + case True + have [simp]: "Euclidean_space 0 = discrete_topology {\i. 0}" + by (auto simp: subtopology_eq_discrete_topology_sing topspace_Euclidean_space) + show ?thesis + using cmf True U by auto +next + case False + define enorm where "enorm \ \x. sqrt(\ii. if i = k then d else 0) = (if k < n then \d\ else 0)" for k d + using \n \ 0\ by (auto simp: enorm_def power2_eq_square if_distrib [of "\x. x * _"] cong: if_cong) + define zero::"nat\real" where "zero \ \i. 0" + have zero_in [simp]: "zero \ topspace ?E" + using False by (simp add: zero_def topspace_Euclidean_space) + have enorm_eq_0 [simp]: "enorm x = 0 \ x = zero" + if "x \ topspace(Euclidean_space n)" for x + using that unfolding zero_def enorm_def + apply (simp add: sum_nonneg_eq_0_iff fun_eq_iff topspace_Euclidean_space) + using le_less_linear by blast + have [simp]: "enorm zero = 0" + by (simp add: zero_def enorm_def) + have cm_enorm: "continuous_map ?E euclideanreal enorm" + unfolding enorm_def + proof (intro continuous_intros) + show "continuous_map ?E euclideanreal (\x. x i)" + if "i \ {.. enorm x" for x + by (auto simp: enorm_def sum_nonneg) + have le_enorm: "\x i\ \ enorm x" if "i < n" for i x + proof - + have "\x i\ \ sqrt (\k\{i}. (x k)\<^sup>2)" + by auto + also have "\ \ sqrt (\k2)" + by (rule real_sqrt_le_mono [OF sum_mono2]) (use that in auto) + finally show ?thesis + by (simp add: enorm_def) + qed + define B where "B \ \r. {x \ topspace ?E. enorm x < r}" + define C where "C \ \r. {x \ topspace ?E. enorm x \ r}" + define S where "S \ \r. {x \ topspace ?E. enorm x = r}" + have BC: "B r \ C r" and SC: "S r \ C r" and disjSB: "disjnt (S r) (B r)" and eqC: "B r \ S r = C r" for r + by (auto simp: B_def C_def S_def disjnt_def) + consider "n = 1" | "n \ 2" + using False by linarith + then have **: "openin ?E (h ` (B r))" + if "r > 0" and cmh: "continuous_map(subtopology ?E (C r)) ?E h" and injh: "inj_on h (C r)" for r h + proof cases + case 1 + define e :: "[real,nat]\real" where "e \ \x i. if i = 0 then x else 0" + define e' :: "(nat\real)\real" where "e' \ \x. x 0" + have "continuous_map euclidean euclideanreal (\f. f (0::nat))" + by auto + then have "continuous_map (subtopology (powertop_real UNIV) {f. \n\Suc 0. f n = 0}) euclideanreal (\f. f 0)" + by (metis (mono_tags) continuous_map_from_subtopology euclidean_product_topology) + then have hom_ee': "homeomorphic_maps euclideanreal (Euclidean_space 1) e e'" + by (auto simp: homeomorphic_maps_def e_def e'_def continuous_map_in_subtopology Euclidean_space_def) + have eBr: "e ` {-r<..x. x * _"] cong: if_cong) + have in_Cr: "\x. \-r < x; x < r\ \ (\i. if i = 0 then x else 0) \ C r" + using \n \ 0\ by (auto simp: C_def topspace_Euclidean_space) + have inj: "inj_on (e' \ h \ e) {- r<..i. if i = 0 then x else 0) 0 = h (\i. if i = 0 then y else 0) 0" + and "-r < x" "x < r" "-r < y" "y < r" + for x y :: real + proof - + have x: "(\i. if i = 0 then x else 0) \ C r" and y: "(\i. if i = 0 then y else 0) \ C r" + by (blast intro: inj_onD [OF \inj_on h (C r)\] that in_Cr)+ + have "continuous_map (subtopology (Euclidean_space (Suc 0)) (C r)) (Euclidean_space (Suc 0)) h" + using cmh by (simp add: 1) + then have "h ` ({x. \i\Suc 0. x i = 0} \ C r) \ {x. \i\Suc 0. x i = 0}" + by (force simp: Euclidean_space_def subtopology_subtopology continuous_map_def) + have "h (\i. if i = 0 then x else 0) j = h (\i. if i = 0 then y else 0) j" for j + proof (cases j) + case (Suc j') + have "h ` ({x. \i\Suc 0. x i = 0} \ C r) \ {x. \i\Suc 0. x i = 0}" + using continuous_map_image_subset_topspace [OF cmh] + by (simp add: 1 Euclidean_space_def subtopology_subtopology) + with Suc f x y show ?thesis + by (simp add: "1" image_subset_iff) + qed (use f in blast) + then have "(\i. if i = 0 then x else 0) = (\i::nat. if i = 0 then y else 0)" + by (blast intro: inj_onD [OF \inj_on h (C r)\] that in_Cr) + then show ?thesis + by (simp add: fun_eq_iff) presburger + qed + qed + have hom_e': "homeomorphic_map (Euclidean_space 1) euclideanreal e'" + using hom_ee' homeomorphic_maps_map by blast + have "openin (Euclidean_space n) (h ` e ` {- r<.. topspace (Euclidean_space 1)" + using "1" C_def \\r. B r \ C r\ cmh continuous_map_image_subset_topspace eBr by fastforce + have cont: "continuous_on {- r<.. h \ e)" + proof (intro continuous_on_compose) + have "\i. continuous_on {- r<..x. if i = 0 then x else 0)" + by (auto simp: continuous_on_topological) + then show "continuous_on {- r<.. topspace (subtopology ?E (C r))" + by (auto simp: eBr \\r. B r \ C r\) (auto simp: B_def) + with cmh show "continuous_on (e ` {- r<.. topspace ?E" + using subCr cmh by (simp add: continuous_map_def image_subset_iff) + moreover have "continuous_on (topspace ?E) e'" + by (metis "1" continuous_map_Euclidean_space_iff hom_ee' homeomorphic_maps_def) + ultimately show "continuous_on (h ` e ` {- r<..r. closedin (Euclidean_space n) (C r)" + unfolding C_def + by (rule closedin_continuous_map_preimage [OF cm_enorm, of concl: "{.._}", simplified]) + have cloS: "\r. closedin (Euclidean_space n) (S r)" + unfolding S_def + by (rule closedin_continuous_map_preimage [OF cm_enorm, of concl: "{_}", simplified]) + have C_subset: "C r \ UNIV \\<^sub>E {- \r\..\r\}" + using le_enorm \r > 0\ + apply (auto simp: C_def topspace_Euclidean_space abs_le_iff) + apply (metis add.inverse_neutral le_cases less_minus_iff not_le order_trans) + by (metis enorm_ge0 not_le order.trans) + have compactinC: "compactin (Euclidean_space n) (C r)" + unfolding Euclidean_space_def compactin_subtopology + proof + show "compactin (powertop_real UNIV) (C r)" + proof (rule closed_compactin [OF _ C_subset]) + show "closedin (powertop_real UNIV) (C r)" + by (metis Euclidean_space_def cloC closedin_Euclidean_space closedin_closed_subtopology topspace_Euclidean_space) + qed (simp add: compactin_PiE) + qed (auto simp: C_def topspace_Euclidean_space) + have compactinS: "compactin (Euclidean_space n) (S r)" + unfolding Euclidean_space_def compactin_subtopology + proof + show "compactin (powertop_real UNIV) (S r)" + proof (rule closed_compactin) + show "S r \ UNIV \\<^sub>E {- \r\..\r\}" + using C_subset \\r. S r \ C r\ by blast + show "closedin (powertop_real UNIV) (S r)" + by (metis Euclidean_space_def cloS closedin_Euclidean_space closedin_closed_subtopology topspace_Euclidean_space) + qed (simp add: compactin_PiE) + qed (auto simp: S_def topspace_Euclidean_space) + have h_if_B: "\y. y \ B r \ h y \ topspace ?E" + using B_def \\r. B r \ S r = C r\ cmh continuous_map_image_subset_topspace by fastforce + have com_hSr: "compactin (Euclidean_space n) (h ` S r)" + by (meson \\r. S r \ C r\ cmh compactinS compactin_subtopology image_compactin) + have ope_comp_hSr: "openin (Euclidean_space n) (topspace (Euclidean_space n) - h ` S r)" + proof (rule openin_diff) + show "closedin (Euclidean_space n) (h ` S r)" + using Hausdorff_Euclidean_space com_hSr compactin_imp_closedin by blast + qed auto + have h_pcs: "h ` (B r) \ path_components_of (subtopology ?E (topspace ?E - h ` (S r)))" + proof (rule lemmaIOD) + have pc_interval: "path_connectedin (Euclidean_space n) {x \ topspace(Euclidean_space n). enorm x \ T}" + if T: "is_interval T" for T + proof - + define mul :: "[real, nat \ real, nat] \ real" where "mul \ \a x i. a * x i" + let ?neg = "mul (-1)" + have neg_neg [simp]: "?neg (?neg x) = x" for x + by (simp add: mul_def) + have enorm_mul [simp]: "enorm(mul a x) = abs a * enorm x" for a x + by (simp add: enorm_def mul_def power_mult_distrib) (metis real_sqrt_abs real_sqrt_mult sum_distrib_left) + have mul_in_top: "mul a x \ topspace ?E" + if "x \ topspace ?E" for a x + using mul_def that topspace_Euclidean_space by auto + have neg_in_S: "?neg x \ S r" + if "x \ S r" for x r + using that topspace_Euclidean_space S_def by simp (simp add: mul_def) + have *: "path_connectedin ?E (S d)" + if "d \ 0" for d + proof (cases "d = 0") + let ?ES = "subtopology ?E (S d)" + case False + then have "d > 0" + using that by linarith + moreover have "path_connected_space ?ES" + unfolding path_connected_space_iff_path_component + proof clarify + have **: "path_component_of ?ES x y" + if x: "x \ topspace ?ES" and y: "y \ topspace ?ES" "x \ ?neg y" for x y + proof - + show ?thesis + unfolding path_component_of_def pathin_def S_def + proof (intro exI conjI) + let ?g = "(\x. mul (d / enorm x) x) \ (\t i. (1 - t) * x i + t * y i)" + show "continuous_map (top_of_set {0::real..1}) (subtopology ?E {x \ topspace ?E. enorm x = d}) ?g" + proof (rule continuous_map_compose) + let ?Y = "subtopology ?E (- {zero})" + have **: False + if eq0: "\j. (1 - r) * x j + r * y j = 0" + and ne: "x i \ - y i" + and d: "enorm x = d" "enorm y = d" + and r: "0 \ r" "r \ 1" + for i r + proof - + have "mul (1-r) x = ?neg (mul r y)" + using eq0 by (simp add: mul_def fun_eq_iff algebra_simps) + then have "enorm (mul (1-r) x) = enorm (?neg (mul r y))" + by metis + with r have "(1-r) * enorm x = r * enorm y" + by simp + then have r12: "r = 1/2" + using \d \ 0\ d by auto + show ?thesis + using ne eq0 [of i] unfolding r12 by (simp add: algebra_simps) + qed + show "continuous_map (top_of_set {0..1}) ?Y (\t i. (1 - t) * x i + t * y i)" + using x y + unfolding continuous_map_componentwise_UNIV Euclidean_space_def continuous_map_in_subtopology + apply (intro conjI allI continuous_intros) + apply (auto simp: zero_def mul_def S_def Euclidean_space_def fun_eq_iff) + using ** by blast + have cm_enorm': "continuous_map (subtopology (powertop_real UNIV) A) euclideanreal enorm" for A + unfolding enorm_def by (intro continuous_intros) auto + have "continuous_map ?Y (subtopology ?E {x. enorm x = d}) (\x. mul (d / enorm x) x)" + unfolding continuous_map_in_subtopology + proof (intro conjI) + show "continuous_map ?Y (Euclidean_space n) (\x. mul (d / enorm x) x)" + unfolding continuous_map_in_subtopology Euclidean_space_def mul_def zero_def subtopology_subtopology continuous_map_componentwise_UNIV + proof (intro conjI allI cm_enorm' continuous_intros) + show "enorm x \ 0" + if "x \ topspace (subtopology (powertop_real UNIV) ({x. \i\n. x i = 0} \ - {\i. 0}))" for x + using that by simp (metis abs_le_zero_iff le_enorm not_less) + qed auto + qed (use \d > 0\ enorm_ge0 in auto) + moreover have "subtopology ?E {x \ topspace ?E. enorm x = d} = subtopology ?E {x. enorm x = d}" + by (simp add: subtopology_restrict Collect_conj_eq) + ultimately show "continuous_map ?Y (subtopology (Euclidean_space n) {x \ topspace (Euclidean_space n). enorm x = d}) (\x. mul (d / enorm x) x)" + by metis + qed + show "?g (0::real) = x" "?g (1::real) = y" + using that by (auto simp: S_def zero_def mul_def fun_eq_iff) + qed + qed + obtain a b where a: "a \ topspace ?ES" and b: "b \ topspace ?ES" + and "a \ b" and negab: "?neg a \ b" + proof + let ?v = "\j i::nat. if i = j then d else 0" + show "?v 0 \ topspace (subtopology ?E (S d))" "?v 1 \ topspace (subtopology ?E (S d))" + using \n \ 2\ \d \ 0\ by (auto simp: S_def topspace_Euclidean_space) + show "?v 0 \ ?v 1" "?neg (?v 0) \ (?v 1)" + using \d > 0\ by (auto simp: mul_def fun_eq_iff) + qed + show "path_component_of ?ES x y" + if x: "x \ topspace ?ES" and y: "y \ topspace ?ES" + for x y + proof - + have "path_component_of ?ES x (?neg x)" + proof - + have "path_component_of ?ES x a" + by (metis (no_types, hide_lams) ** a b \a \ b\ negab path_component_of_trans path_component_of_sym x) + moreover + have pa_ab: "path_component_of ?ES a b" using "**" a b negab neg_neg by blast + then have "path_component_of ?ES a (?neg x)" + by (metis "**" \a \ b\ cloS closedin_def neg_in_S path_component_of_equiv topspace_subtopology_subset x) + ultimately show ?thesis + by (meson path_component_of_trans) + qed + then show ?thesis + using "**" x y by force + qed + qed + ultimately show ?thesis + by (simp add: cloS closedin_subset path_connectedin_def) + qed (simp add: S_def cong: conj_cong) + have "path_component_of (subtopology ?E {x \ topspace ?E. enorm x \ T}) x y" + if "enorm x = a" "x \ topspace ?E" "enorm x \ T" "enorm y = b" "y \ topspace ?E" "enorm y \ T" + for x y a b + using that + proof (induction a b arbitrary: x y rule: linorder_less_wlog) + case (less a b) + then have "a \ 0" + using enorm_ge0 by blast + with less.hyps have "b > 0" + by linarith + show ?case + proof (rule path_component_of_trans) + have y'_ts: "mul (a / b) y \ topspace ?E" + using \y \ topspace ?E\ mul_in_top by blast + moreover have "enorm (mul (a / b) y) = a" + unfolding enorm_mul using \0 < b\ \0 \ a\ less.prems by simp + ultimately have y'_S: "mul (a / b) y \ S a" + using S_def by blast + have "x \ S a" + using S_def less.prems by blast + with \x \ topspace ?E\ y'_ts y'_S + have "path_component_of (subtopology ?E (S a)) x (mul (a / b) y)" + by (metis * [OF \a \ 0\] path_connected_space_iff_path_component path_connectedin_def topspace_subtopology_subset) + moreover + have "{f \ topspace ?E. enorm f = a} \ {f \ topspace ?E. enorm f \ T}" + using \enorm x = a\ \enorm x \ T\ by force + ultimately + show "path_component_of (subtopology ?E {x. x \ topspace ?E \ enorm x \ T}) x (mul (a / b) y)" + by (simp add: S_def path_component_of_mono) + have "pathin ?E (\t. mul (((1 - t) * b + t * a) / b) y)" + using \b > 0\ \y \ topspace ?E\ + unfolding pathin_def Euclidean_space_def mul_def continuous_map_in_subtopology continuous_map_componentwise_UNIV + by (intro allI conjI continuous_intros) auto + moreover have "mul (((1 - t) * b + t * a) / b) y \ topspace ?E" + if "t \ {0..1}" for t + using \y \ topspace ?E\ mul_in_top by blast + moreover have "enorm (mul (((1 - t) * b + t * a) / b) y) \ T" + if "t \ {0..1}" for t + proof - + have "a \ T" "b \ T" + using less.prems by auto + then have "\(1 - t) * b + t * a\ \ T" + proof (rule mem_is_interval_1_I [OF T]) + show "a \ \(1 - t) * b + t * a\" + using that \a \ 0\ less.hyps segment_bound_lemma by auto + show "\(1 - t) * b + t * a\ \ b" + using that \a \ 0\ less.hyps by (auto intro: convex_bound_le) + qed + then show ?thesis + unfolding enorm_mul \enorm y = b\ using that \b > 0\ by simp + qed + ultimately have pa: "pathin (subtopology ?E {x \ topspace ?E. enorm x \ T}) + (\t. mul (((1 - t) * b + t * a) / b) y)" + by (auto simp: pathin_subtopology) + have ex_pathin: "\g. pathin (subtopology ?E {x \ topspace ?E. enorm x \ T}) g \ + g 0 = y \ g 1 = mul (a / b) y" + apply (rule_tac x="\t. mul (((1 - t) * b + t * a) / b) y" in exI) + using \b > 0\ pa by (auto simp: mul_def) + show "path_component_of (subtopology ?E {x. x \ topspace ?E \ enorm x \ T}) (mul (a / b) y) y" + by (rule path_component_of_sym) (simp add: path_component_of_def ex_pathin) + qed + next + case (refl a) + then have pc: "path_component_of (subtopology ?E (S (enorm u))) u v" + if "u \ topspace ?E \ S (enorm x)" "v \ topspace ?E \ S (enorm u)" for u v + using * [of a] enorm_ge0 that + by (auto simp: path_connectedin_def path_connected_space_iff_path_component S_def) + have sub: "{u \ topspace ?E. enorm u = enorm x} \ {u \ topspace ?E. enorm u \ T}" + using \enorm x \ T\ by auto + show ?case + using pc [of x y] refl by (auto simp: S_def path_component_of_mono [OF _ sub]) + next + case (sym a b) + then show ?case + by (blast intro: path_component_of_sym) + qed + then show ?thesis + by (simp add: path_connectedin_def path_connected_space_iff_path_component) + qed + have "h ` S r \ topspace ?E" + by (meson SC cmh compact_imp_compactin_subtopology compactinS compactin_subset_topspace image_compactin) + moreover + have "\ compact_space ?E " + by (metis compact_Euclidean_space \n \ 0\) + then have "\ compactin ?E (topspace ?E)" + by (simp add: compact_space_def topspace_Euclidean_space) + then have "h ` S r \ topspace ?E" + using com_hSr by auto + ultimately have top_hSr_ne: "topspace (subtopology ?E (topspace ?E - h ` S r)) \ {}" + by auto + show pc1: "\T. T \ path_components_of (subtopology ?E (topspace ?E - h ` S r)) \ h ` B r \ T" + proof (rule exists_path_component_of_superset [OF _ top_hSr_ne]) + have "path_connectedin ?E (h ` B r)" + proof (rule path_connectedin_continuous_map_image) + show "continuous_map (subtopology ?E (C r)) ?E h" + by (simp add: cmh) + have "path_connectedin ?E (B r)" + using pc_interval[of "{.. topspace ?E - h ` S r" + apply (auto simp: h_if_B) + by (metis BC SC disjSB disjnt_iff inj_onD [OF injh] subsetD) + ultimately show "path_connectedin (subtopology ?E (topspace ?E - h ` S r)) (h ` B r)" + by (simp add: path_connectedin_subtopology) + qed metis + show "\T. T \ path_components_of (subtopology ?E (topspace ?E - h ` S r)) \ topspace ?E - h ` (C r) \ T" + proof (rule exists_path_component_of_superset [OF _ top_hSr_ne]) + have eq: "topspace ?E - {x \ topspace ?E. enorm x \ r} = {x \ topspace ?E. r < enorm x}" + by auto + have "path_connectedin ?E (topspace ?E - C r)" + using pc_interval[of "{r<..}"] is_interval_convex_1 unfolding C_def eq by auto + then have "path_connectedin ?E (topspace ?E - h ` C r)" + by (metis biglemma [OF \n \ 0\ compactinC cmh injh]) + then show "path_connectedin (subtopology ?E (topspace ?E - h ` S r)) (topspace ?E - h ` C r)" + by (simp add: Diff_mono SC image_mono path_connectedin_subtopology) + qed metis + have "topspace ?E \ (topspace ?E - h ` S r) = h ` B r \ (topspace ?E - h ` C r)" (is "?lhs = ?rhs") + proof + show "?lhs \ ?rhs" + using \\r. B r \ S r = C r\ by auto + have "h ` B r \ h ` S r = {}" + by (metis Diff_triv \\r. B r \ S r = C r\ \\r. disjnt (S r) (B r)\ disjnt_def inf_commute inj_on_Un injh) + then show "?rhs \ ?lhs" + using path_components_of_subset pc1 \\r. B r \ S r = C r\ + by (fastforce simp add: h_if_B) + qed + then show "\ (path_components_of (subtopology ?E (topspace ?E - h ` S r))) = h ` B r \ (topspace ?E - h ` (C r))" + by (simp add: Union_path_components_of) + show "T \ {}" + if "T \ path_components_of (subtopology ?E (topspace ?E - h ` S r))" for T + using that by (simp add: nonempty_path_components_of) + show "disjoint (path_components_of (subtopology ?E (topspace ?E - h ` S r)))" + by (simp add: pairwise_disjoint_path_components_of) + have "\ path_connectedin ?E (topspace ?E - h ` S r)" + proof (subst biglemma [OF \n \ 0\ compactinS]) + show "continuous_map (subtopology ?E (S r)) ?E h" + by (metis Un_commute Un_upper1 cmh continuous_map_from_subtopology_mono eqC) + show "inj_on h (S r)" + using SC inj_on_subset injh by blast + show "\ path_connectedin ?E (topspace ?E - S r)" + proof + have "topspace ?E - S r = {x \ topspace ?E. enorm x \ r}" + by (auto simp: S_def) + moreover have "enorm ` {x \ topspace ?E. enorm x \ r} = {0..} - {r}" + proof + have "\x. x \ topspace ?E \ enorm x \ r \ d = enorm x" + if "d \ r" "d \ 0" for d + proof (intro exI conjI) + show "(\i. if i = 0 then d else 0) \ topspace ?E" + using \n \ 0\ by (auto simp: Euclidean_space_def) + show "enorm (\i. if i = 0 then d else 0) \ r" "d = enorm (\i. if i = 0 then d else 0)" + using \n \ 0\ that by simp_all + qed + then show "{0..} - {r} \ enorm ` {x \ topspace ?E. enorm x \ r}" + by (auto simp: image_def) + qed (auto simp: enorm_ge0) + ultimately have non_r: "enorm ` (topspace ?E - S r) = {0..} - {r}" + by simp + have "\x\0. x \ r \ r \ x" + by (metis gt_ex le_cases not_le order_trans) + then have "\ is_interval ({0..} - {r})" + unfolding is_interval_1 + using \r > 0\ by (auto simp: Bex_def) + then show False + if "path_connectedin ?E (topspace ?E - S r)" + using path_connectedin_continuous_map_image [OF cm_enorm that] by (simp add: is_interval_path_connected_1 non_r) + qed + qed + then have "\ path_connected_space (subtopology ?E (topspace ?E - h ` S r))" + by (simp add: path_connectedin_def) + then show "\T. path_components_of (subtopology ?E (topspace ?E - h ` S r)) \ {T}" + by (simp add: path_components_of_subset_singleton) + qed + moreover have "openin ?E A" + if "A \ path_components_of (subtopology ?E (topspace ?E - h ` (S r)))" for A + using locally_path_connected_Euclidean_space [of n] that ope_comp_hSr + by (simp add: locally_path_connected_space_open_path_components) + ultimately show ?thesis by metis + qed + have "\T. openin ?E T \ f x \ T \ T \ f ` U" + if "x \ U" for x + proof - + have x: "x \ topspace ?E" + by (meson U in_mono openin_subset that) + obtain V where V: "openin (powertop_real UNIV) V" and Ueq: "U = V \ {x. \i\n. x i = 0}" + using U by (auto simp: openin_subtopology Euclidean_space_def) + with \x \ U\ have "x \ V" by blast + then obtain T where Tfin: "finite {i. T i \ UNIV}" and Topen: "\i. open (T i)" + and Tx: "x \ Pi\<^sub>E UNIV T" and TV: "Pi\<^sub>E UNIV T \ V" + using V by (force simp: openin_product_topology_alt) + have "\e>0. \x'. \x' - x i\ < e \ x' \ T i" for i + using Topen [of i] Tx by (auto simp: open_real) + then obtain \ where B0: "\i. \ i > 0" and BT: "\i x'. \x' - x i\ < \ i \ x' \ T i" + by metis + define r where "r \ Min (insert 1 (\ ` {i. T i \ UNIV}))" + have "r > 0" + by (simp add: B0 Tfin r_def) + have inU: "y \ U" + if y: "y \ topspace ?E" and yxr: "\i. i \y i - x i\ < r" for y + proof - + have "y i \ T i" for i + proof (cases "T i = UNIV") + show "y i \ T i" if "T i \ UNIV" + proof (cases "i < n") + case True + then show ?thesis + using yxr [OF True] that by (simp add: r_def BT Tfin) + next + case False + then show ?thesis + using B0 Ueq \x \ U\ topspace_Euclidean_space y by (force intro: BT) + qed + qed auto + with TV have "y \ V" by auto + then show ?thesis + using that by (auto simp: Ueq topspace_Euclidean_space) + qed + have xinU: "(\i. x i + y i) \ U" if "y \ C(r/2)" for y + proof (rule inU) + have y: "y \ topspace ?E" + using C_def that by blast + show "(\i. x i + y i) \ topspace ?E" + using x y by (simp add: topspace_Euclidean_space) + have "enorm y \ r/2" + using that by (simp add: C_def) + then show "\x i + y i - x i\ < r" if "i < n" for i + using le_enorm enorm_ge0 that \0 < r\ leI order_trans by fastforce + qed + show ?thesis + proof (intro exI conjI) + show "openin ?E ((f \ (\y i. x i + y i)) ` B (r/2))" + proof (rule **) + have "continuous_map (subtopology ?E (C(r/2))) (subtopology ?E U) (\y i. x i + y i)" + by (auto simp: xinU continuous_map_in_subtopology + intro!: continuous_intros continuous_map_Euclidean_space_add x) + then show "continuous_map (subtopology ?E (C(r/2))) ?E (f \ (\y i. x i + y i))" + by (rule continuous_map_compose) (simp add: cmf) + show "inj_on (f \ (\y i. x i + y i)) (C(r/2))" + proof (clarsimp simp add: inj_on_def C_def topspace_Euclidean_space simp del: divide_const_simps) + show "y' = y" + if ey: "enorm y \ r / 2" and ey': "enorm y' \ r / 2" + and y0: "\i\n. y i = 0" and y'0: "\i\n. y' i = 0" + and feq: "f (\i. x i + y' i) = f (\i. x i + y i)" + for y' y :: "nat \ real" + proof - + have "(\i. x i + y i) \ U" + proof (rule inU) + show "(\i. x i + y i) \ topspace ?E" + using topspace_Euclidean_space x y0 by auto + show "\x i + y i - x i\ < r" if "i < n" for i + using ey le_enorm [of _ y] \r > 0\ that by fastforce + qed + moreover have "(\i. x i + y' i) \ U" + proof (rule inU) + show "(\i. x i + y' i) \ topspace ?E" + using topspace_Euclidean_space x y'0 by auto + show "\x i + y' i - x i\ < r" if "i < n" for i + using ey' le_enorm [of _ y'] \r > 0\ that by fastforce + qed + ultimately have "(\i. x i + y' i) = (\i. x i + y i)" + using feq by (meson \inj_on f U\ inj_on_def) + then show ?thesis + by (auto simp: fun_eq_iff) + qed + qed + qed (simp add: \0 < r\) + have "x \ (\y i. x i + y i) ` B (r / 2)" + proof + show "x = (\i. x i + zero i)" + by (simp add: zero_def) + qed (auto simp: B_def \r > 0\) + then show "f x \ (f \ (\y i. x i + y i)) ` B (r/2)" + by (metis image_comp image_eqI) + show "(f \ (\y i. x i + y i)) ` B (r/2) \ f ` U" + using \\r. B r \ C r\ xinU by fastforce + qed + qed + then show ?thesis + using openin_subopen by force +qed + + +corollary invariance_of_domain_Euclidean_space_embedding_map: + assumes "openin (Euclidean_space n) U" + and cmf: "continuous_map(subtopology (Euclidean_space n) U) (Euclidean_space n) f" + and "inj_on f U" + shows "embedding_map(subtopology (Euclidean_space n) U) (Euclidean_space n) f" +proof (rule injective_open_imp_embedding_map [OF cmf]) + show "open_map (subtopology (Euclidean_space n) U) (Euclidean_space n) f" + unfolding open_map_def + by (meson assms continuous_map_from_subtopology_mono inj_on_subset invariance_of_domain_Euclidean_space openin_imp_subset openin_trans_full) + show "inj_on f (topspace (subtopology (Euclidean_space n) U))" + using assms openin_subset topspace_subtopology_subset by fastforce +qed + +corollary invariance_of_domain_Euclidean_space_gen: + assumes "n \ m" and U: "openin (Euclidean_space m) U" + and cmf: "continuous_map(subtopology (Euclidean_space m) U) (Euclidean_space n) f" + and "inj_on f U" + shows "openin (Euclidean_space n) (f ` U)" +proof - + have *: "Euclidean_space n = subtopology (Euclidean_space m) (topspace(Euclidean_space n))" + by (metis Euclidean_space_def \n \ m\ inf.absorb_iff2 subset_Euclidean_space subtopology_subtopology topspace_Euclidean_space) + moreover have "U \ topspace (subtopology (Euclidean_space m) U)" + by (metis U inf.absorb_iff2 openin_subset openin_subtopology openin_topspace) + ultimately show ?thesis + by (metis (no_types) U \inj_on f U\ cmf continuous_map_in_subtopology inf.absorb_iff2 + inf.orderE invariance_of_domain_Euclidean_space openin_imp_subset openin_subtopology openin_topspace) +qed + +corollary invariance_of_domain_Euclidean_space_embedding_map_gen: + assumes "n \ m" and U: "openin (Euclidean_space m) U" + and cmf: "continuous_map(subtopology (Euclidean_space m) U) (Euclidean_space n) f" + and "inj_on f U" + shows "embedding_map(subtopology (Euclidean_space m) U) (Euclidean_space n) f" + proof (rule injective_open_imp_embedding_map [OF cmf]) + show "open_map (subtopology (Euclidean_space m) U) (Euclidean_space n) f" + by (meson U \n \ m\ \inj_on f U\ cmf continuous_map_from_subtopology_mono invariance_of_domain_Euclidean_space_gen open_map_def openin_open_subtopology subset_inj_on) + show "inj_on f (topspace (subtopology (Euclidean_space m) U))" + using assms openin_subset topspace_subtopology_subset by fastforce +qed + + +subsection\Relating two variants of Euclidean space, one within product topology. \ + +proposition homeomorphic_maps_Euclidean_space_euclidean_gen_OLD: + fixes B :: "'n::euclidean_space set" + assumes "finite B" "independent B" and orth: "pairwise orthogonal B" and n: "card B = n" + obtains f g where "homeomorphic_maps (Euclidean_space n) (top_of_set (span B)) f g" +proof - + note representation_basis [OF \independent B\, simp] + obtain b where injb: "inj_on b {..finite B\] + by (metis n card_Collect_less_nat card_image lessThan_def) + then have biB: "\i. i < n \ b i \ B" + by force + have repr: "\v. v \ span B \ (\iR b i) = v" + using real_vector.sum_representation_eq [OF \independent B\ _ \finite B\] + by (metis (no_types, lifting) injb beq order_refl sum.reindex_cong) + let ?f = "\x. \iR b i" + let ?g = "\v i. if i < n then representation B v (b i) else 0" + show thesis + proof + show "homeomorphic_maps (Euclidean_space n) (top_of_set (span B)) ?f ?g" + unfolding homeomorphic_maps_def + proof (intro conjI) + have *: "continuous_map euclidean (top_of_set (span B)) ?f" + by (metis (mono_tags) biB continuous_map_span_sum lessThan_iff) + show "continuous_map (Euclidean_space n) (top_of_set (span B)) ?f" + unfolding Euclidean_space_def + by (rule continuous_map_from_subtopology) (simp add: euclidean_product_topology *) + show "continuous_map (top_of_set (span B)) (Euclidean_space n) ?g" + unfolding Euclidean_space_def + by (auto simp: continuous_map_in_subtopology continuous_map_componentwise_UNIV continuous_on_representation \independent B\ biB orth pairwise_orthogonal_imp_finite) + have [simp]: "\x i. i x i *\<^sub>R b i \ span B" + by (simp add: biB span_base span_scale) + have "representation B (?f x) (b j) = x j" + if 0: "\i\n. x i = (0::real)" and "j < n" for x j + proof - + have "representation B (?f x) (b j) = (\iR b i) (b j))" + by (subst real_vector.representation_sum) (auto simp add: \independent B\) + also have "... = (\iix\topspace (Euclidean_space n). ?g (?f x) = x" + by (auto simp: Euclidean_space_def) + show "\y\topspace (top_of_set (span B)). ?f (?g y) = y" + using repr by (auto simp: Euclidean_space_def) + qed + qed +qed + +proposition homeomorphic_maps_Euclidean_space_euclidean_gen: + fixes B :: "'n::euclidean_space set" + assumes "independent B" and orth: "pairwise orthogonal B" and n: "card B = n" + and 1: "\u. u \ B \ norm u = 1" + obtains f g where "homeomorphic_maps (Euclidean_space n) (top_of_set (span B)) f g" + and "\x. x \ topspace (Euclidean_space n) \ (norm (f x))\<^sup>2 = (\i2)" +proof - + note representation_basis [OF \independent B\, simp] + have "finite B" + using \independent B\ finiteI_independent by metis + obtain b where injb: "inj_on b {..finite B\] + by (metis n card_Collect_less_nat card_image lessThan_def) + then have biB: "\i. i < n \ b i \ B" + by force + have "0 \ B" + using \independent B\ dependent_zero by blast + have [simp]: "b i \ b j = (if j = i then 1 else 0)" + if "i < n" "j < n" for i j + proof (cases "i = j") + case True + with 1 that show ?thesis + by (auto simp: norm_eq_sqrt_inner biB) + next + case False + then have "b i \ b j" + by (meson inj_onD injb lessThan_iff that) + then show ?thesis + using orth by (auto simp: orthogonal_def pairwise_def norm_eq_sqrt_inner that biB) + qed + have [simp]: "\x i. i x i *\<^sub>R b i \ span B" + by (simp add: biB span_base span_scale) + have repr: "\v. v \ span B \ (\iR b i) = v" + using real_vector.sum_representation_eq [OF \independent B\ _ \finite B\] + by (metis (no_types, lifting) injb beq order_refl sum.reindex_cong) + define f where "f \ \x. \iR b i" + define g where "g \ \v i. if i < n then representation B v (b i) else 0" + show thesis + proof + show "homeomorphic_maps (Euclidean_space n) (top_of_set (span B)) f g" + unfolding homeomorphic_maps_def + proof (intro conjI) + have *: "continuous_map euclidean (top_of_set (span B)) f" + unfolding f_def + by (rule continuous_map_span_sum) (use biB \0 \ B\ in auto) + show "continuous_map (Euclidean_space n) (top_of_set (span B)) f" + unfolding Euclidean_space_def + by (rule continuous_map_from_subtopology) (simp add: euclidean_product_topology *) + show "continuous_map (top_of_set (span B)) (Euclidean_space n) g" + unfolding Euclidean_space_def g_def + by (auto simp: continuous_map_in_subtopology continuous_map_componentwise_UNIV continuous_on_representation \independent B\ biB orth pairwise_orthogonal_imp_finite) + have "representation B (f x) (b j) = x j" + if 0: "\i\n. x i = (0::real)" and "j < n" for x j + proof - + have "representation B (f x) (b j) = (\iR b i) (b j))" + unfolding f_def + by (subst real_vector.representation_sum) (auto simp add: \independent B\) + also have "... = (\iindependent B\ biB representation_scale span_base) + also have "... = (\ix\topspace (Euclidean_space n). g (f x) = x" + by (auto simp: Euclidean_space_def f_def g_def) + show "\y\topspace (top_of_set (span B)). f (g y) = y" + using repr by (auto simp: Euclidean_space_def f_def g_def) + qed + show normeq: "(norm (f x))\<^sup>2 = (\i2)" if "x \ topspace (Euclidean_space n)" for x + unfolding f_def dot_square_norm [symmetric] + by (simp add: power2_eq_square inner_sum_left inner_sum_right if_distrib biB cong: if_cong) + qed +qed + +corollary homeomorphic_maps_Euclidean_space_euclidean: + obtains f :: "(nat \ real) \ 'n::euclidean_space" and g + where "homeomorphic_maps (Euclidean_space (DIM('n))) euclidean f g" + by (force intro: homeomorphic_maps_Euclidean_space_euclidean_gen [OF independent_Basis orthogonal_Basis refl norm_Basis]) + +lemma homeomorphic_maps_nsphere_euclidean_sphere: + fixes B :: "'n::euclidean_space set" + assumes B: "independent B" and orth: "pairwise orthogonal B" and n: "card B = n" and "n \ 0" + and 1: "\u. u \ B \ norm u = 1" + obtains f :: "(nat \ real) \ 'n::euclidean_space" and g + where "homeomorphic_maps (nsphere(n - 1)) (top_of_set (sphere 0 1 \ span B)) f g" +proof - + have "finite B" + using \independent B\ finiteI_independent by metis + obtain f g where fg: "homeomorphic_maps (Euclidean_space n) (top_of_set (span B)) f g" + and normf: "\x. x \ topspace (Euclidean_space n) \ (norm (f x))\<^sup>2 = (\i2)" + using homeomorphic_maps_Euclidean_space_euclidean_gen [OF B orth n 1] + by blast + obtain b where injb: "inj_on b {..finite B\] + by (metis n card_Collect_less_nat card_image lessThan_def) + then have biB: "\i. i < n \ b i \ B" + by force + have [simp]: "\i. i < n \ b i \ 0" + using \independent B\ biB dependent_zero by fastforce + have [simp]: "b i \ b j = (if j = i then (norm (b i))\<^sup>2 else 0)" + if "i < n" "j < n" for i j + proof (cases "i = j") + case False + then have "b i \ b j" + by (meson inj_onD injb lessThan_iff that) + then show ?thesis + using orth by (auto simp: orthogonal_def pairwise_def norm_eq_sqrt_inner that biB) + qed (auto simp: norm_eq_sqrt_inner) + have [simp]: "Suc (n - Suc 0) = n" + using Suc_pred \n \ 0\ by blast + then have [simp]: "{..card B - Suc 0} = {..i2) = (1::real)" "x \ topspace (Euclidean_space n)" for x + proof - + have "norm (f x)^2 = 1" + using normf that by (simp add: n) + with that show ?thesis + by (simp add: power2_eq_imp_eq) + qed + have "homeomorphic_maps (nsphere (n - 1)) (top_of_set (span B \ sphere 0 1)) f g" + unfolding nsphere_def subtopology_subtopology [symmetric] + proof (rule homeomorphic_maps_subtopologies_alt) + show "homeomorphic_maps (Euclidean_space (Suc (n - 1))) (top_of_set (span B)) f g" + using fg by (force simp add: ) + show "f ` (topspace (Euclidean_space (Suc (n - 1))) \ {x. (\i\n - 1. (x i)\<^sup>2) = 1}) \ sphere 0 1" + using n by (auto simp: image_subset_iff Euclidean_space_def 1) + have "(\i\n - Suc 0. (g u i)\<^sup>2) = 1" + if "u \ span B" and "norm (u::'n) = 1" for u + proof - + obtain v where [simp]: "u = f v" "v \ topspace (Euclidean_space n)" + using fg unfolding homeomorphic_maps_map subset_iff + by (metis \u \ span B\ homeomorphic_imp_surjective_map image_eqI topspace_euclidean_subtopology) + then have [simp]: "g (f v) = v" + by (meson fg homeomorphic_maps_map) + have fv21: "norm (f v) ^ 2 = 1" + using that by simp + show ?thesis + using that normf fv21 \v \ topspace (Euclidean_space n)\ n by force + qed + then show "g ` (topspace (top_of_set (span B)) \ sphere 0 1) \ {x. (\i\n - 1. (x i)\<^sup>2) = 1}" + by auto + qed + then show "homeomorphic_maps (nsphere(n - 1)) (top_of_set (sphere 0 1 \ span B)) f g" + by (simp add: inf_commute) + qed +qed + + + +subsection\ Invariance of dimension and domain in setting of R^n.\ + +lemma homeomorphic_maps_iff_homeomorphism [simp]: + "homeomorphic_maps (top_of_set S) (top_of_set T) f g \ homeomorphism S T f g" + unfolding homeomorphic_maps_def homeomorphism_def by force + +lemma homeomorphic_space_iff_homeomorphic [simp]: + "(top_of_set S) homeomorphic_space (top_of_set T) \ S homeomorphic T" + by (simp add: homeomorphic_def homeomorphic_space_def) + +lemma homeomorphic_subspace_Euclidean_space: + fixes S :: "'a::euclidean_space set" + assumes "subspace S" + shows "top_of_set S homeomorphic_space Euclidean_space n \ dim S = n" +proof - + obtain B where B: "B \ S" "independent B" "span B = S" "card B = dim S" + and orth: "pairwise orthogonal B" and 1: "\x. x \ B \ norm x = 1" + by (metis assms orthonormal_basis_subspace) + then have "finite B" + by (simp add: pairwise_orthogonal_imp_finite) + have "top_of_set S homeomorphic_space top_of_set (span B)" + unfolding homeomorphic_space_iff_homeomorphic + by (auto simp: assms B intro: homeomorphic_subspaces) + also have "\ homeomorphic_space Euclidean_space (dim S)" + unfolding homeomorphic_space_def + using homeomorphic_maps_Euclidean_space_euclidean_gen [OF \independent B\ orth] homeomorphic_maps_sym 1 B + by metis + finally have "top_of_set S homeomorphic_space Euclidean_space (dim S)" . + then show ?thesis + using homeomorphic_space_sym homeomorphic_space_trans invariance_of_dimension_Euclidean_space by blast +qed + +lemma homeomorphic_subspace_Euclidean_space_dim: + fixes S :: "'a::euclidean_space set" + assumes "subspace S" + shows "top_of_set S homeomorphic_space Euclidean_space (dim S)" + by (simp add: homeomorphic_subspace_Euclidean_space assms) + +lemma homeomorphic_subspaces_eq: + fixes S T:: "'a::euclidean_space set" + assumes "subspace S" "subspace T" + shows "S homeomorphic T \ dim S = dim T" +proof + show "dim S = dim T" + if "S homeomorphic T" + proof - + have "Euclidean_space (dim S) homeomorphic_space top_of_set S" + using \subspace S\ homeomorphic_space_sym homeomorphic_subspace_Euclidean_space_dim by blast + also have "\ homeomorphic_space top_of_set T" + by (simp add: that) + also have "\ homeomorphic_space Euclidean_space (dim T)" + by (simp add: homeomorphic_subspace_Euclidean_space assms) + finally have "Euclidean_space (dim S) homeomorphic_space Euclidean_space (dim T)" . + then show ?thesis + by (simp add: invariance_of_dimension_Euclidean_space) + qed +next + show "S homeomorphic T" + if "dim S = dim T" + by (metis that assms homeomorphic_subspaces) +qed + +lemma homeomorphic_affine_Euclidean_space: + assumes "affine S" + shows "top_of_set S homeomorphic_space Euclidean_space n \ aff_dim S = n" + (is "?X homeomorphic_space ?E \ aff_dim S = n") +proof (cases "S = {}") + case True + with assms show ?thesis + using homeomorphic_empty_space nonempty_Euclidean_space by fastforce +next + case False + then obtain a where "a \ S" + by force + have "(?X homeomorphic_space ?E) + = (top_of_set (image (\x. -a + x) S) homeomorphic_space ?E)" + proof + show "top_of_set ((+) (- a) ` S) homeomorphic_space ?E" + if "?X homeomorphic_space ?E" + using that + by (meson homeomorphic_space_iff_homeomorphic homeomorphic_space_sym homeomorphic_space_trans homeomorphic_translation) + show "?X homeomorphic_space ?E" + if "top_of_set ((+) (- a) ` S) homeomorphic_space ?E" + using that + by (meson homeomorphic_space_iff_homeomorphic homeomorphic_space_trans homeomorphic_translation) + qed + also have "\ \ aff_dim S = n" + by (metis \a \ S\ aff_dim_eq_dim affine_diffs_subspace affine_hull_eq assms homeomorphic_subspace_Euclidean_space of_nat_eq_iff) + finally show ?thesis . +qed + + +corollary invariance_of_domain_subspaces: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes ope: "openin (top_of_set U) S" + and "subspace U" "subspace V" and VU: "dim V \ dim U" + and contf: "continuous_on S f" and fim: "f ` S \ V" + and injf: "inj_on f S" + shows "openin (top_of_set V) (f ` S)" +proof - + have "S \ U" + using openin_imp_subset [OF ope] . + have Uhom: "top_of_set U homeomorphic_space Euclidean_space (dim U)" + and Vhom: "top_of_set V homeomorphic_space Euclidean_space (dim V)" + by (simp_all add: assms homeomorphic_subspace_Euclidean_space_dim) + then obtain \ \' where hom: "homeomorphic_maps (top_of_set U) (Euclidean_space (dim U)) \ \'" + by (auto simp: homeomorphic_space_def) + obtain \ \' where \: "homeomorphic_map (top_of_set V) (Euclidean_space (dim V)) \" + and \'\: "\x\V. \' (\ x) = x" + using Vhom by (auto simp: homeomorphic_space_def homeomorphic_maps_map) + have "((\ \ f \ \') o \) ` S = (\ o f) ` S" + proof (rule image_cong [OF refl]) + show "(\ \ f \ \' \ \) x = (\ \ f) x" if "x \ S" for x + using that unfolding o_def + by (metis \S \ U\ hom homeomorphic_maps_map in_mono topspace_euclidean_subtopology) + qed + moreover + have "openin (Euclidean_space (dim V)) ((\ \ f \ \') ` \ ` S)" + proof (rule invariance_of_domain_Euclidean_space_gen [OF VU]) + show "openin (Euclidean_space (dim U)) (\ ` S)" + using homeomorphic_map_openness_eq hom homeomorphic_maps_map ope by blast + show "continuous_map (subtopology (Euclidean_space (dim U)) (\ ` S)) (Euclidean_space (dim V)) (\ \ f \ \')" + proof (intro continuous_map_compose) + have "continuous_on ({x. \i\dim U. x i = 0} \ \ ` S) \'" + if "continuous_on {x. \i\dim U. x i = 0} \'" + using that by (force elim: continuous_on_subset) + moreover have "\' ` ({x. \i\dim U. x i = 0} \ \ ` S) \ S" + if "\x\U. \' (\ x) = x" + using that \S \ U\ by fastforce + ultimately show "continuous_map (subtopology (Euclidean_space (dim U)) (\ ` S)) (top_of_set S) \'" + using hom unfolding homeomorphic_maps_def + by (simp add: Euclidean_space_def subtopology_subtopology euclidean_product_topology) + show "continuous_map (top_of_set S) (top_of_set V) f" + by (simp add: contf fim) + show "continuous_map (top_of_set V) (Euclidean_space (dim V)) \" + by (simp add: \ homeomorphic_imp_continuous_map) + qed + show "inj_on (\ \ f \ \') (\ ` S)" + using injf hom + unfolding inj_on_def homeomorphic_maps_map + by simp (metis \S \ U\ \'\ fim imageI subsetD) + qed + ultimately have "openin (Euclidean_space (dim V)) (\ ` f ` S)" + by (simp add: image_comp) + then show ?thesis + by (simp add: fim homeomorphic_map_openness_eq [OF \]) +qed + +lemma invariance_of_domain: + fixes f :: "'a \ 'a::euclidean_space" + assumes "continuous_on S f" "open S" "inj_on f S" shows "open(f ` S)" + using invariance_of_domain_subspaces [of UNIV S UNIV] assms by (force simp add: ) + +corollary invariance_of_dimension_subspaces: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes ope: "openin (top_of_set U) S" + and "subspace U" "subspace V" + and contf: "continuous_on S f" and fim: "f ` S \ V" + and injf: "inj_on f S" and "S \ {}" + shows "dim U \ dim V" +proof - + have "False" if "dim V < dim U" + proof - + obtain T where "subspace T" "T \ U" "dim T = dim V" + using choose_subspace_of_subspace [of "dim V" U] + by (metis \dim V < dim U\ assms(2) order.strict_implies_order span_eq_iff) + then have "V homeomorphic T" + by (simp add: \subspace V\ homeomorphic_subspaces) + then obtain h k where homhk: "homeomorphism V T h k" + using homeomorphic_def by blast + have "continuous_on S (h \ f)" + by (meson contf continuous_on_compose continuous_on_subset fim homeomorphism_cont1 homhk) + moreover have "(h \ f) ` S \ U" + using \T \ U\ fim homeomorphism_image1 homhk by fastforce + moreover have "inj_on (h \ f) S" + apply (clarsimp simp: inj_on_def) + by (metis fim homeomorphism_apply1 homhk image_subset_iff inj_onD injf) + ultimately have ope_hf: "openin (top_of_set U) ((h \ f) ` S)" + using invariance_of_domain_subspaces [OF ope \subspace U\ \subspace U\] by blast + have "(h \ f) ` S \ T" + using fim homeomorphism_image1 homhk by fastforce + then have "dim ((h \ f) ` S) \ dim T" + by (rule dim_subset) + also have "dim ((h \ f) ` S) = dim U" + using \S \ {}\ \subspace U\ + by (blast intro: dim_openin ope_hf) + finally show False + using \dim V < dim U\ \dim T = dim V\ by simp + qed + then show ?thesis + using not_less by blast +qed + +corollary invariance_of_domain_affine_sets: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes ope: "openin (top_of_set U) S" + and aff: "affine U" "affine V" "aff_dim V \ aff_dim U" + and contf: "continuous_on S f" and fim: "f ` S \ V" + and injf: "inj_on f S" + shows "openin (top_of_set V) (f ` S)" +proof (cases "S = {}") + case False + obtain a b where "a \ S" "a \ U" "b \ V" + using False fim ope openin_contains_cball by fastforce + have "openin (top_of_set ((+) (- b) ` V)) (((+) (- b) \ f \ (+) a) ` (+) (- a) ` S)" + proof (rule invariance_of_domain_subspaces) + show "openin (top_of_set ((+) (- a) ` U)) ((+) (- a) ` S)" + by (metis ope homeomorphism_imp_open_map homeomorphism_translation translation_galois) + show "subspace ((+) (- a) ` U)" + by (simp add: \a \ U\ affine_diffs_subspace_subtract \affine U\ cong: image_cong_simp) + show "subspace ((+) (- b) ` V)" + by (simp add: \b \ V\ affine_diffs_subspace_subtract \affine V\ cong: image_cong_simp) + show "dim ((+) (- b) ` V) \ dim ((+) (- a) ` U)" + by (metis \a \ U\ \b \ V\ aff_dim_eq_dim affine_hull_eq aff of_nat_le_iff) + show "continuous_on ((+) (- a) ` S) ((+) (- b) \ f \ (+) a)" + by (metis contf continuous_on_compose homeomorphism_cont2 homeomorphism_translation translation_galois) + show "((+) (- b) \ f \ (+) a) ` (+) (- a) ` S \ (+) (- b) ` V" + using fim by auto + show "inj_on ((+) (- b) \ f \ (+) a) ((+) (- a) ` S)" + by (auto simp: inj_on_def) (meson inj_onD injf) + qed + then show ?thesis + by (metis (no_types, lifting) homeomorphism_imp_open_map homeomorphism_translation image_comp translation_galois) +qed auto + +corollary invariance_of_dimension_affine_sets: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes ope: "openin (top_of_set U) S" + and aff: "affine U" "affine V" + and contf: "continuous_on S f" and fim: "f ` S \ V" + and injf: "inj_on f S" and "S \ {}" + shows "aff_dim U \ aff_dim V" +proof - + obtain a b where "a \ S" "a \ U" "b \ V" + using \S \ {}\ fim ope openin_contains_cball by fastforce + have "dim ((+) (- a) ` U) \ dim ((+) (- b) ` V)" + proof (rule invariance_of_dimension_subspaces) + show "openin (top_of_set ((+) (- a) ` U)) ((+) (- a) ` S)" + by (metis ope homeomorphism_imp_open_map homeomorphism_translation translation_galois) + show "subspace ((+) (- a) ` U)" + by (simp add: \a \ U\ affine_diffs_subspace_subtract \affine U\ cong: image_cong_simp) + show "subspace ((+) (- b) ` V)" + by (simp add: \b \ V\ affine_diffs_subspace_subtract \affine V\ cong: image_cong_simp) + show "continuous_on ((+) (- a) ` S) ((+) (- b) \ f \ (+) a)" + by (metis contf continuous_on_compose homeomorphism_cont2 homeomorphism_translation translation_galois) + show "((+) (- b) \ f \ (+) a) ` (+) (- a) ` S \ (+) (- b) ` V" + using fim by auto + show "inj_on ((+) (- b) \ f \ (+) a) ((+) (- a) ` S)" + by (auto simp: inj_on_def) (meson inj_onD injf) + qed (use \S \ {}\ in auto) + then show ?thesis + by (metis \a \ U\ \b \ V\ aff_dim_eq_dim affine_hull_eq aff of_nat_le_iff) +qed + +corollary invariance_of_dimension: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes contf: "continuous_on S f" and "open S" + and injf: "inj_on f S" and "S \ {}" + shows "DIM('a) \ DIM('b)" + using%unimportant invariance_of_dimension_subspaces [of UNIV S UNIV f] assms + by auto + +corollary continuous_injective_image_subspace_dim_le: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes "subspace S" "subspace T" + and contf: "continuous_on S f" and fim: "f ` S \ T" + and injf: "inj_on f S" + shows "dim S \ dim T" + apply (rule invariance_of_dimension_subspaces [of S S _ f]) + using%unimportant assms by (auto simp: subspace_affine) + +lemma invariance_of_dimension_convex_domain: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes "convex S" + and contf: "continuous_on S f" and fim: "f ` S \ affine hull T" + and injf: "inj_on f S" + shows "aff_dim S \ aff_dim T" +proof (cases "S = {}") + case True + then show ?thesis by (simp add: aff_dim_geq) +next + case False + have "aff_dim (affine hull S) \ aff_dim (affine hull T)" + proof (rule invariance_of_dimension_affine_sets) + show "openin (top_of_set (affine hull S)) (rel_interior S)" + by (simp add: openin_rel_interior) + show "continuous_on (rel_interior S) f" + using contf continuous_on_subset rel_interior_subset by blast + show "f ` rel_interior S \ affine hull T" + using fim rel_interior_subset by blast + show "inj_on f (rel_interior S)" + using inj_on_subset injf rel_interior_subset by blast + show "rel_interior S \ {}" + by (simp add: False \convex S\ rel_interior_eq_empty) + qed auto + then show ?thesis + by simp +qed + +lemma homeomorphic_convex_sets_le: + assumes "convex S" "S homeomorphic T" + shows "aff_dim S \ aff_dim T" +proof - + obtain h k where homhk: "homeomorphism S T h k" + using homeomorphic_def assms by blast + show ?thesis + proof (rule invariance_of_dimension_convex_domain [OF \convex S\]) + show "continuous_on S h" + using homeomorphism_def homhk by blast + show "h ` S \ affine hull T" + by (metis homeomorphism_def homhk hull_subset) + show "inj_on h S" + by (meson homeomorphism_apply1 homhk inj_on_inverseI) + qed +qed + +lemma homeomorphic_convex_sets: + assumes "convex S" "convex T" "S homeomorphic T" + shows "aff_dim S = aff_dim T" + by (meson assms dual_order.antisym homeomorphic_convex_sets_le homeomorphic_sym) + +lemma homeomorphic_convex_compact_sets_eq: + assumes "convex S" "compact S" "convex T" "compact T" + shows "S homeomorphic T \ aff_dim S = aff_dim T" + by (meson assms homeomorphic_convex_compact_sets homeomorphic_convex_sets) + +lemma invariance_of_domain_gen: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes "open S" "continuous_on S f" "inj_on f S" "DIM('b) \ DIM('a)" + shows "open(f ` S)" + using invariance_of_domain_subspaces [of UNIV S UNIV f] assms by auto + +lemma injective_into_1d_imp_open_map_UNIV: + fixes f :: "'a::euclidean_space \ real" + assumes "open T" "continuous_on S f" "inj_on f S" "T \ S" + shows "open (f ` T)" + apply (rule invariance_of_domain_gen [OF \open T\]) + using assms apply (auto simp: elim: continuous_on_subset subset_inj_on) + done + +lemma continuous_on_inverse_open: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes "open S" "continuous_on S f" "DIM('b) \ DIM('a)" and gf: "\x. x \ S \ g(f x) = x" + shows "continuous_on (f ` S) g" +proof (clarsimp simp add: continuous_openin_preimage_eq) + fix T :: "'a set" + assume "open T" + have eq: "f ` S \ g -` T = f ` (S \ T)" + by (auto simp: gf) + have "openin (top_of_set (f ` S)) (f ` (S \ T))" + proof (rule open_openin_trans [OF invariance_of_domain_gen]) + show "inj_on f S" + using inj_on_inverseI gf by auto + show "open (f ` (S \ T))" + by (meson \inj_on f S\ \open T\ assms(1-3) continuous_on_subset inf_le1 inj_on_subset invariance_of_domain_gen open_Int) + qed (use assms in auto) + then show "openin (top_of_set (f ` S)) (f ` S \ g -` T)" + by (simp add: eq) +qed + +end \ No newline at end of file diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Homology/Simplices.thy --- a/src/HOL/Homology/Simplices.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Homology/Simplices.thy Wed Apr 10 13:34:55 2019 +0100 @@ -575,9 +575,6 @@ subsection\Show that all boundaries are cycles, the key "chain complex" property.\ -lemma sum_Int_Diff: "finite A \ sum f A = sum f (A \ B) + sum f (A - B)" - by (metis Diff_Diff_Int Diff_subset sum.subset_diff) - lemma chain_boundary_boundary: assumes "singular_chain p X c" shows "chain_boundary (p - Suc 0) (chain_boundary p c) = 0" @@ -623,7 +620,7 @@ have *: "(\x\p. \i\p - Suc 0. frag_cmul ((-1) ^ (x + i)) (frag_of (singular_face (p - Suc 0) i (singular_face p x g)))) = 0" - apply (simp add: sum.cartesian_product sum_Int_Diff [of "_ \ _" _ "{(x,y). y < x}"]) + apply (simp add: sum.cartesian_product sum.Int_Diff [of "_ \ _" _ "{(x,y). y < x}"]) apply (rule eq0) apply (simp only: frag_cmul_sum prod.case_distrib [of "frag_cmul (-1)"] frag_cmul_cmul eql eqr flip: power_Suc) apply (force simp: simp add: inj_on_def sum.reindex add.commute eqf intro: sum.cong) @@ -1091,26 +1088,6 @@ qed qed (auto simp: oriented_simplex_def) -lemma sum_zero_middle: - fixes g :: "nat \ 'a::comm_monoid_add" - assumes "1 \ p" "k \ p" - shows "(\j\p. if j < k then f j else if j = k then 0 else g (j - Suc 0)) - = (\j\p - Suc 0. if j < k then f j else g j)" (is "?lhs = ?rhs") -proof - - have [simp]: "{..p - Suc 0} \ {j. j < k} = {.. - {j. j < k} = {k..p - Suc 0}" - using assms by auto - have "?lhs = (\jj = k..p. if j = k then 0 else g (j - Suc 0))" - using sum.union_disjoint [of "{..x. _ * x"] if_distrib [of "\f. f i * _"] atLeast0AtMost cong: if_cong) done qed @@ -1144,7 +1121,7 @@ apply (simp add: feq singular_face_def oriented_simplex_def) apply (simp add: simplical_face_in_standard_simplex [OF p] restrict_compose_left subset_eq) apply (rule_tac x="\i. if i < k then m i else m (Suc i)" in exI) - using sum_zero_middle [OF p, where 'a=real, symmetric] unfolding simplical_face_def o_def + using sum.zero_middle [OF p, where 'a=real, symmetric] unfolding simplical_face_def o_def apply (simp add: if_distrib [of "\x. _ * x"] if_distrib [of "\f. f _ * _"] atLeast0AtMost cong: if_cong) done ultimately @@ -1213,7 +1190,7 @@ by (simp add: oriented_simplex_def standard_simplex_def) have "oriented_simplex (Suc p) (\i. if i = 0 then v else l (i -1)) x \ T" if "x \ standard_simplex (Suc p)" for x - proof (simp add: that oriented_simplex_def sum_atMost_Suc_shift del: sum_atMost_Suc) + proof (simp add: that oriented_simplex_def sum_atMost_Suc_shift del: sum.atMost_Suc) have x01: "\i. 0 \ x i \ x i \ 1" and x0: "\i. i > Suc p \ x i = 0" and x1: "sum x {..Suc p} = 1" using that by (auto simp: oriented_simplex_def standard_simplex_def) obtain a where "a \ S" @@ -1222,7 +1199,7 @@ proof (cases "x 0 = 1") case True then have "sum x {Suc 0..Suc p} = 0" - using x1 by (simp add: atMost_atLeast0 sum_head_Suc) + using x1 by (simp add: atMost_atLeast0 sum.atLeast_Suc_atMost) then have [simp]: "x (Suc j) = 0" if "j\p" for j unfolding sum.atLeast_Suc_atMost_Suc_shift using x01 that by (simp add: sum_nonneg_eq_0_iff) @@ -1318,9 +1295,9 @@ show "chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))" using \p > 0\ - apply (simp add: assms simplicial_cone_def chain_boundary_of atMost_atLeast0 del: sum_atMost_Suc) - apply (subst sum_head_Suc [of 0]) - apply (simp_all add: 1 2 del: sum_atMost_Suc) + apply (simp add: assms simplicial_cone_def chain_boundary_of atMost_atLeast0 del: sum.atMost_Suc) + apply (subst sum.atLeast_Suc_atMost [of 0]) + apply (simp_all add: 1 2 del: sum.atMost_Suc) done qed @@ -1462,7 +1439,7 @@ moreover obtain l where l: "\x. x \ standard_simplex (Suc p) \ (\i. (\j\Suc p. l j i * x j)) \ S" and feq: "f = oriented_simplex (Suc p) l" - using f by (fastforce simp: simplicial_simplex oriented_simplex_def simp del: sum_atMost_Suc) + using f by (fastforce simp: simplicial_simplex oriented_simplex_def simp del: sum.atMost_Suc) have "(\i. (1 - u) * ((\j\Suc p. simplicial_vertex j f i) / (real p + 2)) + u * y i) \ S" if "0 \ u" "u \ 1" and y: "y \ f ` standard_simplex (Suc p)" for y u proof - @@ -1474,7 +1451,7 @@ by (simp add: divide_simps) show "(\j. if j \ Suc p then (1 - u) * inverse (real (p + 2)) + u * x j else 0) \ standard_simplex (Suc p)" using x \0 \ u\ \u \ 1\ - apply (simp add: sum.distrib standard_simplex_def i2p linepath_le_1 flip: sum_distrib_left del: sum_atMost_Suc) + apply (simp add: sum.distrib standard_simplex_def i2p linepath_le_1 flip: sum_distrib_left del: sum.atMost_Suc) apply (simp add: divide_simps) done qed @@ -1486,7 +1463,7 @@ = (\j\Suc p. (1 - u) * l j i / (real p + 2) + u * l j i * x j)" (is "?lhs = _") by (simp add: field_simps cong: sum.cong) also have "\ = (1 - u) * (\j\Suc p. l j i) / (real p + 2) + u * (\j\Suc p. l j i * x j)" (is "_ = ?rhs") - by (simp add: sum_distrib_left sum.distrib sum_divide_distrib mult.assoc del: sum_atMost_Suc) + by (simp add: sum_distrib_left sum.distrib sum_divide_distrib mult.assoc del: sum.atMost_Suc) finally show "?lhs = ?rhs" . qed ultimately show ?thesis @@ -1589,7 +1566,7 @@ and feq: "f = oriented_simplex (Suc p) l" using ssf by (auto simp: simplicial_simplex) show ?thesis - proof (clarsimp simp add: geq simp del: sum_atMost_Suc) + proof (clarsimp simp add: geq simp del: sum.atMost_Suc) fix x y assume x: "x \ standard_simplex (Suc p)" and y: "y \ standard_simplex (Suc p)" then have x': "(\i. 0 \ x i \ x i \ 1) \ (\i>Suc p. x i = 0) \ (\i\Suc p. x i) = 1" @@ -1633,7 +1610,7 @@ then have "\\j\Suc p. l i k / (p + 2) - l j k / (p + 2)\ \ (1 + real p) * d / (p + 2)" by (rule order_trans [OF sum_abs]) then show "\l i k - (\j\Suc p. l j k) / (2 + real p)\ \ (1 + real p) * d / (2 + real p)" - by (simp add: sum_subtractf sum_divide_distrib del: sum_atMost_Suc) + by (simp add: sum_subtractf sum_divide_distrib del: sum.atMost_Suc) qed (use standard_simplex_def z in auto) qed have nonz: "\m (s - Suc 0) k - m (r - Suc 0) k\ \ (1 + real p) * d / (2 + real p)" (is "?lhs \ ?rhs") @@ -1650,7 +1627,7 @@ (if j = 0 then \i. (\j\Suc p. l j i) / (2 + real p) else m (j -1)) k\ \ (1 + real p) * d / (2 + real p)" for j j' apply (rule_tac a=j and b = "j'" in linorder_less_wlog) - apply (force simp: zero nonz \0 \ d\ simp del: sum_atMost_Suc)+ + apply (force simp: zero nonz \0 \ d\ simp del: sum.atMost_Suc)+ done show ?thesis apply (rule convex_sum_bound_le) @@ -1664,8 +1641,8 @@ qed then show "\simplex_cone p (Sigp f) (oriented_simplex p m) x k - simplex_cone p (Sigp f) (oriented_simplex p m) y k\ \ (1 + real p) * d / (2 + real p)" - apply (simp add: feq Sigp_def simplicial_vertex_oriented_simplex simplex_cone del: sum_atMost_Suc) - apply (simp add: oriented_simplex_def x y del: sum_atMost_Suc) + apply (simp add: feq Sigp_def simplicial_vertex_oriented_simplex simplex_cone del: sum.atMost_Suc) + apply (simp add: oriented_simplex_def x y del: sum.atMost_Suc) done qed qed @@ -1678,9 +1655,9 @@ qed show ?case using Suc - apply (simp del: sum_atMost_Suc) + apply (simp del: sum.atMost_Suc) apply (drule subsetD [OF keys_frag_extend]) - apply (simp del: sum_atMost_Suc) + apply (simp del: sum.atMost_Suc) apply clarify (*OBTAIN?*) apply (rename_tac FFF) using * @@ -1831,7 +1808,7 @@ by (metis diff_Suc_1 order_refl simplicial_chain_boundary simplicial_chain_of simplicial_chain_simplicial_subdivision simplicial_simplex_id) have 2: "(\i. (\j\Suc p. simplicial_vertex j (restrict id (standard_simplex (Suc p))) i) / (real p + 2)) \ standard_simplex (Suc p)" - by (simp add: simplicial_vertex_def standard_simplex_def del: sum_atMost_Suc) + by (simp add: simplicial_vertex_def standard_simplex_def del: sum.atMost_Suc) have ss_Sp: "(\i. (if i \ Suc p then 1 else 0) / (real p + 2)) \ standard_simplex (Suc p)" by (simp add: standard_simplex_def divide_simps) obtain l where feq: "f = oriented_simplex (Suc p) l" @@ -1839,7 +1816,7 @@ then have 3: "f (\i. (\j\Suc p. simplicial_vertex j (restrict id (standard_simplex (Suc p))) i) / (real p + 2)) = (\i. (\j\Suc p. simplicial_vertex j f i) / (real p + 2))" unfolding simplicial_vertex_def oriented_simplex_def - by (simp add: ss_Sp if_distrib [of "\x. _ * x"] sum_divide_distrib del: sum_atMost_Suc cong: if_cong) + by (simp add: ss_Sp if_distrib [of "\x. _ * x"] sum_divide_distrib del: sum.atMost_Suc cong: if_cong) have scp: "singular_chain (Suc p) (subtopology (powertop_real UNIV) (standard_simplex (Suc p))) (frag_of (restrict id (standard_simplex (Suc p))))" @@ -1859,7 +1836,7 @@ flip: singular_simplex_chain_map_id [OF simplicial_imp_singular_simplex [OF ssf]]) by (metis (no_types) scp singular_chain_boundary_alt Suc.IH [OF scps] Suc.IH [OF scpf] naturality_singular_subdivision) show ?case - apply (simp add: singular_subdivision_def del: sum_atMost_Suc) + apply (simp add: singular_subdivision_def del: sum.atMost_Suc) apply (simp only: ssf 1 2 3 4 chain_map_simplicial_cone [of "Suc p" S _ p "Suc p"]) done qed (auto simp: frag_extend_diff singular_subdivision_diff) @@ -1960,7 +1937,7 @@ have "(\i'. \j\Suc p. l j i' * (if j = i then 1 else 0)) \ standard_simplex s" using subsetD [OF l] basis_in_standard_simplex that by blast moreover have "(\i'. \j\Suc p. l j i' * (if j = i then 1 else 0)) = l i" - using that by (simp add: if_distrib [of "\x. _ * x"] del: sum_atMost_Suc cong: if_cong) + using that by (simp add: if_distrib [of "\x. _ * x"] del: sum.atMost_Suc cong: if_cong) ultimately show ?thesis by simp qed @@ -2026,7 +2003,7 @@ apply (rule order_refl) apply (simp only: chain_map_of frag_extend_of) apply (rule arg_cong2 [where f = "simplicial_cone (Suc p)"]) - apply (simp add: geq sum_distrib_left oriented_simplex_def ** del: sum_atMost_Suc flip: sum_divide_distrib) + apply (simp add: geq sum_distrib_left oriented_simplex_def ** del: sum.atMost_Suc flip: sum_divide_distrib) using 2 apply (simp only: oriented_simplex_def sum.swap [where A = "{..s}"]) using naturality_simplicial_subdivision scf apply (fastforce simp add: 4 chain_map_diff) done @@ -2061,7 +2038,7 @@ apply (simp only: subd.simps frag_extend_of) apply (subst chain_boundary_simplicial_cone [of "Suc p" "standard_simplex s"]) apply (meson ff scf simplicial_chain_diff simplicial_chain_simplicial_subdivision) - apply (simp add: simplicial_cone_def del: sum_atMost_Suc simplicial_subdivision.simps) + apply (simp add: simplicial_cone_def del: sum.atMost_Suc simplicial_subdivision.simps) done qed next @@ -2789,7 +2766,7 @@ assumes hom: "homotopic_with (\h. h ` T \ V) S U f g" and c: "singular_relcycle p S T c" shows "homologous_rel p U V (chain_map p f c) (chain_map p g c)" proof - - note sum_atMost_Suc [simp del] + note sum.atMost_Suc [simp del] have contf: "continuous_map S U f" and contg: "continuous_map S U g" using homotopic_with_imp_continuous_maps [OF hom] by metis+ obtain h where conth: "continuous_map (prod_topology (top_of_set {0..1::real}) S) U h" @@ -2986,11 +2963,11 @@ assume x: "x \ standard_simplex q" then have "simp q q (simplical_face (Suc q) x) 0 = 0" unfolding oriented_simplex_def simp_def - by (simp add: simplical_face_in_standard_simplex sum_atMost_Suc) (simp add: simplical_face_def vv_def) + by (simp add: simplical_face_in_standard_simplex sum.atMost_Suc) (simp add: simplical_face_def vv_def) moreover have "(\n. simp q q (simplical_face (Suc q) x) (Suc n)) = x" unfolding oriented_simplex_def simp_def vv_def using x apply (simp add: simplical_face_in_standard_simplex) - apply (force simp: standard_simplex_def simplical_face_def if_distribR if_distrib [of "\x. x * _"] sum_atMost_Suc cong: if_cong) + apply (force simp: standard_simplex_def simplical_face_def if_distribR if_distrib [of "\x. x * _"] sum.atMost_Suc cong: if_cong) done ultimately show "((\z. h (z 0, m (z \ Suc))) \ (simp q q \ simplical_face (Suc q))) x = (f \ m) x" by (simp add: o_def h0) @@ -3083,7 +3060,7 @@ apply (simp add: simplical_face_in_standard_simplex if_distribR) apply (simp add: simplical_face_def if_distrib [of "\u. u * _"] cong: if_cong) apply (intro impI conjI) - apply (force simp: sum_atMost_Suc intro: sum.cong) + apply (force simp: sum.atMost_Suc intro: sum.cong) apply (force simp: q0_eq sum.reindex intro!: sum.cong) done qed @@ -3202,7 +3179,7 @@ show ?thesis apply (rule ext) unfolding simplical_face_def using ij - apply (auto simp: sum_atMost_Suc cong: if_cong) + apply (auto simp: sum.atMost_Suc cong: if_cong) apply (force simp flip: ivl_disj_un(2) intro: sum.neutral) apply (auto simp: *) done diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Nonstandard_Analysis/HSeries.thy --- a/src/HOL/Nonstandard_Analysis/HSeries.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Nonstandard_Analysis/HSeries.thy Wed Apr 10 13:34:55 2019 +0100 @@ -54,7 +54,7 @@ unfolding sumhr_app by transfer (rule sum_distrib_left) lemma sumhr_split_add: "\n p. n < p \ sumhr (0, n, f) + sumhr (n, p, f) = sumhr (0, p, f)" - unfolding sumhr_app by transfer (simp add: sum_add_nat_ivl) + unfolding sumhr_app by transfer (simp add: sum.atLeastLessThan_concat) lemma sumhr_split_diff: "n < p \ sumhr (0, p, f) - sumhr (0, n, f) = sumhr (n, p, f)" by (drule sumhr_split_add [symmetric, where f = f]) simp diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Probability/Characteristic_Functions.thy --- a/src/HOL/Probability/Characteristic_Functions.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Probability/Characteristic_Functions.thy Wed Apr 10 13:34:55 2019 +0100 @@ -177,7 +177,7 @@ unfolding of_nat_mult[symmetric] by (simp add: complex_eq_iff ** of_nat_add[symmetric] del: of_nat_mult of_nat_fact of_nat_add) show "?P (Suc n)" - unfolding sum_atMost_Suc ih f_def CLBINT_I0c_power_mirror_iexp[of _ n] + unfolding sum.atMost_Suc ih f_def CLBINT_I0c_power_mirror_iexp[of _ n] by (simp add: divide_simps add_eq_0_iff *) (simp add: field_simps) qed diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Series.thy --- a/src/HOL/Series.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Series.thy Wed Apr 10 13:34:55 2019 +0100 @@ -305,7 +305,7 @@ unfolding lessThan_Suc_eq_insert_0 by (simp add: ac_simps sum_atLeast1_atMost_eq image_Suc_lessThan) ultimately show ?thesis - by (auto simp: sums_def simp del: sum_lessThan_Suc intro: LIMSEQ_Suc_iff[THEN iffD1]) + by (auto simp: sums_def simp del: sum.lessThan_Suc intro: LIMSEQ_Suc_iff[THEN iffD1]) qed lemma sums_add: "f sums a \ g sums b \ (\n. f n + g n) sums (a + b)" @@ -460,7 +460,7 @@ apply (drule summable_iff_convergent [THEN iffD1]) apply (drule convergent_Cauchy) apply (simp only: Cauchy_iff LIMSEQ_iff) - by (metis add.commute add_diff_cancel_right' diff_zero le_SucI sum_lessThan_Suc) + by (metis add.commute add_diff_cancel_right' diff_zero le_SucI sum.lessThan_Suc) lemma summable_imp_convergent: "summable f \ convergent f" by (force dest!: summable_LIMSEQ_zero simp: convergent_def) diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Set_Interval.thy --- a/src/HOL/Set_Interval.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Set_Interval.thy Wed Apr 10 13:34:55 2019 +0100 @@ -1831,19 +1831,41 @@ with the simplifier who adds the unsimplified premise \<^term>\x\B\ to the context.\ -lemmas sum_ivl_cong = sum.ivl_cong +context comm_monoid_set +begin + +lemma zero_middle: + assumes "1 \ p" "k \ p" + shows "F (\j. if j < k then g j else if j = k then \<^bold>1 else h (j - Suc 0)) {..p} + = F (\j. if j < k then g j else h j) {..p - Suc 0}" (is "?lhs = ?rhs") +proof - + have [simp]: "{..p - Suc 0} \ {j. j < k} = {.. - {j. j < k} = {k..p - Suc 0}" + using assms by auto + have "?lhs = F g {..* F (\j. if j = k then \<^bold>1 else h (j - Suc 0)) {k..p}" + using union_disjoint [of "{.. = F g {..* F (\j. h (j - Suc 0)) {Suc k..p}" + by (simp add: atLeast_Suc_atMost [of k p] assms) + also have "\ = F g {..* F h {k .. p - Suc 0}" + using reindex [of Suc "{k..p - Suc 0}"] assms by simp + also have "\ = ?rhs" + by (simp add: If_cases) + finally show ?thesis . +qed + +lemma atMost_Suc [simp]: + "F g {..Suc n} = F g {..n} \<^bold>* g (Suc n)" + by (simp add: atMost_Suc ac_simps) + +lemma lessThan_Suc [simp]: + "F g {..* g n" + by (simp add: lessThan_Suc ac_simps) + +end (* FIXME why are the following simp rules but the corresponding eqns on intervals are not? *) -lemma sum_atMost_Suc [simp]: - "(\i \ Suc n. f i) = (\i \ n. f i) + f (Suc n)" - by (simp add: atMost_Suc ac_simps) - -lemma sum_lessThan_Suc [simp]: - "(\i < Suc n. f i) = (\i < n. f i) + f n" - by (simp add: lessThan_Suc ac_simps) - lemma sum_cl_ivl_Suc [simp]: "sum f {m..Suc n} = (if Suc n < m then 0 else sum f {m..n} + f(Suc n))" by (auto simp: ac_simps atLeastAtMostSuc_conv) @@ -1851,11 +1873,6 @@ lemma sum_op_ivl_Suc [simp]: "sum f {m.. m + 1 ==> - (\i=n..m+1. f i) = (\i=n..m. f i) + f(m + 1)" -by (auto simp:ac_simps atLeastAtMostSuc_conv) -*) lemma sum_head: fixes n :: nat @@ -1871,14 +1888,6 @@ finally show ?thesis . qed -lemma sum_head_Suc: - "m \ n \ sum f {m..n} = f m + sum f {Suc m..n}" - by (fact sum.atLeast_Suc_atMost) - -lemma sum_head_upt_Suc: - "m < n \ sum f {m.. n + 1" shows "sum f {m..n + p} = sum f {m..n} + sum f {n + 1..n + p}" proof- @@ -1887,12 +1896,10 @@ atLeastSucAtMost_greaterThanAtMost) qed -lemmas sum_add_nat_ivl = sum.atLeastLessThan_concat - lemma sum_diff_nat_ivl: fixes f :: "nat \ 'a::ab_group_add" shows "\ m \ n; n \ p \ \ sum f {m.. 0" by auto then show ?thesis - by (induct n) (simp_all add: sum_add_nat_ivl add.commute atLeast0LessThan[symmetric]) + by (induct n) (simp_all add: sum.atLeastLessThan_concat add.commute atLeast0LessThan[symmetric]) qed auto lemma sum_triangle_reindex: @@ -2020,14 +2027,14 @@ next case (Suc n) note IH = this have "(\i\Suc (Suc n). f i) = (\i\Suc n. f i) + f (Suc (Suc n))" - by (rule sum_atMost_Suc) + by (rule sum.atMost_Suc) also have "(\i\Suc n. f i) = f 0 + (\i\n. f (Suc i))" by (rule IH) also have "f 0 + (\i\n. f (Suc i)) + f (Suc (Suc n)) = f 0 + ((\i\n. f (Suc i)) + f (Suc (Suc n)))" by (rule add.assoc) also have "(\i\n. f (Suc i)) + f (Suc (Suc n)) = (\i\Suc n. f (Suc i))" - by (rule sum_atMost_Suc [symmetric]) + by (rule sum.atMost_Suc [symmetric]) finally show ?case . qed diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/Transcendental.thy Wed Apr 10 13:34:55 2019 +0100 @@ -638,13 +638,13 @@ (\ij n" shows "z^n = a \ (\i\n. (if i = 0 then -a else if i=n then 1 else 0) * z^i) = 0" - using assms by (cases n) (simp_all add: sum_head_Suc atLeast0AtMost [symmetric]) + using assms by (cases n) (simp_all add: sum.atLeast_Suc_atMost atLeast0AtMost [symmetric]) lemma assumes "SORT_CONSTRAINT('a::{idom,real_normed_div_algebra})" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/ex/Sum_of_Powers.thy --- a/src/HOL/ex/Sum_of_Powers.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/ex/Sum_of_Powers.thy Wed Apr 10 13:34:55 2019 +0100 @@ -151,7 +151,7 @@ lemma sum_unroll: "(\k\n::nat. f k) = (if n = 0 then f 0 else f n + (\k\n - 1. f k))" -by auto (metis One_nat_def Suc_pred add.commute sum_atMost_Suc) +by auto (metis One_nat_def Suc_pred add.commute sum.atMost_Suc) lemma bernoulli_unroll: "n > 0 \ bernoulli n = - 1 / (real n + 1) * (\k\n - 1. real (n + 1 choose k) * bernoulli k)" diff -r c4f2cac288d2 -r 4005298550a6 src/HOL/ex/ThreeDivides.thy --- a/src/HOL/ex/ThreeDivides.thy Tue Apr 09 21:05:48 2019 +0100 +++ b/src/HOL/ex/ThreeDivides.thy Wed Apr 10 13:34:55 2019 +0100 @@ -203,7 +203,7 @@ (simp add: atLeast0LessThan) also have "\ = (\xSuc nd = nlen m\ finally show "m = (\x