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