src/HOL/Analysis/Winding_Numbers.thy
changeset 66827 c94531b5007d
parent 66826 0d60d2118544
child 66884 c2128ab11f61
equal deleted inserted replaced
66826:0d60d2118544 66827:c94531b5007d
   797 (* TODO: Move *)
   797 (* TODO: Move *)
   798 lemma closed_segmentI:
   798 lemma closed_segmentI:
   799   "u \<in> {0..1} \<Longrightarrow> z = (1 - u) *\<^sub>R a + u *\<^sub>R b \<Longrightarrow> z \<in> closed_segment a b"
   799   "u \<in> {0..1} \<Longrightarrow> z = (1 - u) *\<^sub>R a + u *\<^sub>R b \<Longrightarrow> z \<in> closed_segment a b"
   800   by (auto simp: closed_segment_def)
   800   by (auto simp: closed_segment_def)
   801 
   801 
   802 lemma in_cbox_complex_iff: 
   802 lemma in_cbox_complex_iff:
   803   "x \<in> cbox a b \<longleftrightarrow> Re x \<in> {Re a..Re b} \<and> Im x \<in> {Im a..Im b}"
   803   "x \<in> cbox a b \<longleftrightarrow> Re x \<in> {Re a..Re b} \<and> Im x \<in> {Im a..Im b}"
   804   by (cases x; cases a; cases b) (auto simp: cbox_Complex_eq)
   804   by (cases x; cases a; cases b) (auto simp: cbox_Complex_eq)
   805 
   805 
   806 lemma box_Complex_eq: 
   806 lemma box_Complex_eq:
   807   "box (Complex a c) (Complex b d) = (\<lambda>(x,y). Complex x y) ` (box a b \<times> box c d)"
   807   "box (Complex a c) (Complex b d) = (\<lambda>(x,y). Complex x y) ` (box a b \<times> box c d)"
   808   by (auto simp: box_def Basis_complex_def image_iff complex_eq_iff)
   808   by (auto simp: box_def Basis_complex_def image_iff complex_eq_iff)
   809 
   809 
   810 lemma in_box_complex_iff: 
   810 lemma in_box_complex_iff:
   811   "x \<in> box a b \<longleftrightarrow> Re x \<in> {Re a<..<Re b} \<and> Im x \<in> {Im a<..<Im b}"
   811   "x \<in> box a b \<longleftrightarrow> Re x \<in> {Re a<..<Re b} \<and> Im x \<in> {Im a<..<Im b}"
   812   by (cases x; cases a; cases b) (auto simp: box_Complex_eq)
   812   by (cases x; cases a; cases b) (auto simp: box_Complex_eq)
   813 (* END TODO *)
   813 (* END TODO *)
   814 
   814 
   815 lemma closed_segment_same_Re:
   815 lemma closed_segment_same_Re:
   849 qed
   849 qed
   850 
   850 
   851 
   851 
   852 definition rectpath where
   852 definition rectpath where
   853   "rectpath a1 a3 = (let a2 = Complex (Re a3) (Im a1); a4 = Complex (Re a1) (Im a3)
   853   "rectpath a1 a3 = (let a2 = Complex (Re a3) (Im a1); a4 = Complex (Re a1) (Im a3)
   854                       in linepath a1 a2 +++ linepath a2 a3 +++ linepath a3 a4 +++ linepath a4 a1)" 
   854                       in linepath a1 a2 +++ linepath a2 a3 +++ linepath a3 a4 +++ linepath a4 a1)"
   855 
   855 
   856 lemma path_rectpath [simp, intro]: "path (rectpath a b)"
   856 lemma path_rectpath [simp, intro]: "path (rectpath a b)"
   857   by (simp add: Let_def rectpath_def)
   857   by (simp add: Let_def rectpath_def)
   858 
   858 
   859 lemma valid_path_rectpath [simp, intro]: "valid_path (rectpath a b)"
   859 lemma valid_path_rectpath [simp, intro]: "valid_path (rectpath a b)"
   863   by (simp add: rectpath_def Let_def)
   863   by (simp add: rectpath_def Let_def)
   864 
   864 
   865 lemma pathfinish_rectpath [simp]: "pathfinish (rectpath a1 a3) = a1"
   865 lemma pathfinish_rectpath [simp]: "pathfinish (rectpath a1 a3) = a1"
   866   by (simp add: rectpath_def Let_def)
   866   by (simp add: rectpath_def Let_def)
   867 
   867 
   868 lemma simple_path_rectpath [simp, intro]: 
   868 lemma simple_path_rectpath [simp, intro]:
   869   assumes "Re a1 \<noteq> Re a3" "Im a1 \<noteq> Im a3"
   869   assumes "Re a1 \<noteq> Re a3" "Im a1 \<noteq> Im a3"
   870   shows   "simple_path (rectpath a1 a3)"
   870   shows   "simple_path (rectpath a1 a3)"
   871   unfolding rectpath_def Let_def using assms
   871   unfolding rectpath_def Let_def using assms
   872   by (intro simple_path_join_loop arc_join arc_linepath)
   872   by (intro simple_path_join_loop arc_join arc_linepath)
   873      (auto simp: complex_eq_iff path_image_join closed_segment_same_Re closed_segment_same_Im)
   873      (auto simp: complex_eq_iff path_image_join closed_segment_same_Re closed_segment_same_Im)
   874 
   874 
   875 lemma path_image_rectpath: 
   875 lemma path_image_rectpath:
   876   assumes "Re a1 \<le> Re a3" "Im a1 \<le> Im a3"
   876   assumes "Re a1 \<le> Re a3" "Im a1 \<le> Im a3"
   877   shows "path_image (rectpath a1 a3) = 
   877   shows "path_image (rectpath a1 a3) =
   878            {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union>
   878            {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union>
   879            {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}" (is "?lhs = ?rhs")
   879            {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}" (is "?lhs = ?rhs")
   880 proof -
   880 proof -
   881   define a2 a4 where "a2 = Complex (Re a3) (Im a1)" and "a4 = Complex (Re a1) (Im a3)"
   881   define a2 a4 where "a2 = Complex (Re a3) (Im a1)" and "a4 = Complex (Re a1) (Im a3)"
   882   have "?lhs = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> 
   882   have "?lhs = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union>
   883                   closed_segment a4 a3 \<union> closed_segment a1 a4"
   883                   closed_segment a4 a3 \<union> closed_segment a1 a4"
   884     by (simp_all add: rectpath_def Let_def path_image_join closed_segment_commute
   884     by (simp_all add: rectpath_def Let_def path_image_join closed_segment_commute
   885                       a2_def a4_def Un_assoc)
   885                       a2_def a4_def Un_assoc)
   886   also have "\<dots> = ?rhs" using assms
   886   also have "\<dots> = ?rhs" using assms
   887     by (auto simp: rectpath_def Let_def path_image_join a2_def a4_def
   887     by (auto simp: rectpath_def Let_def path_image_join a2_def a4_def
   900   using assms by (auto simp: path_image_rectpath in_box_complex_iff)
   900   using assms by (auto simp: path_image_rectpath in_box_complex_iff)
   901 
   901 
   902 lemma path_image_rectpath_cbox_minus_box:
   902 lemma path_image_rectpath_cbox_minus_box:
   903   assumes "Re a \<le> Re b" "Im a \<le> Im b"
   903   assumes "Re a \<le> Re b" "Im a \<le> Im b"
   904   shows   "path_image (rectpath a b) = cbox a b - box a b"
   904   shows   "path_image (rectpath a b) = cbox a b - box a b"
   905   using assms by (auto simp: path_image_rectpath in_cbox_complex_iff 
   905   using assms by (auto simp: path_image_rectpath in_cbox_complex_iff
   906                              in_box_complex_iff)
   906                              in_box_complex_iff)
   907 
   907 
   908 lemma winding_number_rectpath:
   908 lemma winding_number_rectpath:
   909   assumes "z \<in> box a1 a3"
   909   assumes "z \<in> box a1 a3"
   910   shows   "winding_number (rectpath a1 a3) z = 1"
   910   shows   "winding_number (rectpath a1 a3) z = 1"
   914   define a2 a4 where "a2 = Complex (Re a3) (Im a1)" and "a4 = Complex (Re a1) (Im a3)"
   914   define a2 a4 where "a2 = Complex (Re a3) (Im a1)" and "a4 = Complex (Re a1) (Im a3)"
   915   let ?l1 = "linepath a1 a2" and ?l2 = "linepath a2 a3"
   915   let ?l1 = "linepath a1 a2" and ?l2 = "linepath a2 a3"
   916   and ?l3 = "linepath a3 a4" and ?l4 = "linepath a4 a1"
   916   and ?l3 = "linepath a3 a4" and ?l4 = "linepath a4 a1"
   917   from assms and less have "z \<notin> path_image (rectpath a1 a3)"
   917   from assms and less have "z \<notin> path_image (rectpath a1 a3)"
   918     by (auto simp: path_image_rectpath_cbox_minus_box)
   918     by (auto simp: path_image_rectpath_cbox_minus_box)
   919   also have "path_image (rectpath a1 a3) = 
   919   also have "path_image (rectpath a1 a3) =
   920                path_image ?l1 \<union> path_image ?l2 \<union> path_image ?l3 \<union> path_image ?l4"
   920                path_image ?l1 \<union> path_image ?l2 \<union> path_image ?l3 \<union> path_image ?l4"
   921     by (simp add: rectpath_def Let_def path_image_join Un_assoc a2_def a4_def)
   921     by (simp add: rectpath_def Let_def path_image_join Un_assoc a2_def a4_def)
   922   finally have "z \<notin> \<dots>" .
   922   finally have "z \<notin> \<dots>" .
   923   moreover have "\<forall>l\<in>{?l1,?l2,?l3,?l4}. Re (winding_number l z) > 0"
   923   moreover have "\<forall>l\<in>{?l1,?l2,?l3,?l4}. Re (winding_number l z) > 0"
   924     unfolding ball_simps HOL.simp_thms a2_def a4_def
   924     unfolding ball_simps HOL.simp_thms a2_def a4_def
   933 
   933 
   934 lemma winding_number_rectpath_outside:
   934 lemma winding_number_rectpath_outside:
   935   assumes "Re a1 \<le> Re a3" "Im a1 \<le> Im a3"
   935   assumes "Re a1 \<le> Re a3" "Im a1 \<le> Im a3"
   936   assumes "z \<notin> cbox a1 a3"
   936   assumes "z \<notin> cbox a1 a3"
   937   shows   "winding_number (rectpath a1 a3) z = 0"
   937   shows   "winding_number (rectpath a1 a3) z = 0"
   938   using assms by (intro winding_number_zero_outside[OF _ _ _ assms(3)] 
   938   using assms by (intro winding_number_zero_outside[OF _ _ _ assms(3)]
   939                      path_image_rectpath_subset_cbox) simp_all
   939                      path_image_rectpath_subset_cbox) simp_all
   940 
   940 
   941 
   941 
   942 text\<open>A per-function version for continuous logs, a kind of monodromy\<close>
   942 text\<open>A per-function version for continuous logs, a kind of monodromy\<close>
   943 
   943 
  1072             (at t within {0..1})"
  1072             (at t within {0..1})"
  1073       proof (rule Lim_transform_within [OF _ \<open>d > 0\<close>])
  1073       proof (rule Lim_transform_within [OF _ \<open>d > 0\<close>])
  1074         have "continuous (at t within {0..1}) (g o p)"
  1074         have "continuous (at t within {0..1}) (g o p)"
  1075           apply (rule continuous_within_compose)
  1075           apply (rule continuous_within_compose)
  1076           using \<open>path p\<close> continuous_on_eq_continuous_within path_def that apply blast
  1076           using \<open>path p\<close> continuous_on_eq_continuous_within path_def that apply blast
  1077           by (metis (no_types, lifting) Topology_Euclidean_Space.open_ball UNIV_I \<open>p t \<noteq> \<zeta>\<close> centre_in_ball contg continuous_on_eq_continuous_at continuous_within_topological right_minus_eq zero_less_norm_iff)
  1077           by (metis (no_types, lifting) open_ball UNIV_I \<open>p t \<noteq> \<zeta>\<close> centre_in_ball contg continuous_on_eq_continuous_at continuous_within_topological right_minus_eq zero_less_norm_iff)
  1078         with LIM_zero have "((\<lambda>u. (g (subpath t u p 1) - g (subpath t u p 0))) \<longlongrightarrow> 0) (at t within {0..1})"
  1078         with LIM_zero have "((\<lambda>u. (g (subpath t u p 1) - g (subpath t u p 0))) \<longlongrightarrow> 0) (at t within {0..1})"
  1079           by (auto simp: subpath_def continuous_within o_def)
  1079           by (auto simp: subpath_def continuous_within o_def)
  1080         then show "((\<lambda>u.  (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * of_real pi * \<i>)) \<longlongrightarrow> 0)
  1080         then show "((\<lambda>u.  (g (subpath t u p 1) - g (subpath t u p 0)) / (2 * of_real pi * \<i>)) \<longlongrightarrow> 0)
  1081            (at t within {0..1})"
  1081            (at t within {0..1})"
  1082           by (simp add: tendsto_divide_zero)
  1082           by (simp add: tendsto_divide_zero)