src/HOL/Analysis/Cauchy_Integral_Theorem.thy
 author paulson Mon Jun 11 22:43:33 2018 +0100 (12 months ago) changeset 68420 529d6b132c27 parent 68403 223172b97d0b child 68493 143b4cc8fc74 permissions -rw-r--r--
tidier Cauchy proofs
 lp15@60809 ` 1` ```section \Complex path integrals and Cauchy's integral theorem\ ``` lp15@60809 ` 2` lp15@61711 ` 3` ```text\By John Harrison et al. Ported from HOL Light by L C Paulson (2015)\ ``` lp15@61711 ` 4` hoelzl@63594 ` 5` ```theory Cauchy_Integral_Theorem ``` hoelzl@63594 ` 6` ```imports Complex_Transcendental Weierstrass_Theorems Ordered_Euclidean_Space ``` lp15@60809 ` 7` ```begin ``` lp15@60809 ` 8` lp15@62620 ` 9` ```subsection\Homeomorphisms of arc images\ ``` lp15@62620 ` 10` lp15@62620 ` 11` ```lemma homeomorphism_arc: ``` lp15@62620 ` 12` ``` fixes g :: "real \ 'a::t2_space" ``` lp15@62620 ` 13` ``` assumes "arc g" ``` lp15@62620 ` 14` ``` obtains h where "homeomorphism {0..1} (path_image g) g h" ``` lp15@68339 ` 15` ```using assms by (force simp: arc_def homeomorphism_compact path_def path_image_def) ``` lp15@62620 ` 16` lp15@62620 ` 17` ```lemma homeomorphic_arc_image_interval: ``` lp15@62620 ` 18` ``` fixes g :: "real \ 'a::t2_space" and a::real ``` lp15@62620 ` 19` ``` assumes "arc g" "a < b" ``` lp15@62620 ` 20` ``` shows "(path_image g) homeomorphic {a..b}" ``` lp15@62620 ` 21` ```proof - ``` lp15@62620 ` 22` ``` have "(path_image g) homeomorphic {0..1::real}" ``` lp15@62620 ` 23` ``` by (meson assms(1) homeomorphic_def homeomorphic_sym homeomorphism_arc) ``` lp15@68339 ` 24` ``` also have "\ homeomorphic {a..b}" ``` lp15@62620 ` 25` ``` using assms by (force intro: homeomorphic_closed_intervals_real) ``` lp15@62620 ` 26` ``` finally show ?thesis . ``` lp15@62620 ` 27` ```qed ``` lp15@62620 ` 28` lp15@62620 ` 29` ```lemma homeomorphic_arc_images: ``` lp15@62620 ` 30` ``` fixes g :: "real \ 'a::t2_space" and h :: "real \ 'b::t2_space" ``` lp15@62620 ` 31` ``` assumes "arc g" "arc h" ``` lp15@62620 ` 32` ``` shows "(path_image g) homeomorphic (path_image h)" ``` lp15@62620 ` 33` ```proof - ``` lp15@62620 ` 34` ``` have "(path_image g) homeomorphic {0..1::real}" ``` lp15@62620 ` 35` ``` by (meson assms homeomorphic_def homeomorphic_sym homeomorphism_arc) ``` lp15@68339 ` 36` ``` also have "\ homeomorphic (path_image h)" ``` lp15@62620 ` 37` ``` by (meson assms homeomorphic_def homeomorphism_arc) ``` lp15@62620 ` 38` ``` finally show ?thesis . ``` lp15@62620 ` 39` ```qed ``` lp15@62620 ` 40` lp15@65037 ` 41` ```lemma path_connected_arc_complement: ``` lp15@65037 ` 42` ``` fixes \ :: "real \ 'a::euclidean_space" ``` lp15@65037 ` 43` ``` assumes "arc \" "2 \ DIM('a)" ``` lp15@65037 ` 44` ``` shows "path_connected(- path_image \)" ``` lp15@65037 ` 45` ```proof - ``` lp15@65037 ` 46` ``` have "path_image \ homeomorphic {0..1::real}" ``` lp15@65037 ` 47` ``` by (simp add: assms homeomorphic_arc_image_interval) ``` lp15@65037 ` 48` ``` then ``` lp15@65037 ` 49` ``` show ?thesis ``` lp15@65037 ` 50` ``` apply (rule path_connected_complement_homeomorphic_convex_compact) ``` lp15@65037 ` 51` ``` apply (auto simp: assms) ``` lp15@65037 ` 52` ``` done ``` lp15@65037 ` 53` ```qed ``` lp15@65037 ` 54` lp15@65037 ` 55` ```lemma connected_arc_complement: ``` lp15@65037 ` 56` ``` fixes \ :: "real \ 'a::euclidean_space" ``` lp15@65037 ` 57` ``` assumes "arc \" "2 \ DIM('a)" ``` lp15@65037 ` 58` ``` shows "connected(- path_image \)" ``` lp15@65037 ` 59` ``` by (simp add: assms path_connected_arc_complement path_connected_imp_connected) ``` lp15@65037 ` 60` lp15@65037 ` 61` ```lemma inside_arc_empty: ``` lp15@65037 ` 62` ``` fixes \ :: "real \ 'a::euclidean_space" ``` lp15@65037 ` 63` ``` assumes "arc \" ``` lp15@65037 ` 64` ``` shows "inside(path_image \) = {}" ``` lp15@65037 ` 65` ```proof (cases "DIM('a) = 1") ``` lp15@65037 ` 66` ``` case True ``` lp15@65037 ` 67` ``` then show ?thesis ``` lp15@65037 ` 68` ``` using assms connected_arc_image connected_convex_1_gen inside_convex by blast ``` lp15@65037 ` 69` ```next ``` lp15@65037 ` 70` ``` case False ``` lp15@65037 ` 71` ``` show ?thesis ``` lp15@65037 ` 72` ``` proof (rule inside_bounded_complement_connected_empty) ``` lp15@65037 ` 73` ``` show "connected (- path_image \)" ``` lp15@65037 ` 74` ``` apply (rule connected_arc_complement [OF assms]) ``` lp15@65037 ` 75` ``` using False ``` lp15@65037 ` 76` ``` by (metis DIM_ge_Suc0 One_nat_def Suc_1 not_less_eq_eq order_class.order.antisym) ``` lp15@65037 ` 77` ``` show "bounded (path_image \)" ``` lp15@65037 ` 78` ``` by (simp add: assms bounded_arc_image) ``` lp15@65037 ` 79` ``` qed ``` lp15@65037 ` 80` ```qed ``` lp15@65037 ` 81` lp15@65037 ` 82` ```lemma inside_simple_curve_imp_closed: ``` lp15@65037 ` 83` ``` fixes \ :: "real \ 'a::euclidean_space" ``` lp15@65037 ` 84` ``` shows "\simple_path \; x \ inside(path_image \)\ \ pathfinish \ = pathstart \" ``` lp15@65037 ` 85` ``` using arc_simple_path inside_arc_empty by blast ``` lp15@65037 ` 86` lp15@65037 ` 87` ``` ``` lp15@61190 ` 88` ```subsection \Piecewise differentiable functions\ ``` lp15@60809 ` 89` lp15@60809 ` 90` ```definition piecewise_differentiable_on ``` lp15@60809 ` 91` ``` (infixr "piecewise'_differentiable'_on" 50) ``` lp15@60809 ` 92` ``` where "f piecewise_differentiable_on i \ ``` lp15@60809 ` 93` ``` continuous_on i f \ ``` lp15@68284 ` 94` ``` (\S. finite S \ (\x \ i - S. f differentiable (at x within i)))" ``` lp15@60809 ` 95` lp15@60809 ` 96` ```lemma piecewise_differentiable_on_imp_continuous_on: ``` lp15@68284 ` 97` ``` "f piecewise_differentiable_on S \ continuous_on S f" ``` lp15@60809 ` 98` ```by (simp add: piecewise_differentiable_on_def) ``` lp15@60809 ` 99` lp15@60809 ` 100` ```lemma piecewise_differentiable_on_subset: ``` lp15@68284 ` 101` ``` "f piecewise_differentiable_on S \ T \ S \ f piecewise_differentiable_on T" ``` lp15@60809 ` 102` ``` using continuous_on_subset ``` lp15@61190 ` 103` ``` unfolding piecewise_differentiable_on_def ``` lp15@61190 ` 104` ``` apply safe ``` lp15@68339 ` 105` ``` apply (blast elim: continuous_on_subset) ``` lp15@61190 ` 106` ``` by (meson Diff_iff differentiable_within_subset subsetCE) ``` lp15@60809 ` 107` lp15@60809 ` 108` ```lemma differentiable_on_imp_piecewise_differentiable: ``` lp15@60809 ` 109` ``` fixes a:: "'a::{linorder_topology,real_normed_vector}" ``` lp15@60809 ` 110` ``` shows "f differentiable_on {a..b} \ f piecewise_differentiable_on {a..b}" ``` lp15@60809 ` 111` ``` apply (simp add: piecewise_differentiable_on_def differentiable_imp_continuous_on) ``` lp15@61190 ` 112` ``` apply (rule_tac x="{a,b}" in exI, simp add: differentiable_on_def) ``` lp15@61190 ` 113` ``` done ``` lp15@60809 ` 114` lp15@60809 ` 115` ```lemma differentiable_imp_piecewise_differentiable: ``` lp15@68284 ` 116` ``` "(\x. x \ S \ f differentiable (at x within S)) ``` lp15@68284 ` 117` ``` \ f piecewise_differentiable_on S" ``` lp15@61190 ` 118` ```by (auto simp: piecewise_differentiable_on_def differentiable_imp_continuous_on differentiable_on_def ``` lp15@61190 ` 119` ``` intro: differentiable_within_subset) ``` lp15@60809 ` 120` lp15@68284 ` 121` ```lemma piecewise_differentiable_const [iff]: "(\x. z) piecewise_differentiable_on S" ``` paulson@61204 ` 122` ``` by (simp add: differentiable_imp_piecewise_differentiable) ``` paulson@61204 ` 123` lp15@60809 ` 124` ```lemma piecewise_differentiable_compose: ``` lp15@68284 ` 125` ``` "\f piecewise_differentiable_on S; g piecewise_differentiable_on (f ` S); ``` lp15@68284 ` 126` ``` \x. finite (S \ f-`{x})\ ``` lp15@68339 ` 127` ``` \ (g \ f) piecewise_differentiable_on S" ``` lp15@60809 ` 128` ``` apply (simp add: piecewise_differentiable_on_def, safe) ``` lp15@60809 ` 129` ``` apply (blast intro: continuous_on_compose2) ``` lp15@60809 ` 130` ``` apply (rename_tac A B) ``` lp15@68284 ` 131` ``` apply (rule_tac x="A \ (\x\B. S \ f-`{x})" in exI) ``` lp15@65036 ` 132` ``` apply (blast intro!: differentiable_chain_within) ``` lp15@61190 ` 133` ``` done ``` lp15@60809 ` 134` lp15@60809 ` 135` ```lemma piecewise_differentiable_affine: ``` lp15@60809 ` 136` ``` fixes m::real ``` lp15@68284 ` 137` ``` assumes "f piecewise_differentiable_on ((\x. m *\<^sub>R x + c) ` S)" ``` lp15@68339 ` 138` ``` shows "(f \ (\x. m *\<^sub>R x + c)) piecewise_differentiable_on S" ``` lp15@60809 ` 139` ```proof (cases "m = 0") ``` lp15@60809 ` 140` ``` case True ``` lp15@60809 ` 141` ``` then show ?thesis ``` lp15@60809 ` 142` ``` unfolding o_def ``` lp15@60809 ` 143` ``` by (force intro: differentiable_imp_piecewise_differentiable differentiable_const) ``` lp15@60809 ` 144` ```next ``` lp15@60809 ` 145` ``` case False ``` lp15@60809 ` 146` ``` show ?thesis ``` lp15@60809 ` 147` ``` apply (rule piecewise_differentiable_compose [OF differentiable_imp_piecewise_differentiable]) ``` lp15@60809 ` 148` ``` apply (rule assms derivative_intros | simp add: False vimage_def real_vector_affinity_eq)+ ``` lp15@60809 ` 149` ``` done ``` lp15@60809 ` 150` ```qed ``` lp15@60809 ` 151` lp15@60809 ` 152` ```lemma piecewise_differentiable_cases: ``` lp15@60809 ` 153` ``` fixes c::real ``` lp15@60809 ` 154` ``` assumes "f piecewise_differentiable_on {a..c}" ``` lp15@60809 ` 155` ``` "g piecewise_differentiable_on {c..b}" ``` lp15@60809 ` 156` ``` "a \ c" "c \ b" "f c = g c" ``` lp15@60809 ` 157` ``` shows "(\x. if x \ c then f x else g x) piecewise_differentiable_on {a..b}" ``` lp15@60809 ` 158` ```proof - ``` lp15@68284 ` 159` ``` obtain S T where st: "finite S" "finite T" ``` lp15@68284 ` 160` ``` and fd: "\x. x \ {a..c} - S \ f differentiable at x within {a..c}" ``` lp15@68284 ` 161` ``` and gd: "\x. x \ {c..b} - T \ g differentiable at x within {c..b}" ``` lp15@60809 ` 162` ``` using assms ``` lp15@60809 ` 163` ``` by (auto simp: piecewise_differentiable_on_def) ``` lp15@68284 ` 164` ``` have finabc: "finite ({a,b,c} \ (S \ T))" ``` lp15@68284 ` 165` ``` by (metis \finite S\ \finite T\ finite_Un finite_insert finite.emptyI) ``` lp15@60809 ` 166` ``` have "continuous_on {a..c} f" "continuous_on {c..b} g" ``` lp15@60809 ` 167` ``` using assms piecewise_differentiable_on_def by auto ``` lp15@60809 ` 168` ``` then have "continuous_on {a..b} (\x. if x \ c then f x else g x)" ``` lp15@60809 ` 169` ``` using continuous_on_cases [OF closed_real_atLeastAtMost [of a c], ``` lp15@60809 ` 170` ``` OF closed_real_atLeastAtMost [of c b], ``` lp15@60809 ` 171` ``` of f g "\x. x\c"] assms ``` lp15@60809 ` 172` ``` by (force simp: ivl_disj_un_two_touch) ``` lp15@60809 ` 173` ``` moreover ``` lp15@60809 ` 174` ``` { fix x ``` lp15@68284 ` 175` ``` assume x: "x \ {a..b} - ({a,b,c} \ (S \ T))" ``` lp15@61190 ` 176` ``` have "(\x. if x \ c then f x else g x) differentiable at x within {a..b}" (is "?diff_fg") ``` lp15@60809 ` 177` ``` proof (cases x c rule: le_cases) ``` lp15@60809 ` 178` ``` case le show ?diff_fg ``` lp15@68284 ` 179` ``` proof (rule differentiable_transform_within [where d = "dist x c"]) ``` lp15@68284 ` 180` ``` have "f differentiable at x" ``` lp15@68284 ` 181` ``` using x le fd [of x] at_within_interior [of x "{a..c}"] by simp ``` lp15@68284 ` 182` ``` then show "f differentiable at x within {a..b}" ``` lp15@68284 ` 183` ``` by (simp add: differentiable_at_withinI) ``` lp15@63955 ` 184` ``` qed (use x le st dist_real_def in auto) ``` lp15@60809 ` 185` ``` next ``` lp15@60809 ` 186` ``` case ge show ?diff_fg ``` lp15@68284 ` 187` ``` proof (rule differentiable_transform_within [where d = "dist x c"]) ``` lp15@68284 ` 188` ``` have "g differentiable at x" ``` lp15@68284 ` 189` ``` using x ge gd [of x] at_within_interior [of x "{c..b}"] by simp ``` lp15@68284 ` 190` ``` then show "g differentiable at x within {a..b}" ``` lp15@68284 ` 191` ``` by (simp add: differentiable_at_withinI) ``` lp15@63955 ` 192` ``` qed (use x ge st dist_real_def in auto) ``` lp15@60809 ` 193` ``` qed ``` lp15@60809 ` 194` ``` } ``` lp15@68284 ` 195` ``` then have "\S. finite S \ ``` lp15@68284 ` 196` ``` (\x\{a..b} - S. (\x. if x \ c then f x else g x) differentiable at x within {a..b})" ``` lp15@61190 ` 197` ``` by (meson finabc) ``` lp15@60809 ` 198` ``` ultimately show ?thesis ``` lp15@60809 ` 199` ``` by (simp add: piecewise_differentiable_on_def) ``` lp15@60809 ` 200` ```qed ``` lp15@60809 ` 201` lp15@60809 ` 202` ```lemma piecewise_differentiable_neg: ``` lp15@68284 ` 203` ``` "f piecewise_differentiable_on S \ (\x. -(f x)) piecewise_differentiable_on S" ``` lp15@60809 ` 204` ``` by (auto simp: piecewise_differentiable_on_def continuous_on_minus) ``` lp15@60809 ` 205` lp15@60809 ` 206` ```lemma piecewise_differentiable_add: ``` lp15@60809 ` 207` ``` assumes "f piecewise_differentiable_on i" ``` lp15@60809 ` 208` ``` "g piecewise_differentiable_on i" ``` lp15@60809 ` 209` ``` shows "(\x. f x + g x) piecewise_differentiable_on i" ``` lp15@60809 ` 210` ```proof - ``` lp15@68284 ` 211` ``` obtain S T where st: "finite S" "finite T" ``` lp15@68284 ` 212` ``` "\x\i - S. f differentiable at x within i" ``` lp15@68284 ` 213` ``` "\x\i - T. g differentiable at x within i" ``` lp15@60809 ` 214` ``` using assms by (auto simp: piecewise_differentiable_on_def) ``` lp15@68284 ` 215` ``` then have "finite (S \ T) \ (\x\i - (S \ T). (\x. f x + g x) differentiable at x within i)" ``` lp15@60809 ` 216` ``` by auto ``` lp15@60809 ` 217` ``` moreover have "continuous_on i f" "continuous_on i g" ``` lp15@60809 ` 218` ``` using assms piecewise_differentiable_on_def by auto ``` lp15@60809 ` 219` ``` ultimately show ?thesis ``` lp15@60809 ` 220` ``` by (auto simp: piecewise_differentiable_on_def continuous_on_add) ``` lp15@60809 ` 221` ```qed ``` lp15@60809 ` 222` lp15@60809 ` 223` ```lemma piecewise_differentiable_diff: ``` lp15@68284 ` 224` ``` "\f piecewise_differentiable_on S; g piecewise_differentiable_on S\ ``` lp15@68284 ` 225` ``` \ (\x. f x - g x) piecewise_differentiable_on S" ``` lp15@60809 ` 226` ``` unfolding diff_conv_add_uminus ``` lp15@60809 ` 227` ``` by (metis piecewise_differentiable_add piecewise_differentiable_neg) ``` lp15@60809 ` 228` lp15@61190 ` 229` ```lemma continuous_on_joinpaths_D1: ``` lp15@61190 ` 230` ``` "continuous_on {0..1} (g1 +++ g2) \ continuous_on {0..1} g1" ``` lp15@68339 ` 231` ``` apply (rule continuous_on_eq [of _ "(g1 +++ g2) \ (( *)(inverse 2))"]) ``` lp15@61190 ` 232` ``` apply (rule continuous_intros | simp)+ ``` lp15@61190 ` 233` ``` apply (auto elim!: continuous_on_subset simp: joinpaths_def) ``` lp15@61190 ` 234` ``` done ``` lp15@61190 ` 235` lp15@61190 ` 236` ```lemma continuous_on_joinpaths_D2: ``` lp15@61190 ` 237` ``` "\continuous_on {0..1} (g1 +++ g2); pathfinish g1 = pathstart g2\ \ continuous_on {0..1} g2" ``` lp15@68339 ` 238` ``` apply (rule continuous_on_eq [of _ "(g1 +++ g2) \ (\x. inverse 2*x + 1/2)"]) ``` lp15@61190 ` 239` ``` apply (rule continuous_intros | simp)+ ``` lp15@61190 ` 240` ``` apply (auto elim!: continuous_on_subset simp add: joinpaths_def pathfinish_def pathstart_def Ball_def) ``` lp15@61190 ` 241` ``` done ``` lp15@61190 ` 242` lp15@61190 ` 243` ```lemma piecewise_differentiable_D1: ``` lp15@68284 ` 244` ``` assumes "(g1 +++ g2) piecewise_differentiable_on {0..1}" ``` lp15@68284 ` 245` ``` shows "g1 piecewise_differentiable_on {0..1}" ``` lp15@68284 ` 246` ```proof - ``` lp15@68284 ` 247` ``` obtain S where cont: "continuous_on {0..1} g1" and "finite S" ``` lp15@68284 ` 248` ``` and S: "\x. x \ {0..1} - S \ g1 +++ g2 differentiable at x within {0..1}" ``` lp15@68284 ` 249` ``` using assms unfolding piecewise_differentiable_on_def ``` lp15@68284 ` 250` ``` by (blast dest!: continuous_on_joinpaths_D1) ``` lp15@68284 ` 251` ``` show ?thesis ``` lp15@68284 ` 252` ``` unfolding piecewise_differentiable_on_def ``` lp15@68284 ` 253` ``` proof (intro exI conjI ballI cont) ``` lp15@68339 ` 254` ``` show "finite (insert 1 ((( *)2) ` S))" ``` lp15@68284 ` 255` ``` by (simp add: \finite S\) ``` lp15@68339 ` 256` ``` show "g1 differentiable at x within {0..1}" if "x \ {0..1} - insert 1 (( *) 2 ` S)" for x ``` lp15@68284 ` 257` ``` proof (rule_tac d="dist (x/2) (1/2)" in differentiable_transform_within) ``` lp15@68296 ` 258` ``` have "g1 +++ g2 differentiable at (x / 2) within {0..1/2}" ``` lp15@68284 ` 259` ``` by (rule differentiable_subset [OF S [of "x/2"]] | use that in force)+ ``` lp15@68339 ` 260` ``` then show "g1 +++ g2 \ ( *) (inverse 2) differentiable at x within {0..1}" ``` lp15@68284 ` 261` ``` by (auto intro: differentiable_chain_within) ``` lp15@68284 ` 262` ``` qed (use that in \auto simp: joinpaths_def\) ``` lp15@68284 ` 263` ``` qed ``` lp15@68284 ` 264` ```qed ``` lp15@61190 ` 265` lp15@61190 ` 266` ```lemma piecewise_differentiable_D2: ``` lp15@68284 ` 267` ``` assumes "(g1 +++ g2) piecewise_differentiable_on {0..1}" and eq: "pathfinish g1 = pathstart g2" ``` lp15@68284 ` 268` ``` shows "g2 piecewise_differentiable_on {0..1}" ``` lp15@68284 ` 269` ```proof - ``` lp15@68284 ` 270` ``` have [simp]: "g1 1 = g2 0" ``` lp15@68284 ` 271` ``` using eq by (simp add: pathfinish_def pathstart_def) ``` lp15@68284 ` 272` ``` obtain S where cont: "continuous_on {0..1} g2" and "finite S" ``` lp15@68284 ` 273` ``` and S: "\x. x \ {0..1} - S \ g1 +++ g2 differentiable at x within {0..1}" ``` lp15@68284 ` 274` ``` using assms unfolding piecewise_differentiable_on_def ``` lp15@68284 ` 275` ``` by (blast dest!: continuous_on_joinpaths_D2) ``` lp15@68284 ` 276` ``` show ?thesis ``` lp15@68284 ` 277` ``` unfolding piecewise_differentiable_on_def ``` lp15@68284 ` 278` ``` proof (intro exI conjI ballI cont) ``` lp15@68284 ` 279` ``` show "finite (insert 0 ((\x. 2*x-1)`S))" ``` lp15@68284 ` 280` ``` by (simp add: \finite S\) ``` lp15@68284 ` 281` ``` show "g2 differentiable at x within {0..1}" if "x \ {0..1} - insert 0 ((\x. 2*x-1)`S)" for x ``` lp15@68284 ` 282` ``` proof (rule_tac d="dist ((x+1)/2) (1/2)" in differentiable_transform_within) ``` lp15@68284 ` 283` ``` have x2: "(x + 1) / 2 \ S" ``` lp15@68284 ` 284` ``` using that ``` lp15@68284 ` 285` ``` apply (clarsimp simp: image_iff) ``` lp15@68284 ` 286` ``` by (metis add.commute add_diff_cancel_left' mult_2 real_sum_of_halves) ``` lp15@68284 ` 287` ``` have "g1 +++ g2 \ (\x. (x+1) / 2) differentiable at x within {0..1}" ``` lp15@68284 ` 288` ``` by (rule differentiable_chain_within differentiable_subset [OF S [of "(x+1)/2"]] | use x2 that in force)+ ``` lp15@68284 ` 289` ``` then show "g1 +++ g2 \ (\x. (x+1) / 2) differentiable at x within {0..1}" ``` lp15@68284 ` 290` ``` by (auto intro: differentiable_chain_within) ``` lp15@68296 ` 291` ``` show "(g1 +++ g2 \ (\x. (x + 1) / 2)) x' = g2 x'" if "x' \ {0..1}" "dist x' x < dist ((x + 1) / 2) (1/2)" for x' ``` lp15@68284 ` 292` ``` proof - ``` lp15@68284 ` 293` ``` have [simp]: "(2*x'+2)/2 = x'+1" ``` lp15@68284 ` 294` ``` by (simp add: divide_simps) ``` lp15@68284 ` 295` ``` show ?thesis ``` lp15@68284 ` 296` ``` using that by (auto simp: joinpaths_def) ``` lp15@68284 ` 297` ``` qed ``` lp15@68284 ` 298` ``` qed (use that in \auto simp: joinpaths_def\) ``` lp15@68284 ` 299` ``` qed ``` lp15@68284 ` 300` ```qed ``` lp15@61190 ` 301` lp15@61190 ` 302` lp15@61190 ` 303` ```subsubsection\The concept of continuously differentiable\ ``` lp15@61190 ` 304` lp15@62408 ` 305` ```text \ ``` lp15@62408 ` 306` ```John Harrison writes as follows: ``` lp15@62408 ` 307` wenzelm@62456 ` 308` `````The usual assumption in complex analysis texts is that a path \\\ should be piecewise ``` lp15@62408 ` 309` ```continuously differentiable, which ensures that the path integral exists at least for any continuous ``` lp15@62408 ` 310` ```f, since all piecewise continuous functions are integrable. However, our notion of validity is ``` lp15@68341 ` 311` ```weaker, just piecewise differentiability\ldots{} [namely] continuity plus differentiability except on a ``` lp15@68341 ` 312` ```finite set\ldots{} [Our] underlying theory of integration is the Kurzweil-Henstock theory. In contrast to ``` lp15@62408 ` 313` ```the Riemann or Lebesgue theory (but in common with a simple notion based on antiderivatives), this ``` lp15@62408 ` 314` ```can integrate all derivatives.'' ``` lp15@62408 ` 315` lp15@62534 ` 316` ```"Formalizing basic complex analysis." From Insight to Proof: Festschrift in Honour of Andrzej Trybulec. ``` lp15@62408 ` 317` ```Studies in Logic, Grammar and Rhetoric 10.23 (2007): 151-165. ``` lp15@62408 ` 318` lp15@62408 ` 319` ```And indeed he does not assume that his derivatives are continuous, but the penalty is unreasonably ``` lp15@62408 ` 320` ```difficult proofs concerning winding numbers. We need a self-contained and straightforward theorem ``` lp15@62408 ` 321` ```asserting that all derivatives can be integrated before we can adopt Harrison's choice.\ ``` lp15@62408 ` 322` lp15@61190 ` 323` ```definition C1_differentiable_on :: "(real \ 'a::real_normed_vector) \ real set \ bool" ``` lp15@61190 ` 324` ``` (infix "C1'_differentiable'_on" 50) ``` lp15@61190 ` 325` ``` where ``` lp15@68296 ` 326` ``` "f C1_differentiable_on S \ ``` lp15@68296 ` 327` ``` (\D. (\x \ S. (f has_vector_derivative (D x)) (at x)) \ continuous_on S D)" ``` lp15@61190 ` 328` lp15@61190 ` 329` ```lemma C1_differentiable_on_eq: ``` lp15@68296 ` 330` ``` "f C1_differentiable_on S \ ``` lp15@68296 ` 331` ``` (\x \ S. f differentiable at x) \ continuous_on S (\x. vector_derivative f (at x))" ``` lp15@68296 ` 332` ``` (is "?lhs = ?rhs") ``` lp15@68296 ` 333` ```proof ``` lp15@68296 ` 334` ``` assume ?lhs ``` lp15@68296 ` 335` ``` then show ?rhs ``` lp15@68296 ` 336` ``` unfolding C1_differentiable_on_def ``` lp15@68296 ` 337` ``` by (metis (no_types, lifting) continuous_on_eq differentiableI_vector vector_derivative_at) ``` lp15@68296 ` 338` ```next ``` lp15@68296 ` 339` ``` assume ?rhs ``` lp15@68296 ` 340` ``` then show ?lhs ``` lp15@68296 ` 341` ``` using C1_differentiable_on_def vector_derivative_works by fastforce ``` lp15@68296 ` 342` ```qed ``` lp15@61190 ` 343` lp15@61190 ` 344` ```lemma C1_differentiable_on_subset: ``` lp15@68296 ` 345` ``` "f C1_differentiable_on T \ S \ T \ f C1_differentiable_on S" ``` lp15@61190 ` 346` ``` unfolding C1_differentiable_on_def continuous_on_eq_continuous_within ``` lp15@61190 ` 347` ``` by (blast intro: continuous_within_subset) ``` lp15@61190 ` 348` lp15@61190 ` 349` ```lemma C1_differentiable_compose: ``` lp15@68296 ` 350` ``` assumes fg: "f C1_differentiable_on S" "g C1_differentiable_on (f ` S)" and fin: "\x. finite (S \ f-`{x})" ``` lp15@68339 ` 351` ``` shows "(g \ f) C1_differentiable_on S" ``` lp15@68296 ` 352` ```proof - ``` lp15@68296 ` 353` ``` have "\x. x \ S \ g \ f differentiable at x" ``` lp15@68296 ` 354` ``` by (meson C1_differentiable_on_eq assms differentiable_chain_at imageI) ``` lp15@68296 ` 355` ``` moreover have "continuous_on S (\x. vector_derivative (g \ f) (at x))" ``` lp15@68296 ` 356` ``` proof (rule continuous_on_eq [of _ "\x. vector_derivative f (at x) *\<^sub>R vector_derivative g (at (f x))"]) ``` lp15@68296 ` 357` ``` show "continuous_on S (\x. vector_derivative f (at x) *\<^sub>R vector_derivative g (at (f x)))" ``` lp15@68296 ` 358` ``` using fg ``` lp15@68296 ` 359` ``` apply (clarsimp simp add: C1_differentiable_on_eq) ``` lp15@68296 ` 360` ``` apply (rule Limits.continuous_on_scaleR, assumption) ``` lp15@68296 ` 361` ``` by (metis (mono_tags, lifting) continuous_at_imp_continuous_on continuous_on_compose continuous_on_cong differentiable_imp_continuous_within o_def) ``` lp15@68296 ` 362` ``` show "\x. x \ S \ vector_derivative f (at x) *\<^sub>R vector_derivative g (at (f x)) = vector_derivative (g \ f) (at x)" ``` lp15@68296 ` 363` ``` by (metis (mono_tags, hide_lams) C1_differentiable_on_eq fg imageI vector_derivative_chain_at) ``` lp15@68296 ` 364` ``` qed ``` lp15@68296 ` 365` ``` ultimately show ?thesis ``` lp15@68296 ` 366` ``` by (simp add: C1_differentiable_on_eq) ``` lp15@68296 ` 367` ```qed ``` lp15@68296 ` 368` lp15@68296 ` 369` ```lemma C1_diff_imp_diff: "f C1_differentiable_on S \ f differentiable_on S" ``` lp15@61190 ` 370` ``` by (simp add: C1_differentiable_on_eq differentiable_at_imp_differentiable_on) ``` lp15@61190 ` 371` lp15@68296 ` 372` ```lemma C1_differentiable_on_ident [simp, derivative_intros]: "(\x. x) C1_differentiable_on S" ``` lp15@61190 ` 373` ``` by (auto simp: C1_differentiable_on_eq continuous_on_const) ``` lp15@61190 ` 374` lp15@68296 ` 375` ```lemma C1_differentiable_on_const [simp, derivative_intros]: "(\z. a) C1_differentiable_on S" ``` lp15@61190 ` 376` ``` by (auto simp: C1_differentiable_on_eq continuous_on_const) ``` lp15@61190 ` 377` lp15@61190 ` 378` ```lemma C1_differentiable_on_add [simp, derivative_intros]: ``` lp15@68296 ` 379` ``` "f C1_differentiable_on S \ g C1_differentiable_on S \ (\x. f x + g x) C1_differentiable_on S" ``` lp15@61190 ` 380` ``` unfolding C1_differentiable_on_eq by (auto intro: continuous_intros) ``` lp15@61190 ` 381` lp15@61190 ` 382` ```lemma C1_differentiable_on_minus [simp, derivative_intros]: ``` lp15@68296 ` 383` ``` "f C1_differentiable_on S \ (\x. - f x) C1_differentiable_on S" ``` lp15@61190 ` 384` ``` unfolding C1_differentiable_on_eq by (auto intro: continuous_intros) ``` lp15@61190 ` 385` lp15@61190 ` 386` ```lemma C1_differentiable_on_diff [simp, derivative_intros]: ``` lp15@68296 ` 387` ``` "f C1_differentiable_on S \ g C1_differentiable_on S \ (\x. f x - g x) C1_differentiable_on S" ``` lp15@61190 ` 388` ``` unfolding C1_differentiable_on_eq by (auto intro: continuous_intros) ``` lp15@61190 ` 389` lp15@61190 ` 390` ```lemma C1_differentiable_on_mult [simp, derivative_intros]: ``` lp15@61190 ` 391` ``` fixes f g :: "real \ 'a :: real_normed_algebra" ``` lp15@68296 ` 392` ``` shows "f C1_differentiable_on S \ g C1_differentiable_on S \ (\x. f x * g x) C1_differentiable_on S" ``` lp15@61190 ` 393` ``` unfolding C1_differentiable_on_eq ``` lp15@61190 ` 394` ``` by (auto simp: continuous_on_add continuous_on_mult continuous_at_imp_continuous_on differentiable_imp_continuous_within) ``` lp15@61190 ` 395` lp15@61190 ` 396` ```lemma C1_differentiable_on_scaleR [simp, derivative_intros]: ``` lp15@68296 ` 397` ``` "f C1_differentiable_on S \ g C1_differentiable_on S \ (\x. f x *\<^sub>R g x) C1_differentiable_on S" ``` lp15@61190 ` 398` ``` unfolding C1_differentiable_on_eq ``` lp15@61190 ` 399` ``` by (rule continuous_intros | simp add: continuous_at_imp_continuous_on differentiable_imp_continuous_within)+ ``` lp15@61190 ` 400` lp15@61190 ` 401` lp15@61190 ` 402` ```definition piecewise_C1_differentiable_on ``` lp15@61190 ` 403` ``` (infixr "piecewise'_C1'_differentiable'_on" 50) ``` lp15@61190 ` 404` ``` where "f piecewise_C1_differentiable_on i \ ``` lp15@61190 ` 405` ``` continuous_on i f \ ``` lp15@68296 ` 406` ``` (\S. finite S \ (f C1_differentiable_on (i - S)))" ``` lp15@61190 ` 407` lp15@61190 ` 408` ```lemma C1_differentiable_imp_piecewise: ``` lp15@68296 ` 409` ``` "f C1_differentiable_on S \ f piecewise_C1_differentiable_on S" ``` lp15@61190 ` 410` ``` by (auto simp: piecewise_C1_differentiable_on_def C1_differentiable_on_eq continuous_at_imp_continuous_on differentiable_imp_continuous_within) ``` lp15@61190 ` 411` lp15@61190 ` 412` ```lemma piecewise_C1_imp_differentiable: ``` lp15@61190 ` 413` ``` "f piecewise_C1_differentiable_on i \ f piecewise_differentiable_on i" ``` lp15@61190 ` 414` ``` by (auto simp: piecewise_C1_differentiable_on_def piecewise_differentiable_on_def ``` lp15@61190 ` 415` ``` C1_differentiable_on_def differentiable_def has_vector_derivative_def ``` lp15@67979 ` 416` ``` intro: has_derivative_at_withinI) ``` lp15@61190 ` 417` lp15@61190 ` 418` ```lemma piecewise_C1_differentiable_compose: ``` lp15@68296 ` 419` ``` assumes fg: "f piecewise_C1_differentiable_on S" "g piecewise_C1_differentiable_on (f ` S)" and fin: "\x. finite (S \ f-`{x})" ``` lp15@68339 ` 420` ``` shows "(g \ f) piecewise_C1_differentiable_on S" ``` lp15@68296 ` 421` ```proof - ``` lp15@68296 ` 422` ``` have "continuous_on S (\x. g (f x))" ``` lp15@68296 ` 423` ``` by (metis continuous_on_compose2 fg order_refl piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 424` ``` moreover have "\T. finite T \ g \ f C1_differentiable_on S - T" ``` lp15@68296 ` 425` ``` proof - ``` lp15@68296 ` 426` ``` obtain F where "finite F" and F: "f C1_differentiable_on S - F" and f: "f piecewise_C1_differentiable_on S" ``` lp15@68296 ` 427` ``` using fg by (auto simp: piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 428` ``` obtain G where "finite G" and G: "g C1_differentiable_on f ` S - G" and g: "g piecewise_C1_differentiable_on f ` S" ``` lp15@68296 ` 429` ``` using fg by (auto simp: piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 430` ``` show ?thesis ``` lp15@68296 ` 431` ``` proof (intro exI conjI) ``` lp15@68296 ` 432` ``` show "finite (F \ (\x\G. S \ f-`{x}))" ``` lp15@68296 ` 433` ``` using fin by (auto simp only: Int_Union \finite F\ \finite G\ finite_UN finite_imageI) ``` lp15@68296 ` 434` ``` show "g \ f C1_differentiable_on S - (F \ (\x\G. S \ f -` {x}))" ``` lp15@68296 ` 435` ``` apply (rule C1_differentiable_compose) ``` lp15@68296 ` 436` ``` apply (blast intro: C1_differentiable_on_subset [OF F]) ``` lp15@68296 ` 437` ``` apply (blast intro: C1_differentiable_on_subset [OF G]) ``` lp15@68296 ` 438` ``` by (simp add: C1_differentiable_on_subset G Diff_Int_distrib2 fin) ``` lp15@68296 ` 439` ``` qed ``` lp15@68296 ` 440` ``` qed ``` lp15@68296 ` 441` ``` ultimately show ?thesis ``` lp15@68296 ` 442` ``` by (simp add: piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 443` ```qed ``` lp15@61190 ` 444` lp15@61190 ` 445` ```lemma piecewise_C1_differentiable_on_subset: ``` lp15@68296 ` 446` ``` "f piecewise_C1_differentiable_on S \ T \ S \ f piecewise_C1_differentiable_on T" ``` lp15@61190 ` 447` ``` by (auto simp: piecewise_C1_differentiable_on_def elim!: continuous_on_subset C1_differentiable_on_subset) ``` lp15@61190 ` 448` lp15@61190 ` 449` ```lemma C1_differentiable_imp_continuous_on: ``` lp15@68296 ` 450` ``` "f C1_differentiable_on S \ continuous_on S f" ``` lp15@61190 ` 451` ``` unfolding C1_differentiable_on_eq continuous_on_eq_continuous_within ``` lp15@61190 ` 452` ``` using differentiable_at_withinI differentiable_imp_continuous_within by blast ``` lp15@61190 ` 453` lp15@61190 ` 454` ```lemma C1_differentiable_on_empty [iff]: "f C1_differentiable_on {}" ``` lp15@61190 ` 455` ``` unfolding C1_differentiable_on_def ``` lp15@61190 ` 456` ``` by auto ``` lp15@61190 ` 457` lp15@61190 ` 458` ```lemma piecewise_C1_differentiable_affine: ``` lp15@61190 ` 459` ``` fixes m::real ``` lp15@68296 ` 460` ``` assumes "f piecewise_C1_differentiable_on ((\x. m * x + c) ` S)" ``` lp15@68339 ` 461` ``` shows "(f \ (\x. m *\<^sub>R x + c)) piecewise_C1_differentiable_on S" ``` lp15@61190 ` 462` ```proof (cases "m = 0") ``` lp15@61190 ` 463` ``` case True ``` lp15@61190 ` 464` ``` then show ?thesis ``` lp15@61190 ` 465` ``` unfolding o_def by (auto simp: piecewise_C1_differentiable_on_def continuous_on_const) ``` lp15@61190 ` 466` ```next ``` lp15@61190 ` 467` ``` case False ``` lp15@68296 ` 468` ``` have *: "\x. finite (S \ {y. m * y + c = x})" ``` lp15@68296 ` 469` ``` using False not_finite_existsD by fastforce ``` lp15@61190 ` 470` ``` show ?thesis ``` lp15@61190 ` 471` ``` apply (rule piecewise_C1_differentiable_compose [OF C1_differentiable_imp_piecewise]) ``` lp15@68296 ` 472` ``` apply (rule * assms derivative_intros | simp add: False vimage_def)+ ``` lp15@61190 ` 473` ``` done ``` lp15@61190 ` 474` ```qed ``` lp15@61190 ` 475` lp15@61190 ` 476` ```lemma piecewise_C1_differentiable_cases: ``` lp15@61190 ` 477` ``` fixes c::real ``` lp15@61190 ` 478` ``` assumes "f piecewise_C1_differentiable_on {a..c}" ``` lp15@61190 ` 479` ``` "g piecewise_C1_differentiable_on {c..b}" ``` lp15@61190 ` 480` ``` "a \ c" "c \ b" "f c = g c" ``` lp15@61190 ` 481` ``` shows "(\x. if x \ c then f x else g x) piecewise_C1_differentiable_on {a..b}" ``` lp15@61190 ` 482` ```proof - ``` lp15@68296 ` 483` ``` obtain S T where st: "f C1_differentiable_on ({a..c} - S)" ``` lp15@68296 ` 484` ``` "g C1_differentiable_on ({c..b} - T)" ``` lp15@68296 ` 485` ``` "finite S" "finite T" ``` lp15@61190 ` 486` ``` using assms ``` lp15@61190 ` 487` ``` by (force simp: piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 488` ``` then have f_diff: "f differentiable_on {a..x. if x \ c then f x else g x)" ``` lp15@61190 ` 494` ``` using continuous_on_cases [OF closed_real_atLeastAtMost [of a c], ``` lp15@61190 ` 495` ``` OF closed_real_atLeastAtMost [of c b], ``` lp15@61190 ` 496` ``` of f g "\x. x\c"] assms ``` lp15@61190 ` 497` ``` by (force simp: ivl_disj_un_two_touch) ``` lp15@61190 ` 498` ``` { fix x ``` lp15@68296 ` 499` ``` assume x: "x \ {a..b} - insert c (S \ T)" ``` lp15@61190 ` 500` ``` have "(\x. if x \ c then f x else g x) differentiable at x" (is "?diff_fg") ``` lp15@61190 ` 501` ``` proof (cases x c rule: le_cases) ``` lp15@61190 ` 502` ``` case le show ?diff_fg ``` paulson@62087 ` 503` ``` apply (rule differentiable_transform_within [where f=f and d = "dist x c"]) ``` lp15@61190 ` 504` ``` using x dist_real_def le st by (auto simp: C1_differentiable_on_eq) ``` lp15@61190 ` 505` ``` next ``` lp15@61190 ` 506` ``` case ge show ?diff_fg ``` paulson@62087 ` 507` ``` apply (rule differentiable_transform_within [where f=g and d = "dist x c"]) ``` lp15@61190 ` 508` ``` using dist_nz x dist_real_def ge st x by (auto simp: C1_differentiable_on_eq) ``` lp15@61190 ` 509` ``` qed ``` lp15@61190 ` 510` ``` } ``` lp15@68296 ` 511` ``` then have "(\x \ {a..b} - insert c (S \ T). (\x. if x \ c then f x else g x) differentiable at x)" ``` lp15@61190 ` 512` ``` by auto ``` lp15@61190 ` 513` ``` moreover ``` lp15@68296 ` 514` ``` { assume fcon: "continuous_on ({a<..x. vector_derivative f (at x))" ``` lp15@68296 ` 515` ``` and gcon: "continuous_on ({c<..x. vector_derivative g (at x))" ``` lp15@68296 ` 516` ``` have "open ({a<..x. vector_derivative (\x. if x \ c then f x else g x) (at x))" ``` lp15@68296 ` 519` ``` proof - ``` lp15@68296 ` 520` ``` have "((\x. if x \ c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)" ``` lp15@68296 ` 521` ``` if "a < x" "x < c" "x \ S" for x ``` lp15@68296 ` 522` ``` proof - ``` lp15@68296 ` 523` ``` have f: "f differentiable at x" ``` lp15@68296 ` 524` ``` by (meson C1_differentiable_on_eq Diff_iff atLeastAtMost_iff less_eq_real_def st(1) that) ``` lp15@68296 ` 525` ``` show ?thesis ``` lp15@68296 ` 526` ``` using that ``` lp15@68296 ` 527` ``` apply (rule_tac f=f and d="dist x c" in has_vector_derivative_transform_within) ``` lp15@68339 ` 528` ``` apply (auto simp: dist_norm vector_derivative_works [symmetric] f) ``` lp15@68296 ` 529` ``` done ``` lp15@68296 ` 530` ``` qed ``` lp15@68296 ` 531` ``` then show ?thesis ``` lp15@68296 ` 532` ``` by (metis (no_types, lifting) continuous_on_eq [OF fcon] DiffE greaterThanLessThan_iff vector_derivative_at) ``` lp15@68296 ` 533` ``` qed ``` lp15@68296 ` 534` ``` moreover have "continuous_on ({c<..x. vector_derivative (\x. if x \ c then f x else g x) (at x))" ``` lp15@68296 ` 535` ``` proof - ``` lp15@68296 ` 536` ``` have "((\x. if x \ c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)" ``` lp15@68296 ` 537` ``` if "c < x" "x < b" "x \ T" for x ``` lp15@68296 ` 538` ``` proof - ``` lp15@68296 ` 539` ``` have g: "g differentiable at x" ``` lp15@68296 ` 540` ``` by (metis C1_differentiable_on_eq DiffD1 DiffI atLeastAtMost_diff_ends greaterThanLessThan_iff st(2) that) ``` lp15@68296 ` 541` ``` show ?thesis ``` lp15@68296 ` 542` ``` using that ``` lp15@68296 ` 543` ``` apply (rule_tac f=g and d="dist x c" in has_vector_derivative_transform_within) ``` lp15@68339 ` 544` ``` apply (auto simp: dist_norm vector_derivative_works [symmetric] g) ``` lp15@68296 ` 545` ``` done ``` lp15@68296 ` 546` ``` qed ``` lp15@68296 ` 547` ``` then show ?thesis ``` lp15@68296 ` 548` ``` by (metis (no_types, lifting) continuous_on_eq [OF gcon] DiffE greaterThanLessThan_iff vector_derivative_at) ``` lp15@68296 ` 549` ``` qed ``` lp15@68296 ` 550` ``` ultimately have "continuous_on ({a<.. T)) ``` lp15@61190 ` 551` ``` (\x. vector_derivative (\x. if x \ c then f x else g x) (at x))" ``` lp15@68296 ` 552` ``` by (rule continuous_on_subset [OF continuous_on_open_Un], auto) ``` lp15@61190 ` 553` ``` } note * = this ``` lp15@68296 ` 554` ``` have "continuous_on ({a<.. T)) (\x. vector_derivative (\x. if x \ c then f x else g x) (at x))" ``` lp15@61190 ` 555` ``` using st ``` lp15@61190 ` 556` ``` by (auto simp: C1_differentiable_on_eq elim!: continuous_on_subset intro: *) ``` lp15@68296 ` 557` ``` ultimately have "\S. finite S \ ((\x. if x \ c then f x else g x) C1_differentiable_on {a..b} - S)" ``` lp15@68296 ` 558` ``` apply (rule_tac x="{a,b,c} \ S \ T" in exI) ``` lp15@61190 ` 559` ``` using st by (auto simp: C1_differentiable_on_eq elim!: continuous_on_subset) ``` lp15@61190 ` 560` ``` with cab show ?thesis ``` lp15@61190 ` 561` ``` by (simp add: piecewise_C1_differentiable_on_def) ``` lp15@61190 ` 562` ```qed ``` lp15@61190 ` 563` lp15@61190 ` 564` ```lemma piecewise_C1_differentiable_neg: ``` lp15@68296 ` 565` ``` "f piecewise_C1_differentiable_on S \ (\x. -(f x)) piecewise_C1_differentiable_on S" ``` lp15@61190 ` 566` ``` unfolding piecewise_C1_differentiable_on_def ``` lp15@61190 ` 567` ``` by (auto intro!: continuous_on_minus C1_differentiable_on_minus) ``` lp15@61190 ` 568` lp15@61190 ` 569` ```lemma piecewise_C1_differentiable_add: ``` lp15@61190 ` 570` ``` assumes "f piecewise_C1_differentiable_on i" ``` lp15@61190 ` 571` ``` "g piecewise_C1_differentiable_on i" ``` lp15@61190 ` 572` ``` shows "(\x. f x + g x) piecewise_C1_differentiable_on i" ``` lp15@61190 ` 573` ```proof - ``` lp15@68296 ` 574` ``` obtain S t where st: "finite S" "finite t" ``` lp15@68296 ` 575` ``` "f C1_differentiable_on (i-S)" ``` lp15@61190 ` 576` ``` "g C1_differentiable_on (i-t)" ``` lp15@61190 ` 577` ``` using assms by (auto simp: piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 578` ``` then have "finite (S \ t) \ (\x. f x + g x) C1_differentiable_on i - (S \ t)" ``` lp15@61190 ` 579` ``` by (auto intro: C1_differentiable_on_add elim!: C1_differentiable_on_subset) ``` lp15@61190 ` 580` ``` moreover have "continuous_on i f" "continuous_on i g" ``` lp15@61190 ` 581` ``` using assms piecewise_C1_differentiable_on_def by auto ``` lp15@61190 ` 582` ``` ultimately show ?thesis ``` lp15@61190 ` 583` ``` by (auto simp: piecewise_C1_differentiable_on_def continuous_on_add) ``` lp15@61190 ` 584` ```qed ``` lp15@61190 ` 585` paulson@61204 ` 586` ```lemma piecewise_C1_differentiable_diff: ``` lp15@68296 ` 587` ``` "\f piecewise_C1_differentiable_on S; g piecewise_C1_differentiable_on S\ ``` lp15@68296 ` 588` ``` \ (\x. f x - g x) piecewise_C1_differentiable_on S" ``` lp15@61190 ` 589` ``` unfolding diff_conv_add_uminus ``` lp15@61190 ` 590` ``` by (metis piecewise_C1_differentiable_add piecewise_C1_differentiable_neg) ``` lp15@61190 ` 591` lp15@61190 ` 592` ```lemma piecewise_C1_differentiable_D1: ``` lp15@61190 ` 593` ``` fixes g1 :: "real \ 'a::real_normed_field" ``` lp15@61190 ` 594` ``` assumes "(g1 +++ g2) piecewise_C1_differentiable_on {0..1}" ``` lp15@61190 ` 595` ``` shows "g1 piecewise_C1_differentiable_on {0..1}" ``` lp15@61190 ` 596` ```proof - ``` lp15@68296 ` 597` ``` obtain S where "finite S" ``` lp15@68296 ` 598` ``` and co12: "continuous_on ({0..1} - S) (\x. vector_derivative (g1 +++ g2) (at x))" ``` lp15@68296 ` 599` ``` and g12D: "\x\{0..1} - S. g1 +++ g2 differentiable at x" ``` lp15@61190 ` 600` ``` using assms by (auto simp: piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@68339 ` 601` ``` have g1D: "g1 differentiable at x" if "x \ {0..1} - insert 1 (( *) 2 ` S)" for x ``` lp15@68296 ` 602` ``` proof (rule differentiable_transform_within) ``` lp15@68339 ` 603` ``` show "g1 +++ g2 \ ( *) (inverse 2) differentiable at x" ``` lp15@68296 ` 604` ``` using that g12D ``` lp15@68296 ` 605` ``` apply (simp only: joinpaths_def) ``` lp15@68296 ` 606` ``` by (rule differentiable_chain_at derivative_intros | force)+ ``` lp15@68296 ` 607` ``` show "\x'. \dist x' x < dist (x/2) (1/2)\ ``` lp15@68339 ` 608` ``` \ (g1 +++ g2 \ ( *) (inverse 2)) x' = g1 x'" ``` lp15@68339 ` 609` ``` using that by (auto simp: dist_real_def joinpaths_def) ``` lp15@68296 ` 610` ``` qed (use that in \auto simp: dist_real_def\) ``` lp15@68339 ` 611` ``` have [simp]: "vector_derivative (g1 \ ( *) 2) (at (x/2)) = 2 *\<^sub>R vector_derivative g1 (at x)" ``` lp15@68339 ` 612` ``` if "x \ {0..1} - insert 1 (( *) 2 ` S)" for x ``` lp15@61190 ` 613` ``` apply (subst vector_derivative_chain_at) ``` lp15@61190 ` 614` ``` using that ``` lp15@61190 ` 615` ``` apply (rule derivative_eq_intros g1D | simp)+ ``` lp15@61190 ` 616` ``` done ``` lp15@68296 ` 617` ``` have "continuous_on ({0..1/2} - insert (1/2) S) (\x. vector_derivative (g1 +++ g2) (at x))" ``` lp15@61190 ` 618` ``` using co12 by (rule continuous_on_subset) force ``` lp15@68339 ` 619` ``` then have coDhalf: "continuous_on ({0..1/2} - insert (1/2) S) (\x. vector_derivative (g1 \ ( *)2) (at x))" ``` lp15@68296 ` 620` ``` proof (rule continuous_on_eq [OF _ vector_derivative_at]) ``` lp15@68339 ` 621` ``` show "(g1 +++ g2 has_vector_derivative vector_derivative (g1 \ ( *) 2) (at x)) (at x)" ``` lp15@68296 ` 622` ``` if "x \ {0..1/2} - insert (1/2) S" for x ``` lp15@68296 ` 623` ``` proof (rule has_vector_derivative_transform_within) ``` lp15@68339 ` 624` ``` show "(g1 \ ( *) 2 has_vector_derivative vector_derivative (g1 \ ( *) 2) (at x)) (at x)" ``` lp15@68296 ` 625` ``` using that ``` lp15@68296 ` 626` ``` by (force intro: g1D differentiable_chain_at simp: vector_derivative_works [symmetric]) ``` lp15@68339 ` 627` ``` show "\x'. \dist x' x < dist x (1/2)\ \ (g1 \ ( *) 2) x' = (g1 +++ g2) x'" ``` lp15@68296 ` 628` ``` using that by (auto simp: dist_norm joinpaths_def) ``` lp15@68296 ` 629` ``` qed (use that in \auto simp: dist_norm\) ``` lp15@68296 ` 630` ``` qed ``` lp15@68339 ` 631` ``` have "continuous_on ({0..1} - insert 1 (( *) 2 ` S)) ``` lp15@68339 ` 632` ``` ((\x. 1/2 * vector_derivative (g1 \ ( *)2) (at x)) \ ( *)(1/2))" ``` lp15@61190 ` 633` ``` apply (rule continuous_intros)+ ``` lp15@61190 ` 634` ``` using coDhalf ``` lp15@61190 ` 635` ``` apply (simp add: scaleR_conv_of_real image_set_diff image_image) ``` lp15@61190 ` 636` ``` done ``` lp15@68339 ` 637` ``` then have con_g1: "continuous_on ({0..1} - insert 1 (( *) 2 ` S)) (\x. vector_derivative g1 (at x))" ``` lp15@61190 ` 638` ``` by (rule continuous_on_eq) (simp add: scaleR_conv_of_real) ``` lp15@61190 ` 639` ``` have "continuous_on {0..1} g1" ``` lp15@61190 ` 640` ``` using continuous_on_joinpaths_D1 assms piecewise_C1_differentiable_on_def by blast ``` lp15@68296 ` 641` ``` with \finite S\ show ?thesis ``` lp15@61190 ` 642` ``` apply (clarsimp simp add: piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@68339 ` 643` ``` apply (rule_tac x="insert 1 ((( *)2)`S)" in exI) ``` lp15@61190 ` 644` ``` apply (simp add: g1D con_g1) ``` lp15@61190 ` 645` ``` done ``` lp15@61190 ` 646` ```qed ``` lp15@61190 ` 647` lp15@61190 ` 648` ```lemma piecewise_C1_differentiable_D2: ``` lp15@61190 ` 649` ``` fixes g2 :: "real \ 'a::real_normed_field" ``` lp15@61190 ` 650` ``` assumes "(g1 +++ g2) piecewise_C1_differentiable_on {0..1}" "pathfinish g1 = pathstart g2" ``` lp15@61190 ` 651` ``` shows "g2 piecewise_C1_differentiable_on {0..1}" ``` lp15@61190 ` 652` ```proof - ``` lp15@68296 ` 653` ``` obtain S where "finite S" ``` lp15@68296 ` 654` ``` and co12: "continuous_on ({0..1} - S) (\x. vector_derivative (g1 +++ g2) (at x))" ``` lp15@68296 ` 655` ``` and g12D: "\x\{0..1} - S. g1 +++ g2 differentiable at x" ``` lp15@61190 ` 656` ``` using assms by (auto simp: piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@68296 ` 657` ``` have g2D: "g2 differentiable at x" if "x \ {0..1} - insert 0 ((\x. 2*x-1) ` S)" for x ``` lp15@68296 ` 658` ``` proof (rule differentiable_transform_within) ``` lp15@68296 ` 659` ``` show "g1 +++ g2 \ (\x. (x + 1) / 2) differentiable at x" ``` lp15@68296 ` 660` ``` using g12D that ``` lp15@68296 ` 661` ``` apply (simp only: joinpaths_def) ``` lp15@68296 ` 662` ``` apply (drule_tac x= "(x+1) / 2" in bspec, force simp: divide_simps) ``` lp15@68296 ` 663` ``` apply (rule differentiable_chain_at derivative_intros | force)+ ``` lp15@68296 ` 664` ``` done ``` lp15@68296 ` 665` ``` show "\x'. dist x' x < dist ((x + 1) / 2) (1/2) \ (g1 +++ g2 \ (\x. (x + 1) / 2)) x' = g2 x'" ``` lp15@68296 ` 666` ``` using that by (auto simp: dist_real_def joinpaths_def field_simps) ``` lp15@68296 ` 667` ``` qed (use that in \auto simp: dist_norm\) ``` lp15@61190 ` 668` ``` have [simp]: "vector_derivative (g2 \ (\x. 2*x-1)) (at ((x+1)/2)) = 2 *\<^sub>R vector_derivative g2 (at x)" ``` lp15@68296 ` 669` ``` if "x \ {0..1} - insert 0 ((\x. 2*x-1) ` S)" for x ``` lp15@61190 ` 670` ``` using that by (auto simp: vector_derivative_chain_at divide_simps g2D) ``` lp15@68296 ` 671` ``` have "continuous_on ({1/2..1} - insert (1/2) S) (\x. vector_derivative (g1 +++ g2) (at x))" ``` lp15@61190 ` 672` ``` using co12 by (rule continuous_on_subset) force ``` lp15@68339 ` 673` ``` then have coDhalf: "continuous_on ({1/2..1} - insert (1/2) S) (\x. vector_derivative (g2 \ (\x. 2*x-1)) (at x))" ``` lp15@68296 ` 674` ``` proof (rule continuous_on_eq [OF _ vector_derivative_at]) ``` lp15@68296 ` 675` ``` show "(g1 +++ g2 has_vector_derivative vector_derivative (g2 \ (\x. 2 * x - 1)) (at x)) ``` lp15@68296 ` 676` ``` (at x)" ``` lp15@68296 ` 677` ``` if "x \ {1 / 2..1} - insert (1 / 2) S" for x ``` lp15@68339 ` 678` ``` proof (rule_tac f="g2 \ (\x. 2*x-1)" and d="dist (3/4) ((x+1)/2)" in has_vector_derivative_transform_within) ``` lp15@68296 ` 679` ``` show "(g2 \ (\x. 2 * x - 1) has_vector_derivative vector_derivative (g2 \ (\x. 2 * x - 1)) (at x)) ``` lp15@68296 ` 680` ``` (at x)" ``` lp15@68296 ` 681` ``` using that by (force intro: g2D differentiable_chain_at simp: vector_derivative_works [symmetric]) ``` lp15@68296 ` 682` ``` show "\x'. \dist x' x < dist (3 / 4) ((x + 1) / 2)\ \ (g2 \ (\x. 2 * x - 1)) x' = (g1 +++ g2) x'" ``` lp15@68296 ` 683` ``` using that by (auto simp: dist_norm joinpaths_def add_divide_distrib) ``` lp15@68296 ` 684` ``` qed (use that in \auto simp: dist_norm\) ``` lp15@68296 ` 685` ``` qed ``` lp15@68296 ` 686` ``` have [simp]: "((\x. (x+1) / 2) ` ({0..1} - insert 0 ((\x. 2 * x - 1) ` S))) = ({1/2..1} - insert (1/2) S)" ``` lp15@61190 ` 687` ``` apply (simp add: image_set_diff inj_on_def image_image) ``` lp15@61190 ` 688` ``` apply (auto simp: image_affinity_atLeastAtMost_div add_divide_distrib) ``` lp15@61190 ` 689` ``` done ``` lp15@68296 ` 690` ``` have "continuous_on ({0..1} - insert 0 ((\x. 2*x-1) ` S)) ``` lp15@68339 ` 691` ``` ((\x. 1/2 * vector_derivative (g2 \ (\x. 2*x-1)) (at x)) \ (\x. (x+1)/2))" ``` lp15@61190 ` 692` ``` by (rule continuous_intros | simp add: coDhalf)+ ``` lp15@68296 ` 693` ``` then have con_g2: "continuous_on ({0..1} - insert 0 ((\x. 2*x-1) ` S)) (\x. vector_derivative g2 (at x))" ``` lp15@61190 ` 694` ``` by (rule continuous_on_eq) (simp add: scaleR_conv_of_real) ``` lp15@61190 ` 695` ``` have "continuous_on {0..1} g2" ``` lp15@61190 ` 696` ``` using continuous_on_joinpaths_D2 assms piecewise_C1_differentiable_on_def by blast ``` lp15@68296 ` 697` ``` with \finite S\ show ?thesis ``` lp15@61190 ` 698` ``` apply (clarsimp simp add: piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@68296 ` 699` ``` apply (rule_tac x="insert 0 ((\x. 2 * x - 1) ` S)" in exI) ``` lp15@61190 ` 700` ``` apply (simp add: g2D con_g2) ``` lp15@61190 ` 701` ``` done ``` lp15@61190 ` 702` ```qed ``` lp15@60809 ` 703` lp15@60809 ` 704` ```subsection \Valid paths, and their start and finish\ ``` lp15@60809 ` 705` lp15@60809 ` 706` ```definition valid_path :: "(real \ 'a :: real_normed_vector) \ bool" ``` lp15@61190 ` 707` ``` where "valid_path f \ f piecewise_C1_differentiable_on {0..1::real}" ``` lp15@60809 ` 708` lp15@60809 ` 709` ```definition closed_path :: "(real \ 'a :: real_normed_vector) \ bool" ``` lp15@60809 ` 710` ``` where "closed_path g \ g 0 = g 1" ``` lp15@60809 ` 711` lp15@60809 ` 712` ```subsubsection\In particular, all results for paths apply\ ``` lp15@60809 ` 713` lp15@60809 ` 714` ```lemma valid_path_imp_path: "valid_path g \ path g" ``` lp15@61190 ` 715` ```by (simp add: path_def piecewise_C1_differentiable_on_def valid_path_def) ``` lp15@60809 ` 716` lp15@60809 ` 717` ```lemma connected_valid_path_image: "valid_path g \ connected(path_image g)" ``` lp15@60809 ` 718` ``` by (metis connected_path_image valid_path_imp_path) ``` lp15@60809 ` 719` lp15@60809 ` 720` ```lemma compact_valid_path_image: "valid_path g \ compact(path_image g)" ``` lp15@60809 ` 721` ``` by (metis compact_path_image valid_path_imp_path) ``` lp15@60809 ` 722` lp15@60809 ` 723` ```lemma bounded_valid_path_image: "valid_path g \ bounded(path_image g)" ``` lp15@60809 ` 724` ``` by (metis bounded_path_image valid_path_imp_path) ``` lp15@60809 ` 725` lp15@60809 ` 726` ```lemma closed_valid_path_image: "valid_path g \ closed(path_image g)" ``` lp15@60809 ` 727` ``` by (metis closed_path_image valid_path_imp_path) ``` lp15@60809 ` 728` lp15@62540 ` 729` ```proposition valid_path_compose: ``` lp15@62623 ` 730` ``` assumes "valid_path g" ``` lp15@64394 ` 731` ``` and der: "\x. x \ path_image g \ f field_differentiable (at x)" ``` lp15@62540 ` 732` ``` and con: "continuous_on (path_image g) (deriv f)" ``` lp15@68339 ` 733` ``` shows "valid_path (f \ g)" ``` lp15@62408 ` 734` ```proof - ``` lp15@68296 ` 735` ``` obtain S where "finite S" and g_diff: "g C1_differentiable_on {0..1} - S" ``` wenzelm@62837 ` 736` ``` using \valid_path g\ unfolding valid_path_def piecewise_C1_differentiable_on_def by auto ``` lp15@68296 ` 737` ``` have "f \ g differentiable at t" when "t\{0..1} - S" for t ``` lp15@62408 ` 738` ``` proof (rule differentiable_chain_at) ``` wenzelm@62837 ` 739` ``` show "g differentiable at t" using \valid_path g\ ``` lp15@68296 ` 740` ``` by (meson C1_differentiable_on_eq \g C1_differentiable_on {0..1} - S\ that) ``` lp15@62408 ` 741` ``` next ``` lp15@62408 ` 742` ``` have "g t\path_image g" using that DiffD1 image_eqI path_image_def by metis ``` lp15@64394 ` 743` ``` then show "f differentiable at (g t)" ``` lp15@64394 ` 744` ``` using der[THEN field_differentiable_imp_differentiable] by auto ``` lp15@62408 ` 745` ``` qed ``` lp15@68296 ` 746` ``` moreover have "continuous_on ({0..1} - S) (\x. vector_derivative (f \ g) (at x))" ``` lp15@62540 ` 747` ``` proof (rule continuous_on_eq [where f = "\x. vector_derivative g (at x) * deriv f (g x)"], ``` lp15@62540 ` 748` ``` rule continuous_intros) ``` lp15@68296 ` 749` ``` show "continuous_on ({0..1} - S) (\x. vector_derivative g (at x))" ``` lp15@62540 ` 750` ``` using g_diff C1_differentiable_on_eq by auto ``` lp15@62540 ` 751` ``` next ``` lp15@62623 ` 752` ``` have "continuous_on {0..1} (\x. deriv f (g x))" ``` lp15@62623 ` 753` ``` using continuous_on_compose[OF _ con[unfolded path_image_def],unfolded comp_def] ``` wenzelm@62837 ` 754` ``` \valid_path g\ piecewise_C1_differentiable_on_def valid_path_def ``` lp15@62540 ` 755` ``` by blast ``` lp15@68296 ` 756` ``` then show "continuous_on ({0..1} - S) (\x. deriv f (g x))" ``` lp15@62540 ` 757` ``` using continuous_on_subset by blast ``` lp15@62408 ` 758` ``` next ``` lp15@62540 ` 759` ``` show "vector_derivative g (at t) * deriv f (g t) = vector_derivative (f \ g) (at t)" ``` lp15@68296 ` 760` ``` when "t \ {0..1} - S" for t ``` lp15@62540 ` 761` ``` proof (rule vector_derivative_chain_at_general[symmetric]) ``` lp15@62540 ` 762` ``` show "g differentiable at t" by (meson C1_differentiable_on_eq g_diff that) ``` lp15@62540 ` 763` ``` next ``` lp15@62540 ` 764` ``` have "g t\path_image g" using that DiffD1 image_eqI path_image_def by metis ``` lp15@64394 ` 765` ``` then show "f field_differentiable at (g t)" using der by auto ``` lp15@62540 ` 766` ``` qed ``` lp15@62408 ` 767` ``` qed ``` lp15@68339 ` 768` ``` ultimately have "f \ g C1_differentiable_on {0..1} - S" ``` lp15@62408 ` 769` ``` using C1_differentiable_on_eq by blast ``` lp15@64394 ` 770` ``` moreover have "path (f \ g)" ``` lp15@64394 ` 771` ``` apply (rule path_continuous_image[OF valid_path_imp_path[OF \valid_path g\]]) ``` lp15@64394 ` 772` ``` using der ``` lp15@64394 ` 773` ``` by (simp add: continuous_at_imp_continuous_on field_differentiable_imp_continuous_at) ``` lp15@62408 ` 774` ``` ultimately show ?thesis unfolding valid_path_def piecewise_C1_differentiable_on_def path_def ``` lp15@68296 ` 775` ``` using \finite S\ by auto ``` lp15@62408 ` 776` ```qed ``` lp15@62408 ` 777` lp15@60809 ` 778` lp15@60809 ` 779` ```subsection\Contour Integrals along a path\ ``` lp15@60809 ` 780` lp15@60809 ` 781` ```text\This definition is for complex numbers only, and does not generalise to line integrals in a vector field\ ``` lp15@60809 ` 782` lp15@61190 ` 783` ```text\piecewise differentiable function on [0,1]\ ``` lp15@60809 ` 784` lp15@61738 ` 785` ```definition has_contour_integral :: "(complex \ complex) \ complex \ (real \ complex) \ bool" ``` lp15@61738 ` 786` ``` (infixr "has'_contour'_integral" 50) ``` lp15@61738 ` 787` ``` where "(f has_contour_integral i) g \ ``` lp15@60809 ` 788` ``` ((\x. f(g x) * vector_derivative g (at x within {0..1})) ``` lp15@60809 ` 789` ``` has_integral i) {0..1}" ``` lp15@60809 ` 790` lp15@61738 ` 791` ```definition contour_integrable_on ``` lp15@61738 ` 792` ``` (infixr "contour'_integrable'_on" 50) ``` lp15@61738 ` 793` ``` where "f contour_integrable_on g \ \i. (f has_contour_integral i) g" ``` lp15@61738 ` 794` lp15@61738 ` 795` ```definition contour_integral ``` wenzelm@67613 ` 796` ``` where "contour_integral g f \ SOME i. (f has_contour_integral i) g \ \ f contour_integrable_on g \ i=0" ``` wenzelm@67613 ` 797` wenzelm@67613 ` 798` ```lemma not_integrable_contour_integral: "\ f contour_integrable_on g \ contour_integral g f = 0" ``` lp15@62534 ` 799` ``` unfolding contour_integrable_on_def contour_integral_def by blast ``` lp15@62463 ` 800` lp15@62463 ` 801` ```lemma contour_integral_unique: "(f has_contour_integral i) g \ contour_integral g f = i" ``` lp15@62463 ` 802` ``` apply (simp add: contour_integral_def has_contour_integral_def contour_integrable_on_def) ``` lp15@62463 ` 803` ``` using has_integral_unique by blast ``` lp15@61738 ` 804` paulson@62131 ` 805` ```corollary has_contour_integral_eqpath: ``` lp15@62397 ` 806` ``` "\(f has_contour_integral y) p; f contour_integrable_on \; ``` paulson@62131 ` 807` ``` contour_integral p f = contour_integral \ f\ ``` paulson@62131 ` 808` ``` \ (f has_contour_integral y) \" ``` paulson@62131 ` 809` ```using contour_integrable_on_def contour_integral_unique by auto ``` paulson@62131 ` 810` lp15@61738 ` 811` ```lemma has_contour_integral_integral: ``` lp15@61738 ` 812` ``` "f contour_integrable_on i \ (f has_contour_integral (contour_integral i f)) i" ``` lp15@61738 ` 813` ``` by (metis contour_integral_unique contour_integrable_on_def) ``` lp15@61738 ` 814` lp15@61738 ` 815` ```lemma has_contour_integral_unique: ``` lp15@61738 ` 816` ``` "(f has_contour_integral i) g \ (f has_contour_integral j) g \ i = j" ``` lp15@60809 ` 817` ``` using has_integral_unique ``` lp15@61738 ` 818` ``` by (auto simp: has_contour_integral_def) ``` lp15@61738 ` 819` lp15@61738 ` 820` ```lemma has_contour_integral_integrable: "(f has_contour_integral i) g \ f contour_integrable_on g" ``` lp15@61738 ` 821` ``` using contour_integrable_on_def by blast ``` lp15@60809 ` 822` lp15@68296 ` 823` ```subsubsection\Show that we can forget about the localized derivative.\ ``` lp15@60809 ` 824` lp15@60809 ` 825` ```lemma has_integral_localized_vector_derivative: ``` lp15@60809 ` 826` ``` "((\x. f (g x) * vector_derivative g (at x within {a..b})) has_integral i) {a..b} \ ``` lp15@60809 ` 827` ``` ((\x. f (g x) * vector_derivative g (at x)) has_integral i) {a..b}" ``` lp15@60809 ` 828` ```proof - ``` lp15@68296 ` 829` ``` have *: "{a..b} - {a,b} = interior {a..b}" ``` lp15@60809 ` 830` ``` by (simp add: atLeastAtMost_diff_ends) ``` lp15@60809 ` 831` ``` show ?thesis ``` lp15@60809 ` 832` ``` apply (rule has_integral_spike_eq [of "{a,b}"]) ``` lp15@68296 ` 833` ``` apply (auto simp: at_within_interior [of _ "{a..b}"]) ``` lp15@60809 ` 834` ``` done ``` lp15@60809 ` 835` ```qed ``` lp15@60809 ` 836` lp15@60809 ` 837` ```lemma integrable_on_localized_vector_derivative: ``` lp15@60809 ` 838` ``` "(\x. f (g x) * vector_derivative g (at x within {a..b})) integrable_on {a..b} \ ``` lp15@60809 ` 839` ``` (\x. f (g x) * vector_derivative g (at x)) integrable_on {a..b}" ``` lp15@60809 ` 840` ``` by (simp add: integrable_on_def has_integral_localized_vector_derivative) ``` lp15@60809 ` 841` lp15@61738 ` 842` ```lemma has_contour_integral: ``` lp15@61738 ` 843` ``` "(f has_contour_integral i) g \ ``` lp15@60809 ` 844` ``` ((\x. f (g x) * vector_derivative g (at x)) has_integral i) {0..1}" ``` lp15@61738 ` 845` ``` by (simp add: has_integral_localized_vector_derivative has_contour_integral_def) ``` lp15@61738 ` 846` lp15@61738 ` 847` ```lemma contour_integrable_on: ``` lp15@61738 ` 848` ``` "f contour_integrable_on g \ ``` lp15@60809 ` 849` ``` (\t. f(g t) * vector_derivative g (at t)) integrable_on {0..1}" ``` lp15@61738 ` 850` ``` by (simp add: has_contour_integral integrable_on_def contour_integrable_on_def) ``` lp15@60809 ` 851` lp15@60809 ` 852` ```subsection\Reversing a path\ ``` lp15@60809 ` 853` lp15@60809 ` 854` ```lemma valid_path_imp_reverse: ``` lp15@60809 ` 855` ``` assumes "valid_path g" ``` lp15@60809 ` 856` ``` shows "valid_path(reversepath g)" ``` lp15@60809 ` 857` ```proof - ``` lp15@68296 ` 858` ``` obtain S where "finite S" and S: "g C1_differentiable_on ({0..1} - S)" ``` lp15@61190 ` 859` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 860` ``` then have "finite ((-) 1 ` S)" ``` lp15@68296 ` 861` ``` by auto ``` lp15@68296 ` 862` ``` moreover have "(reversepath g C1_differentiable_on ({0..1} - (-) 1 ` S))" ``` lp15@68296 ` 863` ``` unfolding reversepath_def ``` lp15@61190 ` 864` ``` apply (rule C1_differentiable_compose [of "\x::real. 1-x" _ g, unfolded o_def]) ``` lp15@68296 ` 865` ``` using S ``` lp15@68296 ` 866` ``` by (force simp: finite_vimageI inj_on_def C1_differentiable_on_eq continuous_on_const elim!: continuous_on_subset)+ ``` lp15@68296 ` 867` ``` ultimately show ?thesis using assms ``` lp15@61190 ` 868` ``` by (auto simp: valid_path_def piecewise_C1_differentiable_on_def path_def [symmetric]) ``` lp15@60809 ` 869` ```qed ``` lp15@60809 ` 870` lp15@62540 ` 871` ```lemma valid_path_reversepath [simp]: "valid_path(reversepath g) \ valid_path g" ``` lp15@60809 ` 872` ``` using valid_path_imp_reverse by force ``` lp15@60809 ` 873` lp15@61738 ` 874` ```lemma has_contour_integral_reversepath: ``` lp15@68296 ` 875` ``` assumes "valid_path g" and f: "(f has_contour_integral i) g" ``` lp15@61738 ` 876` ``` shows "(f has_contour_integral (-i)) (reversepath g)" ``` lp15@60809 ` 877` ```proof - ``` lp15@68296 ` 878` ``` { fix S x ``` lp15@68296 ` 879` ``` assume xs: "g C1_differentiable_on ({0..1} - S)" "x \ (-) 1 ` S" "0 \ x" "x \ 1" ``` lp15@68296 ` 880` ``` have "vector_derivative (\x. g (1 - x)) (at x within {0..1}) = ``` lp15@60809 ` 881` ``` - vector_derivative g (at (1 - x) within {0..1})" ``` lp15@68296 ` 882` ``` proof - ``` lp15@68296 ` 883` ``` obtain f' where f': "(g has_vector_derivative f') (at (1 - x))" ``` lp15@68296 ` 884` ``` using xs ``` lp15@68296 ` 885` ``` by (force simp: has_vector_derivative_def C1_differentiable_on_def) ``` lp15@68339 ` 886` ``` have "(g \ (\x. 1 - x) has_vector_derivative -1 *\<^sub>R f') (at x)" ``` lp15@68296 ` 887` ``` by (intro vector_diff_chain_within has_vector_derivative_at_within [OF f'] derivative_eq_intros | simp)+ ``` lp15@68296 ` 888` ``` then have mf': "((\x. g (1 - x)) has_vector_derivative -f') (at x)" ``` lp15@68296 ` 889` ``` by (simp add: o_def) ``` lp15@68296 ` 890` ``` show ?thesis ``` lp15@68296 ` 891` ``` using xs ``` lp15@68296 ` 892` ``` by (auto simp: vector_derivative_at_within_ivl [OF mf'] vector_derivative_at_within_ivl [OF f']) ``` lp15@68296 ` 893` ``` qed ``` lp15@60809 ` 894` ``` } note * = this ``` lp15@68296 ` 895` ``` obtain S where S: "continuous_on {0..1} g" "finite S" "g C1_differentiable_on {0..1} - S" ``` lp15@68296 ` 896` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def) ``` lp15@68296 ` 897` ``` have "((\x. - (f (g (1 - x)) * vector_derivative g (at (1 - x) within {0..1}))) has_integral -i) ``` lp15@68296 ` 898` ``` {0..1}" ``` lp15@68296 ` 899` ``` using has_integral_affinity01 [where m= "-1" and c=1, OF f [unfolded has_contour_integral_def]] ``` lp15@68296 ` 900` ``` by (simp add: has_integral_neg) ``` lp15@68296 ` 901` ``` then show ?thesis ``` lp15@68296 ` 902` ``` using S ``` lp15@68296 ` 903` ``` apply (clarsimp simp: reversepath_def has_contour_integral_def) ``` lp15@68296 ` 904` ``` apply (rule_tac S = "(\x. 1 - x) ` S" in has_integral_spike_finite) ``` lp15@68296 ` 905` ``` apply (auto simp: *) ``` lp15@60809 ` 906` ``` done ``` lp15@60809 ` 907` ```qed ``` lp15@60809 ` 908` lp15@61738 ` 909` ```lemma contour_integrable_reversepath: ``` lp15@61738 ` 910` ``` "valid_path g \ f contour_integrable_on g \ f contour_integrable_on (reversepath g)" ``` lp15@61738 ` 911` ``` using has_contour_integral_reversepath contour_integrable_on_def by blast ``` lp15@61738 ` 912` lp15@61738 ` 913` ```lemma contour_integrable_reversepath_eq: ``` lp15@61738 ` 914` ``` "valid_path g \ (f contour_integrable_on (reversepath g) \ f contour_integrable_on g)" ``` lp15@61738 ` 915` ``` using contour_integrable_reversepath valid_path_reversepath by fastforce ``` lp15@61738 ` 916` lp15@61738 ` 917` ```lemma contour_integral_reversepath: ``` lp15@62463 ` 918` ``` assumes "valid_path g" ``` lp15@62463 ` 919` ``` shows "contour_integral (reversepath g) f = - (contour_integral g f)" ``` lp15@62463 ` 920` ```proof (cases "f contour_integrable_on g") ``` lp15@62463 ` 921` ``` case True then show ?thesis ``` lp15@62463 ` 922` ``` by (simp add: assms contour_integral_unique has_contour_integral_integral has_contour_integral_reversepath) ``` lp15@62463 ` 923` ```next ``` lp15@62463 ` 924` ``` case False then have "~ f contour_integrable_on (reversepath g)" ``` lp15@62463 ` 925` ``` by (simp add: assms contour_integrable_reversepath_eq) ``` lp15@62463 ` 926` ``` with False show ?thesis by (simp add: not_integrable_contour_integral) ``` lp15@62463 ` 927` ```qed ``` lp15@60809 ` 928` lp15@60809 ` 929` lp15@60809 ` 930` ```subsection\Joining two paths together\ ``` lp15@60809 ` 931` lp15@60809 ` 932` ```lemma valid_path_join: ``` lp15@60809 ` 933` ``` assumes "valid_path g1" "valid_path g2" "pathfinish g1 = pathstart g2" ``` lp15@60809 ` 934` ``` shows "valid_path(g1 +++ g2)" ``` lp15@60809 ` 935` ```proof - ``` lp15@60809 ` 936` ``` have "g1 1 = g2 0" ``` lp15@60809 ` 937` ``` using assms by (auto simp: pathfinish_def pathstart_def) ``` lp15@68339 ` 938` ``` moreover have "(g1 \ (\x. 2*x)) piecewise_C1_differentiable_on {0..1/2}" ``` lp15@61190 ` 939` ``` apply (rule piecewise_C1_differentiable_compose) ``` lp15@60809 ` 940` ``` using assms ``` lp15@61190 ` 941` ``` apply (auto simp: valid_path_def piecewise_C1_differentiable_on_def continuous_on_joinpaths) ``` lp15@68339 ` 942` ``` apply (force intro: finite_vimageI [where h = "( *)2"] inj_onI) ``` lp15@60809 ` 943` ``` done ``` lp15@68339 ` 944` ``` moreover have "(g2 \ (\x. 2*x-1)) piecewise_C1_differentiable_on {1/2..1}" ``` lp15@61190 ` 945` ``` apply (rule piecewise_C1_differentiable_compose) ``` lp15@61190 ` 946` ``` using assms unfolding valid_path_def piecewise_C1_differentiable_on_def ``` lp15@61190 ` 947` ``` by (auto intro!: continuous_intros finite_vimageI [where h = "(\x. 2*x - 1)"] inj_onI ``` lp15@61190 ` 948` ``` simp: image_affinity_atLeastAtMost_diff continuous_on_joinpaths) ``` lp15@60809 ` 949` ``` ultimately show ?thesis ``` lp15@60809 ` 950` ``` apply (simp only: valid_path_def continuous_on_joinpaths joinpaths_def) ``` lp15@61190 ` 951` ``` apply (rule piecewise_C1_differentiable_cases) ``` lp15@60809 ` 952` ``` apply (auto simp: o_def) ``` lp15@60809 ` 953` ``` done ``` lp15@60809 ` 954` ```qed ``` lp15@60809 ` 955` lp15@61190 ` 956` ```lemma valid_path_join_D1: ``` lp15@61190 ` 957` ``` fixes g1 :: "real \ 'a::real_normed_field" ``` lp15@61190 ` 958` ``` shows "valid_path (g1 +++ g2) \ valid_path g1" ``` lp15@61190 ` 959` ``` unfolding valid_path_def ``` lp15@61190 ` 960` ``` by (rule piecewise_C1_differentiable_D1) ``` lp15@60809 ` 961` lp15@61190 ` 962` ```lemma valid_path_join_D2: ``` lp15@61190 ` 963` ``` fixes g2 :: "real \ 'a::real_normed_field" ``` lp15@61190 ` 964` ``` shows "\valid_path (g1 +++ g2); pathfinish g1 = pathstart g2\ \ valid_path g2" ``` lp15@61190 ` 965` ``` unfolding valid_path_def ``` lp15@61190 ` 966` ``` by (rule piecewise_C1_differentiable_D2) ``` lp15@60809 ` 967` lp15@60809 ` 968` ```lemma valid_path_join_eq [simp]: ``` lp15@61190 ` 969` ``` fixes g2 :: "real \ 'a::real_normed_field" ``` lp15@61190 ` 970` ``` shows "pathfinish g1 = pathstart g2 \ (valid_path(g1 +++ g2) \ valid_path g1 \ valid_path g2)" ``` lp15@60809 ` 971` ``` using valid_path_join_D1 valid_path_join_D2 valid_path_join by blast ``` lp15@60809 ` 972` lp15@61738 ` 973` ```lemma has_contour_integral_join: ``` lp15@61738 ` 974` ``` assumes "(f has_contour_integral i1) g1" "(f has_contour_integral i2) g2" ``` lp15@60809 ` 975` ``` "valid_path g1" "valid_path g2" ``` lp15@61738 ` 976` ``` shows "(f has_contour_integral (i1 + i2)) (g1 +++ g2)" ``` lp15@60809 ` 977` ```proof - ``` lp15@60809 ` 978` ``` obtain s1 s2 ``` lp15@60809 ` 979` ``` where s1: "finite s1" "\x\{0..1} - s1. g1 differentiable at x" ``` lp15@60809 ` 980` ``` and s2: "finite s2" "\x\{0..1} - s2. g2 differentiable at x" ``` lp15@60809 ` 981` ``` using assms ``` lp15@61190 ` 982` ``` by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@60809 ` 983` ``` have 1: "((\x. f (g1 x) * vector_derivative g1 (at x)) has_integral i1) {0..1}" ``` lp15@60809 ` 984` ``` and 2: "((\x. f (g2 x) * vector_derivative g2 (at x)) has_integral i2) {0..1}" ``` lp15@60809 ` 985` ``` using assms ``` lp15@61738 ` 986` ``` by (auto simp: has_contour_integral) ``` lp15@60809 ` 987` ``` have i1: "((\x. (2*f (g1 (2*x))) * vector_derivative g1 (at (2*x))) has_integral i1) {0..1/2}" ``` lp15@60809 ` 988` ``` and i2: "((\x. (2*f (g2 (2*x - 1))) * vector_derivative g2 (at (2*x - 1))) has_integral i2) {1/2..1}" ``` lp15@60809 ` 989` ``` using has_integral_affinity01 [OF 1, where m= 2 and c=0, THEN has_integral_cmul [where c=2]] ``` lp15@60809 ` 990` ``` has_integral_affinity01 [OF 2, where m= 2 and c="-1", THEN has_integral_cmul [where c=2]] ``` lp15@60809 ` 991` ``` by (simp_all only: image_affinity_atLeastAtMost_div_diff, simp_all add: scaleR_conv_of_real mult_ac) ``` lp15@60809 ` 992` ``` have g1: "\0 \ z; z*2 < 1; z*2 \ s1\ \ ``` lp15@60809 ` 993` ``` vector_derivative (\x. if x*2 \ 1 then g1 (2*x) else g2 (2*x - 1)) (at z) = ``` lp15@60809 ` 994` ``` 2 *\<^sub>R vector_derivative g1 (at (z*2))" for z ``` paulson@62087 ` 995` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g1(2*x))" and d = "\z - 1/2\"]]) ``` nipkow@62390 ` 996` ``` apply (simp_all add: dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 997` ``` apply (rule vector_diff_chain_at [of "\x. 2*x" 2 _ g1, simplified o_def]) ``` lp15@60809 ` 998` ``` apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left) ``` lp15@60809 ` 999` ``` using s1 ``` lp15@60809 ` 1000` ``` apply (auto simp: algebra_simps vector_derivative_works) ``` lp15@60809 ` 1001` ``` done ``` lp15@60809 ` 1002` ``` have g2: "\1 < z*2; z \ 1; z*2 - 1 \ s2\ \ ``` lp15@60809 ` 1003` ``` vector_derivative (\x. if x*2 \ 1 then g1 (2*x) else g2 (2*x - 1)) (at z) = ``` lp15@60809 ` 1004` ``` 2 *\<^sub>R vector_derivative g2 (at (z*2 - 1))" for z ``` paulson@62087 ` 1005` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g2 (2*x - 1))" and d = "\z - 1/2\"]]) ``` nipkow@62390 ` 1006` ``` apply (simp_all add: dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 1007` ``` apply (rule vector_diff_chain_at [of "\x. 2*x - 1" 2 _ g2, simplified o_def]) ``` lp15@60809 ` 1008` ``` apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left) ``` lp15@60809 ` 1009` ``` using s2 ``` lp15@60809 ` 1010` ``` apply (auto simp: algebra_simps vector_derivative_works) ``` lp15@60809 ` 1011` ``` done ``` lp15@60809 ` 1012` ``` have "((\x. f ((g1 +++ g2) x) * vector_derivative (g1 +++ g2) (at x)) has_integral i1) {0..1/2}" ``` lp15@68339 ` 1013` ``` apply (rule has_integral_spike_finite [OF _ _ i1, of "insert (1/2) (( *)2 -` s1)"]) ``` lp15@60809 ` 1014` ``` using s1 ``` lp15@68339 ` 1015` ``` apply (force intro: finite_vimageI [where h = "( *)2"] inj_onI) ``` lp15@60809 ` 1016` ``` apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g1) ``` lp15@60809 ` 1017` ``` done ``` lp15@60809 ` 1018` ``` moreover have "((\x. f ((g1 +++ g2) x) * vector_derivative (g1 +++ g2) (at x)) has_integral i2) {1/2..1}" ``` lp15@60809 ` 1019` ``` apply (rule has_integral_spike_finite [OF _ _ i2, of "insert (1/2) ((\x. 2*x-1) -` s2)"]) ``` lp15@60809 ` 1020` ``` using s2 ``` lp15@60809 ` 1021` ``` apply (force intro: finite_vimageI [where h = "\x. 2*x-1"] inj_onI) ``` lp15@60809 ` 1022` ``` apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g2) ``` lp15@60809 ` 1023` ``` done ``` lp15@60809 ` 1024` ``` ultimately ``` lp15@60809 ` 1025` ``` show ?thesis ``` lp15@61738 ` 1026` ``` apply (simp add: has_contour_integral) ``` lp15@60809 ` 1027` ``` apply (rule has_integral_combine [where c = "1/2"], auto) ``` lp15@60809 ` 1028` ``` done ``` lp15@60809 ` 1029` ```qed ``` lp15@60809 ` 1030` lp15@61738 ` 1031` ```lemma contour_integrable_joinI: ``` lp15@61738 ` 1032` ``` assumes "f contour_integrable_on g1" "f contour_integrable_on g2" ``` lp15@60809 ` 1033` ``` "valid_path g1" "valid_path g2" ``` lp15@61738 ` 1034` ``` shows "f contour_integrable_on (g1 +++ g2)" ``` lp15@60809 ` 1035` ``` using assms ``` lp15@61738 ` 1036` ``` by (meson has_contour_integral_join contour_integrable_on_def) ``` lp15@61738 ` 1037` lp15@61738 ` 1038` ```lemma contour_integrable_joinD1: ``` lp15@61738 ` 1039` ``` assumes "f contour_integrable_on (g1 +++ g2)" "valid_path g1" ``` lp15@61738 ` 1040` ``` shows "f contour_integrable_on g1" ``` lp15@60809 ` 1041` ```proof - ``` lp15@60809 ` 1042` ``` obtain s1 ``` lp15@60809 ` 1043` ``` where s1: "finite s1" "\x\{0..1} - s1. g1 differentiable at x" ``` lp15@61190 ` 1044` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@60809 ` 1045` ``` have "(\x. f ((g1 +++ g2) (x/2)) * vector_derivative (g1 +++ g2) (at (x/2))) integrable_on {0..1}" ``` lp15@60809 ` 1046` ``` using assms ``` lp15@61738 ` 1047` ``` apply (auto simp: contour_integrable_on) ``` lp15@60809 ` 1048` ``` apply (drule integrable_on_subcbox [where a=0 and b="1/2"]) ``` lp15@60809 ` 1049` ``` apply (auto intro: integrable_affinity [of _ 0 "1/2::real" "1/2" 0, simplified]) ``` lp15@60809 ` 1050` ``` done ``` lp15@60809 ` 1051` ``` then have *: "(\x. (f ((g1 +++ g2) (x/2))/2) * vector_derivative (g1 +++ g2) (at (x/2))) integrable_on {0..1}" ``` lp15@61190 ` 1052` ``` by (auto dest: integrable_cmul [where c="1/2"] simp: scaleR_conv_of_real) ``` lp15@60809 ` 1053` ``` have g1: "\0 < z; z < 1; z \ s1\ \ ``` lp15@60809 ` 1054` ``` vector_derivative (\x. if x*2 \ 1 then g1 (2*x) else g2 (2*x - 1)) (at (z/2)) = ``` lp15@60809 ` 1055` ``` 2 *\<^sub>R vector_derivative g1 (at z)" for z ``` paulson@62087 ` 1056` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g1(2*x))" and d = "\(z-1)/2\"]]) ``` nipkow@62390 ` 1057` ``` apply (simp_all add: field_simps dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 1058` ``` apply (rule vector_diff_chain_at [of "\x. x*2" 2 _ g1, simplified o_def]) ``` lp15@60809 ` 1059` ``` using s1 ``` lp15@60809 ` 1060` ``` apply (auto simp: vector_derivative_works has_vector_derivative_def has_derivative_def bounded_linear_mult_left) ``` lp15@60809 ` 1061` ``` done ``` lp15@60809 ` 1062` ``` show ?thesis ``` lp15@60809 ` 1063` ``` using s1 ``` lp15@61738 ` 1064` ``` apply (auto simp: contour_integrable_on) ``` lp15@60809 ` 1065` ``` apply (rule integrable_spike_finite [of "{0,1} \ s1", OF _ _ *]) ``` lp15@60809 ` 1066` ``` apply (auto simp: joinpaths_def scaleR_conv_of_real g1) ``` lp15@60809 ` 1067` ``` done ``` lp15@60809 ` 1068` ```qed ``` lp15@60809 ` 1069` lp15@61738 ` 1070` ```lemma contour_integrable_joinD2: ``` lp15@61738 ` 1071` ``` assumes "f contour_integrable_on (g1 +++ g2)" "valid_path g2" ``` lp15@61738 ` 1072` ``` shows "f contour_integrable_on g2" ``` lp15@60809 ` 1073` ```proof - ``` lp15@60809 ` 1074` ``` obtain s2 ``` lp15@60809 ` 1075` ``` where s2: "finite s2" "\x\{0..1} - s2. g2 differentiable at x" ``` lp15@61190 ` 1076` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@60809 ` 1077` ``` have "(\x. f ((g1 +++ g2) (x/2 + 1/2)) * vector_derivative (g1 +++ g2) (at (x/2 + 1/2))) integrable_on {0..1}" ``` lp15@60809 ` 1078` ``` using assms ``` lp15@61738 ` 1079` ``` apply (auto simp: contour_integrable_on) ``` lp15@60809 ` 1080` ``` apply (drule integrable_on_subcbox [where a="1/2" and b=1], auto) ``` lp15@60809 ` 1081` ``` apply (drule integrable_affinity [of _ "1/2::real" 1 "1/2" "1/2", simplified]) ``` lp15@60809 ` 1082` ``` apply (simp add: image_affinity_atLeastAtMost_diff) ``` lp15@60809 ` 1083` ``` done ``` lp15@60809 ` 1084` ``` then have *: "(\x. (f ((g1 +++ g2) (x/2 + 1/2))/2) * vector_derivative (g1 +++ g2) (at (x/2 + 1/2))) ``` lp15@60809 ` 1085` ``` integrable_on {0..1}" ``` lp15@60809 ` 1086` ``` by (auto dest: integrable_cmul [where c="1/2"] simp: scaleR_conv_of_real) ``` lp15@60809 ` 1087` ``` have g2: "\0 < z; z < 1; z \ s2\ \ ``` lp15@60809 ` 1088` ``` vector_derivative (\x. if x*2 \ 1 then g1 (2*x) else g2 (2*x - 1)) (at (z/2+1/2)) = ``` lp15@60809 ` 1089` ``` 2 *\<^sub>R vector_derivative g2 (at z)" for z ``` paulson@62087 ` 1090` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g2(2*x-1))" and d = "\z/2\"]]) ``` nipkow@62390 ` 1091` ``` apply (simp_all add: field_simps dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 1092` ``` apply (rule vector_diff_chain_at [of "\x. x*2-1" 2 _ g2, simplified o_def]) ``` lp15@60809 ` 1093` ``` using s2 ``` lp15@60809 ` 1094` ``` apply (auto simp: has_vector_derivative_def has_derivative_def bounded_linear_mult_left ``` lp15@60809 ` 1095` ``` vector_derivative_works add_divide_distrib) ``` lp15@60809 ` 1096` ``` done ``` lp15@60809 ` 1097` ``` show ?thesis ``` lp15@60809 ` 1098` ``` using s2 ``` lp15@61738 ` 1099` ``` apply (auto simp: contour_integrable_on) ``` lp15@60809 ` 1100` ``` apply (rule integrable_spike_finite [of "{0,1} \ s2", OF _ _ *]) ``` lp15@60809 ` 1101` ``` apply (auto simp: joinpaths_def scaleR_conv_of_real g2) ``` lp15@60809 ` 1102` ``` done ``` lp15@60809 ` 1103` ```qed ``` lp15@60809 ` 1104` lp15@61738 ` 1105` ```lemma contour_integrable_join [simp]: ``` lp15@60809 ` 1106` ``` shows ``` lp15@60809 ` 1107` ``` "\valid_path g1; valid_path g2\ ``` lp15@61738 ` 1108` ``` \ f contour_integrable_on (g1 +++ g2) \ f contour_integrable_on g1 \ f contour_integrable_on g2" ``` lp15@61738 ` 1109` ```using contour_integrable_joinD1 contour_integrable_joinD2 contour_integrable_joinI by blast ``` lp15@61738 ` 1110` lp15@61738 ` 1111` ```lemma contour_integral_join [simp]: ``` lp15@60809 ` 1112` ``` shows ``` lp15@61738 ` 1113` ``` "\f contour_integrable_on g1; f contour_integrable_on g2; valid_path g1; valid_path g2\ ``` lp15@61738 ` 1114` ``` \ contour_integral (g1 +++ g2) f = contour_integral g1 f + contour_integral g2 f" ``` lp15@61738 ` 1115` ``` by (simp add: has_contour_integral_integral has_contour_integral_join contour_integral_unique) ``` lp15@60809 ` 1116` lp15@60809 ` 1117` lp15@60809 ` 1118` ```subsection\Shifting the starting point of a (closed) path\ ``` lp15@60809 ` 1119` lp15@60809 ` 1120` ```lemma shiftpath_alt_def: "shiftpath a f = (\x. if x \ 1-a then f (a + x) else f (a + x - 1))" ``` lp15@60809 ` 1121` ``` by (auto simp: shiftpath_def) ``` lp15@60809 ` 1122` lp15@60809 ` 1123` ```lemma valid_path_shiftpath [intro]: ``` lp15@60809 ` 1124` ``` assumes "valid_path g" "pathfinish g = pathstart g" "a \ {0..1}" ``` lp15@60809 ` 1125` ``` shows "valid_path(shiftpath a g)" ``` lp15@60809 ` 1126` ``` using assms ``` lp15@60809 ` 1127` ``` apply (auto simp: valid_path_def shiftpath_alt_def) ``` lp15@61190 ` 1128` ``` apply (rule piecewise_C1_differentiable_cases) ``` lp15@60809 ` 1129` ``` apply (auto simp: algebra_simps) ``` lp15@61190 ` 1130` ``` apply (rule piecewise_C1_differentiable_affine [of g 1 a, simplified o_def scaleR_one]) ``` lp15@61190 ` 1131` ``` apply (auto simp: pathfinish_def pathstart_def elim: piecewise_C1_differentiable_on_subset) ``` lp15@61190 ` 1132` ``` apply (rule piecewise_C1_differentiable_affine [of g 1 "a-1", simplified o_def scaleR_one algebra_simps]) ``` lp15@61190 ` 1133` ``` apply (auto simp: pathfinish_def pathstart_def elim: piecewise_C1_differentiable_on_subset) ``` lp15@60809 ` 1134` ``` done ``` lp15@60809 ` 1135` lp15@61738 ` 1136` ```lemma has_contour_integral_shiftpath: ``` lp15@61738 ` 1137` ``` assumes f: "(f has_contour_integral i) g" "valid_path g" ``` lp15@60809 ` 1138` ``` and a: "a \ {0..1}" ``` lp15@61738 ` 1139` ``` shows "(f has_contour_integral i) (shiftpath a g)" ``` lp15@60809 ` 1140` ```proof - ``` lp15@60809 ` 1141` ``` obtain s ``` lp15@60809 ` 1142` ``` where s: "finite s" and g: "\x\{0..1} - s. g differentiable at x" ``` lp15@61190 ` 1143` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@60809 ` 1144` ``` have *: "((\x. f (g x) * vector_derivative g (at x)) has_integral i) {0..1}" ``` lp15@61738 ` 1145` ``` using assms by (auto simp: has_contour_integral) ``` lp15@60809 ` 1146` ``` then have i: "i = integral {a..1} (\x. f (g x) * vector_derivative g (at x)) + ``` lp15@60809 ` 1147` ``` integral {0..a} (\x. f (g x) * vector_derivative g (at x))" ``` lp15@60809 ` 1148` ``` apply (rule has_integral_unique) ``` lp15@60809 ` 1149` ``` apply (subst add.commute) ``` hoelzl@63594 ` 1150` ``` apply (subst integral_combine) ``` lp15@60809 ` 1151` ``` using assms * integral_unique by auto ``` lp15@60809 ` 1152` ``` { fix x ``` lp15@60809 ` 1153` ``` have "0 \ x \ x + a < 1 \ x \ (\x. x - a) ` s \ ``` lp15@60809 ` 1154` ``` vector_derivative (shiftpath a g) (at x) = vector_derivative g (at (x + a))" ``` lp15@60809 ` 1155` ``` unfolding shiftpath_def ``` paulson@62087 ` 1156` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g(a+x))" and d = "dist(1-a) x"]]) ``` nipkow@62390 ` 1157` ``` apply (auto simp: field_simps dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 1158` ``` apply (rule vector_diff_chain_at [of "\x. x+a" 1 _ g, simplified o_def scaleR_one]) ``` lp15@60809 ` 1159` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@60809 ` 1160` ``` using g ``` lp15@60809 ` 1161` ``` apply (drule_tac x="x+a" in bspec) ``` lp15@60809 ` 1162` ``` using a apply (auto simp: has_vector_derivative_def vector_derivative_works image_def add.commute) ``` lp15@60809 ` 1163` ``` done ``` lp15@60809 ` 1164` ``` } note vd1 = this ``` lp15@60809 ` 1165` ``` { fix x ``` lp15@60809 ` 1166` ``` have "1 < x + a \ x \ 1 \ x \ (\x. x - a + 1) ` s \ ``` lp15@60809 ` 1167` ``` vector_derivative (shiftpath a g) (at x) = vector_derivative g (at (x + a - 1))" ``` lp15@60809 ` 1168` ``` unfolding shiftpath_def ``` paulson@62087 ` 1169` ``` apply (rule vector_derivative_at [OF has_vector_derivative_transform_within [where f = "(\x. g(a+x-1))" and d = "dist (1-a) x"]]) ``` nipkow@62390 ` 1170` ``` apply (auto simp: field_simps dist_real_def abs_if split: if_split_asm) ``` lp15@60809 ` 1171` ``` apply (rule vector_diff_chain_at [of "\x. x+a-1" 1 _ g, simplified o_def scaleR_one]) ``` lp15@60809 ` 1172` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@60809 ` 1173` ``` using g ``` lp15@60809 ` 1174` ``` apply (drule_tac x="x+a-1" in bspec) ``` lp15@60809 ` 1175` ``` using a apply (auto simp: has_vector_derivative_def vector_derivative_works image_def add.commute) ``` lp15@60809 ` 1176` ``` done ``` lp15@60809 ` 1177` ``` } note vd2 = this ``` lp15@60809 ` 1178` ``` have va1: "(\x. f (g x) * vector_derivative g (at x)) integrable_on ({a..1})" ``` lp15@60809 ` 1179` ``` using * a by (fastforce intro: integrable_subinterval_real) ``` lp15@60809 ` 1180` ``` have v0a: "(\x. f (g x) * vector_derivative g (at x)) integrable_on ({0..a})" ``` lp15@60809 ` 1181` ``` apply (rule integrable_subinterval_real) ``` lp15@60809 ` 1182` ``` using * a by auto ``` lp15@60809 ` 1183` ``` have "((\x. f (shiftpath a g x) * vector_derivative (shiftpath a g) (at x)) ``` lp15@60809 ` 1184` ``` has_integral integral {a..1} (\x. f (g x) * vector_derivative g (at x))) {0..1 - a}" ``` lp15@60809 ` 1185` ``` apply (rule has_integral_spike_finite ``` lp15@65587 ` 1186` ``` [where S = "{1-a} \ (\x. x-a) ` s" and f = "\x. f(g(a+x)) * vector_derivative g (at(a+x))"]) ``` lp15@60809 ` 1187` ``` using s apply blast ``` lp15@60809 ` 1188` ``` using a apply (auto simp: algebra_simps vd1) ``` lp15@60809 ` 1189` ``` apply (force simp: shiftpath_def add.commute) ``` lp15@60809 ` 1190` ``` using has_integral_affinity [where m=1 and c=a, simplified, OF integrable_integral [OF va1]] ``` lp15@60809 ` 1191` ``` apply (simp add: image_affinity_atLeastAtMost_diff [where m=1 and c=a, simplified] add.commute) ``` lp15@60809 ` 1192` ``` done ``` lp15@60809 ` 1193` ``` moreover ``` lp15@60809 ` 1194` ``` have "((\x. f (shiftpath a g x) * vector_derivative (shiftpath a g) (at x)) ``` lp15@60809 ` 1195` ``` has_integral integral {0..a} (\x. f (g x) * vector_derivative g (at x))) {1 - a..1}" ``` lp15@60809 ` 1196` ``` apply (rule has_integral_spike_finite ``` lp15@65587 ` 1197` ``` [where S = "{1-a} \ (\x. x-a+1) ` s" and f = "\x. f(g(a+x-1)) * vector_derivative g (at(a+x-1))"]) ``` lp15@60809 ` 1198` ``` using s apply blast ``` lp15@60809 ` 1199` ``` using a apply (auto simp: algebra_simps vd2) ``` lp15@60809 ` 1200` ``` apply (force simp: shiftpath_def add.commute) ``` lp15@60809 ` 1201` ``` using has_integral_affinity [where m=1 and c="a-1", simplified, OF integrable_integral [OF v0a]] ``` lp15@60809 ` 1202` ``` apply (simp add: image_affinity_atLeastAtMost [where m=1 and c="1-a", simplified]) ``` lp15@60809 ` 1203` ``` apply (simp add: algebra_simps) ``` lp15@60809 ` 1204` ``` done ``` lp15@60809 ` 1205` ``` ultimately show ?thesis ``` lp15@60809 ` 1206` ``` using a ``` lp15@61738 ` 1207` ``` by (auto simp: i has_contour_integral intro: has_integral_combine [where c = "1-a"]) ``` lp15@60809 ` 1208` ```qed ``` lp15@60809 ` 1209` lp15@61738 ` 1210` ```lemma has_contour_integral_shiftpath_D: ``` lp15@61738 ` 1211` ``` assumes "(f has_contour_integral i) (shiftpath a g)" ``` lp15@60809 ` 1212` ``` "valid_path g" "pathfinish g = pathstart g" "a \ {0..1}" ``` lp15@61738 ` 1213` ``` shows "(f has_contour_integral i) g" ``` lp15@60809 ` 1214` ```proof - ``` lp15@60809 ` 1215` ``` obtain s ``` lp15@60809 ` 1216` ``` where s: "finite s" and g: "\x\{0..1} - s. g differentiable at x" ``` lp15@61190 ` 1217` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) ``` lp15@60809 ` 1218` ``` { fix x ``` lp15@60809 ` 1219` ``` assume x: "0 < x" "x < 1" "x \ s" ``` lp15@60809 ` 1220` ``` then have gx: "g differentiable at x" ``` lp15@60809 ` 1221` ``` using g by auto ``` lp15@60809 ` 1222` ``` have "vector_derivative g (at x within {0..1}) = ``` lp15@60809 ` 1223` ``` vector_derivative (shiftpath (1 - a) (shiftpath a g)) (at x within {0..1})" ``` lp15@60809 ` 1224` ``` apply (rule vector_derivative_at_within_ivl ``` lp15@60809 ` 1225` ``` [OF has_vector_derivative_transform_within_open ``` lp15@68239 ` 1226` ``` [where f = "(shiftpath (1 - a) (shiftpath a g))" and S = "{0<..<1}-s"]]) ``` lp15@60809 ` 1227` ``` using s g assms x ``` lp15@60809 ` 1228` ``` apply (auto simp: finite_imp_closed open_Diff shiftpath_shiftpath ``` lp15@68296 ` 1229` ``` at_within_interior [of _ "{0..1}"] vector_derivative_works [symmetric]) ``` paulson@62087 ` 1230` ``` apply (rule differentiable_transform_within [OF gx, of "min x (1-x)"]) ``` nipkow@62390 ` 1231` ``` apply (auto simp: dist_real_def shiftpath_shiftpath abs_if split: if_split_asm) ``` lp15@60809 ` 1232` ``` done ``` lp15@60809 ` 1233` ``` } note vd = this ``` lp15@61738 ` 1234` ``` have fi: "(f has_contour_integral i) (shiftpath (1 - a) (shiftpath a g))" ``` lp15@61738 ` 1235` ``` using assms by (auto intro!: has_contour_integral_shiftpath) ``` lp15@60809 ` 1236` ``` show ?thesis ``` lp15@61738 ` 1237` ``` apply (simp add: has_contour_integral_def) ``` lp15@61738 ` 1238` ``` apply (rule has_integral_spike_finite [of "{0,1} \ s", OF _ _ fi [unfolded has_contour_integral_def]]) ``` lp15@60809 ` 1239` ``` using s assms vd ``` lp15@60809 ` 1240` ``` apply (auto simp: Path_Connected.shiftpath_shiftpath) ``` lp15@60809 ` 1241` ``` done ``` lp15@60809 ` 1242` ```qed ``` lp15@60809 ` 1243` lp15@61738 ` 1244` ```lemma has_contour_integral_shiftpath_eq: ``` lp15@60809 ` 1245` ``` assumes "valid_path g" "pathfinish g = pathstart g" "a \ {0..1}" ``` lp15@61738 ` 1246` ``` shows "(f has_contour_integral i) (shiftpath a g) \ (f has_contour_integral i) g" ``` lp15@61738 ` 1247` ``` using assms has_contour_integral_shiftpath has_contour_integral_shiftpath_D by blast ``` lp15@61738 ` 1248` lp15@62463 ` 1249` ```lemma contour_integrable_on_shiftpath_eq: ``` lp15@62463 ` 1250` ``` assumes "valid_path g" "pathfinish g = pathstart g" "a \ {0..1}" ``` lp15@62463 ` 1251` ``` shows "f contour_integrable_on (shiftpath a g) \ f contour_integrable_on g" ``` lp15@62463 ` 1252` ```using assms contour_integrable_on_def has_contour_integral_shiftpath_eq by auto ``` lp15@62463 ` 1253` lp15@61738 ` 1254` ```lemma contour_integral_shiftpath: ``` lp15@60809 ` 1255` ``` assumes "valid_path g" "pathfinish g = pathstart g" "a \ {0..1}" ``` lp15@61738 ` 1256` ``` shows "contour_integral (shiftpath a g) f = contour_integral g f" ``` lp15@62534 ` 1257` ``` using assms ``` lp15@62463 ` 1258` ``` by (simp add: contour_integral_def contour_integrable_on_def has_contour_integral_shiftpath_eq) ``` lp15@60809 ` 1259` lp15@60809 ` 1260` lp15@60809 ` 1261` ```subsection\More about straight-line paths\ ``` lp15@60809 ` 1262` lp15@60809 ` 1263` ```lemma has_vector_derivative_linepath_within: ``` lp15@60809 ` 1264` ``` "(linepath a b has_vector_derivative (b - a)) (at x within s)" ``` lp15@60809 ` 1265` ```apply (simp add: linepath_def has_vector_derivative_def algebra_simps) ``` lp15@60809 ` 1266` ```apply (rule derivative_eq_intros | simp)+ ``` lp15@60809 ` 1267` ```done ``` lp15@60809 ` 1268` lp15@60809 ` 1269` ```lemma vector_derivative_linepath_within: ``` lp15@60809 ` 1270` ``` "x \ {0..1} \ vector_derivative (linepath a b) (at x within {0..1}) = b - a" ``` immler@67685 ` 1271` ``` apply (rule vector_derivative_within_cbox [of 0 "1::real", simplified]) ``` lp15@60809 ` 1272` ``` apply (auto simp: has_vector_derivative_linepath_within) ``` lp15@60809 ` 1273` ``` done ``` lp15@60809 ` 1274` lp15@61190 ` 1275` ```lemma vector_derivative_linepath_at [simp]: "vector_derivative (linepath a b) (at x) = b - a" ``` lp15@60809 ` 1276` ``` by (simp add: has_vector_derivative_linepath_within vector_derivative_at) ``` lp15@60809 ` 1277` lp15@61190 ` 1278` ```lemma valid_path_linepath [iff]: "valid_path (linepath a b)" ``` lp15@61190 ` 1279` ``` apply (simp add: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq continuous_on_linepath) ``` lp15@61190 ` 1280` ``` apply (rule_tac x="{}" in exI) ``` lp15@61190 ` 1281` ``` apply (simp add: differentiable_on_def differentiable_def) ``` lp15@61190 ` 1282` ``` using has_vector_derivative_def has_vector_derivative_linepath_within ``` lp15@61190 ` 1283` ``` apply (fastforce simp add: continuous_on_eq_continuous_within) ``` lp15@61190 ` 1284` ``` done ``` lp15@61190 ` 1285` lp15@61738 ` 1286` ```lemma has_contour_integral_linepath: ``` lp15@61738 ` 1287` ``` shows "(f has_contour_integral i) (linepath a b) \ ``` lp15@60809 ` 1288` ``` ((\x. f(linepath a b x) * (b - a)) has_integral i) {0..1}" ``` lp15@61738 ` 1289` ``` by (simp add: has_contour_integral vector_derivative_linepath_at) ``` lp15@60809 ` 1290` lp15@60809 ` 1291` ```lemma linepath_in_path: ``` lp15@60809 ` 1292` ``` shows "x \ {0..1} \ linepath a b x \ closed_segment a b" ``` lp15@60809 ` 1293` ``` by (auto simp: segment linepath_def) ``` lp15@60809 ` 1294` lp15@60809 ` 1295` ```lemma linepath_image_01: "linepath a b ` {0..1} = closed_segment a b" ``` lp15@60809 ` 1296` ``` by (auto simp: segment linepath_def) ``` lp15@60809 ` 1297` lp15@60809 ` 1298` ```lemma linepath_in_convex_hull: ``` lp15@60809 ` 1299` ``` fixes x::real ``` lp15@60809 ` 1300` ``` assumes a: "a \ convex hull s" ``` lp15@60809 ` 1301` ``` and b: "b \ convex hull s" ``` lp15@60809 ` 1302` ``` and x: "0\x" "x\1" ``` lp15@60809 ` 1303` ``` shows "linepath a b x \ convex hull s" ``` lp15@60809 ` 1304` ``` apply (rule closed_segment_subset_convex_hull [OF a b, THEN subsetD]) ``` lp15@60809 ` 1305` ``` using x ``` lp15@60809 ` 1306` ``` apply (auto simp: linepath_image_01 [symmetric]) ``` lp15@60809 ` 1307` ``` done ``` lp15@60809 ` 1308` lp15@60809 ` 1309` ```lemma Re_linepath: "Re(linepath (of_real a) (of_real b) x) = (1 - x)*a + x*b" ``` lp15@60809 ` 1310` ``` by (simp add: linepath_def) ``` lp15@60809 ` 1311` lp15@60809 ` 1312` ```lemma Im_linepath: "Im(linepath (of_real a) (of_real b) x) = 0" ``` lp15@60809 ` 1313` ``` by (simp add: linepath_def) ``` lp15@60809 ` 1314` lp15@61738 ` 1315` ```lemma has_contour_integral_trivial [iff]: "(f has_contour_integral 0) (linepath a a)" ``` lp15@61738 ` 1316` ``` by (simp add: has_contour_integral_linepath) ``` lp15@61738 ` 1317` lp15@68296 ` 1318` ```lemma has_contour_integral_trivial_iff [simp]: "(f has_contour_integral i) (linepath a a) \ i=0" ``` lp15@68296 ` 1319` ``` using has_contour_integral_unique by blast ``` lp15@68296 ` 1320` lp15@61738 ` 1321` ```lemma contour_integral_trivial [simp]: "contour_integral (linepath a a) f = 0" ``` lp15@61738 ` 1322` ``` using has_contour_integral_trivial contour_integral_unique by blast ``` lp15@60809 ` 1323` lp15@60809 ` 1324` lp15@60809 ` 1325` ```subsection\Relation to subpath construction\ ``` lp15@60809 ` 1326` lp15@60809 ` 1327` ```lemma valid_path_subpath: ``` lp15@60809 ` 1328` ``` fixes g :: "real \ 'a :: real_normed_vector" ``` lp15@60809 ` 1329` ``` assumes "valid_path g" "u \ {0..1}" "v \ {0..1}" ``` lp15@60809 ` 1330` ``` shows "valid_path(subpath u v g)" ``` lp15@60809 ` 1331` ```proof (cases "v=u") ``` lp15@60809 ` 1332` ``` case True ``` lp15@60809 ` 1333` ``` then show ?thesis ``` lp15@61190 ` 1334` ``` unfolding valid_path_def subpath_def ``` lp15@61190 ` 1335` ``` by (force intro: C1_differentiable_on_const C1_differentiable_imp_piecewise) ``` lp15@60809 ` 1336` ```next ``` lp15@60809 ` 1337` ``` case False ``` lp15@68339 ` 1338` ``` have "(g \ (\x. ((v-u) * x + u))) piecewise_C1_differentiable_on {0..1}" ``` lp15@61190 ` 1339` ``` apply (rule piecewise_C1_differentiable_compose) ``` lp15@61190 ` 1340` ``` apply (simp add: C1_differentiable_imp_piecewise) ``` lp15@60809 ` 1341` ``` apply (simp add: image_affinity_atLeastAtMost) ``` lp15@60809 ` 1342` ``` using assms False ``` lp15@61190 ` 1343` ``` apply (auto simp: algebra_simps valid_path_def piecewise_C1_differentiable_on_subset) ``` lp15@60809 ` 1344` ``` apply (subst Int_commute) ``` lp15@60809 ` 1345` ``` apply (auto simp: inj_on_def algebra_simps crossproduct_eq finite_vimage_IntI) ``` lp15@60809 ` 1346` ``` done ``` lp15@60809 ` 1347` ``` then show ?thesis ``` lp15@60809 ` 1348` ``` by (auto simp: o_def valid_path_def subpath_def) ``` lp15@60809 ` 1349` ```qed ``` lp15@60809 ` 1350` lp15@61738 ` 1351` ```lemma has_contour_integral_subpath_refl [iff]: "(f has_contour_integral 0) (subpath u u g)" ``` lp15@61738 ` 1352` ``` by (simp add: has_contour_integral subpath_def) ``` lp15@61738 ` 1353` lp15@61738 ` 1354` ```lemma contour_integrable_subpath_refl [iff]: "f contour_integrable_on (subpath u u g)" ``` lp15@61738 ` 1355` ``` using has_contour_integral_subpath_refl contour_integrable_on_def by blast ``` lp15@61738 ` 1356` lp15@61738 ` 1357` ```lemma contour_integral_subpath_refl [simp]: "contour_integral (subpath u u g) f = 0" ``` lp15@61738 ` 1358` ``` by (simp add: has_contour_integral_subpath_refl contour_integral_unique) ``` lp15@61738 ` 1359` lp15@61738 ` 1360` ```lemma has_contour_integral_subpath: ``` lp15@61738 ` 1361` ``` assumes f: "f contour_integrable_on g" and g: "valid_path g" ``` lp15@60809 ` 1362` ``` and uv: "u \ {0..1}" "v \ {0..1}" "u \ v" ``` lp15@61738 ` 1363` ``` shows "(f has_contour_integral integral {u..v} (\x. f(g x) * vector_derivative g (at x))) ``` lp15@60809 ` 1364` ``` (subpath u v g)" ``` lp15@60809 ` 1365` ```proof (cases "v=u") ``` lp15@60809 ` 1366` ``` case True ``` lp15@60809 ` 1367` ``` then show ?thesis ``` lp15@61738 ` 1368` ``` using f by (simp add: contour_integrable_on_def subpath_def has_contour_integral) ``` lp15@60809 ` 1369` ```next ``` lp15@60809 ` 1370` ``` case False ``` lp15@60809 ` 1371` ``` obtain s where s: "\x. x \ {0..1} - s \ g differentiable at x" and fs: "finite s" ``` lp15@61190 ` 1372` ``` using g unfolding piecewise_C1_differentiable_on_def C1_differentiable_on_eq valid_path_def by blast ``` lp15@60809 ` 1373` ``` have *: "((\x. f (g ((v - u) * x + u)) * vector_derivative g (at ((v - u) * x + u))) ``` lp15@60809 ` 1374` ``` has_integral (1 / (v - u)) * integral {u..v} (\t. f (g t) * vector_derivative g (at t))) ``` lp15@60809 ` 1375` ``` {0..1}" ``` lp15@60809 ` 1376` ``` using f uv ``` lp15@61738 ` 1377` ``` apply (simp add: contour_integrable_on subpath_def has_contour_integral) ``` lp15@60809 ` 1378` ``` apply (drule integrable_on_subcbox [where a=u and b=v, simplified]) ``` lp15@60809 ` 1379` ``` apply (simp_all add: has_integral_integral) ``` lp15@60809 ` 1380` ``` apply (drule has_integral_affinity [where m="v-u" and c=u, simplified]) ``` lp15@60809 ` 1381` ``` apply (simp_all add: False image_affinity_atLeastAtMost_div_diff scaleR_conv_of_real) ``` lp15@60809 ` 1382` ``` apply (simp add: divide_simps False) ``` lp15@60809 ` 1383` ``` done ``` lp15@60809 ` 1384` ``` { fix x ``` lp15@60809 ` 1385` ``` have "x \ {0..1} \ ``` lp15@60809 ` 1386` ``` x \ (\t. (v-u) *\<^sub>R t + u) -` s \ ``` lp15@60809 ` 1387` ``` vector_derivative (\x. g ((v-u) * x + u)) (at x) = (v-u) *\<^sub>R vector_derivative g (at ((v-u) * x + u))" ``` lp15@60809 ` 1388` ``` apply (rule vector_derivative_at [OF vector_diff_chain_at [simplified o_def]]) ``` lp15@60809 ` 1389` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@60809 ` 1390` ``` apply (cut_tac s [of "(v - u) * x + u"]) ``` lp15@60809 ` 1391` ``` using uv mult_left_le [of x "v-u"] ``` lp15@60809 ` 1392` ``` apply (auto simp: vector_derivative_works) ``` lp15@60809 ` 1393` ``` done ``` lp15@60809 ` 1394` ``` } note vd = this ``` lp15@60809 ` 1395` ``` show ?thesis ``` lp15@60809 ` 1396` ``` apply (cut_tac has_integral_cmul [OF *, where c = "v-u"]) ``` lp15@60809 ` 1397` ``` using fs assms ``` lp15@61738 ` 1398` ``` apply (simp add: False subpath_def has_contour_integral) ``` lp15@65587 ` 1399` ``` apply (rule_tac S = "(\t. ((v-u) *\<^sub>R t + u)) -` s" in has_integral_spike_finite) ``` lp15@60809 ` 1400` ``` apply (auto simp: inj_on_def False finite_vimageI vd scaleR_conv_of_real) ``` lp15@60809 ` 1401` ``` done ``` lp15@60809 ` 1402` ```qed ``` lp15@60809 ` 1403` lp15@61738 ` 1404` ```lemma contour_integrable_subpath: ``` lp15@61738 ` 1405` ``` assumes "f contour_integrable_on g" "valid_path g" "u \ {0..1}" "v \ {0..1}" ``` lp15@61738 ` 1406` ``` shows "f contour_integrable_on (subpath u v g)" ``` lp15@60809 ` 1407` ``` apply (cases u v rule: linorder_class.le_cases) ``` lp15@61738 ` 1408` ``` apply (metis contour_integrable_on_def has_contour_integral_subpath [OF assms]) ``` lp15@60809 ` 1409` ``` apply (subst reversepath_subpath [symmetric]) ``` lp15@61738 ` 1410` ``` apply (rule contour_integrable_reversepath) ``` lp15@60809 ` 1411` ``` using assms apply (blast intro: valid_path_subpath) ``` lp15@61738 ` 1412` ``` apply (simp add: contour_integrable_on_def) ``` lp15@61738 ` 1413` ``` using assms apply (blast intro: has_contour_integral_subpath) ``` lp15@60809 ` 1414` ``` done ``` lp15@60809 ` 1415` lp15@61738 ` 1416` ```lemma has_integral_contour_integral_subpath: ``` lp15@61738 ` 1417` ``` assumes "f contour_integrable_on g" "valid_path g" "u \ {0..1}" "v \ {0..1}" "u \ v" ``` lp15@60809 ` 1418` ``` shows "(((\x. f(g x) * vector_derivative g (at x))) ``` lp15@61738 ` 1419` ``` has_integral contour_integral (subpath u v g) f) {u..v}" ``` lp15@60809 ` 1420` ``` using assms ``` lp15@60809 ` 1421` ``` apply (auto simp: has_integral_integrable_integral) ``` lp15@66507 ` 1422` ``` apply (rule integrable_on_subcbox [where a=u and b=v and S = "{0..1}", simplified]) ``` lp15@61738 ` 1423` ``` apply (auto simp: contour_integral_unique [OF has_contour_integral_subpath] contour_integrable_on) ``` lp15@60809 ` 1424` ``` done ``` lp15@60809 ` 1425` lp15@61738 ` 1426` ```lemma contour_integral_subcontour_integral: ``` lp15@61738 ` 1427` ``` assumes "f contour_integrable_on g" "valid_path g" "u \ {0..1}" "v \ {0..1}" "u \ v" ``` lp15@61738 ` 1428` ``` shows "contour_integral (subpath u v g) f = ``` lp15@60809 ` 1429` ``` integral {u..v} (\x. f(g x) * vector_derivative g (at x))" ``` lp15@61738 ` 1430` ``` using assms has_contour_integral_subpath contour_integral_unique by blast ``` lp15@61738 ` 1431` lp15@61738 ` 1432` ```lemma contour_integral_subpath_combine_less: ``` lp15@61738 ` 1433` ``` assumes "f contour_integrable_on g" "valid_path g" "u \ {0..1}" "v \ {0..1}" "w \ {0..1}" ``` lp15@60809 ` 1434` ``` "u {0..1}" "v \ {0..1}" "w \ {0..1}" ``` lp15@61738 ` 1445` ``` shows "contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = ``` lp15@61738 ` 1446` ``` contour_integral (subpath u w g) f" ``` lp15@60809 ` 1447` ```proof (cases "u\v \ v\w \ u\w") ``` lp15@60809 ` 1448` ``` case True ``` lp15@60809 ` 1449` ``` have *: "subpath v u g = reversepath(subpath u v g) \ ``` lp15@60809 ` 1450` ``` subpath w u g = reversepath(subpath u w g) \ ``` lp15@60809 ` 1451` ``` subpath w v g = reversepath(subpath v w g)" ``` lp15@60809 ` 1452` ``` by (auto simp: reversepath_subpath) ``` lp15@60809 ` 1453` ``` have "u < v \ v < w \ ``` lp15@60809 ` 1454` ``` u < w \ w < v \ ``` lp15@60809 ` 1455` ``` v < u \ u < w \ ``` lp15@60809 ` 1456` ``` v < w \ w < u \ ``` lp15@60809 ` 1457` ``` w < u \ u < v \ ``` lp15@60809 ` 1458` ``` w < v \ v < u" ``` lp15@60809 ` 1459` ``` using True assms by linarith ``` lp15@60809 ` 1460` ``` with assms show ?thesis ``` lp15@61738 ` 1461` ``` using contour_integral_subpath_combine_less [of f g u v w] ``` lp15@61738 ` 1462` ``` contour_integral_subpath_combine_less [of f g u w v] ``` lp15@61738 ` 1463` ``` contour_integral_subpath_combine_less [of f g v u w] ``` lp15@61738 ` 1464` ``` contour_integral_subpath_combine_less [of f g v w u] ``` lp15@61738 ` 1465` ``` contour_integral_subpath_combine_less [of f g w u v] ``` lp15@61738 ` 1466` ``` contour_integral_subpath_combine_less [of f g w v u] ``` lp15@60809 ` 1467` ``` apply simp ``` lp15@60809 ` 1468` ``` apply (elim disjE) ``` lp15@61738 ` 1469` ``` apply (auto simp: * contour_integral_reversepath contour_integrable_subpath ``` lp15@60809 ` 1470` ``` valid_path_reversepath valid_path_subpath algebra_simps) ``` lp15@60809 ` 1471` ``` done ``` lp15@60809 ` 1472` ```next ``` lp15@60809 ` 1473` ``` case False ``` lp15@60809 ` 1474` ``` then show ?thesis ``` lp15@61738 ` 1475` ``` apply (auto simp: contour_integral_subpath_refl) ``` lp15@60809 ` 1476` ``` using assms ``` lp15@61738 ` 1477` ``` by (metis eq_neg_iff_add_eq_0 contour_integrable_subpath contour_integral_reversepath reversepath_subpath valid_path_subpath) ``` lp15@60809 ` 1478` ```qed ``` lp15@60809 ` 1479` lp15@61738 ` 1480` ```lemma contour_integral_integral: ``` lp15@62463 ` 1481` ``` "contour_integral g f = integral {0..1} (\x. f (g x) * vector_derivative g (at x))" ``` lp15@62463 ` 1482` ``` by (simp add: contour_integral_def integral_def has_contour_integral contour_integrable_on) ``` lp15@60809 ` 1483` lp15@60809 ` 1484` lp15@60809 ` 1485` ```text\Cauchy's theorem where there's a primitive\ ``` lp15@60809 ` 1486` lp15@61738 ` 1487` ```lemma contour_integral_primitive_lemma: ``` lp15@60809 ` 1488` ``` fixes f :: "complex \ complex" and g :: "real \ complex" ``` lp15@60809 ` 1489` ``` assumes "a \ b" ``` lp15@60809 ` 1490` ``` and "\x. x \ s \ (f has_field_derivative f' x) (at x within s)" ``` lp15@60809 ` 1491` ``` and "g piecewise_differentiable_on {a..b}" "\x. x \ {a..b} \ g x \ s" ``` lp15@60809 ` 1492` ``` shows "((\x. f'(g x) * vector_derivative g (at x within {a..b})) ``` lp15@60809 ` 1493` ``` has_integral (f(g b) - f(g a))) {a..b}" ``` lp15@60809 ` 1494` ```proof - ``` lp15@61190 ` 1495` ``` obtain k where k: "finite k" "\x\{a..b} - k. g differentiable (at x within {a..b})" and cg: "continuous_on {a..b} g" ``` lp15@60809 ` 1496` ``` using assms by (auto simp: piecewise_differentiable_on_def) ``` lp15@60809 ` 1497` ``` have cfg: "continuous_on {a..b} (\x. f (g x))" ``` lp15@60809 ` 1498` ``` apply (rule continuous_on_compose [OF cg, unfolded o_def]) ``` lp15@60809 ` 1499` ``` using assms ``` lp15@62534 ` 1500` ``` apply (metis field_differentiable_def field_differentiable_imp_continuous_at continuous_on_eq_continuous_within continuous_on_subset image_subset_iff) ``` lp15@60809 ` 1501` ``` done ``` lp15@60809 ` 1502` ``` { fix x::real ``` lp15@60809 ` 1503` ``` assume a: "a < x" and b: "x < b" and xk: "x \ k" ``` lp15@60809 ` 1504` ``` then have "g differentiable at x within {a..b}" ``` lp15@60809 ` 1505` ``` using k by (simp add: differentiable_at_withinI) ``` lp15@60809 ` 1506` ``` then have "(g has_vector_derivative vector_derivative g (at x within {a..b})) (at x within {a..b})" ``` lp15@60809 ` 1507` ``` by (simp add: vector_derivative_works has_field_derivative_def scaleR_conv_of_real) ``` lp15@60809 ` 1508` ``` then have gdiff: "(g has_derivative (\u. u * vector_derivative g (at x within {a..b}))) (at x within {a..b})" ``` lp15@60809 ` 1509` ``` by (simp add: has_vector_derivative_def scaleR_conv_of_real) ``` lp15@60809 ` 1510` ``` have "(f has_field_derivative (f' (g x))) (at (g x) within g ` {a..b})" ``` lp15@60809 ` 1511` ``` using assms by (metis a atLeastAtMost_iff b DERIV_subset image_subset_iff less_eq_real_def) ``` lp15@68339 ` 1512` ``` then have fdiff: "(f has_derivative ( *) (f' (g x))) (at (g x) within g ` {a..b})" ``` lp15@60809 ` 1513` ``` by (simp add: has_field_derivative_def) ``` lp15@60809 ` 1514` ``` have "((\x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {a..b})) (at x within {a..b})" ``` lp15@60809 ` 1515` ``` using diff_chain_within [OF gdiff fdiff] ``` lp15@60809 ` 1516` ``` by (simp add: has_vector_derivative_def scaleR_conv_of_real o_def mult_ac) ``` lp15@60809 ` 1517` ``` } note * = this ``` lp15@60809 ` 1518` ``` show ?thesis ``` lp15@60809 ` 1519` ``` apply (rule fundamental_theorem_of_calculus_interior_strong) ``` lp15@60809 ` 1520` ``` using k assms cfg * ``` lp15@66793 ` 1521` ``` apply (auto simp: at_within_Icc_at) ``` lp15@60809 ` 1522` ``` done ``` lp15@60809 ` 1523` ```qed ``` lp15@60809 ` 1524` lp15@61738 ` 1525` ```lemma contour_integral_primitive: ``` lp15@60809 ` 1526` ``` assumes "\x. x \ s \ (f has_field_derivative f' x) (at x within s)" ``` lp15@60809 ` 1527` ``` and "valid_path g" "path_image g \ s" ``` lp15@61738 ` 1528` ``` shows "(f' has_contour_integral (f(pathfinish g) - f(pathstart g))) g" ``` lp15@60809 ` 1529` ``` using assms ``` lp15@61738 ` 1530` ``` apply (simp add: valid_path_def path_image_def pathfinish_def pathstart_def has_contour_integral_def) ``` lp15@61738 ` 1531` ``` apply (auto intro!: piecewise_C1_imp_differentiable contour_integral_primitive_lemma [of 0 1 s]) ``` lp15@60809 ` 1532` ``` done ``` lp15@60809 ` 1533` lp15@60809 ` 1534` ```corollary Cauchy_theorem_primitive: ``` lp15@60809 ` 1535` ``` assumes "\x. x \ s \ (f has_field_derivative f' x) (at x within s)" ``` lp15@60809 ` 1536` ``` and "valid_path g" "path_image g \ s" "pathfinish g = pathstart g" ``` lp15@61738 ` 1537` ``` shows "(f' has_contour_integral 0) g" ``` lp15@60809 ` 1538` ``` using assms ``` lp15@61738 ` 1539` ``` by (metis diff_self contour_integral_primitive) ``` lp15@60809 ` 1540` lp15@60809 ` 1541` lp15@60809 ` 1542` ```text\Existence of path integral for continuous function\ ``` lp15@61738 ` 1543` ```lemma contour_integrable_continuous_linepath: ``` lp15@60809 ` 1544` ``` assumes "continuous_on (closed_segment a b) f" ``` lp15@61738 ` 1545` ``` shows "f contour_integrable_on (linepath a b)" ``` lp15@60809 ` 1546` ```proof - ``` lp15@68339 ` 1547` ``` have "continuous_on {0..1} ((\x. f x * (b - a)) \ linepath a b)" ``` lp15@60809 ` 1548` ``` apply (rule continuous_on_compose [OF continuous_on_linepath], simp add: linepath_image_01) ``` lp15@60809 ` 1549` ``` apply (rule continuous_intros | simp add: assms)+ ``` lp15@60809 ` 1550` ``` done ``` lp15@60809 ` 1551` ``` then show ?thesis ``` lp15@61738 ` 1552` ``` apply (simp add: contour_integrable_on_def has_contour_integral_def integrable_on_def [symmetric]) ``` lp15@60809 ` 1553` ``` apply (rule integrable_continuous [of 0 "1::real", simplified]) ``` lp15@60809 ` 1554` ``` apply (rule continuous_on_eq [where f = "\x. f(linepath a b x)*(b - a)"]) ``` lp15@60809 ` 1555` ``` apply (auto simp: vector_derivative_linepath_within) ``` lp15@60809 ` 1556` ``` done ``` lp15@60809 ` 1557` ```qed ``` lp15@60809 ` 1558` lp15@60809 ` 1559` ```lemma has_field_der_id: "((\x. x\<^sup>2 / 2) has_field_derivative x) (at x)" ``` lp15@60809 ` 1560` ``` by (rule has_derivative_imp_has_field_derivative) ``` lp15@60809 ` 1561` ``` (rule derivative_intros | simp)+ ``` lp15@60809 ` 1562` lp15@61738 ` 1563` ```lemma contour_integral_id [simp]: "contour_integral (linepath a b) (\y. y) = (b^2 - a^2)/2" ``` lp15@61738 ` 1564` ``` apply (rule contour_integral_unique) ``` lp15@61738 ` 1565` ``` using contour_integral_primitive [of UNIV "\x. x^2/2" "\x. x" "linepath a b"] ``` lp15@60809 ` 1566` ``` apply (auto simp: field_simps has_field_der_id) ``` lp15@60809 ` 1567` ``` done ``` lp15@60809 ` 1568` lp15@61738 ` 1569` ```lemma contour_integrable_on_const [iff]: "(\x. c) contour_integrable_on (linepath a b)" ``` lp15@61738 ` 1570` ``` by (simp add: continuous_on_const contour_integrable_continuous_linepath) ``` lp15@61738 ` 1571` lp15@61738 ` 1572` ```lemma contour_integrable_on_id [iff]: "(\x. x) contour_integrable_on (linepath a b)" ``` lp15@61738 ` 1573` ``` by (simp add: continuous_on_id contour_integrable_continuous_linepath) ``` lp15@60809 ` 1574` lp15@60809 ` 1575` lp15@60809 ` 1576` ```subsection\Arithmetical combining theorems\ ``` lp15@60809 ` 1577` lp15@61738 ` 1578` ```lemma has_contour_integral_neg: ``` lp15@61738 ` 1579` ``` "(f has_contour_integral i) g \ ((\x. -(f x)) has_contour_integral (-i)) g" ``` lp15@61738 ` 1580` ``` by (simp add: has_integral_neg has_contour_integral_def) ``` lp15@61738 ` 1581` lp15@61738 ` 1582` ```lemma has_contour_integral_add: ``` lp15@61738 ` 1583` ``` "\(f1 has_contour_integral i1) g; (f2 has_contour_integral i2) g\ ``` lp15@61738 ` 1584` ``` \ ((\x. f1 x + f2 x) has_contour_integral (i1 + i2)) g" ``` lp15@61738 ` 1585` ``` by (simp add: has_integral_add has_contour_integral_def algebra_simps) ``` lp15@61738 ` 1586` lp15@61738 ` 1587` ```lemma has_contour_integral_diff: ``` lp15@61738 ` 1588` ``` "\(f1 has_contour_integral i1) g; (f2 has_contour_integral i2) g\ ``` lp15@61738 ` 1589` ``` \ ((\x. f1 x - f2 x) has_contour_integral (i1 - i2)) g" ``` lp15@66112 ` 1590` ``` by (simp add: has_integral_diff has_contour_integral_def algebra_simps) ``` lp15@61738 ` 1591` lp15@61738 ` 1592` ```lemma has_contour_integral_lmul: ``` lp15@61738 ` 1593` ``` "(f has_contour_integral i) g \ ((\x. c * (f x)) has_contour_integral (c*i)) g" ``` lp15@61738 ` 1594` ```apply (simp add: has_contour_integral_def) ``` lp15@60809 ` 1595` ```apply (drule has_integral_mult_right) ``` lp15@60809 ` 1596` ```apply (simp add: algebra_simps) ``` lp15@60809 ` 1597` ```done ``` lp15@60809 ` 1598` lp15@61738 ` 1599` ```lemma has_contour_integral_rmul: ``` lp15@61738 ` 1600` ``` "(f has_contour_integral i) g \ ((\x. (f x) * c) has_contour_integral (i*c)) g" ``` lp15@61738 ` 1601` ```apply (drule has_contour_integral_lmul) ``` lp15@60809 ` 1602` ```apply (simp add: mult.commute) ``` lp15@60809 ` 1603` ```done ``` lp15@60809 ` 1604` lp15@61738 ` 1605` ```lemma has_contour_integral_div: ``` lp15@61738 ` 1606` ``` "(f has_contour_integral i) g \ ((\x. f x/c) has_contour_integral (i/c)) g" ``` lp15@61738 ` 1607` ``` by (simp add: field_class.field_divide_inverse) (metis has_contour_integral_rmul) ``` lp15@61738 ` 1608` lp15@61738 ` 1609` ```lemma has_contour_integral_eq: ``` lp15@61738 ` 1610` ``` "\(f has_contour_integral y) p; \x. x \ path_image p \ f x = g x\ \ (g has_contour_integral y) p" ``` lp15@61738 ` 1611` ```apply (simp add: path_image_def has_contour_integral_def) ``` lp15@60809 ` 1612` ```by (metis (no_types, lifting) image_eqI has_integral_eq) ``` lp15@60809 ` 1613` lp15@61738 ` 1614` ```lemma has_contour_integral_bound_linepath: ``` lp15@61738 ` 1615` ``` assumes "(f has_contour_integral i) (linepath a b)" ``` lp15@60809 ` 1616` ``` "0 \ B" "\x. x \ closed_segment a b \ norm(f x) \ B" ``` lp15@60809 ` 1617` ``` shows "norm i \ B * norm(b - a)" ``` lp15@60809 ` 1618` ```proof - ``` lp15@60809 ` 1619` ``` { fix x::real ``` lp15@60809 ` 1620` ``` assume x: "0 \ x" "x \ 1" ``` lp15@60809 ` 1621` ``` have "norm (f (linepath a b x)) * ``` lp15@60809 ` 1622` ``` norm (vector_derivative (linepath a b) (at x within {0..1})) \ B * norm (b - a)" ``` lp15@60809 ` 1623` ``` by (auto intro: mult_mono simp: assms linepath_in_path of_real_linepath vector_derivative_linepath_within x) ``` lp15@60809 ` 1624` ``` } note * = this ``` lp15@60809 ` 1625` ``` have "norm i \ (B * norm (b - a)) * content (cbox 0 (1::real))" ``` lp15@60809 ` 1626` ``` apply (rule has_integral_bound ``` lp15@60809 ` 1627` ``` [of _ "\x. f (linepath a b x) * vector_derivative (linepath a b) (at x within {0..1})"]) ``` lp15@61738 ` 1628` ``` using assms * unfolding has_contour_integral_def ``` lp15@60809 ` 1629` ``` apply (auto simp: norm_mult) ``` lp15@60809 ` 1630` ``` done ``` lp15@60809 ` 1631` ``` then show ?thesis ``` lp15@60809 ` 1632` ``` by (auto simp: content_real) ``` lp15@60809 ` 1633` ```qed ``` lp15@60809 ` 1634` lp15@60809 ` 1635` ```(*UNUSED ``` lp15@61738 ` 1636` ```lemma has_contour_integral_bound_linepath_strong: ``` lp15@60809 ` 1637` ``` fixes a :: real and f :: "complex \ real" ``` lp15@61738 ` 1638` ``` assumes "(f has_contour_integral i) (linepath a b)" ``` lp15@60809 ` 1639` ``` "finite k" ``` lp15@60809 ` 1640` ``` "0 \ B" "\x::real. x \ closed_segment a b - k \ norm(f x) \ B" ``` lp15@60809 ` 1641` ``` shows "norm i \ B*norm(b - a)" ``` lp15@60809 ` 1642` ```*) ``` lp15@60809 ` 1643` lp15@61738 ` 1644` ```lemma has_contour_integral_const_linepath: "((\x. c) has_contour_integral c*(b - a))(linepath a b)" ``` lp15@61738 ` 1645` ``` unfolding has_contour_integral_linepath ``` lp15@60809 ` 1646` ``` by (metis content_real diff_0_right has_integral_const_real lambda_one of_real_1 scaleR_conv_of_real zero_le_one) ``` lp15@60809 ` 1647` lp15@61738 ` 1648` ```lemma has_contour_integral_0: "((\x. 0) has_contour_integral 0) g" ``` lp15@61738 ` 1649` ``` by (simp add: has_contour_integral_def) ``` lp15@61738 ` 1650` lp15@61738 ` 1651` ```lemma has_contour_integral_is_0: ``` lp15@61738 ` 1652` ``` "(\z. z \ path_image g \ f z = 0) \ (f has_contour_integral 0) g" ``` lp15@61738 ` 1653` ``` by (rule has_contour_integral_eq [OF has_contour_integral_0]) auto ``` lp15@61738 ` 1654` nipkow@64267 ` 1655` ```lemma has_contour_integral_sum: ``` lp15@61738 ` 1656` ``` "\finite s; \a. a \ s \ (f a has_contour_integral i a) p\ ``` nipkow@64267 ` 1657` ``` \ ((\x. sum (\a. f a x) s) has_contour_integral sum i s) p" ``` lp15@61738 ` 1658` ``` by (induction s rule: finite_induct) (auto simp: has_contour_integral_0 has_contour_integral_add) ``` lp15@60809 ` 1659` lp15@60809 ` 1660` lp15@60809 ` 1661` ```subsection \Operations on path integrals\ ``` lp15@60809 ` 1662` lp15@61738 ` 1663` ```lemma contour_integral_const_linepath [simp]: "contour_integral (linepath a b) (\x. c) = c*(b - a)" ``` lp15@61738 ` 1664` ``` by (rule contour_integral_unique [OF has_contour_integral_const_linepath]) ``` lp15@61738 ` 1665` lp15@61738 ` 1666` ```lemma contour_integral_neg: ``` lp15@61738 ` 1667` ``` "f contour_integrable_on g \ contour_integral g (\x. -(f x)) = -(contour_integral g f)" ``` lp15@61738 ` 1668` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_neg) ``` lp15@61738 ` 1669` lp15@61738 ` 1670` ```lemma contour_integral_add: ``` lp15@61738 ` 1671` ``` "f1 contour_integrable_on g \ f2 contour_integrable_on g \ contour_integral g (\x. f1 x + f2 x) = ``` lp15@61738 ` 1672` ``` contour_integral g f1 + contour_integral g f2" ``` lp15@61738 ` 1673` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_add) ``` lp15@61738 ` 1674` lp15@61738 ` 1675` ```lemma contour_integral_diff: ``` lp15@61738 ` 1676` ``` "f1 contour_integrable_on g \ f2 contour_integrable_on g \ contour_integral g (\x. f1 x - f2 x) = ``` lp15@61738 ` 1677` ``` contour_integral g f1 - contour_integral g f2" ``` lp15@61738 ` 1678` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_diff) ``` lp15@61738 ` 1679` lp15@61738 ` 1680` ```lemma contour_integral_lmul: ``` lp15@61738 ` 1681` ``` shows "f contour_integrable_on g ``` lp15@61738 ` 1682` ``` \ contour_integral g (\x. c * f x) = c*contour_integral g f" ``` lp15@61738 ` 1683` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_lmul) ``` lp15@61738 ` 1684` lp15@61738 ` 1685` ```lemma contour_integral_rmul: ``` lp15@61738 ` 1686` ``` shows "f contour_integrable_on g ``` lp15@61738 ` 1687` ``` \ contour_integral g (\x. f x * c) = contour_integral g f * c" ``` lp15@61738 ` 1688` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_rmul) ``` lp15@61738 ` 1689` lp15@61738 ` 1690` ```lemma contour_integral_div: ``` lp15@61738 ` 1691` ``` shows "f contour_integrable_on g ``` lp15@61738 ` 1692` ``` \ contour_integral g (\x. f x / c) = contour_integral g f / c" ``` lp15@61738 ` 1693` ``` by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_div) ``` lp15@61738 ` 1694` lp15@61738 ` 1695` ```lemma contour_integral_eq: ``` lp15@61738 ` 1696` ``` "(\x. x \ path_image p \ f x = g x) \ contour_integral p f = contour_integral p g" ``` lp15@62463 ` 1697` ``` apply (simp add: contour_integral_def) ``` lp15@62463 ` 1698` ``` using has_contour_integral_eq ``` lp15@62463 ` 1699` ``` by (metis contour_integral_unique has_contour_integral_integrable has_contour_integral_integral) ``` lp15@61738 ` 1700` lp15@61738 ` 1701` ```lemma contour_integral_eq_0: ``` lp15@61738 ` 1702` ``` "(\z. z \ path_image g \ f z = 0) \ contour_integral g f = 0" ``` lp15@61738 ` 1703` ``` by (simp add: has_contour_integral_is_0 contour_integral_unique) ``` lp15@61738 ` 1704` lp15@61738 ` 1705` ```lemma contour_integral_bound_linepath: ``` lp15@60809 ` 1706` ``` shows ``` lp15@61738 ` 1707` ``` "\f contour_integrable_on (linepath a b); ``` lp15@60809 ` 1708` ``` 0 \ B; \x. x \ closed_segment a b \ norm(f x) \ B\ ``` lp15@61738 ` 1709` ``` \ norm(contour_integral (linepath a b) f) \ B*norm(b - a)" ``` lp15@61738 ` 1710` ``` apply (rule has_contour_integral_bound_linepath [of f]) ``` lp15@61738 ` 1711` ``` apply (auto simp: has_contour_integral_integral) ``` lp15@60809 ` 1712` ``` done ``` lp15@60809 ` 1713` lp15@61806 ` 1714` ```lemma contour_integral_0 [simp]: "contour_integral g (\x. 0) = 0" ``` lp15@61738 ` 1715` ``` by (simp add: contour_integral_unique has_contour_integral_0) ``` lp15@61738 ` 1716` nipkow@64267 ` 1717` ```lemma contour_integral_sum: ``` lp15@61738 ` 1718` ``` "\finite s; \a. a \ s \ (f a) contour_integrable_on p\ ``` nipkow@64267 ` 1719` ``` \ contour_integral p (\x. sum (\a. f a x) s) = sum (\a. contour_integral p (f a)) s" ``` nipkow@64267 ` 1720` ``` by (auto simp: contour_integral_unique has_contour_integral_sum has_contour_integral_integral) ``` lp15@61738 ` 1721` lp15@61738 ` 1722` ```lemma contour_integrable_eq: ``` lp15@61738 ` 1723` ``` "\f contour_integrable_on p; \x. x \ path_image p \ f x = g x\ \ g contour_integrable_on p" ``` lp15@61738 ` 1724` ``` unfolding contour_integrable_on_def ``` lp15@61738 ` 1725` ``` by (metis has_contour_integral_eq) ``` lp15@60809 ` 1726` lp15@60809 ` 1727` lp15@60809 ` 1728` ```subsection \Arithmetic theorems for path integrability\ ``` lp15@60809 ` 1729` lp15@61738 ` 1730` ```lemma contour_integrable_neg: ``` lp15@61738 ` 1731` ``` "f contour_integrable_on g \ (\x. -(f x)) contour_integrable_on g" ``` lp15@61738 ` 1732` ``` using has_contour_integral_neg contour_integrable_on_def by blast ``` lp15@61738 ` 1733` lp15@61738 ` 1734` ```lemma contour_integrable_add: ``` lp15@61738 ` 1735` ``` "\f1 contour_integrable_on g; f2 contour_integrable_on g\ \ (\x. f1 x + f2 x) contour_integrable_on g" ``` lp15@61738 ` 1736` ``` using has_contour_integral_add contour_integrable_on_def ``` lp15@60809 ` 1737` ``` by fastforce ``` lp15@60809 ` 1738` lp15@61738 ` 1739` ```lemma contour_integrable_diff: ``` lp15@61738 ` 1740` ``` "\f1 contour_integrable_on g; f2 contour_integrable_on g\ \ (\x. f1 x - f2 x) contour_integrable_on g" ``` lp15@61738 ` 1741` ``` using has_contour_integral_diff contour_integrable_on_def ``` lp15@60809 ` 1742` ``` by fastforce ``` lp15@60809 ` 1743` lp15@61738 ` 1744` ```lemma contour_integrable_lmul: ``` lp15@61738 ` 1745` ``` "f contour_integrable_on g \ (\x. c * f x) contour_integrable_on g" ``` lp15@61738 ` 1746` ``` using has_contour_integral_lmul contour_integrable_on_def ``` lp15@60809 ` 1747` ``` by fastforce ``` lp15@60809 ` 1748` lp15@61738 ` 1749` ```lemma contour_integrable_rmul: ``` lp15@61738 ` 1750` ``` "f contour_integrable_on g \ (\x. f x * c) contour_integrable_on g" ``` lp15@61738 ` 1751` ``` using has_contour_integral_rmul contour_integrable_on_def ``` lp15@60809 ` 1752` ``` by fastforce ``` lp15@60809 ` 1753` lp15@61738 ` 1754` ```lemma contour_integrable_div: ``` lp15@61738 ` 1755` ``` "f contour_integrable_on g \ (\x. f x / c) contour_integrable_on g" ``` lp15@61738 ` 1756` ``` using has_contour_integral_div contour_integrable_on_def ``` lp15@60809 ` 1757` ``` by fastforce ``` lp15@60809 ` 1758` nipkow@64267 ` 1759` ```lemma contour_integrable_sum: ``` lp15@61738 ` 1760` ``` "\finite s; \a. a \ s \ (f a) contour_integrable_on p\ ``` nipkow@64267 ` 1761` ``` \ (\x. sum (\a. f a x) s) contour_integrable_on p" ``` lp15@61738 ` 1762` ``` unfolding contour_integrable_on_def ``` nipkow@64267 ` 1763` ``` by (metis has_contour_integral_sum) ``` lp15@60809 ` 1764` lp15@60809 ` 1765` lp15@60809 ` 1766` ```subsection\Reversing a path integral\ ``` lp15@60809 ` 1767` lp15@61738 ` 1768` ```lemma has_contour_integral_reverse_linepath: ``` lp15@61738 ` 1769` ``` "(f has_contour_integral i) (linepath a b) ``` lp15@61738 ` 1770` ``` \ (f has_contour_integral (-i)) (linepath b a)" ``` lp15@61738 ` 1771` ``` using has_contour_integral_reversepath valid_path_linepath by fastforce ``` lp15@61738 ` 1772` lp15@61738 ` 1773` ```lemma contour_integral_reverse_linepath: ``` lp15@60809 ` 1774` ``` "continuous_on (closed_segment a b) f ``` lp15@61738 ` 1775` ``` \ contour_integral (linepath a b) f = - (contour_integral(linepath b a) f)" ``` lp15@61738 ` 1776` ```apply (rule contour_integral_unique) ``` lp15@61738 ` 1777` ```apply (rule has_contour_integral_reverse_linepath) ``` lp15@61738 ` 1778` ```by (simp add: closed_segment_commute contour_integrable_continuous_linepath has_contour_integral_integral) ``` lp15@60809 ` 1779` lp15@60809 ` 1780` lp15@60809 ` 1781` ```(* Splitting a path integral in a flat way.*) ``` lp15@60809 ` 1782` lp15@61738 ` 1783` ```lemma has_contour_integral_split: ``` lp15@61738 ` 1784` ``` assumes f: "(f has_contour_integral i) (linepath a c)" "(f has_contour_integral j) (linepath c b)" ``` lp15@60809 ` 1785` ``` and k: "0 \ k" "k \ 1" ``` lp15@60809 ` 1786` ``` and c: "c - a = k *\<^sub>R (b - a)" ``` lp15@61738 ` 1787` ``` shows "(f has_contour_integral (i + j)) (linepath a b)" ``` lp15@60809 ` 1788` ```proof (cases "k = 0 \ k = 1") ``` lp15@60809 ` 1789` ``` case True ``` lp15@60809 ` 1790` ``` then show ?thesis ``` lp15@68296 ` 1791` ``` using assms by auto ``` lp15@60809 ` 1792` ```next ``` lp15@60809 ` 1793` ``` case False ``` lp15@60809 ` 1794` ``` then have k: "0 < k" "k < 1" "complex_of_real k \ 1" ``` lp15@65578 ` 1795` ``` using assms by auto ``` lp15@60809 ` 1796` ``` have c': "c = k *\<^sub>R (b - a) + a" ``` lp15@60809 ` 1797` ``` by (metis diff_add_cancel c) ``` lp15@60809 ` 1798` ``` have bc: "(b - c) = (1 - k) *\<^sub>R (b - a)" ``` lp15@60809 ` 1799` ``` by (simp add: algebra_simps c') ``` lp15@60809 ` 1800` ``` { assume *: "((\x. f ((1 - x) *\<^sub>R a + x *\<^sub>R c) * (c - a)) has_integral i) {0..1}" ``` lp15@60809 ` 1801` ``` have **: "\x. ((k - x) / k) *\<^sub>R a + (x / k) *\<^sub>R c = (1 - x) *\<^sub>R a + x *\<^sub>R b" ``` lp15@68302 ` 1802` ``` using False apply (simp add: c' algebra_simps) ``` lp15@60809 ` 1803` ``` apply (simp add: real_vector.scale_left_distrib [symmetric] divide_simps) ``` lp15@60809 ` 1804` ``` done ``` lp15@60809 ` 1805` ``` have "((\x. f ((1 - x) *\<^sub>R a + x *\<^sub>R b) * (b - a)) has_integral i) {0..k}" ``` lp15@68296 ` 1806` ``` using k has_integral_affinity01 [OF *, of "inverse k" "0"] ``` lp15@68296 ` 1807` ``` apply (simp add: divide_simps mult.commute [of _ "k"] image_affinity_atLeastAtMost ** c) ``` lp15@68296 ` 1808` ``` apply (auto dest: has_integral_cmul [where c = "inverse k"]) ``` lp15@60809 ` 1809` ``` done ``` lp15@60809 ` 1810` ``` } note fi = this ``` lp15@60809 ` 1811` ``` { assume *: "((\x. f ((1 - x) *\<^sub>R c + x *\<^sub>R b) * (b - c)) has_integral j) {0..1}" ``` lp15@60809 ` 1812` ``` have **: "\x. (((1 - x) / (1 - k)) *\<^sub>R c + ((x - k) / (1 - k)) *\<^sub>R b) = ((1 - x) *\<^sub>R a + x *\<^sub>R b)" ``` lp15@60809 ` 1813` ``` using k ``` lp15@60809 ` 1814` ``` apply (simp add: c' field_simps) ``` lp15@60809 ` 1815` ``` apply (simp add: scaleR_conv_of_real divide_simps) ``` lp15@60809 ` 1816` ``` apply (simp add: field_simps) ``` lp15@60809 ` 1817` ``` done ``` lp15@60809 ` 1818` ``` have "((\x. f ((1 - x) *\<^sub>R a + x *\<^sub>R b) * (b - a)) has_integral j) {k..1}" ``` lp15@68296 ` 1819` ``` using k has_integral_affinity01 [OF *, of "inverse(1 - k)" "-(k/(1 - k))"] ``` lp15@68296 ` 1820` ``` apply (simp add: divide_simps mult.commute [of _ "1-k"] image_affinity_atLeastAtMost ** bc) ``` lp15@68296 ` 1821` ``` apply (auto dest: has_integral_cmul [where k = "(1 - k) *\<^sub>R j" and c = "inverse (1 - k)"]) ``` lp15@60809 ` 1822` ``` done ``` lp15@60809 ` 1823` ``` } note fj = this ``` lp15@60809 ` 1824` ``` show ?thesis ``` lp15@60809 ` 1825` ``` using f k ``` lp15@61738 ` 1826` ``` apply (simp add: has_contour_integral_linepath) ``` lp15@60809 ` 1827` ``` apply (simp add: linepath_def) ``` lp15@60809 ` 1828` ``` apply (rule has_integral_combine [OF _ _ fi fj], simp_all) ``` lp15@60809 ` 1829` ``` done ``` lp15@60809 ` 1830` ```qed ``` lp15@60809 ` 1831` lp15@60809 ` 1832` ```lemma continuous_on_closed_segment_transform: ``` lp15@60809 ` 1833` ``` assumes f: "continuous_on (closed_segment a b) f" ``` lp15@60809 ` 1834` ``` and k: "0 \ k" "k \ 1" ``` lp15@60809 ` 1835` ``` and c: "c - a = k *\<^sub>R (b - a)" ``` lp15@60809 ` 1836` ``` shows "continuous_on (closed_segment a c) f" ``` lp15@60809 ` 1837` ```proof - ``` lp15@60809 ` 1838` ``` have c': "c = (1 - k) *\<^sub>R a + k *\<^sub>R b" ``` lp15@60809 ` 1839` ``` using c by (simp add: algebra_simps) ``` lp15@68302 ` 1840` ``` have "closed_segment a c \ closed_segment a b" ``` lp15@68302 ` 1841` ``` by (metis c' ends_in_segment(1) in_segment(1) k subset_closed_segment) ``` lp15@68302 ` 1842` ``` then show "continuous_on (closed_segment a c) f" ``` lp15@68302 ` 1843` ``` by (rule continuous_on_subset [OF f]) ``` lp15@60809 ` 1844` ```qed ``` lp15@60809 ` 1845` lp15@61738 ` 1846` ```lemma contour_integral_split: ``` lp15@60809 ` 1847` ``` assumes f: "continuous_on (closed_segment a b) f" ``` lp15@60809 ` 1848` ``` and k: "0 \ k" "k \ 1" ``` lp15@60809 ` 1849` ``` and c: "c - a = k *\<^sub>R (b - a)" ``` lp15@61738 ` 1850` ``` shows "contour_integral(linepath a b) f = contour_integral(linepath a c) f + contour_integral(linepath c b) f" ``` lp15@60809 ` 1851` ```proof - ``` lp15@60809 ` 1852` ``` have c': "c = (1 - k) *\<^sub>R a + k *\<^sub>R b" ``` lp15@60809 ` 1853` ``` using c by (simp add: algebra_simps) ``` lp15@68302 ` 1854` ``` have "closed_segment a c \ closed_segment a b" ``` lp15@68302 ` 1855` ``` by (metis c' ends_in_segment(1) in_segment(1) k subset_closed_segment) ``` lp15@68302 ` 1856` ``` moreover have "closed_segment c b \ closed_segment a b" ``` lp15@68302 ` 1857` ``` by (metis c' ends_in_segment(2) in_segment(1) k subset_closed_segment) ``` lp15@68302 ` 1858` ``` ultimately ``` lp15@60809 ` 1859` ``` have *: "continuous_on (closed_segment a c) f" "continuous_on (closed_segment c b) f" ``` lp15@68302 ` 1860` ``` by (auto intro: continuous_on_subset [OF f]) ``` lp15@60809 ` 1861` ``` show ?thesis ``` lp15@68302 ` 1862` ``` by (rule contour_integral_unique) (meson "*" c contour_integrable_continuous_linepath has_contour_integral_integral has_contour_integral_split k) ``` lp15@60809 ` 1863` ```qed ``` lp15@60809 ` 1864` lp15@61738 ` 1865` ```lemma contour_integral_split_linepath: ``` lp15@60809 ` 1866` ``` assumes f: "continuous_on (closed_segment a b) f" ``` lp15@60809 ` 1867` ``` and c: "c \ closed_segment a b" ``` lp15@61738 ` 1868` ``` shows "contour_integral(linepath a b) f = contour_integral(linepath a c) f + contour_integral(linepath c b) f" ``` lp15@68302 ` 1869` ``` using c by (auto simp: closed_segment_def algebra_simps intro!: contour_integral_split [OF f]) ``` lp15@60809 ` 1870` lp15@68296 ` 1871` ```text\The special case of midpoints used in the main quadrisection\ ``` lp15@60809 ` 1872` lp15@61738 ` 1873` ```lemma has_contour_integral_midpoint: ``` lp15@61738 ` 1874` ``` assumes "(f has_contour_integral i) (linepath a (midpoint a b))" ``` lp15@61738 ` 1875` ``` "(f has_contour_integral j) (linepath (midpoint a b) b)" ``` lp15@61738 ` 1876` ``` shows "(f has_contour_integral (i + j)) (linepath a b)" ``` lp15@61738 ` 1877` ``` apply (rule has_contour_integral_split [where c = "midpoint a b" and k = "1/2"]) ``` lp15@60809 ` 1878` ``` using assms ``` lp15@60809 ` 1879` ``` apply (auto simp: midpoint_def algebra_simps scaleR_conv_of_real) ``` lp15@60809 ` 1880` ``` done ``` lp15@60809 ` 1881` lp15@61738 ` 1882` ```lemma contour_integral_midpoint: ``` lp15@60809 ` 1883` ``` "continuous_on (closed_segment a b) f ``` lp15@61738 ` 1884` ``` \ contour_integral (linepath a b) f = ``` lp15@61738 ` 1885` ``` contour_integral (linepath a (midpoint a b)) f + contour_integral (linepath (midpoint a b) b) f" ``` lp15@61738 ` 1886` ``` apply (rule contour_integral_split [where c = "midpoint a b" and k = "1/2"]) ``` lp15@60809 ` 1887` ``` apply (auto simp: midpoint_def algebra_simps scaleR_conv_of_real) ``` lp15@60809 ` 1888` ``` done ``` lp15@60809 ` 1889` lp15@60809 ` 1890` lp15@60809 ` 1891` ```text\A couple of special case lemmas that are useful below\ ``` lp15@60809 ` 1892` lp15@60809 ` 1893` ```lemma triangle_linear_has_chain_integral: ``` lp15@61738 ` 1894` ``` "((\x. m*x + d) has_contour_integral 0) (linepath a b +++ linepath b c +++ linepath c a)" ``` lp15@60809 ` 1895` ``` apply (rule Cauchy_theorem_primitive [of UNIV "\x. m/2 * x^2 + d*x"]) ``` lp15@60809 ` 1896` ``` apply (auto intro!: derivative_eq_intros) ``` lp15@60809 ` 1897` ``` done ``` lp15@60809 ` 1898` lp15@60809 ` 1899` ```lemma has_chain_integral_chain_integral3: ``` lp15@61738 ` 1900` ``` "(f has_contour_integral i) (linepath a b +++ linepath b c +++ linepath c d) ``` lp15@61738 ` 1901` ``` \ contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i" ``` lp15@61738 ` 1902` ``` apply (subst contour_integral_unique [symmetric], assumption) ``` lp15@61738 ` 1903` ``` apply (drule has_contour_integral_integrable) ``` lp15@60809 ` 1904` ``` apply (simp add: valid_path_join) ``` lp15@60809 ` 1905` ``` done ``` lp15@60809 ` 1906` lp15@62397 ` 1907` ```lemma has_chain_integral_chain_integral4: ``` lp15@62397 ` 1908` ``` "(f has_contour_integral i) (linepath a b +++ linepath b c +++ linepath c d +++ linepath d e) ``` lp15@62397 ` 1909` ``` \ contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f + contour_integral (linepath d e) f = i" ``` lp15@62397 ` 1910` ``` apply (subst contour_integral_unique [symmetric], assumption) ``` lp15@62397 ` 1911` ``` apply (drule has_contour_integral_integrable) ``` lp15@62397 ` 1912` ``` apply (simp add: valid_path_join) ``` lp15@62397 ` 1913` ``` done ``` lp15@62397 ` 1914` lp15@60809 ` 1915` ```subsection\Reversing the order in a double path integral\ ``` lp15@60809 ` 1916` lp15@60809 ` 1917` ```text\The condition is stronger than needed but it's often true in typical situations\ ``` lp15@60809 ` 1918` lp15@60809 ` 1919` ```lemma fst_im_cbox [simp]: "cbox c d \ {} \ (fst ` cbox (a,c) (b,d)) = cbox a b" ``` lp15@60809 ` 1920` ``` by (auto simp: cbox_Pair_eq) ``` lp15@60809 ` 1921` lp15@60809 ` 1922` ```lemma snd_im_cbox [simp]: "cbox a b \ {} \ (snd ` cbox (a,c) (b,d)) = cbox c d" ``` lp15@60809 ` 1923` ``` by (auto simp: cbox_Pair_eq) ``` lp15@60809 ` 1924` lp15@61738 ` 1925` ```lemma contour_integral_swap: ``` lp15@60809 ` 1926` ``` assumes fcon: "continuous_on (path_image g \ path_image h) (\(y1,y2). f y1 y2)" ``` lp15@60809 ` 1927` ``` and vp: "valid_path g" "valid_path h" ``` lp15@60809 ` 1928` ``` and gvcon: "continuous_on {0..1} (\t. vector_derivative g (at t))" ``` lp15@60809 ` 1929` ``` and hvcon: "continuous_on {0..1} (\t. vector_derivative h (at t))" ``` lp15@61738 ` 1930` ``` shows "contour_integral g (\w. contour_integral h (f w)) = ``` lp15@61738 ` 1931` ``` contour_integral h (\z. contour_integral g (\w. f w z))" ``` lp15@60809 ` 1932` ```proof - ``` lp15@60809 ` 1933` ``` have gcon: "continuous_on {0..1} g" and hcon: "continuous_on {0..1} h" ``` lp15@61190 ` 1934` ``` using assms by (auto simp: valid_path_def piecewise_C1_differentiable_on_def) ``` lp15@68339 ` 1935` ``` have fgh1: "\x. (\t. f (g x) (h t)) = (\(y1,y2). f y1 y2) \ (\t. (g x, h t))" ``` lp15@60809 ` 1936` ``` by (rule ext) simp ``` lp15@68339 ` 1937` ``` have fgh2: "\x. (\t. f (g t) (h x)) = (\(y1,y2). f y1 y2) \ (\t. (g t, h x))" ``` lp15@60809 ` 1938` ``` by (rule ext) simp ``` lp15@60809 ` 1939` ``` have fcon_im1: "\x. 0 \ x \ x \ 1 \ continuous_on ((\t. (g x, h t)) ` {0..1}) (\(x, y). f x y)" ``` lp15@60809 ` 1940` ``` by (rule continuous_on_subset [OF fcon]) (auto simp: path_image_def) ``` lp15@60809 ` 1941` ``` have fcon_im2: "\x. 0 \ x \ x \ 1 \ continuous_on ((\t. (g t, h x)) ` {0..1}) (\(x, y). f x y)" ``` lp15@60809 ` 1942` ``` by (rule continuous_on_subset [OF fcon]) (auto simp: path_image_def) ``` lp15@68302 ` 1943` ``` have "\y. y \ {0..1} \ continuous_on {0..1} (\x. f (g x) (h y))" ``` lp15@68302 ` 1944` ``` by (subst fgh2) (rule fcon_im2 gcon continuous_intros | simp)+ ``` lp15@68302 ` 1945` ``` then have vdg: "\y. y \ {0..1} \ (\x. f (g x) (h y) * vector_derivative g (at x)) integrable_on {0..1}" ``` lp15@68302 ` 1946` ``` using continuous_on_mult gvcon integrable_continuous_real by blast ``` lp15@68339 ` 1947` ``` have "(\z. vector_derivative g (at (fst z))) = (\x. vector_derivative g (at x)) \ fst" ``` lp15@60809 ` 1948` ``` by auto ``` lp15@60809 ` 1949` ``` then have gvcon': "continuous_on (cbox (0, 0) (1, 1::real)) (\x. vector_derivative g (at (fst x)))" ``` lp15@60809 ` 1950` ``` apply (rule ssubst) ``` lp15@60809 ` 1951` ``` apply (rule continuous_intros | simp add: gvcon)+ ``` lp15@60809 ` 1952` ``` done ``` lp15@68339 ` 1953` ``` have "(\z. vector_derivative h (at (snd z))) = (\x. vector_derivative h (at x)) \ snd" ``` lp15@60809 ` 1954` ``` by auto ``` lp15@60809 ` 1955` ``` then have hvcon': "continuous_on (cbox (0, 0) (1::real, 1)) (\x. vector_derivative h (at (snd x)))" ``` lp15@60809 ` 1956` ``` apply (rule ssubst) ``` lp15@60809 ` 1957` ``` apply (rule continuous_intros | simp add: hvcon)+ ``` lp15@60809 ` 1958` ``` done ``` lp15@68339 ` 1959` ``` have "(\x. f (g (fst x)) (h (snd x))) = (\(y1,y2). f y1 y2) \ (\w. ((g \ fst) w, (h \ snd) w))" ``` lp15@60809 ` 1960` ``` by auto ``` lp15@60809 ` 1961` ``` then have fgh: "continuous_on (cbox (0, 0) (1, 1)) (\x. f (g (fst x)) (h (snd x)))" ``` lp15@60809 ` 1962` ``` apply (rule ssubst) ``` lp15@60809 ` 1963` ``` apply (rule gcon hcon continuous_intros | simp)+ ``` lp15@60809 ` 1964` ``` apply (auto simp: path_image_def intro: continuous_on_subset [OF fcon]) ``` lp15@60809 ` 1965` ``` done ``` lp15@61738 ` 1966` ``` have "integral {0..1} (\x. contour_integral h (f (g x)) * vector_derivative g (at x)) = ``` lp15@61738 ` 1967` ``` integral {0..1} (\x. contour_integral h (\y. f (g x) y * vector_derivative g (at x)))" ``` lp15@68302 ` 1968` ``` proof (rule integral_cong [OF contour_integral_rmul [symmetric]]) ``` lp15@68302 ` 1969` ``` show "\x. x \ {0..1} \ f (g x) contour_integrable_on h" ``` lp15@68302 ` 1970` ``` unfolding contour_integrable_on ``` lp15@60809 ` 1971` ``` apply (rule integrable_continuous_real) ``` lp15@60809 ` 1972` ``` apply (rule continuous_on_mult [OF _ hvcon]) ``` lp15@60809 ` 1973` ``` apply (subst fgh1) ``` lp15@60809 ` 1974` ``` apply (rule fcon_im1 hcon continuous_intros | simp)+ ``` lp15@68302 ` 1975` ``` done ``` lp15@68302 ` 1976` ``` qed ``` lp15@68339 ` 1977` ``` also have "\ = integral {0..1} ``` lp15@61738 ` 1978` ``` (\y. contour_integral g (\x. f x (h y) * vector_derivative h (at y)))" ``` lp15@68302 ` 1979` ``` unfolding contour_integral_integral ``` lp15@60809 ` 1980` ``` apply (subst integral_swap_continuous [where 'a = real and 'b = real, of 0 0 1 1, simplified]) ``` lp15@62463 ` 1981` ``` apply (rule fgh gvcon' hvcon' continuous_intros | simp add: split_def)+ ``` lp15@62463 ` 1982` ``` unfolding integral_mult_left [symmetric] ``` lp15@62463 ` 1983` ``` apply (simp only: mult_ac) ``` lp15@60809 ` 1984` ``` done ``` lp15@68339 ` 1985` ``` also have "\ = contour_integral h (\z. contour_integral g (\w. f w z))" ``` lp15@68302 ` 1986` ``` unfolding contour_integral_integral ``` lp15@60809 ` 1987` ``` apply (rule integral_cong) ``` lp15@62463 ` 1988` ``` unfolding integral_mult_left [symmetric] ``` lp15@60809 ` 1989` ``` apply (simp add: algebra_simps) ``` lp15@60809 ` 1990` ``` done ``` lp15@60809 ` 1991` ``` finally show ?thesis ``` lp15@61738 ` 1992` ``` by (simp add: contour_integral_integral) ``` lp15@60809 ` 1993` ```qed ``` lp15@60809 ` 1994` lp15@60809 ` 1995` lp15@60809 ` 1996` ```subsection\The key quadrisection step\ ``` lp15@60809 ` 1997` lp15@60809 ` 1998` ```lemma norm_sum_half: ``` lp15@68302 ` 1999` ``` assumes "norm(a + b) \ e" ``` lp15@68302 ` 2000` ``` shows "norm a \ e/2 \ norm b \ e/2" ``` lp15@60809 ` 2001` ```proof - ``` lp15@60809 ` 2002` ``` have "e \ norm (- a - b)" ``` lp15@60809 ` 2003` ``` by (simp add: add.commute assms norm_minus_commute) ``` lp15@60809 ` 2004` ``` thus ?thesis ``` lp15@60809 ` 2005` ``` using norm_triangle_ineq4 order_trans by fastforce ``` lp15@60809 ` 2006` ```qed ``` lp15@60809 ` 2007` lp15@60809 ` 2008` ```lemma norm_sum_lemma: ``` lp15@60809 ` 2009` ``` assumes "e \ norm (a + b + c + d)" ``` lp15@60809 ` 2010` ``` shows "e / 4 \ norm a \ e / 4 \ norm b \ e / 4 \ norm c \ e / 4 \ norm d" ``` lp15@60809 ` 2011` ```proof - ``` lp15@60809 ` 2012` ``` have "e \ norm ((a + b) + (c + d))" using assms ``` lp15@60809 ` 2013` ``` by (simp add: algebra_simps) ``` lp15@60809 ` 2014` ``` then show ?thesis ``` lp15@60809 ` 2015` ``` by (auto dest!: norm_sum_half) ``` lp15@60809 ` 2016` ```qed ``` lp15@60809 ` 2017` lp15@60809 ` 2018` ```lemma Cauchy_theorem_quadrisection: ``` lp15@60809 ` 2019` ``` assumes f: "continuous_on (convex hull {a,b,c}) f" ``` lp15@60809 ` 2020` ``` and dist: "dist a b \ K" "dist b c \ K" "dist c a \ K" ``` lp15@60809 ` 2021` ``` and e: "e * K^2 \ ``` lp15@61738 ` 2022` ``` norm (contour_integral(linepath a b) f + contour_integral(linepath b c) f + contour_integral(linepath c a) f)" ``` lp15@60809 ` 2023` ``` shows "\a' b' c'. ``` lp15@60809 ` 2024` ``` a' \ convex hull {a,b,c} \ b' \ convex hull {a,b,c} \ c' \ convex hull {a,b,c} \ ``` lp15@60809 ` 2025` ``` dist a' b' \ K/2 \ dist b' c' \ K/2 \ dist c' a' \ K/2 \ ``` lp15@61738 ` 2026` ``` e * (K/2)^2 \ norm(contour_integral(linepath a' b') f + contour_integral(linepath b' c') f + contour_integral(linepath c' a') f)" ``` lp15@68302 ` 2027` ``` (is "\x y z. ?\ x y z") ``` lp15@60809 ` 2028` ```proof - ``` lp15@60809 ` 2029` ``` note divide_le_eq_numeral1 [simp del] ``` wenzelm@63040 ` 2030` ``` define a' where "a' = midpoint b c" ``` wenzelm@63040 ` 2031` ``` define b' where "b' = midpoint c a" ``` wenzelm@63040 ` 2032` ``` define c' where "c' = midpoint a b" ``` lp15@60809 ` 2033` ``` have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f" ``` lp15@60809 ` 2034` ``` using f continuous_on_subset segments_subset_convex_hull by metis+ ``` lp15@60809 ` 2035` ``` have fcont': "continuous_on (closed_segment c' b') f" ``` lp15@60809 ` 2036` ``` "continuous_on (closed_segment a' c') f" ``` lp15@60809 ` 2037` ``` "continuous_on (closed_segment b' a') f" ``` lp15@60809 ` 2038` ``` unfolding a'_def b'_def c'_def ``` lp15@68302 ` 2039` ``` by (rule continuous_on_subset [OF f], ``` lp15@60809 ` 2040` ``` metis midpoints_in_convex_hull convex_hull_subset hull_subset insert_subset segment_convex_hull)+ ``` lp15@61738 ` 2041` ``` let ?pathint = "\x y. contour_integral(linepath x y) f" ``` lp15@60809 ` 2042` ``` have *: "?pathint a b + ?pathint b c + ?pathint c a = ``` lp15@60809 ` 2043` ``` (?pathint a c' + ?pathint c' b' + ?pathint b' a) + ``` lp15@60809 ` 2044` ``` (?pathint a' c' + ?pathint c' b + ?pathint b a') + ``` lp15@60809 ` 2045` ``` (?pathint a' c + ?pathint c b' + ?pathint b' a') + ``` lp15@60809 ` 2046` ``` (?pathint a' b' + ?pathint b' c' + ?pathint c' a')" ``` lp15@68302 ` 2047` ``` by (simp add: fcont' contour_integral_reverse_linepath) (simp add: a'_def b'_def c'_def contour_integral_midpoint fabc) ``` lp15@60809 ` 2048` ``` have [simp]: "\x y. cmod (x * 2 - y * 2) = cmod (x - y) * 2" ``` lp15@60809 ` 2049` ``` by (metis left_diff_distrib mult.commute norm_mult_numeral1) ``` lp15@60809 ` 2050` ``` have [simp]: "\x y. cmod (x - y) = cmod (y - x)" ``` lp15@60809 ` 2051` ``` by (simp add: norm_minus_commute) ``` lp15@60809 ` 2052` ``` consider "e * K\<^sup>2 / 4 \ cmod (?pathint a c' + ?pathint c' b' + ?pathint b' a)" | ``` lp15@60809 ` 2053` ``` "e * K\<^sup>2 / 4 \ cmod (?pathint a' c' + ?pathint c' b + ?pathint b a')" | ``` lp15@60809 ` 2054` ``` "e * K\<^sup>2 / 4 \ cmod (?pathint a' c + ?pathint c b' + ?pathint b' a')" | ``` lp15@60809 ` 2055` ``` "e * K\<^sup>2 / 4 \ cmod (?pathint a' b' + ?pathint b' c' + ?pathint c' a')" ``` lp15@68302 ` 2056` ``` using assms unfolding * by (blast intro: that dest!: norm_sum_lemma) ``` lp15@60809 ` 2057` ``` then show ?thesis ``` lp15@60809 ` 2058` ``` proof cases ``` lp15@68302 ` 2059` ``` case 1 then have "?\ a c' b'" ``` lp15@60809 ` 2060` ``` using assms ``` lp15@68302 ` 2061` ``` apply (clarsimp simp: c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD]) ``` lp15@68302 ` 2062` ``` apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps) ``` lp15@68302 ` 2063` ``` done ``` lp15@68302 ` 2064` ``` then show ?thesis by blast ``` lp15@68302 ` 2065` ``` next ``` lp15@68302 ` 2066` ``` case 2 then have "?\ a' c' b" ``` lp15@68302 ` 2067` ``` using assms ``` lp15@68302 ` 2068` ``` apply (clarsimp simp: a'_def c'_def midpoints_in_convex_hull hull_subset [THEN subsetD]) ``` lp15@60809 ` 2069` ``` apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps) ``` lp15@60809 ` 2070` ``` done ``` lp15@68302 ` 2071` ``` then show ?thesis by blast ``` lp15@60809 ` 2072` ``` next ``` lp15@68302 ` 2073` ``` case 3 then have "?\ a' c b'" ``` lp15@60809 ` 2074` ``` using assms ``` lp15@68302 ` 2075` ``` apply (clarsimp simp: a'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD]) ``` lp15@60809 ` 2076` ``` apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps) ``` lp15@60809 ` 2077` ``` done ``` lp15@68302 ` 2078` ``` then show ?thesis by blast ``` lp15@60809 ` 2079` ``` next ``` lp15@68302 ` 2080` ``` case 4 then have "?\ a' b' c'" ``` lp15@60809 ` 2081` ``` using assms ``` lp15@68302 ` 2082` ``` apply (clarsimp simp: a'_def c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD]) ``` lp15@60809 ` 2083` ``` apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps) ``` lp15@60809 ` 2084` ``` done ``` lp15@68302 ` 2085` ``` then show ?thesis by blast ``` lp15@60809 ` 2086` ``` qed ``` lp15@60809 ` 2087` ```qed ``` lp15@60809 ` 2088` lp15@60809 ` 2089` ```subsection\Cauchy's theorem for triangles\ ``` lp15@60809 ` 2090` lp15@60809 ` 2091` ```lemma triangle_points_closer: ``` lp15@60809 ` 2092` ``` fixes a::complex ``` lp15@60809 ` 2093` ``` shows "\x \ convex hull {a,b,c}; y \ convex hull {a,b,c}\ ``` lp15@60809 ` 2094` ``` \ norm(x - y) \ norm(a - b) \ ``` lp15@60809 ` 2095` ``` norm(x - y) \ norm(b - c) \ ``` lp15@60809 ` 2096` ``` norm(x - y) \ norm(c - a)" ``` lp15@60809 ` 2097` ``` using simplex_extremal_le [of "{a,b,c}"] ``` lp15@60809 ` 2098` ``` by (auto simp: norm_minus_commute) ``` lp15@60809 ` 2099` lp15@60809 ` 2100` ```lemma holomorphic_point_small_triangle: ``` lp15@68302 ` 2101` ``` assumes x: "x \ S" ``` lp15@68302 ` 2102` ``` and f: "continuous_on S f" ``` lp15@68302 ` 2103` ``` and cd: "f field_differentiable (at x within S)" ``` lp15@60809 ` 2104` ``` and e: "0 < e" ``` lp15@60809 ` 2105` ``` shows "\k>0. \a b c. dist a b \ k \ dist b c \ k \ dist c a \ k \ ``` lp15@68302 ` 2106` ``` x \ convex hull {a,b,c} \ convex hull {a,b,c} \ S ``` lp15@61738 ` 2107` ``` \ norm(contour_integral(linepath a b) f + contour_integral(linepath b c) f + ``` lp15@61738 ` 2108` ``` contour_integral(linepath c a) f) ``` lp15@60809 ` 2109` ``` \ e*(dist a b + dist b c + dist c a)^2" ``` lp15@60809 ` 2110` ``` (is "\k>0. \a b c. _ \ ?normle a b c") ``` lp15@60809 ` 2111` ```proof - ``` lp15@60809 ` 2112` ``` have le_of_3: "\a x y z. \0 \ x*y; 0 \ x*z; 0 \ y*z; a \ (e*(x + y + z))*x + (e*(x + y + z))*y + (e*(x + y + z))*z\ ``` lp15@60809 ` 2113` ``` \ a \ e*(x + y + z)^2" ``` lp15@60809 ` 2114` ``` by (simp add: algebra_simps power2_eq_square) ``` lp15@60809 ` 2115` ``` have disj_le: "\x \ a \ x \ b \ x \ c; 0 \ a; 0 \ b; 0 \ c\ \ x \ a + b + c" ``` lp15@60809 ` 2116` ``` for x::real and a b c ``` lp15@60809 ` 2117` ``` by linarith ``` lp15@61738 ` 2118` ``` have fabc: "f contour_integrable_on linepath a b" "f contour_integrable_on linepath b c" "f contour_integrable_on linepath c a" ``` lp15@68302 ` 2119` ``` if "convex hull {a, b, c} \ S" for a b c ``` lp15@60809 ` 2120` ``` using segments_subset_convex_hull that ``` lp15@61738 ` 2121` ``` by (metis continuous_on_subset f contour_integrable_continuous_linepath)+ ``` lp15@61738 ` 2122` ``` note path_bound = has_contour_integral_bound_linepath [simplified norm_minus_commute, OF has_contour_integral_integral] ``` lp15@60809 ` 2123` ``` { fix f' a b c d ``` lp15@60809 ` 2124` ``` assume d: "0 < d" ``` lp15@68302 ` 2125` ``` and f': "\y. \cmod (y - x) \ d; y \ S\ \ cmod (f y - f x - f' * (y - x)) \ e * cmod (y - x)" ``` lp15@60809 ` 2126` ``` and le: "cmod (a - b) \ d" "cmod (b - c) \ d" "cmod (c - a) \ d" ``` lp15@60809 ` 2127` ``` and xc: "x \ convex hull {a, b, c}" ``` lp15@68302 ` 2128` ``` and S: "convex hull {a, b, c} \ S" ``` lp15@61738 ` 2129` ``` have pa: "contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = ``` lp15@61738 ` 2130` ``` contour_integral (linepath a b) (\y. f y - f x - f'*(y - x)) + ``` lp15@61738 ` 2131` ``` contour_integral (linepath b c) (\y. f y - f x - f'*(y - x)) + ``` lp15@61738 ` 2132` ``` contour_integral (linepath c a) (\y. f y - f x - f'*(y - x))" ``` lp15@68302 ` 2133` ``` apply (simp add: contour_integral_diff contour_integral_lmul contour_integrable_lmul contour_integrable_diff fabc [OF S]) ``` lp15@60809 ` 2134` ``` apply (simp add: field_simps) ``` lp15@60809 ` 2135` ``` done ``` lp15@60809 ` 2136` ``` { fix y ``` lp15@60809 ` 2137` ``` assume yc: "y \ convex hull {a,b,c}" ``` lp15@60809 ` 2138` ``` have "cmod (f y - f x - f' * (y - x)) \ e*norm(y - x)" ``` lp15@68302 ` 2139` ``` proof (rule f') ``` lp15@68302 ` 2140` ``` show "cmod (y - x) \ d" ``` lp15@68302 ` 2141` ``` by (metis triangle_points_closer [OF xc yc] le norm_minus_commute order_trans) ``` lp15@68302 ` 2142` ``` qed (use S yc in blast) ``` lp15@68339 ` 2143` ``` also have "\ \ e * (cmod (a - b) + cmod (b - c) + cmod (c - a))" ``` lp15@60809 ` 2144` ``` by (simp add: yc e xc disj_le [OF triangle_points_closer]) ``` lp15@60809 ` 2145` ``` finally have "cmod (f y - f x - f' * (y - x)) \ e * (cmod (a - b) + cmod (b - c) + cmod (c - a))" . ``` lp15@60809 ` 2146` ``` } note cm_le = this ``` lp15@60809 ` 2147` ``` have "?normle a b c" ``` lp15@68302 ` 2148` ``` unfolding dist_norm pa ``` lp15@60809 ` 2149` ``` apply (rule le_of_3) ``` lp15@68302 ` 2150` ``` using f' xc S e ``` lp15@60809 ` 2151` ``` apply simp_all ``` lp15@60809 ` 2152` ``` apply (intro norm_triangle_le add_mono path_bound) ``` lp15@61738 ` 2153` ``` apply (simp_all add: contour_integral_diff contour_integral_lmul contour_integrable_lmul contour_integrable_diff fabc) ``` lp15@60809 ` 2154` ``` apply (blast intro: cm_le elim: dest: segments_subset_convex_hull [THEN subsetD])+ ``` lp15@60809 ` 2155` ``` done ``` lp15@60809 ` 2156` ``` } note * = this ``` lp15@60809 ` 2157` ``` show ?thesis ``` lp15@68302 ` 2158` ``` using cd e ``` lp15@62534 ` 2159` ``` apply (simp add: field_differentiable_def has_field_derivative_def has_derivative_within_alt approachable_lt_le2 Ball_def) ``` lp15@60809 ` 2160` ``` apply (clarify dest!: spec mp) ``` lp15@68302 ` 2161` ``` using * unfolding dist_norm ``` lp15@68339 ` 2162` ``` apply blast ``` lp15@60809 ` 2163` ``` done ``` lp15@60809 ` 2164` ```qed ``` lp15@60809 ` 2165` lp15@60809 ` 2166` lp15@68310 ` 2167` ```text\Hence the most basic theorem for a triangle.\ ``` lp15@68310 ` 2168` lp15@60809 ` 2169` ```locale Chain = ``` lp15@60809 ` 2170` ``` fixes x0 At Follows ``` lp15@60809 ` 2171` ``` assumes At0: "At x0 0" ``` lp15@60809 ` 2172` ``` and AtSuc: "\x n. At x n \ \x'. At x' (Suc n) \ Follows x' x" ``` lp15@60809 ` 2173` ```begin ``` lp15@60809 ` 2174` ``` primrec f where ``` lp15@60809 ` 2175` ``` "f 0 = x0" ``` lp15@60809 ` 2176` ``` | "f (Suc n) = (SOME x. At x (Suc n) \ Follows x (f n))" ``` lp15@60809 ` 2177` lp15@60809 ` 2178` ``` lemma At: "At (f n) n" ``` lp15@60809 ` 2179` ``` proof (induct n) ``` lp15@60809 ` 2180` ``` case 0 show ?case ``` lp15@60809 ` 2181` ``` by (simp add: At0) ``` lp15@60809 ` 2182` ``` next ``` lp15@60809 ` 2183` ``` case (Suc n) show ?case ``` lp15@60809 ` 2184` ``` by (metis (no_types, lifting) AtSuc [OF Suc] f.simps(2) someI_ex) ``` lp15@60809 ` 2185` ``` qed ``` lp15@60809 ` 2186` lp15@60809 ` 2187` ``` lemma Follows: "Follows (f(Suc n)) (f n)" ``` lp15@60809 ` 2188` ``` by (metis (no_types, lifting) AtSuc [OF At [of n]] f.simps(2) someI_ex) ``` lp15@60809 ` 2189` lp15@60809 ` 2190` ``` declare f.simps(2) [simp del] ``` lp15@60809 ` 2191` ```end ``` lp15@60809 ` 2192` lp15@60809 ` 2193` ```lemma Chain3: ``` lp15@60809 ` 2194` ``` assumes At0: "At x0 y0 z0 0" ``` lp15@60809 ` 2195` ``` and AtSuc: "\x y z n. At x y z n \ \x' y' z'. At x' y' z' (Suc n) \ Follows x' y' z' x y z" ``` lp15@60809 ` 2196` ``` obtains f g h where ``` lp15@60809 ` 2197` ``` "f 0 = x0" "g 0 = y0" "h 0 = z0" ``` lp15@60809 ` 2198` ``` "\n. At (f n) (g n) (h n) n" ``` lp15@60809 ` 2199` ``` "\n. Follows (f(Suc n)) (g(Suc n)) (h(Suc n)) (f n) (g n) (h n)" ``` lp15@60809 ` 2200` ```proof - ``` lp15@60809 ` 2201` ``` interpret three: Chain "(x0,y0,z0)" "\(x,y,z). At x y z" "\(x',y',z'). \(x,y,z). Follows x' y' z' x y z" ``` lp15@60809 ` 2202` ``` apply unfold_locales ``` lp15@60809 ` 2203` ``` using At0 AtSuc by auto ``` lp15@60809 ` 2204` ``` show ?thesis ``` lp15@60809 ` 2205` ``` apply (rule that [of "\n. fst (three.f n)" "\n. fst (snd (three.f n))" "\n. snd (snd (three.f n))"]) ``` lp15@68302 ` 2206` ``` using three.At three.Follows ``` lp15@60809 ` 2207` ``` apply simp_all ``` lp15@60809 ` 2208` ``` apply (simp_all add: split_beta') ``` lp15@60809 ` 2209` ``` done ``` lp15@60809 ` 2210` ```qed ``` lp15@60809 ` 2211` lp15@68310 ` 2212` ```proposition Cauchy_theorem_triangle: ``` lp15@60809 ` 2213` ``` assumes "f holomorphic_on (convex hull {a,b,c})" ``` lp15@61738 ` 2214` ``` shows "(f has_contour_integral 0) (linepath a b +++ linepath b c +++ linepath c a)" ``` lp15@60809 ` 2215` ```proof - ``` lp15@60809 ` 2216` ``` have contf: "continuous_on (convex hull {a,b,c}) f" ``` lp15@60809 ` 2217` ``` by (metis assms holomorphic_on_imp_continuous_on) ``` lp15@61738 ` 2218` ``` let ?pathint = "\x y. contour_integral(linepath x y) f" ``` lp15@60809 ` 2219` ``` { fix y::complex ``` lp15@61738 ` 2220` ``` assume fy: "(f has_contour_integral y) (linepath a b +++ linepath b c +++ linepath c a)" ``` lp15@60809 ` 2221` ``` and ynz: "y \ 0" ``` wenzelm@63040 ` 2222` ``` define K where "K = 1 + max (dist a b) (max (dist b c) (dist c a))" ``` wenzelm@63040 ` 2223` ``` define e where "e = norm y / K^2" ``` lp15@60809 ` 2224` ``` have K1: "K \ 1" by (simp add: K_def max.coboundedI1) ``` lp15@60809 ` 2225` ``` then have K: "K > 0" by linarith ``` lp15@60809 ` 2226` ``` have [iff]: "dist a b \ K" "dist b c \ K" "dist c a \ K" ``` lp15@60809 ` 2227` ``` by (simp_all add: K_def) ``` lp15@60809 ` 2228` ``` have e: "e > 0" ``` lp15@60809 ` 2229` ``` unfolding e_def using ynz K1 by simp ``` wenzelm@63040 ` 2230` ``` define At where "At x y z n \ ``` wenzelm@63040 ` 2231` ``` convex hull {x,y,z} \ convex hull {a,b,c} \ ``` wenzelm@63040 ` 2232` ``` dist x y \ K/2^n \ dist y z \ K/2^n \ dist z x \ K/2^n \ ``` wenzelm@63040 ` 2233` ``` norm(?pathint x y + ?pathint y z + ?pathint z x) \ e*(K/2^n)^2" ``` wenzelm@63040 ` 2234` ``` for x y z n ``` lp15@60809 ` 2235` ``` have At0: "At a b c 0" ``` lp15@60809 ` 2236` ``` using fy ``` lp15@60809 ` 2237` ``` by (simp add: At_def e_def has_chain_integral_chain_integral3) ``` lp15@60809 ` 2238` ``` { fix x y z n ``` lp15@60809 ` 2239` ``` assume At: "At x y z n" ``` lp15@60809 ` 2240` ``` then have contf': "continuous_on (convex hull {x,y,z}) f" ``` lp15@63938 ` 2241` ``` using contf At_def continuous_on_subset by metis ``` lp15@60809 ` 2242` ``` have "\x' y' z'. At x' y' z' (Suc n) \ convex hull {x',y',z'} \ convex hull {x,y,z}" ``` lp15@68302 ` 2243` ``` using At Cauchy_theorem_quadrisection [OF contf', of "K/2^n" e] ``` lp15@68302 ` 2244` ``` apply (simp add: At_def algebra_simps) ``` lp15@60809 ` 2245` ``` apply (meson convex_hull_subset empty_subsetI insert_subset subsetCE) ``` lp15@60809 ` 2246` ``` done ``` lp15@60809 ` 2247` ``` } note AtSuc = this ``` lp15@60809 ` 2248` ``` obtain fa fb fc ``` lp15@60809 ` 2249` ``` where f0 [simp]: "fa 0 = a" "fb 0 = b" "fc 0 = c" ``` lp15@60809 ` 2250` ``` and cosb: "\n. convex hull {fa n, fb n, fc n} \ convex hull {a,b,c}" ``` lp15@60809 ` 2251` ``` and dist: "\n. dist (fa n) (fb n) \ K/2^n" ``` lp15@60809 ` 2252` ``` "\n. dist (fb n) (fc n) \ K/2^n" ``` lp15@60809 ` 2253` ``` "\n. dist (fc n) (fa n) \ K/2^n" ``` lp15@60809 ` 2254` ``` and no: "\n. norm(?pathint (fa n) (fb n) + ``` lp15@60809 ` 2255` ``` ?pathint (fb n) (fc n) + ``` lp15@60809 ` 2256` ``` ?pathint (fc n) (fa n)) \ e * (K/2^n)^2" ``` lp15@60809 ` 2257` ``` and conv_le: "\n. convex hull {fa(Suc n), fb(Suc n), fc(Suc n)} \ convex hull {fa n, fb n, fc n}" ```