src/HOL/Analysis/Brouwer_Fixpoint.thy
changeset 64267 b9a1486e79be
parent 64122 74fde524799e
child 64394 141e1ed8d5a0
equal deleted inserted replaced
64265:8eb6365f5916 64267:b9a1486e79be
    50 lemmas swap_apply2 = swap_apply(2)
    50 lemmas swap_apply2 = swap_apply(2)
    51 lemmas lessThan_empty_iff = Iio_eq_empty_iff_nat
    51 lemmas lessThan_empty_iff = Iio_eq_empty_iff_nat
    52 lemmas Zero_notin_Suc = zero_notin_Suc_image
    52 lemmas Zero_notin_Suc = zero_notin_Suc_image
    53 lemmas atMost_Suc_eq_insert_0 = Iic_Suc_eq_insert_0
    53 lemmas atMost_Suc_eq_insert_0 = Iic_Suc_eq_insert_0
    54 
    54 
    55 lemma setsum_union_disjoint':
    55 lemma sum_union_disjoint':
    56   assumes "finite A"
    56   assumes "finite A"
    57     and "finite B"
    57     and "finite B"
    58     and "A \<inter> B = {}"
    58     and "A \<inter> B = {}"
    59     and "A \<union> B = C"
    59     and "A \<union> B = C"
    60   shows "setsum g C = setsum g A + setsum g B"
    60   shows "sum g C = sum g A + sum g B"
    61   using setsum.union_disjoint[OF assms(1-3)] and assms(4) by auto
    61   using sum.union_disjoint[OF assms(1-3)] and assms(4) by auto
    62 
    62 
    63 lemma pointwise_minimal_pointwise_maximal:
    63 lemma pointwise_minimal_pointwise_maximal:
    64   fixes s :: "(nat \<Rightarrow> nat) set"
    64   fixes s :: "(nat \<Rightarrow> nat) set"
    65   assumes "finite s"
    65   assumes "finite s"
    66     and "s \<noteq> {}"
    66     and "s \<noteq> {}"
   137     and "\<And>s. s \<in> S \<Longrightarrow> \<not> compo s \<Longrightarrow> nF s = 0 \<or> nF s = 2"
   137     and "\<And>s. s \<in> S \<Longrightarrow> \<not> compo s \<Longrightarrow> nF s = 0 \<or> nF s = 2"
   138     and "odd (card {f\<in>F. compo' f \<and> bnd f})"
   138     and "odd (card {f\<in>F. compo' f \<and> bnd f})"
   139   shows "odd (card {s\<in>S. compo s})"
   139   shows "odd (card {s\<in>S. compo s})"
   140 proof -
   140 proof -
   141   have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + (\<Sum>s | s \<in> S \<and> compo s. nF s) = (\<Sum>s\<in>S. nF s)"
   141   have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + (\<Sum>s | s \<in> S \<and> compo s. nF s) = (\<Sum>s\<in>S. nF s)"
   142     by (subst setsum.union_disjoint[symmetric]) (auto intro!: setsum.cong)
   142     by (subst sum.union_disjoint[symmetric]) (auto intro!: sum.cong)
   143   also have "\<dots> = (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> bnd f}. face f s}) +
   143   also have "\<dots> = (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> bnd f}. face f s}) +
   144                   (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> \<not> bnd f}. face f s})"
   144                   (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> \<not> bnd f}. face f s})"
   145     unfolding setsum.distrib[symmetric]
   145     unfolding sum.distrib[symmetric]
   146     by (subst card_Un_disjoint[symmetric])
   146     by (subst card_Un_disjoint[symmetric])
   147        (auto simp: nF_def intro!: setsum.cong arg_cong[where f=card])
   147        (auto simp: nF_def intro!: sum.cong arg_cong[where f=card])
   148   also have "\<dots> = 1 * card {f\<in>F. compo' f \<and> bnd f} + 2 * card {f\<in>F. compo' f \<and> \<not> bnd f}"
   148   also have "\<dots> = 1 * card {f\<in>F. compo' f \<and> bnd f} + 2 * card {f\<in>F. compo' f \<and> \<not> bnd f}"
   149     using assms(4,5) by (fastforce intro!: arg_cong2[where f="op +"] setsum_multicount)
   149     using assms(4,5) by (fastforce intro!: arg_cong2[where f="op +"] sum_multicount)
   150   finally have "odd ((\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + card {s\<in>S. compo s})"
   150   finally have "odd ((\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + card {s\<in>S. compo s})"
   151     using assms(6,8) by simp
   151     using assms(6,8) by simp
   152   moreover have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) =
   152   moreover have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) =
   153     (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 0. nF s) + (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 2. nF s)"
   153     (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 0. nF s) + (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 2. nF s)"
   154     using assms(7) by (subst setsum.union_disjoint[symmetric]) (fastforce intro!: setsum.cong)+
   154     using assms(7) by (subst sum.union_disjoint[symmetric]) (fastforce intro!: sum.cong)+
   155   ultimately show ?thesis
   155   ultimately show ?thesis
   156     by auto
   156     by auto
   157 qed
   157 qed
   158 
   158 
   159 subsection \<open>The odd/even result for faces of complete vertices, generalized.\<close>
   159 subsection \<open>The odd/even result for faces of complete vertices, generalized.\<close>
  1415   unfolding bounded_def
  1415   unfolding bounded_def
  1416 proof (intro exI ballI)
  1416 proof (intro exI ballI)
  1417   fix y :: 'a assume y: "y \<in> unit_cube"
  1417   fix y :: 'a assume y: "y \<in> unit_cube"
  1418   have "dist 0 y = norm y" by (rule dist_0_norm)
  1418   have "dist 0 y = norm y" by (rule dist_0_norm)
  1419   also have "\<dots> = norm (\<Sum>i\<in>Basis. (y \<bullet> i) *\<^sub>R i)" unfolding euclidean_representation ..
  1419   also have "\<dots> = norm (\<Sum>i\<in>Basis. (y \<bullet> i) *\<^sub>R i)" unfolding euclidean_representation ..
  1420   also have "\<dots> \<le> (\<Sum>i\<in>Basis. norm ((y \<bullet> i) *\<^sub>R i))" by (rule norm_setsum)
  1420   also have "\<dots> \<le> (\<Sum>i\<in>Basis. norm ((y \<bullet> i) *\<^sub>R i))" by (rule norm_sum)
  1421   also have "\<dots> \<le> (\<Sum>i::'a\<in>Basis. 1)"
  1421   also have "\<dots> \<le> (\<Sum>i::'a\<in>Basis. 1)"
  1422     by (rule setsum_mono, simp add: y [unfolded mem_unit_cube])
  1422     by (rule sum_mono, simp add: y [unfolded mem_unit_cube])
  1423   finally show "dist 0 y \<le> (\<Sum>i::'a\<in>Basis. 1)" .
  1423   finally show "dist 0 y \<le> (\<Sum>i::'a\<in>Basis. 1)" .
  1424 qed
  1424 qed
  1425 
  1425 
  1426 lemma closed_unit_cube: "closed unit_cube"
  1426 lemma closed_unit_cube: "closed unit_cube"
  1427   unfolding unit_cube_def Collect_ball_eq Collect_conj_eq
  1427   unfolding unit_cube_def Collect_ball_eq Collect_conj_eq
  1677       by (auto simp add: not_le inner_diff)
  1677       by (auto simp add: not_le inner_diff)
  1678     have "norm (f z - z) \<le> (\<Sum>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar>)"
  1678     have "norm (f z - z) \<le> (\<Sum>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar>)"
  1679       unfolding inner_diff_left[symmetric]
  1679       unfolding inner_diff_left[symmetric]
  1680       by (rule norm_le_l1)
  1680       by (rule norm_le_l1)
  1681     also have "\<dots> < (\<Sum>(i::'a) \<in> Basis. d / real n)"
  1681     also have "\<dots> < (\<Sum>(i::'a) \<in> Basis. d / real n)"
  1682       apply (rule setsum_strict_mono)
  1682       apply (rule sum_strict_mono)
  1683       using as
  1683       using as
  1684       apply auto
  1684       apply auto
  1685       done
  1685       done
  1686     also have "\<dots> = d"
  1686     also have "\<dots> = d"
  1687       using DIM_positive[where 'a='a]
  1687       using DIM_positive[where 'a='a]
  1729     by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1 less_imp_le)
  1729     by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1 less_imp_le)
  1730   have *: "\<And>x. 1 + real x = real (Suc x)"
  1730   have *: "\<And>x. 1 + real x = real (Suc x)"
  1731     by auto
  1731     by auto
  1732   {
  1732   {
  1733     have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
  1733     have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
  1734       apply (rule setsum_mono)
  1734       apply (rule sum_mono)
  1735       using rs(1)[OF b'_im]
  1735       using rs(1)[OF b'_im]
  1736       apply (auto simp add:* field_simps simp del: of_nat_Suc)
  1736       apply (auto simp add:* field_simps simp del: of_nat_Suc)
  1737       done
  1737       done
  1738     also have "\<dots> < e * real p"
  1738     also have "\<dots> < e * real p"
  1739       using p \<open>e > 0\<close> \<open>p > 0\<close>
  1739       using p \<open>e > 0\<close> \<open>p > 0\<close>
  1741     finally have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) < e * real p" .
  1741     finally have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) < e * real p" .
  1742   }
  1742   }
  1743   moreover
  1743   moreover
  1744   {
  1744   {
  1745     have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
  1745     have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
  1746       apply (rule setsum_mono)
  1746       apply (rule sum_mono)
  1747       using rs(2)[OF b'_im]
  1747       using rs(2)[OF b'_im]
  1748       apply (auto simp add:* field_simps simp del: of_nat_Suc)
  1748       apply (auto simp add:* field_simps simp del: of_nat_Suc)
  1749       done
  1749       done
  1750     also have "\<dots> < e * real p"
  1750     also have "\<dots> < e * real p"
  1751       using p \<open>e > 0\<close> \<open>p > 0\<close>
  1751       using p \<open>e > 0\<close> \<open>p > 0\<close>
  1755   ultimately
  1755   ultimately
  1756   have "norm (r' - z) < e" and "norm (s' - z) < e"
  1756   have "norm (r' - z) < e" and "norm (s' - z) < e"
  1757     unfolding r'_def s'_def z_def
  1757     unfolding r'_def s'_def z_def
  1758     using \<open>p > 0\<close>
  1758     using \<open>p > 0\<close>
  1759     apply (rule_tac[!] le_less_trans[OF norm_le_l1])
  1759     apply (rule_tac[!] le_less_trans[OF norm_le_l1])
  1760     apply (auto simp add: field_simps setsum_divide_distrib[symmetric] inner_diff_left)
  1760     apply (auto simp add: field_simps sum_divide_distrib[symmetric] inner_diff_left)
  1761     done
  1761     done
  1762   then have "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
  1762   then have "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
  1763     using rs(3) i
  1763     using rs(3) i
  1764     unfolding r'_def[symmetric] s'_def[symmetric] o_def bb'
  1764     unfolding r'_def[symmetric] s'_def[symmetric] o_def bb'
  1765     by (intro e(2)[OF \<open>r'\<in>unit_cube\<close> \<open>s'\<in>unit_cube\<close> \<open>z\<in>unit_cube\<close>]) auto
  1765     by (intro e(2)[OF \<open>r'\<in>unit_cube\<close> \<open>s'\<in>unit_cube\<close> \<open>z\<in>unit_cube\<close>]) auto