[STATEMENT]
lemma contour_integral_nearby:
  assumes os: "open S" and p: "path p" "path_image p \<subseteq> S"
  shows "\<exists>d. 0 < d \<and>
            (\<forall>g h. valid_path g \<and> valid_path h \<and>
                  (\<forall>t \<in> {0..1}. norm(g t - p t) < d \<and> norm(h t - p t) < d) \<and>
                  linked_paths atends g h
                  \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and>
                      (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S
[PROOF STEP]
using open_contains_ball os p(2)
[PROOF STATE]
proof (prove)
using this:
open ?S = (\<forall>x\<in>?S. \<exists>e>0. ball x e \<subseteq> ?S)
open S
path_image p \<subseteq> S

goal (1 subgoal):
 1. \<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S
[PROOF STEP]
obtain ee where ee: "\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> S

goal (1 subgoal):
 1. (\<And>ee. (\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
define cover where "cover = (\<lambda>z. ball z (ee z/3)) ` (path_image p)"
[PROOF STATE]
proof (state)
this:
cover = (\<lambda>z. ball z (ee z / 3)) ` path_image p

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "compact (path_image p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (path_image p)
[PROOF STEP]
by (metis p(1) compact_path_image)
[PROOF STATE]
proof (state)
this:
compact (path_image p)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
compact (path_image p)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))
[PROOF STEP]
using ee
[PROOF STATE]
proof (prove)
using this:
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S

goal (1 subgoal):
 1. path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
compact (path_image p)
path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))
[PROOF STEP]
have "\<exists>D \<subseteq> cover. finite D \<and> path_image p \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
compact (path_image p)
path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))

goal (1 subgoal):
 1. \<exists>D\<subseteq>cover. finite D \<and> path_image p \<subseteq> \<Union> D
[PROOF STEP]
by (simp add: compact_eq_Heine_Borel cover_def)
[PROOF STATE]
proof (state)
this:
\<exists>D\<subseteq>cover. finite D \<and> path_image p \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>D\<subseteq>cover. finite D \<and> path_image p \<subseteq> \<Union> D
[PROOF STEP]
obtain D where D: "D \<subseteq> cover" "finite D" "path_image p \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
\<exists>D\<subseteq>cover. finite D \<and> path_image p \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<And>D. \<lbrakk>D \<subseteq> cover; finite D; path_image p \<subseteq> \<Union> D\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
D \<subseteq> cover
finite D
path_image p \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> cover
finite D
path_image p \<subseteq> \<Union> D
[PROOF STEP]
obtain k where k: "k \<subseteq> {0..1}" "finite k" and D_eq: "D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> cover
finite D
path_image p \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<subseteq> {0..1}; finite k; D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding cover_def path_image_def image_comp
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` {0..1}
finite D
p ` {0..1} \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<subseteq> {0..1}; finite k; D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson finite_subset_image)
[PROOF STATE]
proof (state)
this:
k \<subseteq> {0..1}
finite k
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<subseteq> {0..1}
finite k
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k
[PROOF STEP]
have kne: "k \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
k \<subseteq> {0..1}
finite k
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k

goal (1 subgoal):
 1. k \<noteq> {}
[PROOF STEP]
using D
[PROOF STATE]
proof (prove)
using this:
k \<subseteq> {0..1}
finite k
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k
D \<subseteq> cover
finite D
path_image p \<subseteq> \<Union> D

goal (1 subgoal):
 1. k \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k \<noteq> {}

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have pi: "\<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k \<subseteq> {0..1}
finite k

goal (1 subgoal):
 1. \<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p
[PROOF STEP]
by (auto simp: path_image_def)
[PROOF STATE]
proof (state)
this:
?i \<in> k \<Longrightarrow> p ?i \<in> path_image p

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i \<in> k \<Longrightarrow> p ?i \<in> path_image p
[PROOF STEP]
have eepi: "\<And>i. i \<in> k \<Longrightarrow> 0 < ee((p i))"
[PROOF STATE]
proof (prove)
using this:
?i \<in> k \<Longrightarrow> p ?i \<in> path_image p

goal (1 subgoal):
 1. \<And>i. i \<in> k \<Longrightarrow> 0 < ee (p i)
[PROOF STEP]
by (metis ee)
[PROOF STATE]
proof (state)
this:
?i \<in> k \<Longrightarrow> 0 < ee (p ?i)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
define e where "e = Min((ee \<circ> p) ` k)"
[PROOF STATE]
proof (state)
this:
e = Min ((ee \<circ> p) ` k)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have fin_eep: "finite ((ee \<circ> p) ` k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((ee \<circ> p) ` k)
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k \<subseteq> {0..1}
finite k

goal (1 subgoal):
 1. finite ((ee \<circ> p) ` k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ((ee \<circ> p) ` k)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "0 < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
using ee k
[PROOF STATE]
proof (prove)
using this:
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S
k \<subseteq> {0..1}
finite k

goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
by (simp add: kne e_def Min_gr_iff [OF fin_eep] eepi)
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "uniformly_continuous_on {0..1} p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on {0..1} p
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
path p
path_image p \<subseteq> S

goal (1 subgoal):
 1. uniformly_continuous_on {0..1} p
[PROOF STEP]
by (simp add: path_def compact_uniformly_continuous)
[PROOF STATE]
proof (state)
this:
uniformly_continuous_on {0..1} p

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
uniformly_continuous_on {0..1} p
[PROOF STEP]
obtain d::real where d: "d>0"
          and de: "\<And>x x'. \<bar>x' - x\<bar> < d \<Longrightarrow> x\<in>{0..1} \<Longrightarrow> x'\<in>{0..1} \<Longrightarrow> cmod (p x' - p x) < e/3"
[PROOF STATE]
proof (prove)
using this:
uniformly_continuous_on {0..1} p

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>x x'. \<lbrakk>\<bar>x' - x\<bar> < d; x \<in> {0..1}; x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p x' - p x) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding uniformly_continuous_on_def dist_norm real_norm_def
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>d>0. \<forall>x\<in>{0..1}. \<forall>x'\<in>{0..1}. \<bar>x' - x\<bar> < d \<longrightarrow> cmod (p x' - p x) < e

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<And>x x'. \<lbrakk>\<bar>x' - x\<bar> < d; x \<in> {0..1}; x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p x' - p x) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis divide_pos_pos \<open>0 < e\<close> zero_less_numeral)
[PROOF STATE]
proof (state)
this:
0 < d
\<lbrakk>\<bar>?x' - ?x\<bar> < d; ?x \<in> {0..1}; ?x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p ?x' - p ?x) < e / 3

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < d
\<lbrakk>\<bar>?x' - ?x\<bar> < d; ?x \<in> {0..1}; ?x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p ?x' - p ?x) < e / 3
[PROOF STEP]
obtain N::nat where N: "N>0" "inverse N < d"
[PROOF STATE]
proof (prove)
using this:
0 < d
\<lbrakk>\<bar>?x' - ?x\<bar> < d; ?x \<in> {0..1}; ?x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p ?x' - p ?x) < e / 3

goal (1 subgoal):
 1. (\<And>N. \<lbrakk>0 < N; inverse (real N) < d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using real_arch_inverse [of d]
[PROOF STATE]
proof (prove)
using this:
0 < d
\<lbrakk>\<bar>?x' - ?x\<bar> < d; ?x \<in> {0..1}; ?x' \<in> {0..1}\<rbrakk> \<Longrightarrow> cmod (p ?x' - p ?x) < e / 3
(0 < d) = (\<exists>n. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < d)

goal (1 subgoal):
 1. (\<And>N. \<lbrakk>0 < N; inverse (real N) < d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < N
inverse (real N) < d

goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
proof (intro exI conjI allI; clarify?)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?d1
 2. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < ?d1 \<and> cmod (h t - p t) < ?d1; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
show "e/3 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e / 3
[PROOF STEP]
using \<open>0 < e\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 3

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
fix g h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
assume g: "valid_path g" and ghp: "\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and>  cmod (h t - p t) < e / 3"
       and h: "valid_path h"
       and joins: "linked_paths atends g h"
[PROOF STATE]
proof (state)
this:
valid_path g
\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3
valid_path h
linked_paths atends g h

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
valid_path g
\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3
valid_path h
linked_paths atends g h

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
fix t::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
assume t: "0 \<le> t" "t \<le> 1"
[PROOF STATE]
proof (state)
this:
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> t
t \<le> 1
[PROOF STEP]
obtain u where u: "u \<in> k" and ptu: "p t \<in> ball(p u) (ee(p u) / 3)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> k; p t \<in> ball (p u) (ee (p u) / 3)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>path_image p \<subseteq> \<Union>D\<close> D_eq
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
t \<le> 1
path_image p \<subseteq> \<Union> D
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> k; p t \<in> ball (p u) (ee (p u) / 3)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: path_image_def)
[PROOF STATE]
proof (state)
this:
u \<in> k
p t \<in> ball (p u) (ee (p u) / 3)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> k
p t \<in> ball (p u) (ee (p u) / 3)
[PROOF STEP]
have ele: "e \<le> ee (p u)"
[PROOF STATE]
proof (prove)
using this:
u \<in> k
p t \<in> ball (p u) (ee (p u) / 3)

goal (1 subgoal):
 1. e \<le> ee (p u)
[PROOF STEP]
using fin_eep
[PROOF STATE]
proof (prove)
using this:
u \<in> k
p t \<in> ball (p u) (ee (p u) / 3)
finite ((ee \<circ> p) ` k)

goal (1 subgoal):
 1. e \<le> ee (p u)
[PROOF STEP]
by (simp add: e_def)
[PROOF STATE]
proof (state)
this:
e \<le> ee (p u)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "cmod (g t - p t) < e / 3" "cmod (h t - p t) < e / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (g t - p t) < e / 3 &&& cmod (h t - p t) < e / 3
[PROOF STEP]
using ghp t
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. cmod (g t - p t) < e / 3 &&& cmod (h t - p t) < e / 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (g t - p t) < e / 3
cmod (h t - p t) < e / 3

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
with ele
[PROOF STATE]
proof (chain)
picking this:
e \<le> ee (p u)
cmod (g t - p t) < e / 3
cmod (h t - p t) < e / 3
[PROOF STEP]
have "cmod (g t - p t) < ee (p u) / 3"
                    "cmod (h t - p t) < ee (p u) / 3"
[PROOF STATE]
proof (prove)
using this:
e \<le> ee (p u)
cmod (g t - p t) < e / 3
cmod (h t - p t) < e / 3

goal (1 subgoal):
 1. cmod (g t - p t) < ee (p u) / 3 &&& cmod (h t - p t) < ee (p u) / 3
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
cmod (g t - p t) < ee (p u) / 3
cmod (h t - p t) < ee (p u) / 3

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (g t - p t) < ee (p u) / 3
cmod (h t - p t) < ee (p u) / 3
[PROOF STEP]
have "g t \<in> ball(p u) (ee(p u))"  "h t \<in> ball(p u) (ee(p u))"
[PROOF STATE]
proof (prove)
using this:
cmod (g t - p t) < ee (p u) / 3
cmod (h t - p t) < ee (p u) / 3

goal (1 subgoal):
 1. g t \<in> ball (p u) (ee (p u)) &&& h t \<in> ball (p u) (ee (p u))
[PROOF STEP]
using norm_diff_triangle_ineq [of "g t" "p t" "p t" "p u"]
              norm_diff_triangle_ineq [of "h t" "p t" "p t" "p u"] ptu eepi u
[PROOF STATE]
proof (prove)
using this:
cmod (g t - p t) < ee (p u) / 3
cmod (h t - p t) < ee (p u) / 3
cmod (g t + p t - (p t + p u)) \<le> cmod (g t - p t) + cmod (p t - p u)
cmod (h t + p t - (p t + p u)) \<le> cmod (h t - p t) + cmod (p t - p u)
p t \<in> ball (p u) (ee (p u) / 3)
?i \<in> k \<Longrightarrow> 0 < ee (p ?i)
u \<in> k

goal (1 subgoal):
 1. g t \<in> ball (p u) (ee (p u)) &&& h t \<in> ball (p u) (ee (p u))
[PROOF STEP]
by (force simp: dist_norm ball_def norm_minus_commute)+
[PROOF STATE]
proof (state)
this:
g t \<in> ball (p u) (ee (p u))
h t \<in> ball (p u) (ee (p u))

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g t \<in> ball (p u) (ee (p u))
h t \<in> ball (p u) (ee (p u))
[PROOF STEP]
have "g t \<in> S" "h t \<in> S"
[PROOF STATE]
proof (prove)
using this:
g t \<in> ball (p u) (ee (p u))
h t \<in> ball (p u) (ee (p u))

goal (1 subgoal):
 1. g t \<in> S &&& h t \<in> S
[PROOF STEP]
using ee u k
[PROOF STATE]
proof (prove)
using this:
g t \<in> ball (p u) (ee (p u))
h t \<in> ball (p u) (ee (p u))
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S
u \<in> k
k \<subseteq> {0..1}
finite k

goal (1 subgoal):
 1. g t \<in> S &&& h t \<in> S
[PROOF STEP]
by (auto simp: path_image_def ball_def)
[PROOF STATE]
proof (state)
this:
g t \<in> S
h t \<in> S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> g ?t2 \<in> S
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> h ?t2 \<in> S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> g ?t2 \<in> S
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> h ?t2 \<in> S
[PROOF STEP]
have ghs: "path_image g \<subseteq> S" "path_image h \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> g ?t2 \<in> S
\<lbrakk>0 \<le> ?t2; ?t2 \<le> 1\<rbrakk> \<Longrightarrow> h ?t2 \<in> S

goal (1 subgoal):
 1. path_image g \<subseteq> S &&& path_image h \<subseteq> S
[PROOF STEP]
by (auto simp: path_image_def)
[PROOF STATE]
proof (state)
this:
path_image g \<subseteq> S
path_image h \<subseteq> S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
path_image g \<subseteq> S
path_image h \<subseteq> S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
path_image g \<subseteq> S
path_image h \<subseteq> S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
assume fhols: "f holomorphic_on S"
[PROOF STATE]
proof (state)
this:
f holomorphic_on S

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f holomorphic_on S
[PROOF STEP]
have fpa: "f contour_integrable_on g"  "f contour_integrable_on h"
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on S

goal (1 subgoal):
 1. f contour_integrable_on g &&& f contour_integrable_on h
[PROOF STEP]
using g ghs h holomorphic_on_imp_continuous_on os contour_integrable_holomorphic_simple
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on S
valid_path g
path_image g \<subseteq> S
path_image h \<subseteq> S
valid_path h
?f holomorphic_on ?s \<Longrightarrow> continuous_on ?s ?f
open S
\<lbrakk>?f holomorphic_on ?S; open ?S; valid_path ?g; path_image ?g \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f contour_integrable_on ?g

goal (1 subgoal):
 1. f contour_integrable_on g &&& f contour_integrable_on h
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
f contour_integrable_on g
f contour_integrable_on h

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have contf: "continuous_on S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S f
[PROOF STEP]
by (simp add: fhols holomorphic_on_imp_continuous_on)
[PROOF STATE]
proof (state)
this:
continuous_on S f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
continuous_on S f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
assume z: "z \<in> path_image p"
[PROOF STATE]
proof (state)
this:
z \<in> path_image p

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "f holomorphic_on ball z (ee z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f holomorphic_on ball z (ee z)
[PROOF STEP]
using fhols ee z holomorphic_on_subset
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on S
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S
z \<in> path_image p
\<lbrakk>?f holomorphic_on ?s; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> ?f holomorphic_on ?t

goal (1 subgoal):
 1. f holomorphic_on ball z (ee z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f holomorphic_on ball z (ee z)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f holomorphic_on ball z (ee z)
[PROOF STEP]
have "\<exists>ff. (\<forall>w \<in> ball z (ee z). (ff has_field_derivative f w) (at w))"
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on ball z (ee z)

goal (1 subgoal):
 1. \<exists>ff. \<forall>w\<in>ball z (ee z). (ff has_field_derivative f w) (at w)
[PROOF STEP]
using holomorphic_convex_primitive [of "ball z (ee z)" "{}" f, simplified]
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on ball z (ee z)
\<lbrakk>continuous_on (ball z (ee z)) f; \<And>x. dist z x < ee z \<Longrightarrow> f field_differentiable at x; \<And>g. (\<And>x. dist z x < ee z \<Longrightarrow> (g has_field_derivative f x) (at x within ball z (ee z))) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<exists>ff. \<forall>w\<in>ball z (ee z). (ff has_field_derivative f w) (at w)
[PROOF STEP]
by (metis open_ball at_within_open holomorphic_on_def holomorphic_on_imp_continuous_on mem_ball)
[PROOF STATE]
proof (state)
this:
\<exists>ff. \<forall>w\<in>ball z (ee z). (ff has_field_derivative f w) (at w)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?z2 \<in> path_image p \<Longrightarrow> \<exists>ff. \<forall>w\<in>ball ?z2 (ee ?z2). (ff has_field_derivative f w) (at w)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?z2 \<in> path_image p \<Longrightarrow> \<exists>ff. \<forall>w\<in>ball ?z2 (ee ?z2). (ff has_field_derivative f w) (at w)
[PROOF STEP]
obtain ff where ff:
            "\<And>z w. \<lbrakk>z \<in> path_image p; w \<in> ball z (ee z)\<rbrakk> \<Longrightarrow> (ff z has_field_derivative f w) (at w)"
[PROOF STATE]
proof (prove)
using this:
?z2 \<in> path_image p \<Longrightarrow> \<exists>ff. \<forall>w\<in>ball ?z2 (ee ?z2). (ff has_field_derivative f w) (at w)

goal (1 subgoal):
 1. (\<And>ff. (\<And>z w. \<lbrakk>z \<in> path_image p; w \<in> ball z (ee z)\<rbrakk> \<Longrightarrow> (ff z has_field_derivative f w) (at w)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<lbrakk>?z \<in> path_image p; ?w \<in> ball ?z (ee ?z)\<rbrakk> \<Longrightarrow> (ff ?z has_field_derivative f ?w) (at ?w)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?z \<in> path_image p; ?w \<in> ball ?z (ee ?z)\<rbrakk> \<Longrightarrow> (ff ?z has_field_derivative f ?w) (at ?w)

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
assume n: "n \<le> N"
[PROOF STATE]
proof (state)
this:
n \<le> N

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<le> N
[PROOF STEP]
have "contour_integral(subpath 0 (n/N) h) f - contour_integral(subpath 0 (n/N) g) f =
                   contour_integral(linepath (g(n/N)) (h(n/N))) f - contour_integral(linepath (g 0) (h 0)) f"
[PROOF STATE]
proof (prove)
using this:
n \<le> N

goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> N \<Longrightarrow> contour_integral (subpath 0 (real 0 / real N) h) f - contour_integral (subpath 0 (real 0 / real N) g) f = contour_integral (linepath (g (real 0 / real N)) (h (real 0 / real N))) f - contour_integral (linepath (g 0) (h 0)) f
 2. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> N

goal (2 subgoals):
 1. 0 \<le> N \<Longrightarrow> contour_integral (subpath 0 (real 0 / real N) h) f - contour_integral (subpath 0 (real 0 / real N) g) f = contour_integral (linepath (g (real 0 / real N)) (h (real 0 / real N))) f - contour_integral (linepath (g 0) (h 0)) f
 2. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real 0 / real N) h) f - contour_integral (subpath 0 (real 0 / real N) g) f = contour_integral (linepath (g (real 0 / real N)) (h (real 0 / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real 0 / real N) h) f - contour_integral (subpath 0 (real 0 / real N) g) f = contour_integral (linepath (g (real 0 / real N)) (h (real 0 / real N))) f - contour_integral (linepath (g 0) (h 0)) f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f
Suc n \<le> N

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
obtain t where t: "t \<in> k" and "p (n/N) \<in> ball(p t) (ee(p t) / 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> k; p (real n / real N) \<in> ball (p t) (ee (p t) / 3)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>path_image p \<subseteq> \<Union>D\<close> [THEN subsetD, where c="p (n/N)"] D_eq N Suc.prems
[PROOF STATE]
proof (prove)
using this:
p (real n / real N) \<in> path_image p \<Longrightarrow> p (real n / real N) \<in> \<Union> D
D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k
0 < N
inverse (real N) < d
Suc n \<le> N

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>t \<in> k; p (real n / real N) \<in> ball (p t) (ee (p t) / 3)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: path_image_def)
[PROOF STATE]
proof (state)
this:
t \<in> k
p (real n / real N) \<in> ball (p t) (ee (p t) / 3)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> k
p (real n / real N) \<in> ball (p t) (ee (p t) / 3)
[PROOF STEP]
have ptu: "cmod (p t - p (n/N)) < ee (p t) / 3"
[PROOF STATE]
proof (prove)
using this:
t \<in> k
p (real n / real N) \<in> ball (p t) (ee (p t) / 3)

goal (1 subgoal):
 1. cmod (p t - p (real n / real N)) < ee (p t) / 3
[PROOF STEP]
by (simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
cmod (p t - p (real n / real N)) < ee (p t) / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have e3le: "e/3 \<le> ee (p t) / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e / 3 \<le> ee (p t) / 3
[PROOF STEP]
using fin_eep t
[PROOF STATE]
proof (prove)
using this:
finite ((ee \<circ> p) ` k)
t \<in> k

goal (1 subgoal):
 1. e / 3 \<le> ee (p t) / 3
[PROOF STEP]
by (simp add: e_def)
[PROOF STATE]
proof (state)
this:
e / 3 \<le> ee (p t) / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
e / 3 \<le> ee (p t) / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
assume x: "n/N \<le> x" "x \<le> (1 + n)/N"
[PROOF STATE]
proof (state)
this:
real n / real N \<le> x
x \<le> real (1 + n) / real N

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real n / real N \<le> x
x \<le> real (1 + n) / real N
[PROOF STEP]
have nN01: "0 \<le> n/N" "(1 + n)/N \<le> 1"
[PROOF STATE]
proof (prove)
using this:
real n / real N \<le> x
x \<le> real (1 + n) / real N

goal (1 subgoal):
 1. 0 \<le> real n / real N &&& real (1 + n) / real N \<le> 1
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
real n / real N \<le> x
x \<le> real (1 + n) / real N
Suc n \<le> N

goal (1 subgoal):
 1. 0 \<le> real n / real N &&& real (1 + n) / real N \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real n / real N
real (1 + n) / real N \<le> 1

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> real n / real N
real (1 + n) / real N \<le> 1
[PROOF STEP]
have x01: "0 \<le> x" "x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> real n / real N
real (1 + n) / real N \<le> 1

goal (1 subgoal):
 1. 0 \<le> x &&& x \<le> 1
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
0 \<le> real n / real N
real (1 + n) / real N \<le> 1
real n / real N \<le> x
x \<le> real (1 + n) / real N

goal (1 subgoal):
 1. 0 \<le> x &&& x \<le> 1
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "cmod (p t - p x)  < ee (p t) / 3 + e/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (p t - p x) < ee (p t) / 3 + e / 3
[PROOF STEP]
proof (rule norm_diff_triangle_less [OF ptu de])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<bar>real n / real N - x\<bar> < d
 2. x \<in> {0..1}
 3. real n / real N \<in> {0..1}
[PROOF STEP]
show "\<bar>real n / real N - x\<bar> < d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real n / real N - x\<bar> < d
[PROOF STEP]
using x N
[PROOF STATE]
proof (prove)
using this:
real n / real N \<le> x
x \<le> real (1 + n) / real N
0 < N
inverse (real N) < d

goal (1 subgoal):
 1. \<bar>real n / real N - x\<bar> < d
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<bar>real n / real N - x\<bar> < d

goal (2 subgoals):
 1. x \<in> {0..1}
 2. real n / real N \<in> {0..1}
[PROOF STEP]
qed (use x01 Suc.prems in auto)
[PROOF STATE]
proof (state)
this:
cmod (p t - p x) < ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (p t - p x) < ee (p t) / 3 + e / 3
[PROOF STEP]
have ptx: "cmod (p t - p x) < 2*ee (p t)/3"
[PROOF STATE]
proof (prove)
using this:
cmod (p t - p x) < ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. cmod (p t - p x) < 2 * ee (p t) / 3
[PROOF STEP]
using e3le eepi [OF t]
[PROOF STATE]
proof (prove)
using this:
cmod (p t - p x) < ee (p t) / 3 + e / 3
e / 3 \<le> ee (p t) / 3
0 < ee (p t)

goal (1 subgoal):
 1. cmod (p t - p x) < 2 * ee (p t) / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (p t - p x) < 2 * ee (p t) / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "cmod (p t - g x) < 2*ee (p t)/3 + e/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (p t - g x) < 2 * ee (p t) / 3 + e / 3
[PROOF STEP]
using ghp x01
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. cmod (p t - g x) < 2 * ee (p t) / 3 + e / 3
[PROOF STEP]
by (force simp add: norm_minus_commute intro!: norm_diff_triangle_less [OF ptx])
[PROOF STATE]
proof (state)
this:
cmod (p t - g x) < 2 * ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (p t - g x) < 2 * ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "\<dots> \<le> ee (p t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ee (p t) / 3 + e / 3 \<le> ee (p t)
[PROOF STEP]
using e3le eepi [OF t]
[PROOF STATE]
proof (prove)
using this:
e / 3 \<le> ee (p t) / 3
0 < ee (p t)

goal (1 subgoal):
 1. 2 * ee (p t) / 3 + e / 3 \<le> ee (p t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * ee (p t) / 3 + e / 3 \<le> ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (p t - g x) < ee (p t)
[PROOF STEP]
have gg: "cmod (p t - g x) < ee (p t)"
[PROOF STATE]
proof (prove)
using this:
cmod (p t - g x) < ee (p t)

goal (1 subgoal):
 1. cmod (p t - g x) < ee (p t)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (p t - g x) < ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "cmod (p t - h x) < 2*ee (p t)/3 + e/3 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (p t - h x) < 2 * ee (p t) / 3 + e / 3
[PROOF STEP]
using ghp x01
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. cmod (p t - h x) < 2 * ee (p t) / 3 + e / 3
[PROOF STEP]
by (force simp add: norm_minus_commute intro!: norm_diff_triangle_less [OF ptx])
[PROOF STATE]
proof (state)
this:
cmod (p t - h x) < 2 * ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (p t - h x) < 2 * ee (p t) / 3 + e / 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "\<dots> \<le> ee (p t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ee (p t) / 3 + e / 3 \<le> ee (p t)
[PROOF STEP]
using e3le eepi [OF t]
[PROOF STATE]
proof (prove)
using this:
e / 3 \<le> ee (p t) / 3
0 < ee (p t)

goal (1 subgoal):
 1. 2 * ee (p t) / 3 + e / 3 \<le> ee (p t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * ee (p t) / 3 + e / 3 \<le> ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (p t - h x) < ee (p t)
[PROOF STEP]
have "cmod (p t - g x) < ee (p t)" "cmod (p t - h x) < ee (p t)"
[PROOF STATE]
proof (prove)
using this:
cmod (p t - h x) < ee (p t)

goal (1 subgoal):
 1. cmod (p t - g x) < ee (p t) &&& cmod (p t - h x) < ee (p t)
[PROOF STEP]
using gg
[PROOF STATE]
proof (prove)
using this:
cmod (p t - h x) < ee (p t)
cmod (p t - g x) < ee (p t)

goal (1 subgoal):
 1. cmod (p t - g x) < ee (p t) &&& cmod (p t - h x) < ee (p t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (p t - g x) < ee (p t)
cmod (p t - h x) < ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>real n / real N \<le> ?x2; ?x2 \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - g ?x2) < ee (p t)
\<lbrakk>real n / real N \<le> ?x2; ?x2 \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - h ?x2) < ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
note ptgh_ee = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>real n / real N \<le> ?x2; ?x2 \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - g ?x2) < ee (p t)
\<lbrakk>real n / real N \<le> ?x2; ?x2 \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - h ?x2) < ee (p t)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "closed_segment (g (n/N)) (h (n/N)) = path_image (linepath (h (n/N)) (g (n/N)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment (g (real n / real N)) (h (real n / real N)) = path_image (linepath (h (real n / real N)) (g (real n / real N)))
[PROOF STEP]
by (simp add: closed_segment_commute)
[PROOF STATE]
proof (state)
this:
closed_segment (g (real n / real N)) (h (real n / real N)) = path_image (linepath (h (real n / real N)) (g (real n / real N)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closed_segment (g (real n / real N)) (h (real n / real N)) = path_image (linepath (h (real n / real N)) (g (real n / real N)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have pi_hgn: "\<dots> \<subseteq> ball (p t) (ee (p t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
using ptgh_ee [of "n/N"] Suc.prems
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>real n / real N \<le> real n / real N; real n / real N \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - g (real n / real N)) < ee (p t)
\<lbrakk>real n / real N \<le> real n / real N; real n / real N \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - h (real n / real N)) < ee (p t)
Suc n \<le> N

goal (1 subgoal):
 1. path_image (linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
by (auto simp: field_simps dist_norm dest: segment_furthest_le [where y="p t"])
[PROOF STATE]
proof (state)
this:
path_image (linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
have gh_ns: "closed_segment (g (n/N)) (h (n/N)) \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> ball (p t) (ee (p t))

goal (1 subgoal):
 1. closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> S
[PROOF STEP]
using ee pi t
[PROOF STATE]
proof (prove)
using this:
closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> ball (p t) (ee (p t))
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S
?i \<in> k \<Longrightarrow> p ?i \<in> path_image p
t \<in> k

goal (1 subgoal):
 1. closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> S

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have pi_ghn': "path_image (linepath (g ((1 + n) / N)) (h ((1 + n) / N))) \<subseteq> ball (p t) (ee (p t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
using ptgh_ee [of "(1+n)/N"] Suc.prems
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>real n / real N \<le> real (1 + n) / real N; real (1 + n) / real N \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - g (real (1 + n) / real N)) < ee (p t)
\<lbrakk>real n / real N \<le> real (1 + n) / real N; real (1 + n) / real N \<le> real (1 + n) / real N\<rbrakk> \<Longrightarrow> cmod (p t - h (real (1 + n) / real N)) < ee (p t)
Suc n \<le> N

goal (1 subgoal):
 1. path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
by (auto simp: field_simps dist_norm dest: segment_furthest_le [where y="p t"])
[PROOF STATE]
proof (state)
this:
path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
have gh_n's: "closed_segment (g ((1 + n) / N)) (h ((1 + n) / N)) \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))

goal (1 subgoal):
 1. closed_segment (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) \<subseteq> S
[PROOF STEP]
using \<open>N>0\<close> Suc.prems ee pi t
[PROOF STATE]
proof (prove)
using this:
path_image (linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N))) \<subseteq> ball (p t) (ee (p t))
0 < N
Suc n \<le> N
?z \<in> path_image p \<Longrightarrow> 0 < ee ?z \<and> ball ?z (ee ?z) \<subseteq> S
?i \<in> k \<Longrightarrow> p ?i \<in> path_image p
t \<in> k

goal (1 subgoal):
 1. closed_segment (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) \<subseteq> S
[PROOF STEP]
by (auto simp: Path_Connected.path_image_join field_simps)
[PROOF STATE]
proof (state)
this:
closed_segment (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) \<subseteq> S

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have pi_subset_ball:
                "path_image (subpath (n/N) ((1+n) / N) g +++ linepath (g ((1+n) / N)) (h ((1+n) / N)) +++
                             subpath ((1+n) / N) (n/N) h +++ linepath (h (n/N)) (g (n/N)))
                 \<subseteq> ball (p t) (ee (p t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (subpath (real n / real N) (real (1 + n) / real N) g +++ linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) +++ subpath (real (1 + n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
proof (intro subset_path_image_join pi_hgn pi_ghn')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. path_image (subpath (real n / real N) (real (1 + n) / real N) g) \<subseteq> ball (p t) (ee (p t))
 2. path_image (subpath (real (1 + n) / real N) (real n / real N) h) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
show "path_image (subpath (n/N) ((1+n) / N) g) \<subseteq> ball (p t) (ee (p t))"
                 "path_image (subpath ((1+n) / N) (n/N) h) \<subseteq> ball (p t) (ee (p t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (subpath (real n / real N) (real (1 + n) / real N) g) \<subseteq> ball (p t) (ee (p t)) &&& path_image (subpath (real (1 + n) / real N) (real n / real N) h) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
using \<open>N>0\<close> Suc.prems
[PROOF STATE]
proof (prove)
using this:
0 < N
Suc n \<le> N

goal (1 subgoal):
 1. path_image (subpath (real n / real N) (real (1 + n) / real N) g) \<subseteq> ball (p t) (ee (p t)) &&& path_image (subpath (real (1 + n) / real N) (real n / real N) h) \<subseteq> ball (p t) (ee (p t))
[PROOF STEP]
by (auto simp: path_image_subpath dist_norm field_simps ptgh_ee)
[PROOF STATE]
proof (state)
this:
path_image (subpath (real n / real N) (real (1 + n) / real N) g) \<subseteq> ball (p t) (ee (p t))
path_image (subpath (real (1 + n) / real N) (real n / real N) h) \<subseteq> ball (p t) (ee (p t))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
path_image (subpath (real n / real N) (real (1 + n) / real N) g +++ linepath (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) +++ subpath (real (1 + n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have pi0: "(f has_contour_integral 0)
                       (subpath (n/ N) ((Suc n)/N) g +++ linepath(g ((Suc n) / N)) (h((Suc n) / N)) +++
                        subpath ((Suc n) / N) (n/N) h +++ linepath(h (n/N)) (g (n/N)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral 0) (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))
[PROOF STEP]
proof (rule Cauchy_theorem_primitive)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x. x \<in> ?S \<Longrightarrow> (?f has_field_derivative f x) (at x within ?S)
 2. valid_path (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))
 3. path_image (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ?S
 4. pathfinish (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) = pathstart (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))
[PROOF STEP]
show "\<And>x. x \<in> ball (p t) (ee (p t))
                      \<Longrightarrow> (ff (p t) has_field_derivative f x) (at x within ball (p t) (ee (p t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> ball (p t) (ee (p t)) \<Longrightarrow> (ff (p t) has_field_derivative f x) (at x within ball (p t) (ee (p t)))
[PROOF STEP]
by (metis ff open_ball at_within_open pi t)
[PROOF STATE]
proof (state)
this:
?x \<in> ball (p t) (ee (p t)) \<Longrightarrow> (ff (p t) has_field_derivative f ?x) (at ?x within ball (p t) (ee (p t)))

goal (3 subgoals):
 1. valid_path (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))
 2. path_image (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) \<subseteq> ball (p t) (ee (p t))
 3. pathfinish (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) = pathstart (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))
[PROOF STEP]
qed (use Suc.prems pi_subset_ball in \<open>simp_all add: valid_path_subpath g h\<close>)
[PROOF STATE]
proof (state)
this:
(f has_contour_integral 0) (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have fpa1: "f contour_integrable_on subpath (n/N) (real (Suc n) / real N) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f contour_integrable_on subpath (real n / real N) (real (Suc n) / real N) g
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N

goal (1 subgoal):
 1. f contour_integrable_on subpath (real n / real N) (real (Suc n) / real N) g
[PROOF STEP]
by (simp add: contour_integrable_subpath g fpa)
[PROOF STATE]
proof (state)
this:
f contour_integrable_on subpath (real n / real N) (real (Suc n) / real N) g

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have fpa2: "f contour_integrable_on linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f contour_integrable_on linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))
[PROOF STEP]
using gh_n's
[PROOF STATE]
proof (prove)
using this:
closed_segment (g (real (1 + n) / real N)) (h (real (1 + n) / real N)) \<subseteq> S

goal (1 subgoal):
 1. f contour_integrable_on linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))
[PROOF STEP]
by (auto intro!: contour_integrable_continuous_linepath continuous_on_subset [OF contf])
[PROOF STATE]
proof (state)
this:
f contour_integrable_on linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have fpa3: "f contour_integrable_on linepath (h (n/N)) (g (n/N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f contour_integrable_on linepath (h (real n / real N)) (g (real n / real N))
[PROOF STEP]
using gh_ns
[PROOF STATE]
proof (prove)
using this:
closed_segment (g (real n / real N)) (h (real n / real N)) \<subseteq> S

goal (1 subgoal):
 1. f contour_integrable_on linepath (h (real n / real N)) (g (real n / real N))
[PROOF STEP]
by (auto simp: closed_segment_commute intro!: contour_integrable_continuous_linepath continuous_on_subset [OF contf])
[PROOF STATE]
proof (state)
this:
f contour_integrable_on linepath (h (real n / real N)) (g (real n / real N))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have eq0: "contour_integral (subpath (n/N) ((Suc n) / real N) g) f +
                     contour_integral (linepath (g ((Suc n) / N)) (h ((Suc n) / N))) f +
                     contour_integral (subpath ((Suc n) / N) (n/N) h) f +
                     contour_integral (linepath (h (n/N)) (g (n/N))) f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f + contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f + contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f + contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = 0
[PROOF STEP]
using contour_integral_unique [OF pi0] Suc.prems
[PROOF STATE]
proof (prove)
using this:
contour_integral (subpath (real n / real N) (real (Suc n) / real N) g +++ linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N)) +++ subpath (real (Suc n) / real N) (real n / real N) h +++ linepath (h (real n / real N)) (g (real n / real N))) f = 0
Suc n \<le> N

goal (1 subgoal):
 1. contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f + contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f + contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f + contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = 0
[PROOF STEP]
by (simp add: g h fpa valid_path_subpath contour_integrable_subpath
                          fpa1 fpa2 fpa3 algebra_simps del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f + contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f + contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f + contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have *: "\<And>hn he hn' gn gd gn' hgn ghn gh0 ghn'.
                    \<lbrakk>hn - gn = ghn - gh0;
                     gd + ghn' + he + hgn = (0::complex);
                     hn - he = hn'; gn + gd = gn'; hgn = -ghn\<rbrakk> \<Longrightarrow> hn' - gn' = ghn' - gh0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>hn he hn' gn gd gn' hgn ghn gh0 ghn'. \<lbrakk>hn - gn = ghn - gh0; gd + ghn' + he + hgn = 0; hn - he = hn'; gn + gd = gn'; hgn = - ghn\<rbrakk> \<Longrightarrow> hn' - gn' = ghn' - gh0
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?hn - ?gn = ?ghn - ?gh0.0; ?gd + ?ghn' + ?he + ?hgn = 0; ?hn - ?he = ?hn'; ?gn + ?gd = ?gn'; ?hgn = - ?ghn\<rbrakk> \<Longrightarrow> ?hn' - ?gn' = ?ghn' - ?gh0.0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "contour_integral (subpath 0 (n/N) h) f - contour_integral (subpath ((Suc n) / N) (n/N) h) f =
                contour_integral (subpath 0 (n/N) h) f + contour_integral (subpath (n/N) ((Suc n) / N) h) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f
[PROOF STEP]
unfolding reversepath_subpath [symmetric, of "((Suc n) / N)"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f - contour_integral (reversepath (subpath (real n / real N) (real (Suc n) / real N) h)) f = contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N

goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f - contour_integral (reversepath (subpath (real n / real N) (real (Suc n) / real N) h)) f = contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f
[PROOF STEP]
by (simp add: h fpa contour_integral_reversepath valid_path_subpath contour_integrable_subpath)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
have "\<dots> = contour_integral (subpath 0 ((Suc n) / N) h) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N

goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f
[PROOF STEP]
by (simp add: contour_integral_subpath_combine h fpa)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) h) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f
[PROOF STEP]
have pi0_eq:
               "contour_integral (subpath 0 (n/N) h) f - contour_integral (subpath ((Suc n) / N) (n/N) h) f =
                contour_integral (subpath 0 ((Suc n) / N) h) f"
[PROOF STATE]
proof (prove)
using this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f

goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath (real (Suc n) / real N) (real n / real N) h) f = contour_integral (subpath 0 (real (Suc n) / real N) h) f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> N \<Longrightarrow> contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f; Suc n \<le> N\<rbrakk> \<Longrightarrow> contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f
[PROOF STEP]
proof (rule * [OF Suc.hyps eq0 pi0_eq])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. n \<le> N
 2. contour_integral (subpath 0 (real n / real N) g) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f = contour_integral (subpath 0 (real (Suc n) / real N) g) f
 3. contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = - contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f
[PROOF STEP]
show "contour_integral (subpath 0 (n/N) g) f +
                  contour_integral (subpath (n/N) ((Suc n) / N) g) f =
                  contour_integral (subpath 0 ((Suc n) / N) g) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) g) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f = contour_integral (subpath 0 (real (Suc n) / real N) g) f
[PROOF STEP]
using Suc.prems contour_integral_subpath_combine fpa(1) g
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N
\<lbrakk>?f contour_integrable_on ?g; valid_path ?g; ?u \<in> {0..1}; ?v \<in> {0..1}; ?w \<in> {0..1}\<rbrakk> \<Longrightarrow> contour_integral (subpath ?u ?v ?g) ?f + contour_integral (subpath ?v ?w ?g) ?f = contour_integral (subpath ?u ?w ?g) ?f
f contour_integrable_on g
valid_path g

goal (1 subgoal):
 1. contour_integral (subpath 0 (real n / real N) g) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f = contour_integral (subpath 0 (real (Suc n) / real N) g) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) g) f + contour_integral (subpath (real n / real N) (real (Suc n) / real N) g) f = contour_integral (subpath 0 (real (Suc n) / real N) g) f

goal (2 subgoals):
 1. n \<le> N
 2. contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = - contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f
[PROOF STEP]
show "contour_integral (linepath (h (n/N)) (g (n/N))) f = - contour_integral (linepath (g (n/N)) (h (n/N))) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = - contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f
[PROOF STEP]
by (metis contour_integral_unique fpa3 has_contour_integral_integral has_contour_integral_reverse_linepath)
[PROOF STATE]
proof (state)
this:
contour_integral (linepath (h (real n / real N)) (g (real n / real N))) f = - contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f

goal (1 subgoal):
 1. n \<le> N
[PROOF STEP]
qed (use Suc.prems in auto)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real (Suc n) / real N) h) f - contour_integral (subpath 0 (real (Suc n) / real N) g) f = contour_integral (linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))) f - contour_integral (linepath (g 0) (h 0)) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
contour_integral (subpath 0 (real n / real N) h) f - contour_integral (subpath 0 (real n / real N) g) f = contour_integral (linepath (g (real n / real N)) (h (real n / real N))) f - contour_integral (linepath (g 0) (h 0)) f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?n2 \<le> N \<Longrightarrow> contour_integral (subpath 0 (real ?n2 / real N) h) f - contour_integral (subpath 0 (real ?n2 / real N) g) f = contour_integral (linepath (g (real ?n2 / real N)) (h (real ?n2 / real N))) f - contour_integral (linepath (g 0) (h 0)) f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
note ind = this
[PROOF STATE]
proof (state)
this:
?n2 \<le> N \<Longrightarrow> contour_integral (subpath 0 (real ?n2 / real N) h) f - contour_integral (subpath 0 (real ?n2 / real N) g) f = contour_integral (linepath (g (real ?n2 / real N)) (h (real ?n2 / real N))) f - contour_integral (linepath (g 0) (h 0)) f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
have "contour_integral h f = contour_integral g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral h f = contour_integral g f
[PROOF STEP]
using ind [OF order_refl] N joins
[PROOF STATE]
proof (prove)
using this:
contour_integral (subpath 0 (real N / real N) h) f - contour_integral (subpath 0 (real N / real N) g) f = contour_integral (linepath (g (real N / real N)) (h (real N / real N))) f - contour_integral (linepath (g 0) (h 0)) f
0 < N
inverse (real N) < d
linked_paths atends g h

goal (1 subgoal):
 1. contour_integral h f = contour_integral g f
[PROOF STEP]
by (simp add: linked_paths_def pathstart_def pathfinish_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
contour_integral h f = contour_integral g f

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?f2 holomorphic_on S \<Longrightarrow> contour_integral h ?f2 = contour_integral g ?f2

goal (1 subgoal):
 1. \<And>g h. \<lbrakk>valid_path g; valid_path h; \<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3 \<and> cmod (h t - p t) < e / 3; linked_paths atends g h\<rbrakk> \<Longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
path_image g \<subseteq> S
path_image h \<subseteq> S
?f2 holomorphic_on S \<Longrightarrow> contour_integral h ?f2 = contour_integral g ?f2
[PROOF STEP]
show "path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)"
[PROOF STATE]
proof (prove)
using this:
path_image g \<subseteq> S
path_image h \<subseteq> S
?f2 holomorphic_on S \<Longrightarrow> contour_integral h ?f2 = contour_integral g ?f2

goal (1 subgoal):
 1. path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>g h. valid_path g \<and> valid_path h \<and> (\<forall>t\<in>{0..1}. cmod (g t - p t) < d \<and> cmod (h t - p t) < d) \<and> linked_paths atends g h \<longrightarrow> path_image g \<subseteq> S \<and> path_image h \<subseteq> S \<and> (\<forall>f. f holomorphic_on S \<longrightarrow> contour_integral h f = contour_integral g f)

goal:
No subgoals!
[PROOF STEP]
qed