src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy
author paulson <lp15@cam.ac.uk>
Tue, 28 Jul 2015 16:16:13 +0100
changeset 60809 457abb82fb9e
child 61104 3c2d4636cebc
permissions -rw-r--r--
the Cauchy integral theorem and related material
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60809
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     1
section \<open>Complex path integrals and Cauchy's integral theorem\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     3
theory Cauchy_Integral_Thm
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     4
imports Complex_Transcendental Path_Connected
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     5
begin
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     6
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     7
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     8
definition piecewise_differentiable_on
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     9
           (infixr "piecewise'_differentiable'_on" 50)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
  where "f piecewise_differentiable_on i  \<equiv>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    11
           continuous_on i f \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    12
           (\<exists>s. finite s \<and> (\<forall>x \<in> i - s. f differentiable (at x)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    13
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
lemma piecewise_differentiable_on_imp_continuous_on:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    15
    "f piecewise_differentiable_on s \<Longrightarrow> continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
by (simp add: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    17
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    18
lemma piecewise_differentiable_on_subset:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
    "f piecewise_differentiable_on s \<Longrightarrow> t \<le> s \<Longrightarrow> f piecewise_differentiable_on t"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
  using continuous_on_subset
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    21
  by (fastforce simp: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    23
lemma differentiable_on_imp_piecewise_differentiable:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    24
  fixes a:: "'a::{linorder_topology,real_normed_vector}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    25
  shows "f differentiable_on {a..b} \<Longrightarrow> f piecewise_differentiable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    26
  apply (simp add: piecewise_differentiable_on_def differentiable_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
  apply (rule_tac x="{a,b}" in exI, simp)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    28
  by (metis DiffE atLeastAtMost_diff_ends differentiable_on_subset subsetI
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    29
        differentiable_on_eq_differentiable_at open_greaterThanLessThan)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    30
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    31
lemma differentiable_imp_piecewise_differentiable:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    32
    "(\<And>x. x \<in> s \<Longrightarrow> f differentiable (at x))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
         \<Longrightarrow> f piecewise_differentiable_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    34
by (auto simp: piecewise_differentiable_on_def differentiable_on_eq_differentiable_at
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
               differentiable_imp_continuous_within continuous_at_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    37
lemma piecewise_differentiable_compose:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    38
    "\<lbrakk>f piecewise_differentiable_on s; g piecewise_differentiable_on (f ` s);
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    39
      \<And>x. finite (s \<inter> f-`{x})\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    40
      \<Longrightarrow> (g o f) piecewise_differentiable_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
  apply (simp add: piecewise_differentiable_on_def, safe)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    42
  apply (blast intro: continuous_on_compose2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
  apply (rename_tac A B)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    44
  apply (rule_tac x="A \<union> (\<Union>x\<in>B. s \<inter> f-`{x})" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    45
  using differentiable_chain_at by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
lemma piecewise_differentiable_affine:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    48
  fixes m::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    49
  assumes "f piecewise_differentiable_on ((\<lambda>x. m *\<^sub>R x + c) ` s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    50
  shows "(f o (\<lambda>x. m *\<^sub>R x + c)) piecewise_differentiable_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    51
proof (cases "m = 0")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    52
  case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    53
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    54
    unfolding o_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    55
    by (force intro: differentiable_imp_piecewise_differentiable differentiable_const)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    56
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    58
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    59
    apply (rule piecewise_differentiable_compose [OF differentiable_imp_piecewise_differentiable])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    60
    apply (rule assms derivative_intros | simp add: False vimage_def real_vector_affinity_eq)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    61
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    62
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    63
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    64
lemma piecewise_differentiable_cases:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    65
  fixes c::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    66
  assumes "f piecewise_differentiable_on {a..c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    67
          "g piecewise_differentiable_on {c..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    68
           "a \<le> c" "c \<le> b" "f c = g c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    69
  shows "(\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    70
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    71
  obtain s t where st: "finite s" "finite t"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    72
                       "\<forall>x\<in>{a..c} - s. f differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    73
                       "\<forall>x\<in>{c..b} - t. g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    74
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    75
    by (auto simp: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    76
  have "continuous_on {a..c} f" "continuous_on {c..b} g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    77
    using assms piecewise_differentiable_on_def by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
  then have "continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
    using continuous_on_cases [OF closed_real_atLeastAtMost [of a c],
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    80
                               OF closed_real_atLeastAtMost [of c b],
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    81
                               of f g "\<lambda>x. x\<le>c"]  assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    82
    by (force simp: ivl_disj_un_two_touch)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    83
  moreover
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    84
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
    assume x: "x \<in> {a..b} - insert c (s \<union> t)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    86
    have "(\<lambda>x. if x \<le> c then f x else g x) differentiable at x" (is "?diff_fg")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    87
    proof (cases x c rule: le_cases)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
      case le show ?diff_fg
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    89
        apply (rule differentiable_transform_at [of "dist x c" _ f])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    90
        using dist_nz x dist_real_def le st x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
        apply auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    92
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    93
    next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    94
      case ge show ?diff_fg
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    95
        apply (rule differentiable_transform_at [of "dist x c" _ g])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    96
        using dist_nz x dist_real_def ge st x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    97
        apply auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    98
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    99
    qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   100
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
  then have "\<exists>s. finite s \<and> (\<forall>x\<in>{a..b} - s. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   102
    using st
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   103
    by (metis (full_types) finite_Un finite_insert)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   105
    by (simp add: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   106
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   107
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   108
lemma piecewise_differentiable_neg:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
    "f piecewise_differentiable_on s \<Longrightarrow> (\<lambda>x. -(f x)) piecewise_differentiable_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   110
  by (auto simp: piecewise_differentiable_on_def continuous_on_minus)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   111
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
lemma piecewise_differentiable_add:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
  assumes "f piecewise_differentiable_on i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   114
          "g piecewise_differentiable_on i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   115
    shows "(\<lambda>x. f x + g x) piecewise_differentiable_on i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   117
  obtain s t where st: "finite s" "finite t"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
                       "\<forall>x\<in>i - s. f differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
                       "\<forall>x\<in>i - t. g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   120
    using assms by (auto simp: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
  then have "finite (s \<union> t) \<and> (\<forall>x\<in>i - (s \<union> t). (\<lambda>x. f x + g x) differentiable at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   122
    by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
  moreover have "continuous_on i f" "continuous_on i g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   124
    using assms piecewise_differentiable_on_def by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   125
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
    by (auto simp: piecewise_differentiable_on_def continuous_on_add)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   129
lemma piecewise_differentiable_diff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   130
    "\<lbrakk>f piecewise_differentiable_on s;  g piecewise_differentiable_on s\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   131
     \<Longrightarrow> (\<lambda>x. f x - g x) piecewise_differentiable_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   132
  unfolding diff_conv_add_uminus
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
  by (metis piecewise_differentiable_add piecewise_differentiable_neg)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   134
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   135
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
subsection \<open>Valid paths, and their start and finish\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
lemma Diff_Un_eq: "A - (B \<union> C) = A - B - C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
  by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   140
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   141
definition valid_path :: "(real \<Rightarrow> 'a :: real_normed_vector) \<Rightarrow> bool"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   142
  where "valid_path f \<equiv> f piecewise_differentiable_on {0..1::real}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   143
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   144
definition closed_path :: "(real \<Rightarrow> 'a :: real_normed_vector) \<Rightarrow> bool"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   145
  where "closed_path g \<equiv> g 0 = g 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   146
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   147
lemma valid_path_compose:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   148
  assumes "valid_path g" "f differentiable_on (path_image g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   149
  shows "valid_path (f o g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   151
  { fix s :: "real set"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   152
    assume df: "f differentiable_on g ` {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   153
       and cg: "continuous_on {0..1} g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   154
       and s: "finite s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   155
       and dg: "\<And>x. x\<in>{0..1} - s \<Longrightarrow> g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   156
    have dfo: "f differentiable_on g ` {0<..<1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
      by (auto intro: differentiable_on_subset [OF df])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   158
    have *: "\<And>x. x \<in> {0<..<1} \<Longrightarrow> x \<notin> s \<Longrightarrow> (f o g) differentiable (at x within ({0<..<1} - s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   159
      apply (rule differentiable_chain_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   160
      apply (simp_all add: dg differentiable_at_withinI differentiable_chain_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
      using df
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
      apply (force simp: differentiable_on_def elim: Deriv.differentiable_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
    have oo: "open ({0<..<1} - s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
      by (simp add: finite_imp_closed open_Diff s)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
    have "\<exists>s. finite s \<and> (\<forall>x\<in>{0..1} - s. f \<circ> g differentiable at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
      apply (rule_tac x="{0,1} Un s" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   168
      apply (simp add: Diff_Un_eq atLeastAtMost_diff_ends s del: Set.Un_insert_left, clarify)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
      apply (rule differentiable_within_open [OF _ oo, THEN iffD1])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
      apply (auto simp: *)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
      done }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   172
  with assms show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   173
    by (clarsimp simp: valid_path_def piecewise_differentiable_on_def continuous_on_compose
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
                       differentiable_imp_continuous_on path_image_def   simp del: o_apply)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
subsubsection\<open>In particular, all results for paths apply\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
lemma valid_path_imp_path: "valid_path g \<Longrightarrow> path g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
by (simp add: path_def piecewise_differentiable_on_def valid_path_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   182
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
lemma connected_valid_path_image: "valid_path g \<Longrightarrow> connected(path_image g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
  by (metis connected_path_image valid_path_imp_path)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
lemma compact_valid_path_image: "valid_path g \<Longrightarrow> compact(path_image g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   187
  by (metis compact_path_image valid_path_imp_path)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   188
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   189
lemma bounded_valid_path_image: "valid_path g \<Longrightarrow> bounded(path_image g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
  by (metis bounded_path_image valid_path_imp_path)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   191
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   192
lemma closed_valid_path_image: "valid_path g \<Longrightarrow> closed(path_image g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   193
  by (metis closed_path_image valid_path_imp_path)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   194
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   195
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   196
subsection\<open>Contour Integrals along a path\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   197
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   198
text\<open>This definition is for complex numbers only, and does not generalise to line integrals in a vector field\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   199
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   200
text\<open>= piecewise differentiable function on [0,1]\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   201
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   202
definition has_path_integral :: "(complex \<Rightarrow> complex) \<Rightarrow> complex \<Rightarrow> (real \<Rightarrow> complex) \<Rightarrow> bool"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   203
           (infixr "has'_path'_integral" 50)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
  where "(f has_path_integral i) g \<equiv>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   205
           ((\<lambda>x. f(g x) * vector_derivative g (at x within {0..1}))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   206
            has_integral i) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   207
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   208
definition path_integrable_on
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   209
           (infixr "path'_integrable'_on" 50)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   210
  where "f path_integrable_on g \<equiv> \<exists>i. (f has_path_integral i) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   211
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   212
definition path_integral
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   213
  where "path_integral g f \<equiv> @i. (f has_path_integral i) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   214
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   215
lemma path_integral_unique: "(f has_path_integral i)  g \<Longrightarrow> path_integral g f = i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   216
  by (auto simp: path_integral_def has_path_integral_def integral_def [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   217
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   218
lemma has_path_integral_integral:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   219
    "f path_integrable_on i \<Longrightarrow> (f has_path_integral (path_integral i f)) i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   220
  by (metis path_integral_unique path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   221
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   222
lemma has_path_integral_unique:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   223
    "(f has_path_integral i) g \<Longrightarrow> (f has_path_integral j) g \<Longrightarrow> i = j"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   224
  using has_integral_unique
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   225
  by (auto simp: has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   226
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   227
lemma has_path_integral_integrable: "(f has_path_integral i) g \<Longrightarrow> f path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   228
  using path_integrable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   229
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   230
(* Show that we can forget about the localized derivative.*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   231
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   232
lemma vector_derivative_within_interior:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   233
     "\<lbrakk>x \<in> interior s; NO_MATCH UNIV s\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   234
      \<Longrightarrow> vector_derivative f (at x within s) = vector_derivative f (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   235
  apply (simp add: vector_derivative_def has_vector_derivative_def has_derivative_def netlimit_within_interior)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   236
  apply (subst lim_within_interior, auto)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   237
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   238
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   239
lemma has_integral_localized_vector_derivative:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   240
    "((\<lambda>x. f (g x) * vector_derivative g (at x within {a..b})) has_integral i) {a..b} \<longleftrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   241
     ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral i) {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   242
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   243
  have "{a..b} - {a,b} = interior {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   244
    by (simp add: atLeastAtMost_diff_ends)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   245
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   246
    apply (rule has_integral_spike_eq [of "{a,b}"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   247
    apply (auto simp: vector_derivative_within_interior)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   248
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   249
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   250
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   251
lemma integrable_on_localized_vector_derivative:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
    "(\<lambda>x. f (g x) * vector_derivative g (at x within {a..b})) integrable_on {a..b} \<longleftrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   253
     (\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   254
  by (simp add: integrable_on_def has_integral_localized_vector_derivative)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   255
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   256
lemma has_path_integral:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   257
     "(f has_path_integral i) g \<longleftrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   258
      ((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral i) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   259
  by (simp add: has_integral_localized_vector_derivative has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   260
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   261
lemma path_integrable_on:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   262
     "f path_integrable_on g \<longleftrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   263
      (\<lambda>t. f(g t) * vector_derivative g (at t)) integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   264
  by (simp add: has_path_integral integrable_on_def path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   265
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
subsection\<open>Reversing a path\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   267
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   268
lemma valid_path_imp_reverse:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   269
  assumes "valid_path g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   270
    shows "valid_path(reversepath g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   271
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   272
  obtain s where "finite s" "\<forall>x\<in>{0..1} - s. g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   273
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   274
  then have "finite (op - 1 ` s)" "(\<forall>x\<in>{0..1} - op - 1 ` s. reversepath g differentiable at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   275
    apply (auto simp: reversepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   276
    apply (rule differentiable_chain_at [of "\<lambda>x::real. 1-x" _ g, unfolded o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   277
    using image_iff
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   278
    apply fastforce+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   279
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   280
  then show ?thesis using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   281
    by (auto simp: valid_path_def piecewise_differentiable_on_def path_def [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   282
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   283
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   284
lemma valid_path_reversepath: "valid_path(reversepath g) \<longleftrightarrow> valid_path g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   285
  using valid_path_imp_reverse by force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   286
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   287
lemma has_path_integral_reversepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   288
  assumes "valid_path g" "(f has_path_integral i) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   289
    shows "(f has_path_integral (-i)) (reversepath g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   290
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   291
  { fix s x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   292
    assume xs: "\<forall>x\<in>{0..1} - s. g differentiable at x" "x \<notin> op - 1 ` s" "0 \<le> x" "x \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   293
      have "vector_derivative (\<lambda>x. g (1 - x)) (at x within {0..1}) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   294
            - vector_derivative g (at (1 - x) within {0..1})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   295
      proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   296
        obtain f' where f': "(g has_vector_derivative f') (at (1 - x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   297
          using xs
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   298
          apply (drule_tac x="1-x" in bspec)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   299
          apply (simp_all add: has_vector_derivative_def differentiable_def, force)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   300
          apply (blast elim!: linear_imp_scaleR dest: has_derivative_linear)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   301
          done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   302
        have "(g o (\<lambda>x. 1 - x) has_vector_derivative -1 *\<^sub>R f') (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   303
          apply (rule vector_diff_chain_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   304
          apply (intro vector_diff_chain_within derivative_eq_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   305
          apply (rule has_vector_derivative_at_within [OF f'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
          done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   307
        then have mf': "((\<lambda>x. g (1 - x)) has_vector_derivative -f') (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   308
          by (simp add: o_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
        show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   310
          using xs
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   311
          by (auto simp: vector_derivative_at_within_ivl [OF mf'] vector_derivative_at_within_ivl [OF f'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   312
      qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
  } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   314
  have 01: "{0..1::real} = cbox 0 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
    by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   316
  show ?thesis using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   317
    apply (auto simp: has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   318
    apply (drule has_integral_affinity01 [where m= "-1" and c=1])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   319
    apply (auto simp: reversepath_def valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   320
    apply (drule has_integral_neg)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   321
    apply (rule_tac s = "(\<lambda>x. 1 - x) ` s" in has_integral_spike_finite)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   322
    apply (auto simp: *)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   323
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   325
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   326
lemma path_integrable_reversepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   327
    "valid_path g \<Longrightarrow> f path_integrable_on g \<Longrightarrow> f path_integrable_on (reversepath g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   328
  using has_path_integral_reversepath path_integrable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   329
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   330
lemma path_integrable_reversepath_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   331
    "valid_path g \<Longrightarrow> (f path_integrable_on (reversepath g) \<longleftrightarrow> f path_integrable_on g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   332
  using path_integrable_reversepath valid_path_reversepath by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   333
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   334
lemma path_integral_reversepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   335
    "\<lbrakk>valid_path g; f path_integrable_on g\<rbrakk> \<Longrightarrow> path_integral (reversepath g) f = -(path_integral g f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   336
  using has_path_integral_reversepath path_integrable_on_def path_integral_unique by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   337
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   338
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   339
subsection\<open>Joining two paths together\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   340
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   341
lemma valid_path_join:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   342
  assumes "valid_path g1" "valid_path g2" "pathfinish g1 = pathstart g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   343
    shows "valid_path(g1 +++ g2)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   344
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   345
  have "g1 1 = g2 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   346
    using assms by (auto simp: pathfinish_def pathstart_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   347
  moreover have "(g1 o (\<lambda>x. 2*x)) piecewise_differentiable_on {0..1/2}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   348
    apply (rule piecewise_differentiable_compose)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   349
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   350
    apply (auto simp: valid_path_def piecewise_differentiable_on_def continuous_on_joinpaths)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   351
    apply (rule continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   352
    apply (force intro: finite_vimageI [where h = "op*2"] inj_onI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   353
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   354
  moreover have "(g2 o (\<lambda>x. 2*x-1)) piecewise_differentiable_on {1/2..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   355
    apply (rule piecewise_differentiable_compose)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   356
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   357
    apply (auto simp: valid_path_def piecewise_differentiable_on_def continuous_on_joinpaths)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   358
    apply (rule continuous_intros | simp add: image_affinity_atLeastAtMost_diff)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   359
    apply (force intro: finite_vimageI [where h = "(\<lambda>x. 2*x - 1)"] inj_onI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   361
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   362
    apply (simp only: valid_path_def continuous_on_joinpaths joinpaths_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   363
    apply (rule piecewise_differentiable_cases)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   364
    apply (auto simp: o_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   365
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   366
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   367
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   368
lemma continuous_on_joinpaths_D1:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   369
    "continuous_on {0..1} (g1 +++ g2) \<Longrightarrow> continuous_on {0..1} g1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   370
  apply (rule continuous_on_eq [of _ "(g1 +++ g2) o (op*(inverse 2))"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   371
  apply (simp add: joinpaths_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   372
  apply (rule continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   373
  apply (auto elim!: continuous_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   374
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   375
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   376
lemma continuous_on_joinpaths_D2:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   377
    "\<lbrakk>continuous_on {0..1} (g1 +++ g2); pathfinish g1 = pathstart g2\<rbrakk> \<Longrightarrow> continuous_on {0..1} g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   378
  apply (rule continuous_on_eq [of _ "(g1 +++ g2) o (\<lambda>x. inverse 2*x + 1/2)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   379
  apply (simp add: joinpaths_def pathfinish_def pathstart_def Ball_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   380
  apply (rule continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   381
  apply (auto elim!: continuous_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   382
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   383
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   384
lemma piecewise_differentiable_D1:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   385
    "(g1 +++ g2) piecewise_differentiable_on {0..1} \<Longrightarrow> g1 piecewise_differentiable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   386
  apply (clarsimp simp add: piecewise_differentiable_on_def continuous_on_joinpaths_D1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   387
  apply (rule_tac x="insert 1 ((op*2)`s)" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   388
  apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   389
  apply (intro ballI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   390
  apply (rule_tac d="dist (x/2) (1/2)" and f = "(g1 +++ g2) o (op*(inverse 2))" in differentiable_transform_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   391
  apply (auto simp: dist_real_def joinpaths_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   392
  apply (rule differentiable_chain_at derivative_intros | force)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   393
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   394
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   395
lemma piecewise_differentiable_D2:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   396
    "\<lbrakk>(g1 +++ g2) piecewise_differentiable_on {0..1}; pathfinish g1 = pathstart g2\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   397
    \<Longrightarrow> g2 piecewise_differentiable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   398
  apply (clarsimp simp add: piecewise_differentiable_on_def continuous_on_joinpaths_D2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   399
  apply (rule_tac x="insert 0 ((\<lambda>x. 2*x-1)`s)" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   400
  apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   401
  apply (intro ballI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   402
  apply (rule_tac d="dist ((x+1)/2) (1/2)" and f = "(g1 +++ g2) o (\<lambda>x. (x+1)/2)" in differentiable_transform_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   403
  apply (auto simp: dist_real_def joinpaths_def abs_if field_simps split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   404
  apply (rule differentiable_chain_at derivative_intros | force simp: divide_simps)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   405
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   406
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   407
lemma valid_path_join_D1: "valid_path (g1 +++ g2) \<Longrightarrow> valid_path g1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   408
  by (simp add: valid_path_def piecewise_differentiable_D1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   409
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   410
lemma valid_path_join_D2: "\<lbrakk>valid_path (g1 +++ g2); pathfinish g1 = pathstart g2\<rbrakk> \<Longrightarrow> valid_path g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   411
  by (simp add: valid_path_def piecewise_differentiable_D2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   412
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   413
lemma valid_path_join_eq [simp]:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   414
    "pathfinish g1 = pathstart g2 \<Longrightarrow> (valid_path(g1 +++ g2) \<longleftrightarrow> valid_path g1 \<and> valid_path g2)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   415
  using valid_path_join_D1 valid_path_join_D2 valid_path_join by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   416
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   417
lemma has_path_integral_join:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   418
  assumes "(f has_path_integral i1) g1" "(f has_path_integral i2) g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   419
          "valid_path g1" "valid_path g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   420
    shows "(f has_path_integral (i1 + i2)) (g1 +++ g2)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   421
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   422
  obtain s1 s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   423
    where s1: "finite s1" "\<forall>x\<in>{0..1} - s1. g1 differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   424
      and s2: "finite s2" "\<forall>x\<in>{0..1} - s2. g2 differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   425
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   426
    by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   427
  have 1: "((\<lambda>x. f (g1 x) * vector_derivative g1 (at x)) has_integral i1) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   428
   and 2: "((\<lambda>x. f (g2 x) * vector_derivative g2 (at x)) has_integral i2) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   429
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   430
    by (auto simp: has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   431
  have i1: "((\<lambda>x. (2*f (g1 (2*x))) * vector_derivative g1 (at (2*x))) has_integral i1) {0..1/2}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   432
   and i2: "((\<lambda>x. (2*f (g2 (2*x - 1))) * vector_derivative g2 (at (2*x - 1))) has_integral i2) {1/2..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   433
    using has_integral_affinity01 [OF 1, where m= 2 and c=0, THEN has_integral_cmul [where c=2]]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   434
          has_integral_affinity01 [OF 2, where m= 2 and c="-1", THEN has_integral_cmul [where c=2]]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   435
    by (simp_all only: image_affinity_atLeastAtMost_div_diff, simp_all add: scaleR_conv_of_real mult_ac)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   436
  have g1: "\<lbrakk>0 \<le> z; z*2 < 1; z*2 \<notin> s1\<rbrakk> \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   437
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at z) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   438
            2 *\<^sub>R vector_derivative g1 (at (z*2))" for z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   439
    apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "\<bar>z - 1/2\<bar>" _ "(\<lambda>x. g1(2*x))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   440
    apply (simp_all add: dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   441
    apply (rule vector_diff_chain_at [of "\<lambda>x. 2*x" 2 _ g1, simplified o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   442
    apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   443
    using s1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   444
    apply (auto simp: algebra_simps vector_derivative_works)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   445
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   446
  have g2: "\<lbrakk>1 < z*2; z \<le> 1; z*2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   447
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at z) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   448
            2 *\<^sub>R vector_derivative g2 (at (z*2 - 1))" for z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   449
    apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "\<bar>z - 1/2\<bar>" _ "(\<lambda>x. g2 (2*x - 1))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   450
    apply (simp_all add: dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   451
    apply (rule vector_diff_chain_at [of "\<lambda>x. 2*x - 1" 2 _ g2, simplified o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   452
    apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   453
    using s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   454
    apply (auto simp: algebra_simps vector_derivative_works)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   455
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   456
  have "((\<lambda>x. f ((g1 +++ g2) x) * vector_derivative (g1 +++ g2) (at x)) has_integral i1) {0..1/2}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   457
    apply (rule has_integral_spike_finite [OF _ _ i1, of "insert (1/2) (op*2 -` s1)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   458
    using s1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   459
    apply (force intro: finite_vimageI [where h = "op*2"] inj_onI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   460
    apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   461
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   462
  moreover have "((\<lambda>x. f ((g1 +++ g2) x) * vector_derivative (g1 +++ g2) (at x)) has_integral i2) {1/2..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   463
    apply (rule has_integral_spike_finite [OF _ _ i2, of "insert (1/2) ((\<lambda>x. 2*x-1) -` s2)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   464
    using s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   465
    apply (force intro: finite_vimageI [where h = "\<lambda>x. 2*x-1"] inj_onI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   466
    apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   467
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   468
  ultimately
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   469
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   470
    apply (simp add: has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   471
    apply (rule has_integral_combine [where c = "1/2"], auto)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   472
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   473
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   474
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   475
lemma path_integrable_joinI:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   476
  assumes "f path_integrable_on g1" "f path_integrable_on g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   477
          "valid_path g1" "valid_path g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   478
    shows "f path_integrable_on (g1 +++ g2)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   479
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   480
  by (meson has_path_integral_join path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   481
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   482
lemma path_integrable_joinD1:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   483
  assumes "f path_integrable_on (g1 +++ g2)" "valid_path g1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   484
    shows "f path_integrable_on g1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   485
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
  obtain s1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   487
    where s1: "finite s1" "\<forall>x\<in>{0..1} - s1. g1 differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   488
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   489
  have "(\<lambda>x. f ((g1 +++ g2) (x/2)) * vector_derivative (g1 +++ g2) (at (x/2))) integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   490
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
    apply (auto simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
    apply (drule integrable_on_subcbox [where a=0 and b="1/2"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   493
    apply (auto intro: integrable_affinity [of _ 0 "1/2::real" "1/2" 0, simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
  then have *: "(\<lambda>x. (f ((g1 +++ g2) (x/2))/2) * vector_derivative (g1 +++ g2) (at (x/2))) integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   496
    by (force dest: integrable_cmul [where c="1/2"] simp: scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   497
  have g1: "\<lbrakk>0 < z; z < 1; z \<notin> s1\<rbrakk> \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   498
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at (z/2)) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   499
            2 *\<^sub>R vector_derivative g1 (at z)"  for z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   500
    apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "\<bar>(z-1)/2\<bar>" _ "(\<lambda>x. g1(2*x))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
    apply (simp_all add: field_simps dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
    apply (rule vector_diff_chain_at [of "\<lambda>x. x*2" 2 _ g1, simplified o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   503
    using s1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   504
    apply (auto simp: vector_derivative_works has_vector_derivative_def has_derivative_def bounded_linear_mult_left)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   505
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   506
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   507
    using s1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   508
    apply (auto simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   509
    apply (rule integrable_spike_finite [of "{0,1} \<union> s1", OF _ _ *])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   510
    apply (auto simp: joinpaths_def scaleR_conv_of_real g1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   512
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   513
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   514
lemma path_integrable_joinD2: (*FIXME: could combine these proofs*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   515
  assumes "f path_integrable_on (g1 +++ g2)" "valid_path g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   516
    shows "f path_integrable_on g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
  obtain s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   519
    where s2: "finite s2" "\<forall>x\<in>{0..1} - s2. g2 differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   520
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   521
  have "(\<lambda>x. f ((g1 +++ g2) (x/2 + 1/2)) * vector_derivative (g1 +++ g2) (at (x/2 + 1/2))) integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   522
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   523
    apply (auto simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   524
    apply (drule integrable_on_subcbox [where a="1/2" and b=1], auto)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
    apply (drule integrable_affinity [of _ "1/2::real" 1 "1/2" "1/2", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   526
    apply (simp add: image_affinity_atLeastAtMost_diff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   527
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   528
  then have *: "(\<lambda>x. (f ((g1 +++ g2) (x/2 + 1/2))/2) * vector_derivative (g1 +++ g2) (at (x/2 + 1/2)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
                integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   530
    by (auto dest: integrable_cmul [where c="1/2"] simp: scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   531
  have g2: "\<lbrakk>0 < z; z < 1; z \<notin> s2\<rbrakk> \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   532
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at (z/2+1/2)) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   533
            2 *\<^sub>R vector_derivative g2 (at z)" for z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   534
    apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "\<bar>z/2\<bar>" _ "(\<lambda>x. g2(2*x-1))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
    apply (simp_all add: field_simps dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
    apply (rule vector_diff_chain_at [of "\<lambda>x. x*2-1" 2 _ g2, simplified o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   537
    using s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   538
    apply (auto simp: has_vector_derivative_def has_derivative_def bounded_linear_mult_left
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   539
                      vector_derivative_works add_divide_distrib)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   541
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   542
    using s2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   543
    apply (auto simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
    apply (rule integrable_spike_finite [of "{0,1} \<union> s2", OF _ _ *])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
    apply (auto simp: joinpaths_def scaleR_conv_of_real g2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   546
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   547
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   548
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   549
lemma path_integrable_join [simp]:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   550
  shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   551
    "\<lbrakk>valid_path g1; valid_path g2\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   552
     \<Longrightarrow> f path_integrable_on (g1 +++ g2) \<longleftrightarrow> f path_integrable_on g1 \<and> f path_integrable_on g2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   553
using path_integrable_joinD1 path_integrable_joinD2 path_integrable_joinI by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   554
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
lemma path_integral_join [simp]:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   556
  shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   557
    "\<lbrakk>f path_integrable_on g1; f path_integrable_on g2; valid_path g1; valid_path g2\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
        \<Longrightarrow> path_integral (g1 +++ g2) f = path_integral g1 f + path_integral g2 f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   559
  by (simp add: has_path_integral_integral has_path_integral_join path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   561
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   562
subsection\<open>Shifting the starting point of a (closed) path\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
lemma shiftpath_alt_def: "shiftpath a f = (\<lambda>x. if x \<le> 1-a then f (a + x) else f (a + x - 1))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   565
  by (auto simp: shiftpath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   566
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   567
lemma valid_path_shiftpath [intro]:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   568
  assumes "valid_path g" "pathfinish g = pathstart g" "a \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   569
    shows "valid_path(shiftpath a g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   570
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   571
  apply (auto simp: valid_path_def shiftpath_alt_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
  apply (rule piecewise_differentiable_cases)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   573
  apply (auto simp: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   574
  apply (rule piecewise_differentiable_affine [of g 1 a, simplified o_def scaleR_one])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
  apply (auto simp: pathfinish_def pathstart_def elim: piecewise_differentiable_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   576
  apply (rule piecewise_differentiable_affine [of g 1 "a-1", simplified o_def scaleR_one algebra_simps])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   577
  apply (auto simp: pathfinish_def pathstart_def elim: piecewise_differentiable_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   578
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   579
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   580
lemma has_path_integral_shiftpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   581
  assumes f: "(f has_path_integral i) g" "valid_path g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   582
      and a: "a \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   583
    shows "(f has_path_integral i) (shiftpath a g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   584
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
  obtain s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   586
    where s: "finite s" and g: "\<forall>x\<in>{0..1} - s. g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   588
  have *: "((\<lambda>x. f (g x) * vector_derivative g (at x)) has_integral i) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   589
    using assms by (auto simp: has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   590
  then have i: "i = integral {a..1} (\<lambda>x. f (g x) * vector_derivative g (at x)) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   591
                    integral {0..a} (\<lambda>x. f (g x) * vector_derivative g (at x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   592
    apply (rule has_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   593
    apply (subst add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   594
    apply (subst Integration.integral_combine)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   595
    using assms * integral_unique by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   596
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   597
    have "0 \<le> x \<Longrightarrow> x + a < 1 \<Longrightarrow> x \<notin> (\<lambda>x. x - a) ` s \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   598
         vector_derivative (shiftpath a g) (at x) = vector_derivative g (at (x + a))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   599
      unfolding shiftpath_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   600
      apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "dist(1-a) x" _ "(\<lambda>x. g(a+x))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   601
        apply (auto simp: field_simps dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   602
      apply (rule vector_diff_chain_at [of "\<lambda>x. x+a" 1 _ g, simplified o_def scaleR_one])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   603
       apply (intro derivative_eq_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   604
      using g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   605
       apply (drule_tac x="x+a" in bspec)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   606
      using a apply (auto simp: has_vector_derivative_def vector_derivative_works image_def add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   607
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   608
  } note vd1 = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   609
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   610
    have "1 < x + a \<Longrightarrow> x \<le> 1 \<Longrightarrow> x \<notin> (\<lambda>x. x - a + 1) ` s \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   611
          vector_derivative (shiftpath a g) (at x) = vector_derivative g (at (x + a - 1))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   612
      unfolding shiftpath_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   613
      apply (rule vector_derivative_at [OF has_vector_derivative_transform_at [of "dist (1-a) x" _ "(\<lambda>x. g(a+x-1))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   614
        apply (auto simp: field_simps dist_real_def abs_if split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
      apply (rule vector_diff_chain_at [of "\<lambda>x. x+a-1" 1 _ g, simplified o_def scaleR_one])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
       apply (intro derivative_eq_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   617
      using g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
      apply (drule_tac x="x+a-1" in bspec)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   619
      using a apply (auto simp: has_vector_derivative_def vector_derivative_works image_def add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   621
  } note vd2 = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   622
  have va1: "(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on ({a..1})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   623
    using * a   by (fastforce intro: integrable_subinterval_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   624
  have v0a: "(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on ({0..a})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
    apply (rule integrable_subinterval_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   626
    using * a by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
  have "((\<lambda>x. f (shiftpath a g x) * vector_derivative (shiftpath a g) (at x))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   628
        has_integral  integral {a..1} (\<lambda>x. f (g x) * vector_derivative g (at x)))  {0..1 - a}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   629
    apply (rule has_integral_spike_finite
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
             [where s = "{1-a} \<union> (\<lambda>x. x-a) ` s" and f = "\<lambda>x. f(g(a+x)) * vector_derivative g (at(a+x))"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
      using s apply blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   632
     using a apply (auto simp: algebra_simps vd1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   633
     apply (force simp: shiftpath_def add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   634
    using has_integral_affinity [where m=1 and c=a, simplified, OF integrable_integral [OF va1]]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
    apply (simp add: image_affinity_atLeastAtMost_diff [where m=1 and c=a, simplified] add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   636
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   637
  moreover
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
  have "((\<lambda>x. f (shiftpath a g x) * vector_derivative (shiftpath a g) (at x))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
        has_integral  integral {0..a} (\<lambda>x. f (g x) * vector_derivative g (at x)))  {1 - a..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
    apply (rule has_integral_spike_finite
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
             [where s = "{1-a} \<union> (\<lambda>x. x-a+1) ` s" and f = "\<lambda>x. f(g(a+x-1)) * vector_derivative g (at(a+x-1))"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
      using s apply blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   643
     using a apply (auto simp: algebra_simps vd2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
     apply (force simp: shiftpath_def add.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
    using has_integral_affinity [where m=1 and c="a-1", simplified, OF integrable_integral [OF v0a]]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
    apply (simp add: image_affinity_atLeastAtMost [where m=1 and c="1-a", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
    apply (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   648
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   649
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   650
    using a
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   651
    by (auto simp: i has_path_integral intro: has_integral_combine [where c = "1-a"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   652
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   654
lemma has_path_integral_shiftpath_D:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   655
  assumes "(f has_path_integral i) (shiftpath a g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
          "valid_path g" "pathfinish g = pathstart g" "a \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
    shows "(f has_path_integral i) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   658
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
  obtain s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
    where s: "finite s" and g: "\<forall>x\<in>{0..1} - s. g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
    assume x: "0 < x" "x < 1" "x \<notin> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
    then have gx: "g differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   665
      using g by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   666
    have "vector_derivative g (at x within {0..1}) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   667
          vector_derivative (shiftpath (1 - a) (shiftpath a g)) (at x within {0..1})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   668
      apply (rule vector_derivative_at_within_ivl
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
                  [OF has_vector_derivative_transform_within_open
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   670
                      [of "{0<..<1}-s" _ "(shiftpath (1 - a) (shiftpath a g))"]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   671
      using s g assms x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   672
      apply (auto simp: finite_imp_closed open_Diff shiftpath_shiftpath
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   673
                        vector_derivative_within_interior vector_derivative_works [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   674
      apply (rule Derivative.differentiable_transform_at [of "min x (1-x)", OF _ _ gx])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   675
      apply (auto simp: dist_real_def shiftpath_shiftpath abs_if)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   676
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   677
  } note vd = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   678
  have fi: "(f has_path_integral i) (shiftpath (1 - a) (shiftpath a g))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   679
    using assms  by (auto intro!: has_path_integral_shiftpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   680
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   681
    apply (simp add: has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   682
    apply (rule has_integral_spike_finite [of "{0,1} \<union> s", OF _ _  fi [unfolded has_path_integral_def]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   683
    using s assms vd
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   684
    apply (auto simp: Path_Connected.shiftpath_shiftpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   685
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   686
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   687
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   688
lemma has_path_integral_shiftpath_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   689
  assumes "valid_path g" "pathfinish g = pathstart g" "a \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   690
    shows "(f has_path_integral i) (shiftpath a g) \<longleftrightarrow> (f has_path_integral i) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   691
  using assms has_path_integral_shiftpath has_path_integral_shiftpath_D by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   692
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   693
lemma path_integral_shiftpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   694
  assumes "valid_path g" "pathfinish g = pathstart g" "a \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   695
    shows "path_integral (shiftpath a g) f = path_integral g f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   696
   using assms by (simp add: path_integral_def has_path_integral_shiftpath_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   697
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   698
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   699
subsection\<open>More about straight-line paths\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   700
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   701
lemma has_vector_derivative_linepath_within:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   702
    "(linepath a b has_vector_derivative (b - a)) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   703
apply (simp add: linepath_def has_vector_derivative_def algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   704
apply (rule derivative_eq_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   705
done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   706
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   707
lemma valid_path_linepath [iff]: "valid_path (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   708
  apply (simp add: valid_path_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   709
  apply (rule differentiable_on_imp_piecewise_differentiable)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   710
  apply (simp add: differentiable_on_def differentiable_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   711
  using has_vector_derivative_def has_vector_derivative_linepath_within by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   712
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   713
lemma vector_derivative_linepath_within:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   714
    "x \<in> {0..1} \<Longrightarrow> vector_derivative (linepath a b) (at x within {0..1}) = b - a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   715
  apply (rule vector_derivative_within_closed_interval [of 0 "1::real", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   716
  apply (auto simp: has_vector_derivative_linepath_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   717
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   718
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   719
lemma vector_derivative_linepath_at: "vector_derivative (linepath a b) (at x) = b - a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   720
  by (simp add: has_vector_derivative_linepath_within vector_derivative_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   721
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   722
lemma has_path_integral_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   723
  shows "(f has_path_integral i) (linepath a b) \<longleftrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   724
         ((\<lambda>x. f(linepath a b x) * (b - a)) has_integral i) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   725
  by (simp add: has_path_integral vector_derivative_linepath_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   726
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   727
lemma linepath_in_path:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   728
  shows "x \<in> {0..1} \<Longrightarrow> linepath a b x \<in> closed_segment a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   729
  by (auto simp: segment linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   730
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   731
lemma linepath_image_01: "linepath a b ` {0..1} = closed_segment a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   732
  by (auto simp: segment linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   733
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   734
lemma linepath_in_convex_hull:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   735
    fixes x::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   736
    assumes a: "a \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   737
        and b: "b \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   738
        and x: "0\<le>x" "x\<le>1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   739
       shows "linepath a b x \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   740
  apply (rule closed_segment_subset_convex_hull [OF a b, THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   741
  using x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   742
  apply (auto simp: linepath_image_01 [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   743
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   744
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   745
lemma Re_linepath: "Re(linepath (of_real a) (of_real b) x) = (1 - x)*a + x*b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   746
  by (simp add: linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   747
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   748
lemma Im_linepath: "Im(linepath (of_real a) (of_real b) x) = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   749
  by (simp add: linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   750
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   751
lemma linepath_of_real: "(linepath (of_real a) (of_real b) x) = of_real ((1 - x)*a + x*b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   752
  by (simp add: scaleR_conv_of_real linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   753
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   754
lemma of_real_linepath: "of_real (linepath a b x) = linepath (of_real a) (of_real b) x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   755
  by (metis linepath_of_real mult.right_neutral of_real_def real_scaleR_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   756
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   757
lemma has_path_integral_trivial [iff]: "(f has_path_integral 0) (linepath a a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   758
  by (simp add: has_path_integral_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   759
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   760
lemma path_integral_trivial [simp]: "path_integral (linepath a a) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   761
  using has_path_integral_trivial path_integral_unique by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   762
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   763
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   764
subsection\<open>Relation to subpath construction\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   765
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   766
lemma valid_path_subpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   767
  fixes g :: "real \<Rightarrow> 'a :: real_normed_vector"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   768
  assumes "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   769
    shows "valid_path(subpath u v g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   770
proof (cases "v=u")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   771
  case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   772
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   773
    by (simp add: valid_path_def subpath_def differentiable_on_def differentiable_on_imp_piecewise_differentiable)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   774
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   775
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   776
  have "(g o (\<lambda>x. ((v-u) * x + u))) piecewise_differentiable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   777
    apply (rule piecewise_differentiable_compose)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   778
      apply (simp add: differentiable_on_def differentiable_on_imp_piecewise_differentiable)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   779
     apply (simp add: image_affinity_atLeastAtMost)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   780
    using assms False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   781
    apply (auto simp: algebra_simps valid_path_def piecewise_differentiable_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   782
    apply (subst Int_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   783
    apply (auto simp: inj_on_def algebra_simps crossproduct_eq finite_vimage_IntI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   784
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   785
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   786
    by (auto simp: o_def valid_path_def subpath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   787
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   788
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   789
lemma has_path_integral_subpath_refl [iff]: "(f has_path_integral 0) (subpath u u g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   790
  by (simp add: has_path_integral subpath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   791
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   792
lemma path_integrable_subpath_refl [iff]: "f path_integrable_on (subpath u u g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   793
  using has_path_integral_subpath_refl path_integrable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   794
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   795
lemma path_integral_subpath_refl [simp]: "path_integral (subpath u u g) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   796
  by (simp add: has_path_integral_subpath_refl path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   797
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   798
lemma has_path_integral_subpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   799
  assumes f: "f path_integrable_on g" and g: "valid_path g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   800
      and uv: "u \<in> {0..1}" "v \<in> {0..1}" "u \<le> v"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   801
    shows "(f has_path_integral  integral {u..v} (\<lambda>x. f(g x) * vector_derivative g (at x)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   802
           (subpath u v g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   803
proof (cases "v=u")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   804
  case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   805
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   806
    using f   by (simp add: path_integrable_on_def subpath_def has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   807
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   808
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   809
  obtain s where s: "\<And>x. x \<in> {0..1} - s \<Longrightarrow> g differentiable at x" and fs: "finite s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   810
    using g   by (auto simp: valid_path_def piecewise_differentiable_on_def) (blast intro: that)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   811
  have *: "((\<lambda>x. f (g ((v - u) * x + u)) * vector_derivative g (at ((v - u) * x + u)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   812
            has_integral (1 / (v - u)) * integral {u..v} (\<lambda>t. f (g t) * vector_derivative g (at t)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   813
           {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   814
    using f uv
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   815
    apply (simp add: path_integrable_on subpath_def has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   816
    apply (drule integrable_on_subcbox [where a=u and b=v, simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   817
    apply (simp_all add: has_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   818
    apply (drule has_integral_affinity [where m="v-u" and c=u, simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   819
    apply (simp_all add: False image_affinity_atLeastAtMost_div_diff scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   820
    apply (simp add: divide_simps False)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   821
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   822
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   823
    have "x \<in> {0..1} \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   824
           x \<notin> (\<lambda>t. (v-u) *\<^sub>R t + u) -` s \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   825
           vector_derivative (\<lambda>x. g ((v-u) * x + u)) (at x) = (v-u) *\<^sub>R vector_derivative g (at ((v-u) * x + u))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   826
      apply (rule vector_derivative_at [OF vector_diff_chain_at [simplified o_def]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   827
      apply (intro derivative_eq_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   828
      apply (cut_tac s [of "(v - u) * x + u"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   829
      using uv mult_left_le [of x "v-u"]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   830
      apply (auto simp:  vector_derivative_works)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   831
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   832
  } note vd = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   833
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   834
    apply (cut_tac has_integral_cmul [OF *, where c = "v-u"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   835
    using fs assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   836
    apply (simp add: False subpath_def has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   837
    apply (rule_tac s = "(\<lambda>t. ((v-u) *\<^sub>R t + u)) -` s" in has_integral_spike_finite)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   838
    apply (auto simp: inj_on_def False finite_vimageI vd scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   839
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   840
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   841
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   842
lemma path_integrable_subpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   843
  assumes "f path_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   844
    shows "f path_integrable_on (subpath u v g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   845
  apply (cases u v rule: linorder_class.le_cases)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   846
   apply (metis path_integrable_on_def has_path_integral_subpath [OF assms])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   847
  apply (subst reversepath_subpath [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   848
  apply (rule path_integrable_reversepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   849
   using assms apply (blast intro: valid_path_subpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   850
  apply (simp add: path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   851
  using assms apply (blast intro: has_path_integral_subpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   852
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   853
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   854
lemma has_integral_integrable_integral: "(f has_integral i) s \<longleftrightarrow> f integrable_on s \<and> integral s f = i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   855
  by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   856
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   857
lemma has_integral_path_integral_subpath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   858
  assumes "f path_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "u \<le> v"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   859
    shows "(((\<lambda>x. f(g x) * vector_derivative g (at x)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   860
            has_integral  path_integral (subpath u v g) f) {u..v}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   861
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   862
  apply (auto simp: has_integral_integrable_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   863
  apply (rule integrable_on_subcbox [where a=u and b=v and s = "{0..1}", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   864
  apply (auto simp: path_integral_unique [OF has_path_integral_subpath] path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   865
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   866
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   867
lemma path_integral_subpath_integral:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   868
  assumes "f path_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "u \<le> v"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   869
    shows "path_integral (subpath u v g) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   870
           integral {u..v} (\<lambda>x. f(g x) * vector_derivative g (at x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   871
  using assms has_path_integral_subpath path_integral_unique by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   872
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   873
lemma path_integral_subpath_combine_less:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   874
  assumes "f path_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "w \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   875
          "u<v" "v<w"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   876
    shows "path_integral (subpath u v g) f + path_integral (subpath v w g) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   877
           path_integral (subpath u w g) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   878
  using assms apply (auto simp: path_integral_subpath_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   879
  apply (rule integral_combine, auto)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   880
  apply (rule integrable_on_subcbox [where a=u and b=w and s = "{0..1}", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   881
  apply (auto simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   882
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   883
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   884
lemma path_integral_subpath_combine:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   885
  assumes "f path_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "w \<in> {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   886
    shows "path_integral (subpath u v g) f + path_integral (subpath v w g) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   887
           path_integral (subpath u w g) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   888
proof (cases "u\<noteq>v \<and> v\<noteq>w \<and> u\<noteq>w")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   889
  case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   890
    have *: "subpath v u g = reversepath(subpath u v g) \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   891
             subpath w u g = reversepath(subpath u w g) \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   892
             subpath w v g = reversepath(subpath v w g)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   893
      by (auto simp: reversepath_subpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   894
    have "u < v \<and> v < w \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   895
          u < w \<and> w < v \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   896
          v < u \<and> u < w \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   897
          v < w \<and> w < u \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   898
          w < u \<and> u < v \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   899
          w < v \<and> v < u"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   900
      using True assms by linarith
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   901
    with assms show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   902
      using path_integral_subpath_combine_less [of f g u v w]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   903
            path_integral_subpath_combine_less [of f g u w v]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   904
            path_integral_subpath_combine_less [of f g v u w]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   905
            path_integral_subpath_combine_less [of f g v w u]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   906
            path_integral_subpath_combine_less [of f g w u v]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   907
            path_integral_subpath_combine_less [of f g w v u]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   908
      apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   909
      apply (elim disjE)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   910
      apply (auto simp: * path_integral_reversepath path_integrable_subpath
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   911
                   valid_path_reversepath valid_path_subpath algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   912
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   913
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   914
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   915
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   916
    apply (auto simp: path_integral_subpath_refl)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   917
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   918
    by (metis eq_neg_iff_add_eq_0 path_integrable_subpath path_integral_reversepath reversepath_subpath valid_path_subpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   919
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   920
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   921
lemma path_integral_integral:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   922
  shows "path_integral g f = integral {0..1} (\<lambda>x. f (g x) * vector_derivative g (at x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   923
  by (simp add: path_integral_def integral_def has_path_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   924
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   925
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   926
subsection\<open>Segments via convex hulls\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   927
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   928
lemma segments_subset_convex_hull:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   929
    "closed_segment a b \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   930
    "closed_segment a c \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   931
    "closed_segment b c \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   932
    "closed_segment b a \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   933
    "closed_segment c a \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   934
    "closed_segment c b \<subseteq> (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   935
by (auto simp: segment_convex_hull linepath_of_real  elim!: rev_subsetD [OF _ hull_mono])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   936
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   937
lemma midpoints_in_convex_hull:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   938
  assumes "x \<in> convex hull s" "y \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   939
    shows "midpoint x y \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   940
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   941
  have "(1 - inverse(2)) *\<^sub>R x + inverse(2) *\<^sub>R y \<in> convex hull s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   942
    apply (rule mem_convex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   943
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   944
    apply (auto simp: convex_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   945
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   946
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   947
    by (simp add: midpoint_def algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   948
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   949
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   950
lemma convex_hull_subset:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   951
    "s \<subseteq> convex hull t \<Longrightarrow> convex hull s \<subseteq> convex hull t"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   952
  by (simp add: convex_convex_hull subset_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   953
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   954
lemma not_in_interior_convex_hull_3:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   955
  fixes a :: "complex"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   956
  shows "a \<notin> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   957
        "b \<notin> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   958
        "c \<notin> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   959
  by (auto simp: card_insert_le_m1 not_in_interior_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   960
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   961
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   962
text\<open>Cauchy's theorem where there's a primitive\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   963
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   964
lemma path_integral_primitive_lemma:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   965
  fixes f :: "complex \<Rightarrow> complex" and g :: "real \<Rightarrow> complex"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   966
  assumes "a \<le> b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   967
      and "\<And>x. x \<in> s \<Longrightarrow> (f has_field_derivative f' x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   968
      and "g piecewise_differentiable_on {a..b}"  "\<And>x. x \<in> {a..b} \<Longrightarrow> g x \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   969
    shows "((\<lambda>x. f'(g x) * vector_derivative g (at x within {a..b}))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   970
             has_integral (f(g b) - f(g a))) {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   971
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   972
  obtain k where k: "finite k" "\<forall>x\<in>{a..b} - k. g differentiable at x" and cg: "continuous_on {a..b} g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   973
    using assms by (auto simp: piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   974
  have cfg: "continuous_on {a..b} (\<lambda>x. f (g x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   975
    apply (rule continuous_on_compose [OF cg, unfolded o_def])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   976
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   977
    apply (metis complex_differentiable_def complex_differentiable_imp_continuous_at continuous_on_eq_continuous_within continuous_on_subset image_subset_iff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   978
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   979
  { fix x::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   980
    assume a: "a < x" and b: "x < b" and xk: "x \<notin> k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   981
    then have "g differentiable at x within {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   982
      using k by (simp add: differentiable_at_withinI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   983
    then have "(g has_vector_derivative vector_derivative g (at x within {a..b})) (at x within {a..b})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   984
      by (simp add: vector_derivative_works has_field_derivative_def scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   985
    then have gdiff: "(g has_derivative (\<lambda>u. u * vector_derivative g (at x within {a..b}))) (at x within {a..b})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   986
      by (simp add: has_vector_derivative_def scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   987
    have "(f has_field_derivative (f' (g x))) (at (g x) within g ` {a..b})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   988
      using assms by (metis a atLeastAtMost_iff b DERIV_subset image_subset_iff less_eq_real_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   989
    then have fdiff: "(f has_derivative op * (f' (g x))) (at (g x) within g ` {a..b})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   990
      by (simp add: has_field_derivative_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   991
    have "((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {a..b})) (at x within {a..b})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   992
      using diff_chain_within [OF gdiff fdiff]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   993
      by (simp add: has_vector_derivative_def scaleR_conv_of_real o_def mult_ac)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   994
  } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   995
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   996
    apply (rule fundamental_theorem_of_calculus_interior_strong)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   997
    using k assms cfg *
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   998
    apply (auto simp: at_within_closed_interval)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   999
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1000
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1001
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1002
lemma path_integral_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1003
  assumes "\<And>x. x \<in> s \<Longrightarrow> (f has_field_derivative f' x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1004
      and "valid_path g" "path_image g \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1005
    shows "(f' has_path_integral (f(pathfinish g) - f(pathstart g))) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1006
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1007
  apply (simp add: valid_path_def path_image_def pathfinish_def pathstart_def has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1008
  apply (auto intro!: path_integral_primitive_lemma [of 0 1 s])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1009
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1010
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1011
corollary Cauchy_theorem_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1012
  assumes "\<And>x. x \<in> s \<Longrightarrow> (f has_field_derivative f' x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1013
      and "valid_path g"  "path_image g \<subseteq> s" "pathfinish g = pathstart g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1014
    shows "(f' has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1015
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1016
  by (metis diff_self path_integral_primitive)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1017
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1018
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1019
text\<open>Existence of path integral for continuous function\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1020
lemma path_integrable_continuous_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1021
  assumes "continuous_on (closed_segment a b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1022
  shows "f path_integrable_on (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1023
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1024
  have "continuous_on {0..1} ((\<lambda>x. f x * (b - a)) o linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1025
    apply (rule continuous_on_compose [OF continuous_on_linepath], simp add: linepath_image_01)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1026
    apply (rule continuous_intros | simp add: assms)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1027
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1028
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1029
    apply (simp add: path_integrable_on_def has_path_integral_def integrable_on_def [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1030
    apply (rule integrable_continuous [of 0 "1::real", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1031
    apply (rule continuous_on_eq [where f = "\<lambda>x. f(linepath a b x)*(b - a)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1032
    apply (auto simp: vector_derivative_linepath_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1033
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1034
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1035
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1036
lemma has_field_der_id: "((\<lambda>x. x\<^sup>2 / 2) has_field_derivative x) (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1037
  by (rule has_derivative_imp_has_field_derivative)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1038
     (rule derivative_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1039
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1040
lemma path_integral_id [simp]: "path_integral (linepath a b) (\<lambda>y. y) = (b^2 - a^2)/2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1041
  apply (rule path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1042
  using path_integral_primitive [of UNIV "\<lambda>x. x^2/2" "\<lambda>x. x" "linepath a b"]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1043
  apply (auto simp: field_simps has_field_der_id)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1044
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1045
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1046
lemma path_integrable_on_const [iff]: "(\<lambda>x. c) path_integrable_on (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1047
  by (simp add: continuous_on_const path_integrable_continuous_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1048
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1049
lemma path_integrable_on_id [iff]: "(\<lambda>x. x) path_integrable_on (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1050
  by (simp add: continuous_on_id path_integrable_continuous_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1051
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1052
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1053
subsection\<open>Arithmetical combining theorems\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1054
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1055
lemma has_path_integral_neg:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1056
    "(f has_path_integral i) g \<Longrightarrow> ((\<lambda>x. -(f x)) has_path_integral (-i)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1057
  by (simp add: has_integral_neg has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1058
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1059
lemma has_path_integral_add:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1060
    "\<lbrakk>(f1 has_path_integral i1) g; (f2 has_path_integral i2) g\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1061
     \<Longrightarrow> ((\<lambda>x. f1 x + f2 x) has_path_integral (i1 + i2)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1062
  by (simp add: has_integral_add has_path_integral_def algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1063
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1064
lemma has_path_integral_diff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1065
  shows "\<lbrakk>(f1 has_path_integral i1) g; (f2 has_path_integral i2) g\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1066
         \<Longrightarrow> ((\<lambda>x. f1 x - f2 x) has_path_integral (i1 - i2)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1067
  by (simp add: has_integral_sub has_path_integral_def algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1068
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1069
lemma has_path_integral_lmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1070
  shows "(f has_path_integral i) g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1071
         \<Longrightarrow> ((\<lambda>x. c * (f x)) has_path_integral (c*i)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1072
apply (simp add: has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1073
apply (drule has_integral_mult_right)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1074
apply (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1075
done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1076
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1077
lemma has_path_integral_rmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1078
  shows "(f has_path_integral i) g \<Longrightarrow> ((\<lambda>x. (f x) * c) has_path_integral (i*c)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1079
apply (drule has_path_integral_lmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1080
apply (simp add: mult.commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1081
done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1082
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1083
lemma has_path_integral_div:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1084
  shows "(f has_path_integral i) g \<Longrightarrow> ((\<lambda>x. f x/c) has_path_integral (i/c)) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1085
  by (simp add: field_class.field_divide_inverse) (metis has_path_integral_rmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1086
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1087
lemma has_path_integral_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1088
  shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1089
    "\<lbrakk>(f has_path_integral y) p; \<And>x. x \<in> path_image p \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> (g has_path_integral y) p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1090
apply (simp add: path_image_def has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1091
by (metis (no_types, lifting) image_eqI has_integral_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1092
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1093
lemma has_path_integral_bound_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1094
  assumes "(f has_path_integral i) (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1095
          "0 \<le> B" "\<And>x. x \<in> closed_segment a b \<Longrightarrow> norm(f x) \<le> B"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1096
    shows "norm i \<le> B * norm(b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1097
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1098
  { fix x::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1099
    assume x: "0 \<le> x" "x \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1100
  have "norm (f (linepath a b x)) *
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1101
        norm (vector_derivative (linepath a b) (at x within {0..1})) \<le> B * norm (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1102
    by (auto intro: mult_mono simp: assms linepath_in_path of_real_linepath vector_derivative_linepath_within x)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1103
  } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1104
  have "norm i \<le> (B * norm (b - a)) * content (cbox 0 (1::real))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1105
    apply (rule has_integral_bound
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1106
       [of _ "\<lambda>x. f (linepath a b x) * vector_derivative (linepath a b) (at x within {0..1})"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1107
    using assms * unfolding has_path_integral_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1108
    apply (auto simp: norm_mult)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1109
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1110
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1111
    by (auto simp: content_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1112
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1113
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1114
(*UNUSED
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1115
lemma has_path_integral_bound_linepath_strong:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1116
  fixes a :: real and f :: "complex \<Rightarrow> real"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1117
  assumes "(f has_path_integral i) (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1118
          "finite k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1119
          "0 \<le> B" "\<And>x::real. x \<in> closed_segment a b - k \<Longrightarrow> norm(f x) \<le> B"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1120
    shows "norm i \<le> B*norm(b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1121
*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1122
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1123
lemma has_path_integral_const_linepath: "((\<lambda>x. c) has_path_integral c*(b - a))(linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1124
  unfolding has_path_integral_linepath
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1125
  by (metis content_real diff_0_right has_integral_const_real lambda_one of_real_1 scaleR_conv_of_real zero_le_one)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1126
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1127
lemma has_path_integral_0: "((\<lambda>x. 0) has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1128
  by (simp add: has_path_integral_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1129
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1130
lemma has_path_integral_is_0:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1131
    "(\<And>z. z \<in> path_image g \<Longrightarrow> f z = 0) \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1132
  by (rule has_path_integral_eq [OF has_path_integral_0]) auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1133
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1134
lemma has_path_integral_setsum:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1135
    "\<lbrakk>finite s; \<And>a. a \<in> s \<Longrightarrow> (f a has_path_integral i a) p\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1136
     \<Longrightarrow> ((\<lambda>x. setsum (\<lambda>a. f a x) s) has_path_integral setsum i s) p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1137
  by (induction s rule: finite_induct) (auto simp: has_path_integral_0 has_path_integral_add)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1138
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1139
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1140
subsection \<open>Operations on path integrals\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1141
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1142
lemma path_integral_const_linepath [simp]: "path_integral (linepath a b) (\<lambda>x. c) = c*(b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1143
  by (rule path_integral_unique [OF has_path_integral_const_linepath])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1144
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1145
lemma path_integral_neg:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1146
    "f path_integrable_on g \<Longrightarrow> path_integral g (\<lambda>x. -(f x)) = -(path_integral g f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1147
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_neg)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1148
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1149
lemma path_integral_add:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1150
    "f1 path_integrable_on g \<Longrightarrow> f2 path_integrable_on g \<Longrightarrow> path_integral g (\<lambda>x. f1 x + f2 x) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1151
                path_integral g f1 + path_integral g f2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1152
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_add)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1153
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1154
lemma path_integral_diff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1155
    "f1 path_integrable_on g \<Longrightarrow> f2 path_integrable_on g \<Longrightarrow> path_integral g (\<lambda>x. f1 x - f2 x) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1156
                path_integral g f1 - path_integral g f2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1157
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_diff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1158
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1159
lemma path_integral_lmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1160
  shows "f path_integrable_on g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1161
           \<Longrightarrow> path_integral g (\<lambda>x. c * f x) = c*path_integral g f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1162
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_lmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1163
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1164
lemma path_integral_rmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1165
  shows "f path_integrable_on g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1166
        \<Longrightarrow> path_integral g (\<lambda>x. f x * c) = path_integral g f * c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1167
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_rmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1168
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1169
lemma path_integral_div:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1170
  shows "f path_integrable_on g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1171
        \<Longrightarrow> path_integral g (\<lambda>x. f x / c) = path_integral g f / c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1172
  by (simp add: path_integral_unique has_path_integral_integral has_path_integral_div)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1173
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1174
lemma path_integral_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1175
    "(\<And>x. x \<in> path_image p \<Longrightarrow> f x = g x) \<Longrightarrow> path_integral p f = path_integral p g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1176
  by (simp add: path_integral_def) (metis has_path_integral_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1177
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1178
lemma path_integral_eq_0:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1179
    "(\<And>z. z \<in> path_image g \<Longrightarrow> f z = 0) \<Longrightarrow> path_integral g f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1180
  by (simp add: has_path_integral_is_0 path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1181
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1182
lemma path_integral_bound_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1183
  shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1184
    "\<lbrakk>f path_integrable_on (linepath a b);
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1185
      0 \<le> B; \<And>x. x \<in> closed_segment a b \<Longrightarrow> norm(f x) \<le> B\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1186
     \<Longrightarrow> norm(path_integral (linepath a b) f) \<le> B*norm(b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1187
  apply (rule has_path_integral_bound_linepath [of f])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1188
  apply (auto simp: has_path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1189
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1190
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1191
lemma path_integral_0: "path_integral g (\<lambda>x. 0) = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1192
  by (simp add: path_integral_unique has_path_integral_0)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1193
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1194
lemma path_integral_setsum:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1195
    "\<lbrakk>finite s; \<And>a. a \<in> s \<Longrightarrow> (f a) path_integrable_on p\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1196
     \<Longrightarrow> path_integral p (\<lambda>x. setsum (\<lambda>a. f a x) s) = setsum (\<lambda>a. path_integral p (f a)) s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1197
  by (auto simp: path_integral_unique has_path_integral_setsum has_path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1198
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1199
lemma path_integrable_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1200
    "\<lbrakk>f path_integrable_on p; \<And>x. x \<in> path_image p \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> g path_integrable_on p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1201
  unfolding path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1202
  by (metis has_path_integral_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1203
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1204
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1205
subsection \<open>Arithmetic theorems for path integrability\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1206
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1207
lemma path_integrable_neg:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1208
    "f path_integrable_on g \<Longrightarrow> (\<lambda>x. -(f x)) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1209
  using has_path_integral_neg path_integrable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1210
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1211
lemma path_integrable_add:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1212
    "\<lbrakk>f1 path_integrable_on g; f2 path_integrable_on g\<rbrakk> \<Longrightarrow> (\<lambda>x. f1 x + f2 x) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1213
  using has_path_integral_add path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1214
  by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1215
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1216
lemma path_integrable_diff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1217
    "\<lbrakk>f1 path_integrable_on g; f2 path_integrable_on g\<rbrakk> \<Longrightarrow> (\<lambda>x. f1 x - f2 x) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1218
  using has_path_integral_diff path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1219
  by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1220
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1221
lemma path_integrable_lmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1222
    "f path_integrable_on g \<Longrightarrow> (\<lambda>x. c * f x) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1223
  using has_path_integral_lmul path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1224
  by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1225
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1226
lemma path_integrable_rmul:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1227
    "f path_integrable_on g \<Longrightarrow> (\<lambda>x. f x * c) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1228
  using has_path_integral_rmul path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1229
  by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1230
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1231
lemma path_integrable_div:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1232
    "f path_integrable_on g \<Longrightarrow> (\<lambda>x. f x / c) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1233
  using has_path_integral_div path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1234
  by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1235
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1236
lemma path_integrable_setsum:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1237
    "\<lbrakk>finite s; \<And>a. a \<in> s \<Longrightarrow> (f a) path_integrable_on p\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1238
     \<Longrightarrow> (\<lambda>x. setsum (\<lambda>a. f a x) s) path_integrable_on p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1239
   unfolding path_integrable_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1240
   by (metis has_path_integral_setsum)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1241
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1242
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1243
subsection\<open>Reversing a path integral\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1244
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1245
lemma has_path_integral_reverse_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1246
    "(f has_path_integral i) (linepath a b)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1247
     \<Longrightarrow> (f has_path_integral (-i)) (linepath b a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1248
  using has_path_integral_reversepath valid_path_linepath by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1249
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1250
lemma path_integral_reverse_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1251
    "continuous_on (closed_segment a b) f
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1252
     \<Longrightarrow> path_integral (linepath a b) f = - (path_integral(linepath b a) f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1253
apply (rule path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1254
apply (rule has_path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1255
by (simp add: closed_segment_commute path_integrable_continuous_linepath has_path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1256
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1257
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1258
(* Splitting a path integral in a flat way.*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1259
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1260
lemma has_path_integral_split:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1261
  assumes f: "(f has_path_integral i) (linepath a c)" "(f has_path_integral j) (linepath c b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1262
      and k: "0 \<le> k" "k \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1263
      and c: "c - a = k *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1264
    shows "(f has_path_integral (i + j)) (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1265
proof (cases "k = 0 \<or> k = 1")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1266
  case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1267
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1268
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1269
    apply auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1270
    apply (metis add.left_neutral has_path_integral_trivial has_path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1271
    apply (metis add.right_neutral has_path_integral_trivial has_path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1272
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1273
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1274
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1275
  then have k: "0 < k" "k < 1" "complex_of_real k \<noteq> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1276
    using assms apply auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1277
    using of_real_eq_iff by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1278
  have c': "c = k *\<^sub>R (b - a) + a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1279
    by (metis diff_add_cancel c)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1280
  have bc: "(b - c) = (1 - k) *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1281
    by (simp add: algebra_simps c')
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1282
  { assume *: "((\<lambda>x. f ((1 - x) *\<^sub>R a + x *\<^sub>R c) * (c - a)) has_integral i) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1283
    have **: "\<And>x. ((k - x) / k) *\<^sub>R a + (x / k) *\<^sub>R c = (1 - x) *\<^sub>R a + x *\<^sub>R b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1284
      using False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1285
      apply (simp add: c' algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1286
      apply (simp add: real_vector.scale_left_distrib [symmetric] divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1287
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1288
    have "((\<lambda>x. f ((1 - x) *\<^sub>R a + x *\<^sub>R b) * (b - a)) has_integral i) {0..k}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1289
      using * k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1290
      apply -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1291
      apply (drule has_integral_affinity [of _ _ 0 "1::real" "inverse k" "0", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1292
      apply (simp_all add: divide_simps mult.commute [of _ "k"] image_affinity_atLeastAtMost ** c)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1293
      apply (drule Integration.has_integral_cmul [where c = "inverse k"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1294
      apply (simp add: Integration.has_integral_cmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1295
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1296
  } note fi = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1297
  { assume *: "((\<lambda>x. f ((1 - x) *\<^sub>R c + x *\<^sub>R b) * (b - c)) has_integral j) {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1298
    have **: "\<And>x. (((1 - x) / (1 - k)) *\<^sub>R c + ((x - k) / (1 - k)) *\<^sub>R b) = ((1 - x) *\<^sub>R a + x *\<^sub>R b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1299
      using k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1300
      apply (simp add: c' field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1301
      apply (simp add: scaleR_conv_of_real divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1302
      apply (simp add: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1303
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1304
    have "((\<lambda>x. f ((1 - x) *\<^sub>R a + x *\<^sub>R b) * (b - a)) has_integral j) {k..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1305
      using * k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1306
      apply -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1307
      apply (drule has_integral_affinity [of _ _ 0 "1::real" "inverse(1 - k)" "-(k/(1 - k))", simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1308
      apply (simp_all add: divide_simps mult.commute [of _ "1-k"] image_affinity_atLeastAtMost ** bc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1309
      apply (drule Integration.has_integral_cmul [where k = "(1 - k) *\<^sub>R j" and c = "inverse (1 - k)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1310
      apply (simp add: Integration.has_integral_cmul)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1311
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1312
  } note fj = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1313
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1314
    using f k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1315
    apply (simp add: has_path_integral_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1316
    apply (simp add: linepath_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1317
    apply (rule has_integral_combine [OF _ _ fi fj], simp_all)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1318
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1319
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1320
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1321
lemma continuous_on_closed_segment_transform:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1322
  assumes f: "continuous_on (closed_segment a b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1323
      and k: "0 \<le> k" "k \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1324
      and c: "c - a = k *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1325
    shows "continuous_on (closed_segment a c) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1326
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1327
  have c': "c = (1 - k) *\<^sub>R a + k *\<^sub>R b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1328
    using c by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1329
  show "continuous_on (closed_segment a c) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1330
    apply (rule continuous_on_subset [OF f])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1331
    apply (simp add: segment_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1332
    apply (rule convex_hull_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1333
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1334
    apply (auto simp: hull_inc c' Convex.mem_convex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1335
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1336
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1337
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1338
lemma path_integral_split:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1339
  assumes f: "continuous_on (closed_segment a b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1340
      and k: "0 \<le> k" "k \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1341
      and c: "c - a = k *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1342
    shows "path_integral(linepath a b) f = path_integral(linepath a c) f + path_integral(linepath c b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1343
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1344
  have c': "c = (1 - k) *\<^sub>R a + k *\<^sub>R b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1345
    using c by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1346
  have *: "continuous_on (closed_segment a c) f" "continuous_on (closed_segment c b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1347
    apply (rule_tac [!] continuous_on_subset [OF f])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1348
    apply (simp_all add: segment_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1349
    apply (rule_tac [!] convex_hull_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1350
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1351
    apply (auto simp: hull_inc c' Convex.mem_convex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1352
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1353
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1354
    apply (rule path_integral_unique)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1355
    apply (rule has_path_integral_split [OF has_path_integral_integral has_path_integral_integral k c])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1356
    apply (rule path_integrable_continuous_linepath *)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1357
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1358
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1359
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1360
lemma path_integral_split_linepath:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1361
  assumes f: "continuous_on (closed_segment a b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1362
      and c: "c \<in> closed_segment a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1363
    shows "path_integral(linepath a b) f = path_integral(linepath a c) f + path_integral(linepath c b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1364
  using c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1365
  by (auto simp: closed_segment_def algebra_simps intro!: path_integral_split [OF f])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1366
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1367
(* The special case of midpoints used in the main quadrisection.*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1368
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1369
lemma has_path_integral_midpoint:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1370
  assumes "(f has_path_integral i) (linepath a (midpoint a b))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1371
          "(f has_path_integral j) (linepath (midpoint a b) b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1372
    shows "(f has_path_integral (i + j)) (linepath a b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1373
  apply (rule has_path_integral_split [where c = "midpoint a b" and k = "1/2"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1374
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1375
  apply (auto simp: midpoint_def algebra_simps scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1376
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1377
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1378
lemma path_integral_midpoint:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1379
   "continuous_on (closed_segment a b) f
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1380
    \<Longrightarrow> path_integral (linepath a b) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1381
        path_integral (linepath a (midpoint a b)) f + path_integral (linepath (midpoint a b) b) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1382
  apply (rule path_integral_split [where c = "midpoint a b" and k = "1/2"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1383
  using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1384
  apply (auto simp: midpoint_def algebra_simps scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1385
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1386
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1387
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1388
text\<open>A couple of special case lemmas that are useful below\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1389
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1390
lemma triangle_linear_has_chain_integral:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1391
    "((\<lambda>x. m*x + d) has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1392
  apply (rule Cauchy_theorem_primitive [of UNIV "\<lambda>x. m/2 * x^2 + d*x"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1393
  apply (auto intro!: derivative_eq_intros)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1394
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1395
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1396
lemma has_chain_integral_chain_integral3:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1397
     "(f has_path_integral i) (linepath a b +++ linepath b c +++ linepath c d)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1398
      \<Longrightarrow> path_integral (linepath a b) f + path_integral (linepath b c) f + path_integral (linepath c d) f = i"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1399
  apply (subst path_integral_unique [symmetric], assumption)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1400
  apply (drule has_path_integral_integrable)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1401
  apply (simp add: valid_path_join)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1402
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1403
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1404
subsection\<open>Reversing the order in a double path integral\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1405
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1406
text\<open>The condition is stronger than needed but it's often true in typical situations\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1407
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1408
lemma fst_im_cbox [simp]: "cbox c d \<noteq> {} \<Longrightarrow> (fst ` cbox (a,c) (b,d)) = cbox a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1409
  by (auto simp: cbox_Pair_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1410
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1411
lemma snd_im_cbox [simp]: "cbox a b \<noteq> {} \<Longrightarrow> (snd ` cbox (a,c) (b,d)) = cbox c d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1412
  by (auto simp: cbox_Pair_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1413
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1414
lemma path_integral_swap:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1415
  assumes fcon:  "continuous_on (path_image g \<times> path_image h) (\<lambda>(y1,y2). f y1 y2)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1416
      and vp:    "valid_path g" "valid_path h"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1417
      and gvcon: "continuous_on {0..1} (\<lambda>t. vector_derivative g (at t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1418
      and hvcon: "continuous_on {0..1} (\<lambda>t. vector_derivative h (at t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1419
  shows "path_integral g (\<lambda>w. path_integral h (f w)) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1420
         path_integral h (\<lambda>z. path_integral g (\<lambda>w. f w z))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1421
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1422
  have gcon: "continuous_on {0..1} g" and hcon: "continuous_on {0..1} h"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1423
    using assms by (auto simp: valid_path_def piecewise_differentiable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1424
  have fgh1: "\<And>x. (\<lambda>t. f (g x) (h t)) = (\<lambda>(y1,y2). f y1 y2) o (\<lambda>t. (g x, h t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1425
    by (rule ext) simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1426
  have fgh2: "\<And>x. (\<lambda>t. f (g t) (h x)) = (\<lambda>(y1,y2). f y1 y2) o (\<lambda>t. (g t, h x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1427
    by (rule ext) simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1428
  have fcon_im1: "\<And>x. 0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> continuous_on ((\<lambda>t. (g x, h t)) ` {0..1}) (\<lambda>(x, y). f x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1429
    by (rule continuous_on_subset [OF fcon]) (auto simp: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1430
  have fcon_im2: "\<And>x. 0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> continuous_on ((\<lambda>t. (g t, h x)) ` {0..1}) (\<lambda>(x, y). f x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1431
    by (rule continuous_on_subset [OF fcon]) (auto simp: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1432
  have vdg: "\<And>y. y \<in> {0..1} \<Longrightarrow> (\<lambda>x. f (g x) (h y) * vector_derivative g (at x)) integrable_on {0..1}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1433
    apply (rule integrable_continuous_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1434
    apply (rule continuous_on_mult [OF _ gvcon])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1435
    apply (subst fgh2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1436
    apply (rule fcon_im2 gcon continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1437
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1438
  have "(\<lambda>z. vector_derivative g (at (fst z))) = (\<lambda>x. vector_derivative g (at x)) o fst"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1439
    by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1440
  then have gvcon': "continuous_on (cbox (0, 0) (1, 1::real)) (\<lambda>x. vector_derivative g (at (fst x)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1441
    apply (rule ssubst)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1442
    apply (rule continuous_intros | simp add: gvcon)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1443
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1444
  have "(\<lambda>z. vector_derivative h (at (snd z))) = (\<lambda>x. vector_derivative h (at x)) o snd"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1445
    by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1446
  then have hvcon': "continuous_on (cbox (0, 0) (1::real, 1)) (\<lambda>x. vector_derivative h (at (snd x)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1447
    apply (rule ssubst)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1448
    apply (rule continuous_intros | simp add: hvcon)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1449
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1450
  have "(\<lambda>x. f (g (fst x)) (h (snd x))) = (\<lambda>(y1,y2). f y1 y2) o (\<lambda>w. ((g o fst) w, (h o snd) w))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1451
    by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1452
  then have fgh: "continuous_on (cbox (0, 0) (1, 1)) (\<lambda>x. f (g (fst x)) (h (snd x)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1453
    apply (rule ssubst)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1454
    apply (rule gcon hcon continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1455
    apply (auto simp: path_image_def intro: continuous_on_subset [OF fcon])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1456
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1457
  have "integral {0..1} (\<lambda>x. path_integral h (f (g x)) * vector_derivative g (at x)) =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1458
        integral {0..1} (\<lambda>x. path_integral h (\<lambda>y. f (g x) y * vector_derivative g (at x)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1459
    apply (rule integral_cong [OF path_integral_rmul [symmetric]])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1460
    apply (clarsimp simp: path_integrable_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1461
    apply (rule integrable_continuous_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1462
    apply (rule continuous_on_mult [OF _ hvcon])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1463
    apply (subst fgh1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1464
    apply (rule fcon_im1 hcon continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1465
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1466
  also have "... = integral {0..1}
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1467
                     (\<lambda>y. path_integral g (\<lambda>x. f x (h y) * vector_derivative h (at y)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1468
    apply (simp add: path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1469
    apply (subst integral_swap_continuous [where 'a = real and 'b = real, of 0 0 1 1, simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1470
    apply (rule fgh gvcon' hvcon' continuous_intros | simp add: split_def)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1471
    apply (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1472
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1473
  also have "... = path_integral h (\<lambda>z. path_integral g (\<lambda>w. f w z))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1474
    apply (simp add: path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1475
    apply (rule integral_cong)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1476
    apply (subst integral_mult_left [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1477
    apply (blast intro: vdg)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1478
    apply (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1479
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1480
  finally show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1481
    by (simp add: path_integral_integral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1482
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1483
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1484
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1485
subsection\<open>The key quadrisection step\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1486
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1487
lemma norm_sum_half:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1488
  assumes "norm(a + b) >= e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1489
    shows "norm a >= e/2 \<or> norm b >= e/2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1490
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1491
  have "e \<le> norm (- a - b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1492
    by (simp add: add.commute assms norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1493
  thus ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1494
    using norm_triangle_ineq4 order_trans by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1495
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1496
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1497
lemma norm_sum_lemma:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1498
  assumes "e \<le> norm (a + b + c + d)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1499
    shows "e / 4 \<le> norm a \<or> e / 4 \<le> norm b \<or> e / 4 \<le> norm c \<or> e / 4 \<le> norm d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1500
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1501
  have "e \<le> norm ((a + b) + (c + d))" using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1502
    by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1503
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1504
    by (auto dest!: norm_sum_half)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1505
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1506
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1507
lemma Cauchy_theorem_quadrisection:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1508
  assumes f: "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1509
      and dist: "dist a b \<le> K" "dist b c \<le> K" "dist c a \<le> K"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1510
      and e: "e * K^2 \<le>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1511
              norm (path_integral(linepath a b) f + path_integral(linepath b c) f + path_integral(linepath c a) f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1512
  shows "\<exists>a' b' c'.
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1513
           a' \<in> convex hull {a,b,c} \<and> b' \<in> convex hull {a,b,c} \<and> c' \<in> convex hull {a,b,c} \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1514
           dist a' b' \<le> K/2  \<and>  dist b' c' \<le> K/2  \<and>  dist c' a' \<le> K/2  \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1515
           e * (K/2)^2 \<le> norm(path_integral(linepath a' b') f + path_integral(linepath b' c') f + path_integral(linepath c' a') f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1516
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1517
  note divide_le_eq_numeral1 [simp del]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1518
  def a' \<equiv> "midpoint b c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1519
  def b' \<equiv> "midpoint c a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1520
  def c' \<equiv> "midpoint a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1521
  have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1522
    using f continuous_on_subset segments_subset_convex_hull by metis+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1523
  have fcont': "continuous_on (closed_segment c' b') f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1524
               "continuous_on (closed_segment a' c') f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1525
               "continuous_on (closed_segment b' a') f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1526
    unfolding a'_def b'_def c'_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1527
    apply (rule continuous_on_subset [OF f],
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1528
           metis midpoints_in_convex_hull convex_hull_subset hull_subset insert_subset segment_convex_hull)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1529
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1530
  let ?pathint = "\<lambda>x y. path_integral(linepath x y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1531
  have *: "?pathint a b + ?pathint b c + ?pathint c a =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1532
          (?pathint a c' + ?pathint c' b' + ?pathint b' a) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1533
          (?pathint a' c' + ?pathint c' b + ?pathint b a') +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1534
          (?pathint a' c + ?pathint c b' + ?pathint b' a') +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1535
          (?pathint a' b' + ?pathint b' c' + ?pathint c' a')"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1536
    apply (simp add: fcont' path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1537
    apply (simp add: a'_def b'_def c'_def path_integral_midpoint fabc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1538
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1539
  have [simp]: "\<And>x y. cmod (x * 2 - y * 2) = cmod (x - y) * 2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1540
    by (metis left_diff_distrib mult.commute norm_mult_numeral1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1541
  have [simp]: "\<And>x y. cmod (x - y) = cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1542
    by (simp add: norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1543
  consider "e * K\<^sup>2 / 4 \<le> cmod (?pathint a c' + ?pathint c' b' + ?pathint b' a)" |
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1544
           "e * K\<^sup>2 / 4 \<le> cmod (?pathint a' c' + ?pathint c' b + ?pathint b a')" |
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1545
           "e * K\<^sup>2 / 4 \<le> cmod (?pathint a' c + ?pathint c b' + ?pathint b' a')" |
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1546
           "e * K\<^sup>2 / 4 \<le> cmod (?pathint a' b' + ?pathint b' c' + ?pathint c' a')"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1547
    using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1548
    apply (simp only: *)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1549
    apply (blast intro: that dest!: norm_sum_lemma)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1550
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1551
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1552
  proof cases
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1553
    case 1 then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1554
      apply (rule_tac x=a in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1555
      apply (rule exI [where x=c'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1556
      apply (rule exI [where x=b'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1557
      using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1558
      apply (auto simp: a'_def c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1559
      apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1560
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1561
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1562
    case 2 then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1563
      apply (rule_tac x=a' in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1564
      apply (rule exI [where x=c'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1565
      apply (rule exI [where x=b])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1566
      using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1567
      apply (auto simp: a'_def c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1568
      apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1569
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1570
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1571
    case 3 then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1572
      apply (rule_tac x=a' in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1573
      apply (rule exI [where x=c])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1574
      apply (rule exI [where x=b'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1575
      using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1576
      apply (auto simp: a'_def c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1577
      apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1578
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1579
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1580
    case 4 then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1581
      apply (rule_tac x=a' in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1582
      apply (rule exI [where x=b'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1583
      apply (rule exI [where x=c'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1584
      using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1585
      apply (auto simp: a'_def c'_def b'_def midpoints_in_convex_hull hull_subset [THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1586
      apply (auto simp: midpoint_def dist_norm scaleR_conv_of_real divide_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1587
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1588
  qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1589
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1590
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1591
subsection\<open>Cauchy's theorem for triangles\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1592
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1593
lemma triangle_points_closer:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1594
  fixes a::complex
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1595
  shows "\<lbrakk>x \<in> convex hull {a,b,c};  y \<in> convex hull {a,b,c}\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1596
         \<Longrightarrow> norm(x - y) \<le> norm(a - b) \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1597
             norm(x - y) \<le> norm(b - c) \<or>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1598
             norm(x - y) \<le> norm(c - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1599
  using simplex_extremal_le [of "{a,b,c}"]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1600
  by (auto simp: norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1601
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1602
lemma holomorphic_point_small_triangle:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1603
  assumes x: "x \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1604
      and f: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1605
      and cd: "f complex_differentiable (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1606
      and e: "0 < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1607
    shows "\<exists>k>0. \<forall>a b c. dist a b \<le> k \<and> dist b c \<le> k \<and> dist c a \<le> k \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1608
              x \<in> convex hull {a,b,c} \<and> convex hull {a,b,c} \<subseteq> s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1609
              \<longrightarrow> norm(path_integral(linepath a b) f + path_integral(linepath b c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1610
                       path_integral(linepath c a) f)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1611
                  \<le> e*(dist a b + dist b c + dist c a)^2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1612
           (is "\<exists>k>0. \<forall>a b c. _ \<longrightarrow> ?normle a b c")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1613
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1614
  have le_of_3: "\<And>a x y z. \<lbrakk>0 \<le> x*y; 0 \<le> x*z; 0 \<le> y*z; a \<le> (e*(x + y + z))*x + (e*(x + y + z))*y + (e*(x + y + z))*z\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1615
                     \<Longrightarrow> a \<le> e*(x + y + z)^2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1616
    by (simp add: algebra_simps power2_eq_square)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1617
  have disj_le: "\<lbrakk>x \<le> a \<or> x \<le> b \<or> x \<le> c; 0 \<le> a; 0 \<le> b; 0 \<le> c\<rbrakk> \<Longrightarrow> x \<le> a + b + c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1618
             for x::real and a b c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1619
    by linarith
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1620
  have fabc: "f path_integrable_on linepath a b" "f path_integrable_on linepath b c" "f path_integrable_on linepath c a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1621
              if "convex hull {a, b, c} \<subseteq> s" for a b c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1622
    using segments_subset_convex_hull that
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1623
    by (metis continuous_on_subset f path_integrable_continuous_linepath)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1624
  note path_bound = has_path_integral_bound_linepath [simplified norm_minus_commute, OF has_path_integral_integral]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1625
  { fix f' a b c d
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1626
    assume d: "0 < d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1627
       and f': "\<And>y. \<lbrakk>cmod (y - x) \<le> d; y \<in> s\<rbrakk> \<Longrightarrow> cmod (f y - f x - f' * (y - x)) \<le> e * cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1628
       and le: "cmod (a - b) \<le> d" "cmod (b - c) \<le> d" "cmod (c - a) \<le> d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1629
       and xc: "x \<in> convex hull {a, b, c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1630
       and s: "convex hull {a, b, c} \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1631
    have pa: "path_integral (linepath a b) f + path_integral (linepath b c) f + path_integral (linepath c a) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1632
              path_integral (linepath a b) (\<lambda>y. f y - f x - f'*(y - x)) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1633
              path_integral (linepath b c) (\<lambda>y. f y - f x - f'*(y - x)) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1634
              path_integral (linepath c a) (\<lambda>y. f y - f x - f'*(y - x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1635
      apply (simp add: path_integral_diff path_integral_lmul path_integrable_lmul path_integrable_diff fabc [OF s])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1636
      apply (simp add: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1637
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1638
    { fix y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1639
      assume yc: "y \<in> convex hull {a,b,c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1640
      have "cmod (f y - f x - f' * (y - x)) \<le> e*norm(y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1641
        apply (rule f')
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1642
        apply (metis triangle_points_closer [OF xc yc] le norm_minus_commute order_trans)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1643
        using s yc by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1644
      also have "... \<le> e * (cmod (a - b) + cmod (b - c) + cmod (c - a))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1645
        by (simp add: yc e xc disj_le [OF triangle_points_closer])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1646
      finally have "cmod (f y - f x - f' * (y - x)) \<le> e * (cmod (a - b) + cmod (b - c) + cmod (c - a))" .
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1647
    } note cm_le = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1648
    have "?normle a b c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1649
      apply (simp add: dist_norm pa)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1650
      apply (rule le_of_3)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1651
      using f' xc s e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1652
      apply simp_all
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1653
      apply (intro norm_triangle_le add_mono path_bound)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1654
      apply (simp_all add: path_integral_diff path_integral_lmul path_integrable_lmul path_integrable_diff fabc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1655
      apply (blast intro: cm_le elim: dest: segments_subset_convex_hull [THEN subsetD])+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1656
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1657
  } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1658
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1659
    using cd e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1660
    apply (simp add: complex_differentiable_def has_field_derivative_def has_derivative_within_alt approachable_lt_le2 Ball_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1661
    apply (clarify dest!: spec mp)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1662
    using *
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1663
    apply (simp add: dist_norm, blast)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1664
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1665
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1666
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1667
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1668
(* Hence the most basic theorem for a triangle.*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1669
locale Chain =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1670
  fixes x0 At Follows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1671
  assumes At0: "At x0 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1672
      and AtSuc: "\<And>x n. At x n \<Longrightarrow> \<exists>x'. At x' (Suc n) \<and> Follows x' x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1673
begin
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1674
  primrec f where
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1675
    "f 0 = x0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1676
  | "f (Suc n) = (SOME x. At x (Suc n) \<and> Follows x (f n))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1677
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1678
  lemma At: "At (f n) n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1679
  proof (induct n)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1680
    case 0 show ?case
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1681
      by (simp add: At0)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1682
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1683
    case (Suc n) show ?case
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1684
      by (metis (no_types, lifting) AtSuc [OF Suc] f.simps(2) someI_ex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1685
  qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1686
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1687
  lemma Follows: "Follows (f(Suc n)) (f n)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1688
    by (metis (no_types, lifting) AtSuc [OF At [of n]] f.simps(2) someI_ex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1689
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1690
  declare f.simps(2) [simp del]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1691
end
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1692
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1693
lemma Chain3:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1694
  assumes At0: "At x0 y0 z0 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1695
      and AtSuc: "\<And>x y z n. At x y z n \<Longrightarrow> \<exists>x' y' z'. At x' y' z' (Suc n) \<and> Follows x' y' z' x y z"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1696
  obtains f g h where
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1697
    "f 0 = x0" "g 0 = y0" "h 0 = z0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1698
                      "\<And>n. At (f n) (g n) (h n) n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1699
                       "\<And>n. Follows (f(Suc n)) (g(Suc n)) (h(Suc n)) (f n) (g n) (h n)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1700
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1701
  interpret three: Chain "(x0,y0,z0)" "\<lambda>(x,y,z). At x y z" "\<lambda>(x',y',z'). \<lambda>(x,y,z). Follows x' y' z' x y z"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1702
    apply unfold_locales
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1703
    using At0 AtSuc by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1704
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1705
  apply (rule that [of "\<lambda>n. fst (three.f n)"  "\<lambda>n. fst (snd (three.f n))" "\<lambda>n. snd (snd (three.f n))"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1706
  apply simp_all
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1707
  using three.At three.Follows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1708
  apply (simp_all add: split_beta')
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1709
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1710
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1711
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1712
lemma Cauchy_theorem_triangle:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1713
  assumes "f holomorphic_on (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1714
    shows "(f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1715
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1716
  have contf: "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1717
    by (metis assms holomorphic_on_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1718
  let ?pathint = "\<lambda>x y. path_integral(linepath x y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1719
  { fix y::complex
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1720
    assume fy: "(f has_path_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1721
       and ynz: "y \<noteq> 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1722
    def K \<equiv> "1 + max (dist a b) (max (dist b c) (dist c a))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1723
    def e \<equiv> "norm y / K^2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1724
    have K1: "K \<ge> 1"  by (simp add: K_def max.coboundedI1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1725
    then have K: "K > 0" by linarith
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1726
    have [iff]: "dist a b \<le> K" "dist b c \<le> K" "dist c a \<le> K"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1727
      by (simp_all add: K_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1728
    have e: "e > 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1729
      unfolding e_def using ynz K1 by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1730
    def At \<equiv> "\<lambda>x y z n. convex hull {x,y,z} \<subseteq> convex hull {a,b,c} \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1731
                         dist x y \<le> K/2^n \<and> dist y z \<le> K/2^n \<and> dist z x \<le> K/2^n \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1732
                         norm(?pathint x y + ?pathint y z + ?pathint z x) \<ge> e*(K/2^n)^2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1733
    have At0: "At a b c 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1734
      using fy
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1735
      by (simp add: At_def e_def has_chain_integral_chain_integral3)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1736
    { fix x y z n
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1737
      assume At: "At x y z n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1738
      then have contf': "continuous_on (convex hull {x,y,z}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1739
        using contf At_def continuous_on_subset by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1740
      have "\<exists>x' y' z'. At x' y' z' (Suc n) \<and> convex hull {x',y',z'} \<subseteq> convex hull {x,y,z}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1741
        using At
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1742
        apply (simp add: At_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1743
        using  Cauchy_theorem_quadrisection [OF contf', of "K/2^n" e]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1744
        apply clarsimp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1745
        apply (rule_tac x="a'" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1746
        apply (rule_tac x="b'" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1747
        apply (rule_tac x="c'" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1748
        apply (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1749
        apply (meson convex_hull_subset empty_subsetI insert_subset subsetCE)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1750
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1751
    } note AtSuc = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1752
    obtain fa fb fc
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1753
      where f0 [simp]: "fa 0 = a" "fb 0 = b" "fc 0 = c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1754
        and cosb: "\<And>n. convex hull {fa n, fb n, fc n} \<subseteq> convex hull {a,b,c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1755
        and dist: "\<And>n. dist (fa n) (fb n) \<le> K/2^n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1756
                  "\<And>n. dist (fb n) (fc n) \<le> K/2^n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1757
                  "\<And>n. dist (fc n) (fa n) \<le> K/2^n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1758
        and no: "\<And>n. norm(?pathint (fa n) (fb n) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1759
                           ?pathint (fb n) (fc n) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1760
                           ?pathint (fc n) (fa n)) \<ge> e * (K/2^n)^2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1761
        and conv_le: "\<And>n. convex hull {fa(Suc n), fb(Suc n), fc(Suc n)} \<subseteq> convex hull {fa n, fb n, fc n}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1762
      apply (rule Chain3 [of At, OF At0 AtSuc])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1763
      apply (auto simp: At_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1764
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1765
    have "\<exists>x. \<forall>n. x \<in> convex hull {fa n, fb n, fc n}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1766
      apply (rule bounded_closed_nest)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1767
      apply (simp_all add: compact_imp_closed finite_imp_compact_convex_hull finite_imp_bounded_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1768
      apply (rule allI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1769
      apply (rule transitive_stepwise_le)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1770
      apply (auto simp: conv_le)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1771
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1772
    then obtain x where x: "\<And>n. x \<in> convex hull {fa n, fb n, fc n}" by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1773
    then have xin: "x \<in> convex hull {a,b,c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1774
      using assms f0 by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1775
    then have fx: "f complex_differentiable at x within (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1776
      using assms holomorphic_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1777
    { fix k n
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1778
      assume k: "0 < k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1779
         and le:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1780
            "\<And>x' y' z'.
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1781
               \<lbrakk>dist x' y' \<le> k; dist y' z' \<le> k; dist z' x' \<le> k;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1782
                x \<in> convex hull {x',y',z'};
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1783
                convex hull {x',y',z'} \<subseteq> convex hull {a,b,c}\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1784
               \<Longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1785
               cmod (?pathint x' y' + ?pathint y' z' + ?pathint z' x') * 10
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1786
                     \<le> e * (dist x' y' + dist y' z' + dist z' x')\<^sup>2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1787
         and Kk: "K / k < 2 ^ n"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1788
      have "K / 2 ^ n < k" using Kk k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1789
        by (auto simp: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1790
      then have DD: "dist (fa n) (fb n) \<le> k" "dist (fb n) (fc n) \<le> k" "dist (fc n) (fa n) \<le> k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1791
        using dist [of n]  k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1792
        by linarith+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1793
      have dle: "(dist (fa n) (fb n) + dist (fb n) (fc n) + dist (fc n) (fa n))\<^sup>2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1794
               \<le> (3 * K / 2 ^ n)\<^sup>2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1795
        using dist [of n] e K
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1796
        by (simp add: abs_le_square_iff [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1797
      have less10: "\<And>x y::real. 0 < x \<Longrightarrow> y \<le> 9*x \<Longrightarrow> y < x*10"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1798
        by linarith
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1799
      have "e * (dist (fa n) (fb n) + dist (fb n) (fc n) + dist (fc n) (fa n))\<^sup>2 \<le> e * (3 * K / 2 ^ n)\<^sup>2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1800
        using ynz dle e mult_le_cancel_left_pos by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1801
      also have "... <
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1802
          cmod (?pathint (fa n) (fb n) + ?pathint (fb n) (fc n) + ?pathint (fc n) (fa n)) * 10"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1803
        using no [of n] e K
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1804
        apply (simp add: e_def field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1805
        apply (simp only: zero_less_norm_iff [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1806
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1807
      finally have False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1808
        using le [OF DD x cosb] by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1809
    } then
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1810
    have ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1811
      using holomorphic_point_small_triangle [OF xin contf fx, of "e/10"] e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1812
      apply clarsimp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1813
      apply (rule_tac x1="K/k" in exE [OF real_arch_pow2], blast)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1814
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1815
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1816
  moreover have "f path_integrable_on (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1817
    by simp (meson contf continuous_on_subset path_integrable_continuous_linepath segments_subset_convex_hull(1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1818
                   segments_subset_convex_hull(3) segments_subset_convex_hull(5))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1819
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1820
    using has_path_integral_integral by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1821
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1822
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1823
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1824
subsection\<open>Version needing function holomorphic in interior only\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1825
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1826
lemma Cauchy_theorem_flat_lemma:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1827
  assumes f: "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1828
      and c: "c - a = k *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1829
      and k: "0 \<le> k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1830
    shows "path_integral (linepath a b) f + path_integral (linepath b c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1831
          path_integral (linepath c a) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1832
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1833
  have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1834
    using f continuous_on_subset segments_subset_convex_hull by metis+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1835
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1836
  proof (cases "k \<le> 1")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1837
    case True show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1838
      by (simp add: path_integral_split [OF fabc(1) k True c] path_integral_reverse_linepath fabc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1839
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1840
    case False then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1841
      using fabc c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1842
      apply (subst path_integral_split [of a c f "1/k" b, symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1843
      apply (metis closed_segment_commute fabc(3))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1844
      apply (auto simp: k path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1845
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1846
  qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1847
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1848
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1849
lemma Cauchy_theorem_flat:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1850
  assumes f: "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1851
      and c: "c - a = k *\<^sub>R (b - a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1852
    shows "path_integral (linepath a b) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1853
           path_integral (linepath b c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1854
           path_integral (linepath c a) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1855
proof (cases "0 \<le> k")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1856
  case True with assms show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1857
    by (blast intro: Cauchy_theorem_flat_lemma)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1858
next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1859
  case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1860
  have "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1861
    using f continuous_on_subset segments_subset_convex_hull by metis+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1862
  moreover have "path_integral (linepath b a) f + path_integral (linepath a c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1863
        path_integral (linepath c b) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1864
    apply (rule Cauchy_theorem_flat_lemma [of b a c f "1-k"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1865
    using False c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1866
    apply (auto simp: f insert_commute scaleR_conv_of_real algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1867
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1868
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1869
    apply (auto simp: path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1870
    using add_eq_0_iff by force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1871
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1872
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1873
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1874
lemma Cauchy_theorem_triangle_interior:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1875
  assumes contf: "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1876
      and holf:  "f holomorphic_on interior (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1877
     shows "(f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1878
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1879
  have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1880
    using contf continuous_on_subset segments_subset_convex_hull by metis+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1881
  have "bounded (f ` (convex hull {a,b,c}))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1882
    by (simp add: compact_continuous_image compact_convex_hull compact_imp_bounded contf)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1883
  then obtain B where "0 < B" and Bnf: "\<And>x. x \<in> convex hull {a,b,c} \<Longrightarrow> norm (f x) \<le> B"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1884
     by (auto simp: dest!: bounded_pos [THEN iffD1])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1885
  have "bounded (convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1886
    by (simp add: bounded_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1887
  then obtain C where C: "0 < C" and Cno: "\<And>y. y \<in> convex hull {a,b,c} \<Longrightarrow> norm y < C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1888
    using bounded_pos_less by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1889
  then have diff_2C: "norm(x - y) \<le> 2*C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1890
           if x: "x \<in> convex hull {a, b, c}" and y: "y \<in> convex hull {a, b, c}" for x y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1891
  proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1892
    have "cmod x \<le> C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1893
      using x by (meson Cno not_le not_less_iff_gr_or_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1894
    hence "cmod (x - y) \<le> C + C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1895
      using y by (meson Cno add_mono_thms_linordered_field(4) less_eq_real_def norm_triangle_ineq4 order_trans)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1896
    thus "cmod (x - y) \<le> 2 * C"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1897
      by (metis mult_2)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1898
  qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1899
  have contf': "continuous_on (convex hull {b,a,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1900
    using contf by (simp add: insert_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1901
  { fix y::complex
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1902
    assume fy: "(f has_path_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1903
       and ynz: "y \<noteq> 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1904
    have pi_eq_y: "path_integral (linepath a b) f + path_integral (linepath b c) f + path_integral (linepath c a) f = y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1905
      by (rule has_chain_integral_chain_integral3 [OF fy])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1906
    have ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1907
    proof (cases "c=a \<or> a=b \<or> b=c")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1908
      case True then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1909
        using Cauchy_theorem_flat [OF contf, of 0]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1910
        using has_chain_integral_chain_integral3 [OF fy] ynz
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1911
        by (force simp: fabc path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1912
    next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1913
      case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1914
      then have car3: "card {a, b, c} = Suc (DIM(complex))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1915
        by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1916
      { assume "interior(convex hull {a,b,c}) = {}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1917
        then have "collinear{a,b,c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1918
          using interior_convex_hull_eq_empty [OF car3]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1919
          by (simp add: collinear_3_eq_affine_dependent)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1920
        then have "False"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1921
          using False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1922
          apply (clarsimp simp add: collinear_3 collinear_lemma)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1923
          apply (drule Cauchy_theorem_flat [OF contf'])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1924
          using pi_eq_y ynz
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1925
          apply (simp add: fabc add_eq_0_iff path_integral_reverse_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1926
          done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1927
      }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1928
      then obtain d where d: "d \<in> interior (convex hull {a, b, c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1929
        by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1930
      { fix d1
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1931
        assume d1_pos: "0 < d1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1932
           and d1: "\<And>x x'. \<lbrakk>x\<in>convex hull {a, b, c}; x'\<in>convex hull {a, b, c}; cmod (x' - x) < d1\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1933
                           \<Longrightarrow> cmod (f x' - f x) < cmod y / (24 * C)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1934
        def e      \<equiv> "min 1 (min (d1/(4*C)) ((norm y / 24 / C) / B))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1935
        def shrink \<equiv> "\<lambda>x. x - e *\<^sub>R (x - d)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1936
        let ?pathint = "\<lambda>x y. path_integral(linepath x y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1937
        have e: "0 < e" "e \<le> 1" "e \<le> d1 / (4 * C)" "e \<le> cmod y / 24 / C / B"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1938
          using d1_pos `C>0` `B>0` ynz by (simp_all add: e_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1939
        then have eCB: "24 * e * C * B \<le> cmod y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1940
          using `C>0` `B>0`  by (simp add: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1941
        have e_le_d1: "e * (4 * C) \<le> d1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1942
          using e `C>0` by (simp add: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1943
        have "shrink a \<in> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1944
             "shrink b \<in> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1945
             "shrink c \<in> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1946
          using d e by (auto simp: hull_inc mem_interior_convex_shrink shrink_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1947
        then have fhp0: "(f has_path_integral 0)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1948
                (linepath (shrink a) (shrink b) +++ linepath (shrink b) (shrink c) +++ linepath (shrink c) (shrink a))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1949
          by (simp add: Cauchy_theorem_triangle holomorphic_on_subset [OF holf] hull_minimal convex_interior)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1950
        then have f_0_shrink: "?pathint (shrink a) (shrink b) + ?pathint (shrink b) (shrink c) + ?pathint (shrink c) (shrink a) = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1951
          by (simp add: has_chain_integral_chain_integral3)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1952
        have fpi_abc: "f path_integrable_on linepath (shrink a) (shrink b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1953
                      "f path_integrable_on linepath (shrink b) (shrink c)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1954
                      "f path_integrable_on linepath (shrink c) (shrink a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1955
          using fhp0  by (auto simp: valid_path_join dest: has_path_integral_integrable)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1956
        have cmod_shr: "\<And>x y. cmod (shrink y - shrink x - (y - x)) = e * cmod (x - y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1957
          using e by (simp add: shrink_def real_vector.scale_right_diff_distrib [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1958
        have sh_eq: "\<And>a b d::complex. (b - e *\<^sub>R (b - d)) - (a - e *\<^sub>R (a - d)) - (b - a) = e *\<^sub>R (a - b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1959
          by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1960
        have "cmod y / (24 * C) \<le> cmod y / cmod (b - a) / 12"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1961
          using False `C>0` diff_2C [of b a] ynz
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1962
          by (auto simp: divide_simps hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1963
        have less_C: "\<lbrakk>u \<in> convex hull {a, b, c}; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> x * cmod u < C" for x u
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1964
          apply (cases "x=0", simp add: `0<C`)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1965
          using Cno [of u] mult_left_le_one_le [of "cmod u" x] le_less_trans norm_ge_zero by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1966
        { fix u v
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1967
          assume uv: "u \<in> convex hull {a, b, c}" "v \<in> convex hull {a, b, c}" "u\<noteq>v"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1968
             and fpi_uv: "f path_integrable_on linepath (shrink u) (shrink v)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1969
          have shr_uv: "shrink u \<in> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1970
                       "shrink v \<in> interior(convex hull {a,b,c})"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1971
            using d e uv
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1972
            by (auto simp: hull_inc mem_interior_convex_shrink shrink_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1973
          have cmod_fuv: "\<And>x. 0\<le>x \<Longrightarrow> x\<le>1 \<Longrightarrow> cmod (f (linepath (shrink u) (shrink v) x)) \<le> B"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1974
            using shr_uv by (blast intro: Bnf linepath_in_convex_hull interior_subset [THEN subsetD])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1975
          have By_uv: "B * (12 * (e * cmod (u - v))) \<le> cmod y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1976
            apply (rule order_trans [OF _ eCB])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1977
            using e `B>0` diff_2C [of u v] uv
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1978
            by (auto simp: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1979
          { fix x::real   assume x: "0\<le>x" "x\<le>1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1980
            have cmod_less_4C: "cmod ((1 - x) *\<^sub>R u - (1 - x) *\<^sub>R d) + cmod (x *\<^sub>R v - x *\<^sub>R d) < (C+C) + (C+C)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1981
              apply (rule add_strict_mono; rule norm_triangle_half_l [of _ 0])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1982
              using uv x d interior_subset
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1983
              apply (auto simp: hull_inc intro!: less_C)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1984
              done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1985
            have ll: "linepath (shrink u) (shrink v) x - linepath u v x = -e * ((1 - x) *\<^sub>R (u - d) + x *\<^sub>R (v - d))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1986
              by (simp add: linepath_def shrink_def algebra_simps scaleR_conv_of_real)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1987
            have cmod_less_dt: "cmod (linepath (shrink u) (shrink v) x - linepath u v x) < d1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1988
              using `e>0`
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1989
              apply (simp add: ll norm_mult scaleR_diff_right)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1990
              apply (rule less_le_trans [OF _ e_le_d1])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1991
              using cmod_less_4C
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1992
              apply (force intro: norm_triangle_lt)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1993
              done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1994
            have "cmod (f (linepath (shrink u) (shrink v) x) - f (linepath u v x)) < cmod y / (24 * C)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1995
              using x uv shr_uv cmod_less_dt
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1996
              by (auto simp: hull_inc intro: d1 interior_subset [THEN subsetD] linepath_in_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1997
            also have "... \<le> cmod y / cmod (v - u) / 12"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1998
              using False uv `C>0` diff_2C [of v u] ynz
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1999
              by (auto simp: divide_simps hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2000
            finally have "cmod (f (linepath (shrink u) (shrink v) x) - f (linepath u v x)) \<le> cmod y / cmod (v - u) / 12"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2001
              by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2002
            then have cmod_12_le: "cmod (v - u) * cmod (f (linepath (shrink u) (shrink v) x) - f (linepath u v x)) * 12 \<le> cmod y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2003
              using uv False by (auto simp: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2004
            have "cmod (f (linepath (shrink u) (shrink v) x)) * cmod (shrink v - shrink u - (v - u)) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2005
                  cmod (v - u) * cmod (f (linepath (shrink u) (shrink v) x) - f (linepath u v x))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2006
                  \<le> cmod y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2007
              apply (rule order_trans [of _ "B*((norm y / 24 / C / B)*2*C) + (2*C)*(norm y /24 / C)"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2008
              apply (rule add_mono [OF mult_mono])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2009
              using By_uv e `0 < B` `0 < C` x ynz
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2010
              apply (simp_all add: cmod_fuv cmod_shr cmod_12_le hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2011
              apply (simp add: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2012
              done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2013
          } note cmod_diff_le = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2014
          have f_uv: "continuous_on (closed_segment u v) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2015
            by (blast intro: uv continuous_on_subset [OF contf closed_segment_subset_convex_hull])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2016
          have **: "\<And>f' x' f x::complex. f'*x' - f*x = f'*(x' - x) + x*(f' - f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2017
            by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2018
          have "norm (?pathint (shrink u) (shrink v) - ?pathint u v) \<le> norm y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2019
            apply (rule order_trans)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2020
            apply (rule has_integral_bound
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2021
                    [of "B*(norm y /24/C/B)*2*C + (2*C)*(norm y/24/C)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2022
                        "\<lambda>x. f(linepath (shrink u) (shrink v) x) * (shrink v - shrink u) - f(linepath u v x)*(v - u)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2023
                        _ 0 1 ])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2024
            using ynz `0 < B` `0 < C`
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2025
            apply (simp_all del: le_divide_eq_numeral1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2026
            apply (simp add: has_integral_sub has_path_integral_linepath [symmetric] has_path_integral_integral
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2027
                             fpi_uv f_uv path_integrable_continuous_linepath, clarify)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2028
            apply (simp only: **)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2029
            apply (simp add: norm_triangle_le norm_mult cmod_diff_le del: le_divide_eq_numeral1)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2030
            done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2031
          } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2032
          have "norm (?pathint (shrink a) (shrink b) - ?pathint a b) \<le> norm y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2033
            using False fpi_abc by (rule_tac *) (auto simp: hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2034
          moreover
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2035
          have "norm (?pathint (shrink b) (shrink c) - ?pathint b c) \<le> norm y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2036
            using False fpi_abc by (rule_tac *) (auto simp: hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2037
          moreover
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2038
          have "norm (?pathint (shrink c) (shrink a) - ?pathint c a) \<le> norm y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2039
            using False fpi_abc by (rule_tac *) (auto simp: hull_inc)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2040
          ultimately
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2041
          have "norm((?pathint (shrink a) (shrink b) - ?pathint a b) +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2042
                     (?pathint (shrink b) (shrink c) - ?pathint b c) + (?pathint (shrink c) (shrink a) - ?pathint c a))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2043
                \<le> norm y / 6 + norm y / 6 + norm y / 6"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2044
            by (metis norm_triangle_le add_mono)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2045
          also have "... = norm y / 2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2046
            by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2047
          finally have "norm((?pathint (shrink a) (shrink b) + ?pathint (shrink b) (shrink c) + ?pathint (shrink c) (shrink a)) -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2048
                          (?pathint a b + ?pathint b c + ?pathint c a))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2049
                \<le> norm y / 2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2050
            by (simp add: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2051
          then
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2052
          have "norm(?pathint a b + ?pathint b c + ?pathint c a) \<le> norm y / 2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2053
            by (simp add: f_0_shrink) (metis (mono_tags) add.commute minus_add_distrib norm_minus_cancel uminus_add_conv_diff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2054
          then have "False"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2055
            using pi_eq_y ynz by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2056
        }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2057
        moreover have "uniformly_continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2058
          by (simp add: contf compact_convex_hull compact_uniformly_continuous)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2059
        ultimately have "False"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2060
          unfolding uniformly_continuous_on_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2061
          by (force simp: ynz `0 < C` dist_norm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2062
        then show ?thesis ..
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2063
      qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2064
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2065
  moreover have "f path_integrable_on (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2066
    using fabc path_integrable_continuous_linepath by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2067
  ultimately show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2068
    using has_path_integral_integral by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2069
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2070
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2071
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2072
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2073
subsection\<open>Version allowing finite number of exceptional points\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2074
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2075
lemma Cauchy_theorem_triangle_cofinite:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2076
  assumes "continuous_on (convex hull {a,b,c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2077
      and "finite s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2078
      and "(\<And>x. x \<in> interior(convex hull {a,b,c}) - s \<Longrightarrow> f complex_differentiable (at x))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2079
     shows "(f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2080
using assms
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2081
proof (induction "card s" arbitrary: a b c s rule: less_induct)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2082
  case (less s a b c)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2083
  show ?case
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2084
  proof (cases "s={}")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2085
    case True with less show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2086
      by (simp add: holomorphic_on_def complex_differentiable_at_within
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2087
                    Cauchy_theorem_triangle_interior)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2088
  next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2089
    case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2090
    then obtain d s' where d: "s = insert d s'" "d \<notin> s'"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2091
      by (meson Set.set_insert all_not_in_conv)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2092
    then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2093
    proof (cases "d \<in> convex hull {a,b,c}")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2094
      case False
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2095
      show "(f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2096
        apply (rule less.hyps [of "s'"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2097
        using False d `finite s` interior_subset
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2098
        apply (auto intro!: less.prems)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2099
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2100
    next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2101
      case True
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2102
      have *: "convex hull {a, b, d} \<subseteq> convex hull {a, b, c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2103
        by (meson True hull_subset insert_subset convex_hull_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2104
      have abd: "(f has_path_integral 0) (linepath a b +++ linepath b d +++ linepath d a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2105
        apply (rule less.hyps [of "s'"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2106
        using True d  `finite s` not_in_interior_convex_hull_3
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2107
        apply (auto intro!: less.prems continuous_on_subset [OF  _ *])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2108
        apply (metis * insert_absorb insert_subset interior_mono)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2109
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2110
      have *: "convex hull {b, c, d} \<subseteq> convex hull {a, b, c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2111
        by (meson True hull_subset insert_subset convex_hull_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2112
      have bcd: "(f has_path_integral 0) (linepath b c +++ linepath c d +++ linepath d b)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2113
        apply (rule less.hyps [of "s'"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2114
        using True d  `finite s` not_in_interior_convex_hull_3
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2115
        apply (auto intro!: less.prems continuous_on_subset [OF _ *])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2116
        apply (metis * insert_absorb insert_subset interior_mono)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2117
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2118
      have *: "convex hull {c, a, d} \<subseteq> convex hull {a, b, c}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2119
        by (meson True hull_subset insert_subset convex_hull_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2120
      have cad: "(f has_path_integral 0) (linepath c a +++ linepath a d +++ linepath d c)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2121
        apply (rule less.hyps [of "s'"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2122
        using True d  `finite s` not_in_interior_convex_hull_3
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2123
        apply (auto intro!: less.prems continuous_on_subset [OF _ *])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2124
        apply (metis * insert_absorb insert_subset interior_mono)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2125
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2126
      have "f path_integrable_on linepath a b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2127
        using less.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2128
        by (metis continuous_on_subset insert_commute path_integrable_continuous_linepath segments_subset_convex_hull(3))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2129
      moreover have "f path_integrable_on linepath b c"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2130
        using less.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2131
        by (metis continuous_on_subset path_integrable_continuous_linepath segments_subset_convex_hull(3))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2132
      moreover have "f path_integrable_on linepath c a"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2133
        using less.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2134
        by (metis continuous_on_subset insert_commute path_integrable_continuous_linepath segments_subset_convex_hull(3))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2135
      ultimately have fpi: "f path_integrable_on (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2136
        by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2137
      { fix y::complex
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2138
        assume fy: "(f has_path_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2139
           and ynz: "y \<noteq> 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2140
        have cont_ad: "continuous_on (closed_segment a d) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2141
          by (meson "*" continuous_on_subset less.prems(1) segments_subset_convex_hull(3))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2142
        have cont_bd: "continuous_on (closed_segment b d) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2143
          by (meson True closed_segment_subset_convex_hull continuous_on_subset hull_subset insert_subset less.prems(1))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2144
        have cont_cd: "continuous_on (closed_segment c d) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2145
          by (meson "*" continuous_on_subset less.prems(1) segments_subset_convex_hull(2))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2146
        have "path_integral  (linepath a b) f = - (path_integral (linepath b d) f + (path_integral (linepath d a) f))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2147
                "path_integral  (linepath b c) f = - (path_integral (linepath c d) f + (path_integral (linepath d b) f))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2148
                "path_integral  (linepath c a) f = - (path_integral (linepath a d) f + path_integral (linepath d c) f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2149
            using has_chain_integral_chain_integral3 [OF abd]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2150
                  has_chain_integral_chain_integral3 [OF bcd]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2151
                  has_chain_integral_chain_integral3 [OF cad]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2152
            by (simp_all add: algebra_simps add_eq_0_iff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2153
        then have ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2154
          using cont_ad cont_bd cont_cd fy has_chain_integral_chain_integral3 path_integral_reverse_linepath by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2155
      }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2156
      then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2157
        using fpi path_integrable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2158
    qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2159
  qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2160
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2161
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2162
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2163
subsection\<open>Cauchy's theorem for an open starlike set\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2164
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2165
lemma starlike_convex_subset:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2166
  assumes s: "a \<in> s" "closed_segment b c \<subseteq> s" and subs: "\<And>x. x \<in> s \<Longrightarrow> closed_segment a x \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2167
    shows "convex hull {a,b,c} \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2168
      using s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2169
      apply (clarsimp simp add: convex_hull_insert [of "{b,c}" a] segment_convex_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2170
      apply (meson subs convexD convex_segment ends_in_segment(1) ends_in_segment(2) subsetCE)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2171
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2172
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2173
lemma triangle_path_integrals_starlike_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2174
  assumes contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2175
      and s: "a \<in> s" "open s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2176
      and x: "x \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2177
      and subs: "\<And>y. y \<in> s \<Longrightarrow> closed_segment a y \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2178
      and zer: "\<And>b c. closed_segment b c \<subseteq> s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2179
                   \<Longrightarrow> path_integral (linepath a b) f + path_integral (linepath b c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2180
                       path_integral (linepath c a) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2181
    shows "((\<lambda>x. path_integral(linepath a x) f) has_field_derivative f x) (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2182
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2183
  let ?pathint = "\<lambda>x y. path_integral(linepath x y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2184
  { fix e y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2185
    assume e: "0 < e" and bxe: "ball x e \<subseteq> s" and close: "cmod (y - x) < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2186
    have y: "y \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2187
      using bxe close  by (force simp: dist_norm norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2188
    have cont_ayf: "continuous_on (closed_segment a y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2189
      using contf continuous_on_subset subs y by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2190
    have xys: "closed_segment x y \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2191
      apply (rule order_trans [OF _ bxe])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2192
      using close
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2193
      by (auto simp: dist_norm ball_def norm_minus_commute dest: segment_bound)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2194
    have "?pathint a y - ?pathint a x = ?pathint x y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2195
      using zer [OF xys]  path_integral_reverse_linepath [OF cont_ayf]  add_eq_0_iff by force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2196
  } note [simp] = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2197
  { fix e::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2198
    assume e: "0 < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2199
    have cont_atx: "continuous (at x) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2200
      using x s contf continuous_on_eq_continuous_at by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2201
    then obtain d1 where d1: "d1>0" and d1_less: "\<And>y. cmod (y - x) < d1 \<Longrightarrow> cmod (f y - f x) < e/2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2202
      unfolding continuous_at Lim_at dist_norm  using e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2203
      by (drule_tac x="e/2" in spec) force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2204
    obtain d2 where d2: "d2>0" "ball x d2 \<subseteq> s" using  `open s` x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2205
      by (auto simp: open_contains_ball)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2206
    have dpos: "min d1 d2 > 0" using d1 d2 by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2207
    { fix y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2208
      assume yx: "y \<noteq> x" and close: "cmod (y - x) < min d1 d2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2209
      have y: "y \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2210
        using d2 close  by (force simp: dist_norm norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2211
      have fxy: "f path_integrable_on linepath x y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2212
        apply (rule path_integrable_continuous_linepath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2213
        apply (rule continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2214
        using close d2
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2215
        apply (auto simp: dist_norm norm_minus_commute dest!: segment_bound(1))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2216
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2217
      then obtain i where i: "(f has_path_integral i) (linepath x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2218
        by (auto simp: path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2219
      then have "((\<lambda>w. f w - f x) has_path_integral (i - f x * (y - x))) (linepath x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2220
        by (rule has_path_integral_diff [OF _ has_path_integral_const_linepath])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2221
      then have "cmod (i - f x * (y - x)) \<le> e / 2 * cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2222
        apply (rule has_path_integral_bound_linepath [where B = "e/2"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2223
        using e apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2224
        apply (rule d1_less [THEN less_imp_le])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2225
        using close segment_bound
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2226
        apply force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2227
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2228
      also have "... < e * cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2229
        by (simp add: e yx)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2230
      finally have "cmod (?pathint x y - f x * (y-x)) / cmod (y-x) < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2231
        using i yx  by (simp add: path_integral_unique divide_less_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2232
    }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2233
    then have "\<exists>d>0. \<forall>y. y \<noteq> x \<and> cmod (y-x) < d \<longrightarrow> cmod (?pathint x y - f x * (y-x)) / cmod (y-x) < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2234
      using dpos by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2235
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2236
  then have *: "(\<lambda>y. (?pathint x y - f x * (y - x)) /\<^sub>R cmod (y - x)) -- x --> 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2237
    by (simp add: Lim_at dist_norm inverse_eq_divide)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2238
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2239
    apply (simp add: has_field_derivative_def has_derivative_at bounded_linear_mult_right)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2240
    apply (rule Lim_transform [OF * Lim_eventually])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2241
    apply (simp add: inverse_eq_divide [symmetric] eventually_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2242
    using `open s` x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2243
    apply (force simp: dist_norm open_contains_ball)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2244
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2245
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2246
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2247
(** Existence of a primitive.*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2248
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2249
lemma holomorphic_starlike_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2250
  assumes contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2251
      and s: "starlike s" and os: "open s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2252
      and k: "finite k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2253
      and fcd: "\<And>x. x \<in> s - k \<Longrightarrow> f complex_differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2254
    shows "\<exists>g. \<forall>x \<in> s. (g has_field_derivative f x) (at x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2255
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2256
  obtain a where a: "a\<in>s" and a_cs: "\<And>x. x\<in>s \<Longrightarrow> closed_segment a x \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2257
    using s by (auto simp: starlike_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2258
  { fix x b c
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2259
    assume "x \<in> s" "closed_segment b c \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2260
    then have abcs: "convex hull {a, b, c} \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2261
      by (simp add: a a_cs starlike_convex_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2262
    then have *: "continuous_on (convex hull {a, b, c}) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2263
      by (simp add: continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2264
    have "(f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2265
      apply (rule Cauchy_theorem_triangle_cofinite [OF _ k])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2266
      using abcs apply (simp add: continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2267
      using * abcs interior_subset apply (auto intro: fcd)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2268
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2269
  } note 0 = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2270
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2271
    apply (intro exI ballI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2272
    apply (rule triangle_path_integrals_starlike_primitive [OF contf a os], assumption)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2273
    apply (metis a_cs)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2274
    apply (metis has_chain_integral_chain_integral3 0)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2275
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2276
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2277
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2278
lemma Cauchy_theorem_starlike:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2279
 "\<lbrakk>open s; starlike s; finite k; continuous_on s f;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2280
   \<And>x. x \<in> s - k \<Longrightarrow> f complex_differentiable at x;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2281
   valid_path g; path_image g \<subseteq> s; pathfinish g = pathstart g\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2282
   \<Longrightarrow> (f has_path_integral 0)  g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2283
  by (metis holomorphic_starlike_primitive Cauchy_theorem_primitive at_within_open)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2284
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2285
lemma Cauchy_theorem_starlike_simple:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2286
  "\<lbrakk>open s; starlike s; f holomorphic_on s; valid_path g; path_image g \<subseteq> s; pathfinish g = pathstart g\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2287
   \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2288
apply (rule Cauchy_theorem_starlike [OF _ _ finite.emptyI])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2289
apply (simp_all add: holomorphic_on_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2290
apply (metis at_within_open holomorphic_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2291
done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2292
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2293
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2294
subsection\<open>Cauchy's theorem for a convex set\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2295
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2296
text\<open>For a convex set we can avoid assuming openness and boundary analyticity\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2297
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2298
lemma triangle_path_integrals_convex_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2299
  assumes contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2300
      and s: "a \<in> s" "convex s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2301
      and x: "x \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2302
      and zer: "\<And>b c. \<lbrakk>b \<in> s; c \<in> s\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2303
                   \<Longrightarrow> path_integral (linepath a b) f + path_integral (linepath b c) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2304
                       path_integral (linepath c a) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2305
    shows "((\<lambda>x. path_integral(linepath a x) f) has_field_derivative f x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2306
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2307
  let ?pathint = "\<lambda>x y. path_integral(linepath x y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2308
  { fix y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2309
    assume y: "y \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2310
    have cont_ayf: "continuous_on (closed_segment a y) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2311
      using s y  by (meson contf continuous_on_subset convex_contains_segment)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2312
    have xys: "closed_segment x y \<subseteq> s"  (*?*)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2313
      using convex_contains_segment s x y by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2314
    have "?pathint a y - ?pathint a x = ?pathint x y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2315
      using zer [OF x y]  path_integral_reverse_linepath [OF cont_ayf]  add_eq_0_iff by force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2316
  } note [simp] = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2317
  { fix e::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2318
    assume e: "0 < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2319
    have cont_atx: "continuous (at x within s) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2320
      using x s contf  by (simp add: continuous_on_eq_continuous_within)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2321
    then obtain d1 where d1: "d1>0" and d1_less: "\<And>y. \<lbrakk>y \<in> s; cmod (y - x) < d1\<rbrakk> \<Longrightarrow> cmod (f y - f x) < e/2"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2322
      unfolding continuous_within Lim_within dist_norm using e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2323
      by (drule_tac x="e/2" in spec) force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2324
    { fix y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2325
      assume yx: "y \<noteq> x" and close: "cmod (y - x) < d1" and y: "y \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2326
      have fxy: "f path_integrable_on linepath x y"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2327
        using convex_contains_segment s x y
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2328
        by (blast intro!: path_integrable_continuous_linepath continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2329
      then obtain i where i: "(f has_path_integral i) (linepath x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2330
        by (auto simp: path_integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2331
      then have "((\<lambda>w. f w - f x) has_path_integral (i - f x * (y - x))) (linepath x y)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2332
        by (rule has_path_integral_diff [OF _ has_path_integral_const_linepath])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2333
      then have "cmod (i - f x * (y - x)) \<le> e / 2 * cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2334
        apply (rule has_path_integral_bound_linepath [where B = "e/2"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2335
        using e apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2336
        apply (rule d1_less [THEN less_imp_le])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2337
        using convex_contains_segment s(2) x y apply blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2338
        using close segment_bound(1) apply fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2339
        done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2340
      also have "... < e * cmod (y - x)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2341
        by (simp add: e yx)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2342
      finally have "cmod (?pathint x y - f x * (y-x)) / cmod (y-x) < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2343
        using i yx  by (simp add: path_integral_unique divide_less_eq)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2344
    }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2345
    then have "\<exists>d>0. \<forall>y\<in>s. y \<noteq> x \<and> cmod (y-x) < d \<longrightarrow> cmod (?pathint x y - f x * (y-x)) / cmod (y-x) < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2346
      using d1 by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2347
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2348
  then have *: "((\<lambda>y. (path_integral (linepath x y) f - f x * (y - x)) /\<^sub>R cmod (y - x)) ---> 0) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2349
    by (simp add: Lim_within dist_norm inverse_eq_divide)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2350
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2351
    apply (simp add: has_field_derivative_def has_derivative_within bounded_linear_mult_right)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2352
    apply (rule Lim_transform [OF * Lim_eventually])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2353
    using linordered_field_no_ub
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2354
    apply (force simp: inverse_eq_divide [symmetric] eventually_at)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2355
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2356
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2357
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2358
lemma pathintegral_convex_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2359
  "\<lbrakk>convex s; continuous_on s f;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2360
    \<And>a b c. \<lbrakk>a \<in> s; b \<in> s; c \<in> s\<rbrakk> \<Longrightarrow> (f has_path_integral 0) (linepath a b +++ linepath b c +++ linepath c a)\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2361
         \<Longrightarrow> \<exists>g. \<forall>x \<in> s. (g has_field_derivative f x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2362
  apply (cases "s={}")
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2363
  apply (simp_all add: ex_in_conv [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2364
  apply (blast intro: triangle_path_integrals_convex_primitive has_chain_integral_chain_integral3)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2365
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2366
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2367
lemma holomorphic_convex_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2368
  "\<lbrakk>convex s; finite k; continuous_on s f;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2369
    \<And>x. x \<in> interior s - k \<Longrightarrow> f complex_differentiable at x\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2370
   \<Longrightarrow> \<exists>g. \<forall>x \<in> s. (g has_field_derivative f x) (at x within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2371
apply (rule pathintegral_convex_primitive [OF _ _ Cauchy_theorem_triangle_cofinite])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2372
prefer 3
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2373
apply (erule continuous_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2374
apply (simp add: subset_hull continuous_on_subset, assumption+)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2375
by (metis Diff_iff convex_contains_segment insert_absorb insert_subset interior_mono segment_convex_hull subset_hull)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2376
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2377
lemma Cauchy_theorem_convex:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2378
    "\<lbrakk>continuous_on s f;convex s; finite k;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2379
      \<And>x. x \<in> interior s - k \<Longrightarrow> f complex_differentiable at x;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2380
     valid_path g; path_image g \<subseteq> s;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2381
     pathfinish g = pathstart g\<rbrakk> \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2382
  by (metis holomorphic_convex_primitive Cauchy_theorem_primitive)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2383
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2384
lemma Cauchy_theorem_convex_simple:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2385
    "\<lbrakk>f holomorphic_on s; convex s;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2386
     valid_path g; path_image g \<subseteq> s;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2387
     pathfinish g = pathstart g\<rbrakk> \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2388
  apply (rule Cauchy_theorem_convex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2389
  apply (simp_all add: holomorphic_on_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2390
  apply (rule finite.emptyI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2391
  using at_within_interior holomorphic_on_def interior_subset by fastforce
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2392
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2393
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2394
text\<open>In particular for a disc\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2395
lemma Cauchy_theorem_disc:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2396
    "\<lbrakk>finite k; continuous_on (cball a e) f;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2397
      \<And>x. x \<in> ball a e - k \<Longrightarrow> f complex_differentiable at x;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2398
     valid_path g; path_image g \<subseteq> cball a e;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2399
     pathfinish g = pathstart g\<rbrakk> \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2400
  apply (rule Cauchy_theorem_convex)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2401
  apply (auto simp: convex_cball interior_cball)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2402
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2403
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2404
lemma Cauchy_theorem_disc_simple:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2405
    "\<lbrakk>f holomorphic_on (ball a e); valid_path g; path_image g \<subseteq> ball a e;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2406
     pathfinish g = pathstart g\<rbrakk> \<Longrightarrow> (f has_path_integral 0) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2407
by (simp add: Cauchy_theorem_convex_simple)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2408
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2409
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2410
subsection\<open>Generalize integrability to local primitives\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2411
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2412
lemma path_integral_local_primitive_lemma:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2413
  fixes f :: "complex\<Rightarrow>complex"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2414
  shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2415
    "\<lbrakk>g piecewise_differentiable_on {a..b};
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2416
      \<And>x. x \<in> s \<Longrightarrow> (f has_field_derivative f' x) (at x within s);
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2417
      \<And>x. x \<in> {a..b} \<Longrightarrow> g x \<in> s\<rbrakk>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2418
     \<Longrightarrow> (\<lambda>x. f' (g x) * vector_derivative g (at x within {a..b}))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2419
            integrable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2420
  apply (cases "cbox a b = {}", force)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2421
  apply (simp add: integrable_on_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2422
  apply (rule exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2423
  apply (rule path_integral_primitive_lemma, assumption+)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2424
  using atLeastAtMost_iff by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2425
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2426
lemma path_integral_local_primitive_any:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2427
  fixes f :: "complex \<Rightarrow> complex"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2428
  assumes gpd: "g piecewise_differentiable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2429
      and dh: "\<And>x. x \<in> s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2430
               \<Longrightarrow> \<exists>d h. 0 < d \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2431
                         (\<forall>y. norm(y - x) < d \<longrightarrow> (h has_field_derivative f y) (at y within s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2432
      and gs: "\<And>x. x \<in> {a..b} \<Longrightarrow> g x \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2433
  shows "(\<lambda>x. f(g x) * vector_derivative g (at x)) integrable_on {a..b}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2434
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2435
  { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2436
    assume x: "a \<le> x" "x \<le> b"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2437
    obtain d h where d: "0 < d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2438
               and h: "(\<And>y. norm(y - g x) < d \<Longrightarrow> (h has_field_derivative f y) (at y within s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2439
      using x gs dh by (metis atLeastAtMost_iff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2440
    have "continuous_on {a..b} g" using gpd piecewise_differentiable_on_def by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2441
    then obtain e where e: "e>0" and lessd: "\<And>x'. x' \<in> {a..b} \<Longrightarrow> \<bar>x' - x\<bar> < e \<Longrightarrow> cmod (g x' - g x) < d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2442
      using x d
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2443
      apply (auto simp: dist_norm continuous_on_iff)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2444
      apply (drule_tac x=x in bspec)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2445
      using x apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2446
      apply (drule_tac x=d in spec, auto)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2447
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2448
    have "\<exists>d>0. \<forall>u v. u \<le> x \<and> x \<le> v \<and> {u..v} \<subseteq> ball x d \<and> (u \<le> v \<longrightarrow> a \<le> u \<and> v \<le> b) \<longrightarrow>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2449
                          (\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..v}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2450
      apply (rule_tac x=e in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2451
      using e
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2452
      apply (simp add: integrable_on_localized_vector_derivative [symmetric], clarify)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2453
      apply (rule_tac f = h and s = "g ` {u..v}" in path_integral_local_primitive_lemma)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2454
        apply (meson atLeastatMost_subset_iff gpd piecewise_differentiable_on_subset)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2455
       apply (force simp: ball_def dist_norm intro: lessd gs DERIV_subset [OF h], force)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2456
      done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2457
  } then
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2458
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2459
    by (force simp: intro!: integrable_on_little_subintervals [of a b, simplified])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2460
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2461
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2462
lemma path_integral_local_primitive:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2463
  fixes f :: "complex \<Rightarrow> complex"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2464
  assumes g: "valid_path g" "path_image g \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2465
      and dh: "\<And>x. x \<in> s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2466
               \<Longrightarrow> \<exists>d h. 0 < d \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2467
                         (\<forall>y. norm(y - x) < d \<longrightarrow> (h has_field_derivative f y) (at y within s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2468
  shows "f path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2469
  using g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2470
  apply (simp add: valid_path_def path_image_def path_integrable_on_def has_path_integral_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2471
            has_integral_localized_vector_derivative integrable_on_def [symmetric])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2472
  apply (auto intro: path_integral_local_primitive_any [OF _ dh])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2473
  done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2474
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2475
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2476
text\<open>In particular if a function is holomorphic\<close>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2477
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2478
lemma path_integrable_holomorphic:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2479
  assumes contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2480
      and os: "open s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2481
      and k: "finite k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2482
      and g: "valid_path g" "path_image g \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2483
      and fcd: "\<And>x. x \<in> s - k \<Longrightarrow> f complex_differentiable at x"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2484
    shows "f path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2485
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2486
  { fix z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2487
    assume z: "z \<in> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2488
    obtain d where d: "d>0" "ball z d \<subseteq> s" using  `open s` z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2489
      by (auto simp: open_contains_ball)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2490
    then have contfb: "continuous_on (ball z d) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2491
      using contf continuous_on_subset by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2492
    obtain h where "\<forall>y\<in>ball z d. (h has_field_derivative f y) (at y within ball z d)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2493
      using holomorphic_convex_primitive [OF convex_ball k contfb fcd] d
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2494
            interior_subset by force
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2495
    then have "\<forall>y\<in>ball z d. (h has_field_derivative f y) (at y within s)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2496
      by (metis Topology_Euclidean_Space.open_ball at_within_open d(2) os subsetCE)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2497
    then have "\<exists>h. (\<forall>y. cmod (y - z) < d \<longrightarrow> (h has_field_derivative f y) (at y within s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2498
      by (force simp: dist_norm norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2499
    then have "\<exists>d h. 0 < d \<and> (\<forall>y. cmod (y - z) < d \<longrightarrow> (h has_field_derivative f y) (at y within s))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2500
      using d by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2501
  }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2502
  then show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2503
    by (rule path_integral_local_primitive [OF g])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2504
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2505
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2506
lemma path_integrable_holomorphic_simple:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2507
  assumes contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2508
      and os: "open s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2509
      and g: "valid_path g" "path_image g \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2510
      and fh: "f holomorphic_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2511
    shows "f path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2512
  apply (rule path_integrable_holomorphic [OF contf os Finite_Set.finite.emptyI g])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2513
  using fh  by (simp add: complex_differentiable_def holomorphic_on_open os)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2514
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2515
lemma path_integrable_inversediff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2516
    "\<lbrakk>valid_path g; z \<notin> path_image g\<rbrakk> \<Longrightarrow> (\<lambda>w. 1 / (w-z)) path_integrable_on g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2517
apply (rule path_integrable_holomorphic_simple [of "UNIV-{z}"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2518
    apply (rule continuous_intros | simp)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2519
 apply blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2520
apply (simp add: holomorphic_on_open open_delete)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2521
apply (force intro: derivative_eq_intros)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2522
done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2523
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2524
text{*Key fact that path integral is the same for a "nearby" path. This is the
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2525
 main lemma for the homotopy form of Cauchy's theorem and is also useful
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2526
 if we want "without loss of generality" to assume some nice properties of a
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2527
 path (e.g. smoothness). It can also be used to define the integrals of
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2528
 analytic functions over arbitrary continuous paths. This is just done for
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2529
 winding numbers now.
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2530
*}
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2531
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2532
text{*This formulation covers two cases: @{term g} and @{term h} share their
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2533
      start and end points; @{term g} and @{term h} both loop upon themselves. *}
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2534
lemma path_integral_nearby:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2535
  assumes os: "open s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2536
      and p: "path p" "path_image p \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2537
    shows
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2538
       "\<exists>d. 0 < d \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2539
            (\<forall>g h. valid_path g \<and> valid_path h \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2540
                  (\<forall>t \<in> {0..1}. norm(g t - p t) < d \<and> norm(h t - p t) < d) \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2541
                  (if Ends then pathstart h = pathstart g \<and> pathfinish h = pathfinish g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2542
                   else pathfinish g = pathstart g \<and> pathfinish h = pathstart h)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2543
                  \<longrightarrow> path_image g \<subseteq> s \<and> path_image h \<subseteq> s \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2544
                      (\<forall>f. f holomorphic_on s \<longrightarrow> path_integral h f = path_integral g f))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2545
proof -
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2546
  have "\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2547
    using open_contains_ball os p(2) by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2548
  then obtain ee where ee: "\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2549
    by metis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2550
  def cover \<equiv> "(\<lambda>z. ball z (ee z/3)) ` (path_image p)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2551
  have "compact (path_image p)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2552
    by (metis p(1) compact_path_image)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2553
  moreover have "path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2554
    using ee by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2555
  ultimately have "\<exists>D \<subseteq> cover. finite D \<and> path_image p \<subseteq> \<Union>D"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2556
    by (simp add: compact_eq_heine_borel cover_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2557
  then obtain D where D: "D \<subseteq> cover" "finite D" "path_image p \<subseteq> \<Union>D"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2558
    by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2559
  then obtain k where k: "k \<subseteq> {0..1}" "finite k" and D_eq: "D = ((\<lambda>z. ball z (ee z / 3)) \<circ> p) ` k"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2560
    apply (simp add: cover_def path_image_def image_comp)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2561
    apply (blast dest!: finite_subset_image [OF `finite D`])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2562
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2563
  then have kne: "k \<noteq> {}"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2564
    using D by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2565
  have pi: "\<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2566
    using k  by (auto simp: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2567
  then have eepi: "\<And>i. i \<in> k \<Longrightarrow> 0 < ee((p i))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2568
    by (metis ee)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2569
  def e \<equiv> "Min((ee o p) ` k)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2570
  have fin_eep: "finite ((ee o p) ` k)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2571
    using k  by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2572
  have enz: "0 < e"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2573
    using ee k  by (simp add: kne e_def Min_gr_iff [OF fin_eep] eepi)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2574
  have "uniformly_continuous_on {0..1} p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2575
    using p  by (simp add: path_def compact_uniformly_continuous)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2576
  then obtain d::real where d: "d>0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2577
          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"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2578
    unfolding uniformly_continuous_on_def dist_norm real_norm_def
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2579
    by (metis divide_pos_pos enz zero_less_numeral)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2580
  then obtain N::nat where N: "N>0" "inverse N < d"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2581
    using real_arch_inv [of d]   by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2582
  { fix g h
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2583
    assume g: "valid_path g" and gp: "\<forall>t\<in>{0..1}. cmod (g t - p t) < e / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2584
       and h: "valid_path h" and hp: "\<forall>t\<in>{0..1}. cmod (h t - p t) < e / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2585
       and joins: "if Ends then pathstart h = pathstart g \<and> pathfinish h = pathfinish g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2586
                   else pathfinish g = pathstart g \<and> pathfinish h = pathstart h"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2587
    { fix t::real
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2588
      assume t: "0 \<le> t" "t \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2589
      then obtain u where u: "u \<in> k" and ptu: "p t \<in> ball(p u) (ee(p u) / 3)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2590
        using `path_image p \<subseteq> \<Union>D` D_eq by (force simp: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2591
      then have ele: "e \<le> ee (p u)" using fin_eep
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2592
        by (simp add: e_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2593
      have "cmod (g t - p t) < e / 3" "cmod (h t - p t) < e / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2594
        using gp hp t by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2595
      with ele have "cmod (g t - p t) < ee (p u) / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2596
                    "cmod (h t - p t) < ee (p u) / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2597
        by linarith+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2598
      then have "g t \<in> ball(p u) (ee(p u))"  "h t \<in> ball(p u) (ee(p u))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2599
        using norm_diff_triangle_ineq [of "g t" "p t" "p t" "p u"]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2600
              norm_diff_triangle_ineq [of "h t" "p t" "p t" "p u"] ptu eepi u
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2601
        by (force simp add: dist_norm ball_def norm_minus_commute)+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2602
      then have "g t \<in> s" "h t \<in> s" using ee u k
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2603
        by (auto simp: path_image_def ball_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2604
    }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2605
    then have ghs: "path_image g \<subseteq> s" "path_image h \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2606
      by (auto simp: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2607
    moreover
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2608
    { fix f
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2609
      assume fhols: "f holomorphic_on s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2610
      then have fpa: "f path_integrable_on g"  "f path_integrable_on h"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2611
        using g ghs h holomorphic_on_imp_continuous_on os path_integrable_holomorphic_simple
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2612
        by blast+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2613
      have contf: "continuous_on s f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2614
        by (simp add: fhols holomorphic_on_imp_continuous_on)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2615
      { fix z
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2616
        assume z: "z \<in> path_image p"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2617
        have "f holomorphic_on ball z (ee z)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2618
          using fhols ee z holomorphic_on_subset by blast
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2619
        then have "\<exists>ff. (\<forall>w \<in> ball z (ee z). (ff has_field_derivative f w) (at w))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2620
          using holomorphic_convex_primitive [of "ball z (ee z)" "{}" f, simplified]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2621
          by (metis open_ball at_within_open holomorphic_on_def holomorphic_on_imp_continuous_on mem_ball)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2622
      }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2623
      then obtain ff where ff:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2624
            "\<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)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2625
        by metis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2626
      { fix n
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2627
        assume n: "n \<le> N"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2628
        then have "path_integral(subpath 0 (n/N) h) f - path_integral(subpath 0 (n/N) g) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2629
                   path_integral(linepath (g(n/N)) (h(n/N))) f - path_integral(linepath (g 0) (h 0)) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2630
        proof (induct n)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2631
          case 0 show ?case by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2632
        next
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2633
          case (Suc n)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2634
          obtain t where t: "t \<in> k" and "p (n/N) \<in> ball(p t) (ee(p t) / 3)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2635
            using `path_image p \<subseteq> \<Union>D` [THEN subsetD, where c="p (n/N)"] D_eq N Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2636
            by (force simp add: path_image_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2637
          then have ptu: "cmod (p t - p (n/N)) < ee (p t) / 3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2638
            by (simp add: dist_norm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2639
          have e3le: "e/3 \<le> ee (p t) / 3"  using fin_eep t
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2640
            by (simp add: e_def)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2641
          { fix x
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2642
            assume x: "n/N \<le> x" "x \<le> (1 + n)/N"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2643
            then have nN01: "0 \<le> n/N" "(1 + n)/N \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2644
              using Suc.prems by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2645
            then have x01: "0 \<le> x" "x \<le> 1"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2646
              using x by linarith+
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2647
            have "cmod (p t - p x)  < ee (p t) / 3 + e/3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2648
              apply (rule norm_diff_triangle_less [OF ptu de])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2649
              using x N x01 Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2650
              apply (auto simp: field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2651
              done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2652
            then have ptx: "cmod (p t - p x) < 2*ee (p t)/3"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2653
              using e3le eepi [OF t] by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2654
            have "cmod (p t - g x) < 2*ee (p t)/3 + e/3 "
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2655
              apply (rule norm_diff_triangle_less [OF ptx])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2656
              using gp x01 by (simp add: norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2657
            also have "... \<le> ee (p t)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2658
              using e3le eepi [OF t] by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2659
            finally have gg: "cmod (p t - g x) < ee (p t)" .
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2660
            have "cmod (p t - h x) < 2*ee (p t)/3 + e/3 "
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2661
              apply (rule norm_diff_triangle_less [OF ptx])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2662
              using hp x01 by (simp add: norm_minus_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2663
            also have "... \<le> ee (p t)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2664
              using e3le eepi [OF t] by simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2665
            finally have "cmod (p t - g x) < ee (p t)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2666
                         "cmod (p t - h x) < ee (p t)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2667
              using gg by auto
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2668
          } note ptgh_ee = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2669
          have pi_hgn: "path_image (linepath (h (n/N)) (g (n/N))) \<subseteq> ball (p t) (ee (p t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2670
            using ptgh_ee [of "n/N"] Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2671
            by (auto simp: field_simps real_of_nat_def dist_norm dest: segment_furthest_le [where y="p t"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2672
          then have gh_ns: "closed_segment (g (n/N)) (h (n/N)) \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2673
            using `N>0` Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2674
            apply (simp add: real_of_nat_def path_image_join field_simps closed_segment_commute)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2675
            apply (erule order_trans)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2676
            apply (simp add: ee pi t)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2677
            done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2678
          have pi_ghn': "path_image (linepath (g ((1 + n) / N)) (h ((1 + n) / N)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2679
                  \<subseteq> ball (p t) (ee (p t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2680
            using ptgh_ee [of "(1+n)/N"] Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2681
            by (auto simp: field_simps real_of_nat_def dist_norm dest: segment_furthest_le [where y="p t"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2682
          then have gh_n's: "closed_segment (g ((1 + n) / N)) (h ((1 + n) / N)) \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2683
            using `N>0` Suc.prems ee pi t
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2684
            by (auto simp: Path_Connected.path_image_join field_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2685
          have pi_subset_ball:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2686
                "path_image (subpath (n/N) ((1+n) / N) g +++ linepath (g ((1+n) / N)) (h ((1+n) / N)) +++
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2687
                             subpath ((1+n) / N) (n/N) h +++ linepath (h (n/N)) (g (n/N)))
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2688
                 \<subseteq> ball (p t) (ee (p t))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2689
            apply (intro subset_path_image_join pi_hgn pi_ghn')
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2690
            using `N>0` Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2691
            apply (auto simp: dist_norm field_simps ptgh_ee)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2692
            done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2693
          have pi0: "(f has_path_integral 0)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2694
                       (subpath (n/ N) ((Suc n)/N) g +++ linepath(g ((Suc n) / N)) (h((Suc n) / N)) +++
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2695
                        subpath ((Suc n) / N) (n/N) h +++ linepath(h (n/N)) (g (n/N)))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2696
            apply (rule Cauchy_theorem_primitive [of "ball(p t) (ee(p t))" "ff (p t)" "f"])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2697
            apply (metis ff open_ball at_within_open pi t)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2698
            apply (intro valid_path_join)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2699
            using Suc.prems pi_subset_ball apply (simp_all add: valid_path_subpath g h)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2700
            done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2701
          have fpa1: "f path_integrable_on subpath (real n / real N) (real (Suc n) / real N) g"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2702
            using Suc.prems by (simp add: path_integrable_subpath g fpa)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2703
          have fpa2: "f path_integrable_on linepath (g (real (Suc n) / real N)) (h (real (Suc n) / real N))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2704
            using gh_n's
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2705
            by (auto intro!: path_integrable_continuous_linepath continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2706
          have fpa3: "f path_integrable_on linepath (h (real n / real N)) (g (real n / real N))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2707
            using gh_ns
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2708
            by (auto simp: closed_segment_commute intro!: path_integrable_continuous_linepath continuous_on_subset [OF contf])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2709
          have eq0: "path_integral (subpath (n/N) ((Suc n) / real N) g) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2710
                     path_integral (linepath (g ((Suc n) / N)) (h ((Suc n) / N))) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2711
                     path_integral (subpath ((Suc n) / N) (n/N) h) f +
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2712
                     path_integral (linepath (h (n/N)) (g (n/N))) f = 0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2713
            using path_integral_unique [OF pi0] Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2714
            by (simp add: g h fpa valid_path_subpath path_integrable_subpath
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2715
                          fpa1 fpa2 fpa3 algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2716
          have *: "\<And>hn he hn' gn gd gn' hgn ghn gh0 ghn'.
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2717
                    \<lbrakk>hn - gn = ghn - gh0;
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2718
                     gd + ghn' + he + hgn = (0::complex);
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2719
                     hn - he = hn'; gn + gd = gn'; hgn = -ghn\<rbrakk> \<Longrightarrow> hn' - gn' = ghn' - gh0"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2720
            by (auto simp: algebra_simps)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2721
          have "path_integral (subpath 0 (n/N) h) f - path_integral (subpath ((Suc n) / N) (n/N) h) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2722
                path_integral (subpath 0 (n/N) h) f + path_integral (subpath (n/N) ((Suc n) / N) h) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2723
            unfolding reversepath_subpath [symmetric, of "((Suc n) / N)"]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2724
            using Suc.prems by (simp add: h fpa path_integral_reversepath valid_path_subpath path_integrable_subpath)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2725
          also have "... = path_integral (subpath 0 ((Suc n) / N) h) f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2726
            using Suc.prems by (simp add: path_integral_subpath_combine h fpa)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2727
          finally have pi0_eq:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2728
               "path_integral (subpath 0 (n/N) h) f - path_integral (subpath ((Suc n) / N) (n/N) h) f =
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2729
                path_integral (subpath 0 ((Suc n) / N) h) f" .
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2730
          show ?case
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2731
            apply (rule * [OF Suc.hyps eq0 pi0_eq])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2732
            using Suc.prems
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2733
            apply (simp_all add: g h fpa path_integral_subpath_combine
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2734
                     path_integral_reversepath [symmetric] path_integrable_continuous_linepath
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2735
                     continuous_on_subset [OF contf gh_ns])
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2736
            done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2737
      qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2738
      } note ind = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2739
      have "path_integral h f = path_integral g f"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2740
        using ind [OF order_refl] N joins
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2741
        by (simp add: pathstart_def pathfinish_def split: split_if_asm)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2742
    }
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2743
    ultimately
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2744
    have "path_image g \<subseteq> s \<and> path_image h \<subseteq> s \<and> (\<forall>f. f holomorphic_on s \<longrightarrow> path_integral h f = path_integral g f)"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2745
      by metis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2746
  } note * = this
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2747
  show ?thesis
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2748
    apply (rule_tac x="e/3" in exI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2749
    apply (rule conjI)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2750
    using enz apply simp
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2751
    apply (clarsimp simp only: ball_conj_distrib)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2752
    apply (rule *; assumption)
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2753
    done
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2754
qed
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2755
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2756
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2757
lemma
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2758
  assumes "open s" "path p" "path_image p \<subseteq> s"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2759
    shows path_integral_nearby_ends:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2760
      "\<exists>d. 0 < d \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2761
              (\<forall>g h. valid_path g \<and> valid_path h \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2762
                    (\<forall>t \<in> {0..1}. norm(g t - p t) < d \<and> norm(h t - p t) < d) \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2763
                    pathstart h = pathstart g \<and> pathfinish h = pathfinish g
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2764
                    \<longrightarrow> path_image g \<subseteq> s \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2765
                        path_image h \<subseteq> s \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2766
                        (\<forall>f. f holomorphic_on s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2767
                            \<longrightarrow> path_integral h f = path_integral g f))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2768
    and path_integral_nearby_loop:
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2769
      "\<exists>d. 0 < d \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2770
              (\<forall>g h. valid_path g \<and> valid_path h \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2771
                    (\<forall>t \<in> {0..1}. norm(g t - p t) < d \<and> norm(h t - p t) < d) \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2772
                    pathfinish g = pathstart g \<and> pathfinish h = pathstart h
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2773
                    \<longrightarrow> path_image g \<subseteq> s \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2774
                        path_image h \<subseteq> s \<and>
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2775
                        (\<forall>f. f holomorphic_on s
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2776
                            \<longrightarrow> path_integral h f = path_integral g f))"
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2777
  using path_integral_nearby [OF assms, where Ends=True]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2778
  using path_integral_nearby [OF assms, where Ends=False]
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2779
  by simp_all
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2780
457abb82fb9e the Cauchy integral theorem and related material
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2781
end