src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
author paulson <lp15@cam.ac.uk>
Thu, 17 Sep 2020 18:48:06 +0100
changeset 72266 1e02b86eb517
parent 71938 e1b262e7480c
child 72445 2c2de074832e
permissions -rw-r--r--
de-applying
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     1
(*  Author:     John Harrison
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen (Translation from HOL light)
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
     3
                Huge cleanup by LCP
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     4
*)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     5
69517
dc20f278e8f3 tuned style and headers
nipkow
parents: 69510
diff changeset
     6
section \<open>Henstock-Kurzweil Gauge Integration in Many Dimensions\<close>
63594
bd218a9320b5 HOL-Multivariate_Analysis: rename theories for more descriptive names
hoelzl
parents: 63593
diff changeset
     7
bd218a9320b5 HOL-Multivariate_Analysis: rename theories for more descriptive names
hoelzl
parents: 63593
diff changeset
     8
theory Henstock_Kurzweil_Integration
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
     9
imports
70196
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
    10
  Lebesgue_Measure Tagged_Division
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    11
begin
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    12
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    13
lemma norm_diff2: "\<lbrakk>y = y1 + y2; x = x1 + x2; e = e1 + e2; norm(y1 - x1) \<le> e1; norm(y2 - x2) \<le> e2\<rbrakk>
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
    14
  \<Longrightarrow> norm(y-x) \<le> e"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    15
  using norm_triangle_mono [of "y1 - x1" "e1" "y2 - x2" "e2"]
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    16
  by (simp add: add_diff_add)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    17
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    18
lemma setcomp_dot1: "{z. P (z \<bullet> (i,0))} = {(x,y). P(x \<bullet> i)}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    19
  by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    20
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    21
lemma setcomp_dot2: "{z. P (z \<bullet> (0,i))} = {(x,y). P(y \<bullet> i)}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    22
  by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    23
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    24
lemma Sigma_Int_Paircomp1: "(Sigma A B) \<inter> {(x, y). P x} = Sigma (A \<inter> {x. P x}) B"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    25
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    26
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    27
lemma Sigma_Int_Paircomp2: "(Sigma A B) \<inter> {(x, y). P y} = Sigma A (\<lambda>z. B z \<inter> {y. P y})"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    28
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    29
(* END MOVE *)
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
    30
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
    31
subsection \<open>Content (length, area, volume...) of an interval\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    32
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    33
abbreviation content :: "'a::euclidean_space set \<Rightarrow> real"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    34
  where "content s \<equiv> measure lborel s"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    35
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    36
lemma content_cbox_cases:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
    37
  "content (cbox a b) = (if \<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i then prod (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis else 0)"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    38
  by (simp add: measure_lborel_cbox_eq inner_diff)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    39
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    40
lemma content_cbox: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    41
  unfolding content_cbox_cases by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    42
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    43
lemma content_cbox': "cbox a b \<noteq> {} \<Longrightarrow> content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    44
  by (simp add: box_ne_empty inner_diff)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    45
66296
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    46
lemma content_cbox_if: "content (cbox a b) = (if cbox a b = {} then 0 else \<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    47
  by (simp add: content_cbox')
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    48
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    49
lemma content_cbox_cart:
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    50
   "cbox a b \<noteq> {} \<Longrightarrow> content(cbox a b) = prod (\<lambda>i. b$i - a$i) UNIV"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    51
  by (simp add: content_cbox_if Basis_vec_def cart_eq_inner_axis axis_eq_axis prod.UNION_disjoint)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    52
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    53
lemma content_cbox_if_cart:
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    54
   "content(cbox a b) = (if cbox a b = {} then 0 else prod (\<lambda>i. b$i - a$i) UNIV)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    55
  by (simp add: content_cbox_cart)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
    56
66296
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    57
lemma content_division_of:
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    58
  assumes "K \<in> \<D>" "\<D> division_of S"
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    59
  shows "content K = (\<Prod>i \<in> Basis. interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)"
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    60
proof -
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    61
  obtain a b where "K = cbox a b"
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    62
    using cbox_division_memE assms by metis
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    63
  then show ?thesis
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    64
    using assms by (force simp: division_of_def content_cbox')
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    65
qed
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    66
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
    67
lemma content_real: "a \<le> b \<Longrightarrow> content {a..b} = b - a"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    68
  by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
    69
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
    70
lemma abs_eq_content: "\<bar>y - x\<bar> = (if x\<le>y then content {x..y} else content {y..x})"
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
    71
  by (auto simp: content_real)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
    72
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    73
lemma content_singleton: "content {a} = 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    74
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    75
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    76
lemma content_unit[iff]: "content (cbox 0 (One::'a::euclidean_space)) = 1"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    77
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    78
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
    79
lemma content_pos_le [iff]: "0 \<le> content X"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    80
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    81
71120
f4579e6800d7 tuned tags
nipkow
parents: 70999
diff changeset
    82
corollary\<^marker>\<open>tag unimportant\<close> content_nonneg [simp]: "\<not> content (cbox a b) < 0"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    83
  using not_le by blast
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    84
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    85
lemma content_pos_lt: "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i \<Longrightarrow> 0 < content (cbox a b)"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
    86
  by (auto simp: less_imp_le inner_diff box_eq_empty intro!: prod_pos)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    87
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    88
lemma content_eq_0: "content (cbox a b) = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    89
  by (auto simp: content_cbox_cases not_le intro: less_imp_le antisym eq_refl)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
    90
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
    91
lemma content_eq_0_interior: "content (cbox a b) = 0 \<longleftrightarrow> interior(cbox a b) = {}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    92
  unfolding content_eq_0 interior_cbox box_eq_empty by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    93
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    94
lemma content_pos_lt_eq: "0 < content (cbox a (b::'a::euclidean_space)) \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
    95
  by (auto simp add: content_cbox_cases less_le prod_nonneg)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    96
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    97
lemma content_empty [simp]: "content {} = 0"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    98
  by simp
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    99
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   100
lemma content_real_if [simp]: "content {a..b} = (if a \<le> b then b - a else 0)"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   101
  by (simp add: content_real)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   102
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   103
lemma content_subset: "cbox a b \<subseteq> cbox c d \<Longrightarrow> content (cbox a b) \<le> content (cbox c d)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   104
  unfolding measure_def
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   105
  by (intro enn2real_mono emeasure_mono) (auto simp: emeasure_lborel_cbox_eq)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   106
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   107
lemma content_lt_nz: "0 < content (cbox a b) \<longleftrightarrow> content (cbox a b) \<noteq> 0"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
   108
  unfolding content_pos_lt_eq content_eq_0 unfolding not_ex not_le by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   109
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   110
lemma content_Pair: "content (cbox (a,c) (b,d)) = content (cbox a b) * content (cbox c d)"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   111
  unfolding measure_lborel_cbox_eq Basis_prod_def
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   112
  apply (subst prod.union_disjoint)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   113
  apply (auto simp: bex_Un ball_Un)
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   114
  apply (subst (1 2) prod.reindex_nontrivial)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   115
  apply auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   116
  done
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   117
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   118
lemma content_cbox_pair_eq0_D:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   119
   "content (cbox (a,c) (b,d)) = 0 \<Longrightarrow> content (cbox a b) = 0 \<or> content (cbox c d) = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   120
  by (simp add: content_Pair)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   121
70380
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   122
lemma content_cbox_plus:
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   123
  fixes x :: "'a::euclidean_space"
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   124
  shows "content(cbox x (x + h *\<^sub>R One)) = (if h \<ge> 0 then h ^ DIM('a) else 0)"
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   125
  by (simp add: algebra_simps content_cbox_if box_eq_empty)
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   126
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   127
lemma content_0_subset: "content(cbox a b) = 0 \<Longrightarrow> s \<subseteq> cbox a b \<Longrightarrow> content s = 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   128
  using emeasure_mono[of s "cbox a b" lborel]
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   129
  by (auto simp: measure_def enn2real_eq_0_iff emeasure_lborel_cbox_eq)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   130
71192
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   131
lemma content_ball_pos:
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   132
  assumes "r > 0"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   133
  shows   "content (ball c r) > 0"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   134
proof -
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   135
  from rational_boxes[OF assms, of c] obtain a b where ab: "c \<in> box a b" "box a b \<subseteq> ball c r"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   136
    by auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   137
  from ab have "0 < content (box a b)"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   138
    by (subst measure_lborel_box_eq) (auto intro!: prod_pos simp: algebra_simps box_def)
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   139
  have "emeasure lborel (box a b) \<le> emeasure lborel (ball c r)"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   140
    using ab by (intro emeasure_mono) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   141
  also have "emeasure lborel (box a b) = ennreal (content (box a b))"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   142
    using emeasure_lborel_box_finite[of a b] by (intro emeasure_eq_ennreal_measure) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   143
  also have "emeasure lborel (ball c r) = ennreal (content (ball c r))"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   144
    using emeasure_lborel_ball_finite[of c r] by (intro emeasure_eq_ennreal_measure) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   145
  finally show ?thesis
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   146
    using \<open>content (box a b) > 0\<close> by simp
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   147
qed
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   148
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   149
lemma content_cball_pos:
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   150
  assumes "r > 0"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   151
  shows   "content (cball c r) > 0"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   152
proof -
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   153
  from rational_boxes[OF assms, of c] obtain a b where ab: "c \<in> box a b" "box a b \<subseteq> ball c r"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   154
    by auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   155
  from ab have "0 < content (box a b)"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   156
    by (subst measure_lborel_box_eq) (auto intro!: prod_pos simp: algebra_simps box_def)
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   157
  have "emeasure lborel (box a b) \<le> emeasure lborel (ball c r)"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   158
    using ab by (intro emeasure_mono) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   159
  also have "\<dots> \<le> emeasure lborel (cball c r)"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   160
    by (intro emeasure_mono) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   161
  also have "emeasure lborel (box a b) = ennreal (content (box a b))"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   162
    using emeasure_lborel_box_finite[of a b] by (intro emeasure_eq_ennreal_measure) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   163
  also have "emeasure lborel (cball c r) = ennreal (content (cball c r))"
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   164
    using emeasure_lborel_cball_finite[of c r] by (intro emeasure_eq_ennreal_measure) auto
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   165
  finally show ?thesis
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   166
    using \<open>content (box a b) > 0\<close> by simp
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   167
qed
a8ccea88b725 Flattened dependency tree of HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71174
diff changeset
   168
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   169
lemma content_split:
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   170
  fixes a :: "'a::euclidean_space"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   171
  assumes "k \<in> Basis"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   172
  shows "content (cbox a b) = content(cbox a b \<inter> {x. x\<bullet>k \<le> c}) + content(cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64773
diff changeset
   173
  \<comment> \<open>Prove using measure theory\<close>
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   174
proof (cases "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i")
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   175
  case True
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   176
  have 1: "\<And>X Y Z. (\<Prod>i\<in>Basis. Z i (if i = k then X else Y i)) = Z k X * (\<Prod>i\<in>Basis-{k}. Z i (Y i))"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   177
    by (simp add: if_distrib prod.delta_remove assms)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   178
  note simps = interval_split[OF assms] content_cbox_cases
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   179
  have 2: "(\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i) = (\<Prod>i\<in>Basis-{k}. b\<bullet>i - a\<bullet>i) * (b\<bullet>k - a\<bullet>k)"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   180
    by (metis (no_types, lifting) assms finite_Basis mult.commute prod.remove)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   181
  have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow>
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   182
    x * (b\<bullet>k - a\<bullet>k) = x * (max (a \<bullet> k) c - a \<bullet> k) + x * (b \<bullet> k - max (a \<bullet> k) c)"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   183
    by  (auto simp add: field_simps)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   184
  moreover
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   185
  have **: "(\<Prod>i\<in>Basis. ((\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) *\<^sub>R i) \<bullet> i - a \<bullet> i)) =
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   186
      (\<Prod>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) - a \<bullet> i)"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   187
    "(\<Prod>i\<in>Basis. b \<bullet> i - ((\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i)) =
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   188
      (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else a \<bullet> i))"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   189
    by (auto intro!: prod.cong)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   190
  have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   191
    unfolding not_le using True assms by auto
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   192
  ultimately show ?thesis
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   193
    using assms unfolding simps ** 1[of "\<lambda>i x. b\<bullet>i - x"] 1[of "\<lambda>i x. x - a\<bullet>i"] 2
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   194
    by auto
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   195
next
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
   196
  case False
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   197
  then have "cbox a b = {}"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   198
    unfolding box_eq_empty by (auto simp: not_le)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   199
  then show ?thesis
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   200
    by (auto simp: not_le)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   201
qed
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   202
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   203
lemma division_of_content_0:
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   204
  assumes "content (cbox a b) = 0" "d division_of (cbox a b)" "K \<in> d"
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   205
  shows "content K = 0"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   206
  unfolding forall_in_division[OF assms(2)]
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   207
  by (meson assms content_0_subset division_of_def)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   208
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   209
lemma sum_content_null:
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   210
  assumes "content (cbox a b) = 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   211
    and "p tagged_division_of (cbox a b)"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   212
  shows "(\<Sum>(x,K)\<in>p. content K *\<^sub>R f x) = (0::'a::real_normed_vector)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   213
proof (rule sum.neutral, rule)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   214
  fix y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   215
  assume y: "y \<in> p"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   216
  obtain x K where xk: "y = (x, K)"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   217
    using surj_pair[of y] by blast
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   218
  then obtain c d where k: "K = cbox c d" "K \<subseteq> cbox a b"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   219
    by (metis assms(2) tagged_division_ofD(3) tagged_division_ofD(4) y)
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
   220
  have "(\<lambda>(x',K'). content K' *\<^sub>R f x') y = content K *\<^sub>R f x"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   221
    unfolding xk by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   222
  also have "\<dots> = 0"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   223
    using assms(1) content_0_subset k(2) by auto
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   224
  finally show "(\<lambda>(x, k). content k *\<^sub>R f x) y = 0" .
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   225
qed
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   226
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   227
global_interpretation sum_content: operative plus 0 content
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   228
  rewrites "comm_monoid_set.F plus 0 = sum"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   229
proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   230
  interpret operative plus 0 content
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   231
    by standard (auto simp add: content_split [symmetric] content_eq_0_interior)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   232
  show "operative plus 0 content"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   233
    by standard
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   234
  show "comm_monoid_set.F plus 0 = sum"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   235
    by (simp add: sum_def)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   236
qed
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   237
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   238
lemma additive_content_division: "d division_of (cbox a b) \<Longrightarrow> sum content d = content (cbox a b)"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   239
  by (fact sum_content.division)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   240
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   241
lemma additive_content_tagged_division:
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   242
  "d tagged_division_of (cbox a b) \<Longrightarrow> sum (\<lambda>(x,l). content l) d = content (cbox a b)"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
   243
  by (fact sum_content.tagged_division)
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   244
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   245
lemma subadditive_content_division:
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   246
  assumes "\<D> division_of S" "S \<subseteq> cbox a b"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   247
  shows "sum content \<D> \<le> content(cbox a b)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   248
proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   249
  have "\<D> division_of \<Union>\<D>" "\<Union>\<D> \<subseteq> cbox a b"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   250
    using assms by auto
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   251
  then obtain \<D>' where "\<D> \<subseteq> \<D>'" "\<D>' division_of cbox a b"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   252
    using partial_division_extend_interval by metis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   253
  then have "sum content \<D> \<le> sum content \<D>'"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   254
    using sum_mono2 by blast
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   255
  also have "... \<le> content(cbox a b)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   256
    by (simp add: \<open>\<D>' division_of cbox a b\<close> additive_content_division less_eq_real_def)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   257
  finally show ?thesis .
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   258
qed
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   259
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
   260
lemma content_real_eq_0: "content {a..b::real} = 0 \<longleftrightarrow> a \<ge> b"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   261
  by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
   262
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   263
lemma property_empty_interval: "\<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   264
  using content_empty unfolding empty_as_interval by auto
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   265
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   266
lemma interval_bounds_nz_content [simp]:
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   267
  assumes "content (cbox a b) \<noteq> 0"
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   268
  shows "interval_upperbound (cbox a b) = b"
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   269
    and "interval_lowerbound (cbox a b) = a"
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   270
  by (metis assms content_empty interval_bounds')+
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   271
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   272
subsection \<open>Gauge integral\<close>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   273
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   274
text \<open>Case distinction to define it first on compact intervals first, then use a limit. This is only
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   275
much later unified. In Fremlin: Measure Theory, Volume 4I this is generalized using residual sets.\<close>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   276
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   277
definition has_integral :: "('n::euclidean_space \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> 'n set \<Rightarrow> bool"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   278
  (infixr "has'_integral" 46)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   279
  where "(f has_integral I) s \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   280
    (if \<exists>a b. s = cbox a b
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   281
      then ((\<lambda>p. \<Sum>(x,k)\<in>p. content k *\<^sub>R f x) \<longlongrightarrow> I) (division_filter s)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   282
      else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   283
        (\<exists>z. ((\<lambda>p. \<Sum>(x,k)\<in>p. content k *\<^sub>R (if x \<in> s then f x else 0)) \<longlongrightarrow> z) (division_filter (cbox a b)) \<and>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   284
          norm (z - I) < e)))"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   285
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   286
lemma has_integral_cbox:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   287
  "(f has_integral I) (cbox a b) \<longleftrightarrow> ((\<lambda>p. \<Sum>(x,k)\<in>p. content k *\<^sub>R f x) \<longlongrightarrow> I) (division_filter (cbox a b))"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   288
  by (auto simp add: has_integral_def)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   289
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   290
lemma has_integral:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   291
  "(f has_integral y) (cbox a b) \<longleftrightarrow>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   292
    (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   293
      (\<forall>\<D>. \<D> tagged_division_of (cbox a b) \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   294
        norm (sum (\<lambda>(x,k). content(k) *\<^sub>R f x) \<D> - y) < e))"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   295
  by (auto simp: dist_norm eventually_division_filter has_integral_def tendsto_iff)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   296
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   297
lemma has_integral_real:
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
   298
  "(f has_integral y) {a..b::real} \<longleftrightarrow>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   299
    (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   300
      (\<forall>\<D>. \<D> tagged_division_of {a..b} \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   301
        norm (sum (\<lambda>(x,k). content(k) *\<^sub>R f x) \<D> - y) < e))"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   302
  unfolding box_real[symmetric] by (rule has_integral)
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   303
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   304
lemma has_integralD[dest]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   305
  assumes "(f has_integral y) (cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   306
    and "e > 0"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   307
  obtains \<gamma>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   308
    where "gauge \<gamma>"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   309
      and "\<And>\<D>. \<D> tagged_division_of (cbox a b) \<Longrightarrow> \<gamma> fine \<D> \<Longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   310
        norm ((\<Sum>(x,k)\<in>\<D>. content k *\<^sub>R f x) - y) < e"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   311
  using assms unfolding has_integral by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   312
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   313
lemma has_integral_alt:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   314
  "(f has_integral y) i \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   315
    (if \<exists>a b. i = cbox a b
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   316
     then (f has_integral y) i
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   317
     else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   318
      (\<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b) \<and> norm (z - y) < e)))"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   319
  by (subst has_integral_def) (auto simp add: has_integral_cbox)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   320
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   321
lemma has_integral_altD:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   322
  assumes "(f has_integral y) i"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   323
    and "\<not> (\<exists>a b. i = cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   324
    and "e>0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   325
  obtains B where "B > 0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   326
    and "\<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   327
      (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) (cbox a b) \<and> norm(z - y) < e)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   328
  using assms has_integral_alt[of f y i] by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   329
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   330
definition integrable_on (infixr "integrable'_on" 46)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   331
  where "f integrable_on i \<longleftrightarrow> (\<exists>y. (f has_integral y) i)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   332
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   333
definition "integral i f = (SOME y. (f has_integral y) i \<or> \<not> f integrable_on i \<and> y=0)"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   334
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   335
lemma integrable_integral[intro]: "f integrable_on i \<Longrightarrow> (f has_integral (integral i f)) i"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   336
  unfolding integrable_on_def integral_def by (metis (mono_tags, lifting) someI_ex)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   337
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   338
lemma not_integrable_integral: "\<not> f integrable_on i \<Longrightarrow> integral i f = 0"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   339
  unfolding integrable_on_def integral_def by blast
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   340
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   341
lemma has_integral_integrable[dest]: "(f has_integral i) s \<Longrightarrow> f integrable_on s"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   342
  unfolding integrable_on_def by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   343
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   344
lemma has_integral_integral: "f integrable_on s \<longleftrightarrow> (f has_integral (integral s f)) s"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   345
  by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   346
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
   347
subsection \<open>Basic theorems about integrals\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   348
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   349
lemma has_integral_eq_rhs: "(f has_integral j) S \<Longrightarrow> i = j \<Longrightarrow> (f has_integral i) S"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   350
  by (rule forw_subst)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   351
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   352
lemma has_integral_unique_cbox:
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   353
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   354
  shows "(f has_integral k1) (cbox a b) \<Longrightarrow> (f has_integral k2) (cbox a b) \<Longrightarrow> k1 = k2"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   355
    by (auto simp: has_integral_cbox intro: tendsto_unique[OF division_filter_not_empty])    
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   356
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
   357
lemma has_integral_unique:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   358
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   359
  assumes "(f has_integral k1) i" "(f has_integral k2) i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
   360
  shows "k1 = k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   361
proof (rule ccontr)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   362
  let ?e = "norm (k1 - k2)/2"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   363
  let ?F = "(\<lambda>x. if x \<in> i then f x else 0)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   364
  assume "k1 \<noteq> k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   365
  then have e: "?e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   366
    by auto
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   367
  have nonbox: "\<not> (\<exists>a b. i = cbox a b)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   368
    using \<open>k1 \<noteq> k2\<close> assms has_integral_unique_cbox by blast
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   369
  obtain B1 where B1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   370
      "0 < B1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   371
      "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   372
        \<exists>z. (?F has_integral z) (cbox a b) \<and> norm (z - k1) < norm (k1 - k2)/2"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   373
    by (rule has_integral_altD[OF assms(1) nonbox,OF e]) blast
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   374
  obtain B2 where B2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   375
      "0 < B2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   376
      "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow>
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   377
        \<exists>z. (?F has_integral z) (cbox a b) \<and> norm (z - k2) < norm (k1 - k2)/2"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   378
    by (rule has_integral_altD[OF assms(2) nonbox,OF e]) blast
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   379
  obtain a b :: 'n where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b"
68120
2f161c6910f7 tidying more messy proofs
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
   380
    by (metis Un_subset_iff bounded_Un bounded_ball bounded_subset_cbox_symmetric)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   381
  obtain w where w: "(?F has_integral w) (cbox a b)" "norm (w - k1) < norm (k1 - k2)/2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   382
    using B1(2)[OF ab(1)] by blast
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   383
  obtain z where z: "(?F has_integral z) (cbox a b)" "norm (z - k2) < norm (k1 - k2)/2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   384
    using B2(2)[OF ab(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   385
  have "z = w"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   386
    using has_integral_unique_cbox[OF w(1) z(1)] by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   387
  then have "norm (k1 - k2) \<le> norm (z - k2) + norm (w - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   388
    using norm_triangle_ineq4 [of "k1 - w" "k2 - z"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   389
    by (auto simp add: norm_minus_commute)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
   390
  also have "\<dots> < norm (k1 - k2)/2 + norm (k1 - k2)/2"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   391
    by (metis add_strict_mono z(2) w(2))
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   392
  finally show False by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   393
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   394
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   395
lemma integral_unique [intro]: "(f has_integral y) k \<Longrightarrow> integral k f = y"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   396
  unfolding integral_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   397
  by (rule some_equality) (auto intro: has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   398
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   399
lemma has_integral_iff: "(f has_integral i) S \<longleftrightarrow> (f integrable_on S \<and> integral S f = i)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   400
  by blast
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
   401
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   402
lemma eq_integralD: "integral k f = y \<Longrightarrow> (f has_integral y) k \<or> \<not> f integrable_on k \<and> y=0"
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   403
  unfolding integral_def integrable_on_def
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   404
  apply (erule subst)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   405
  apply (rule someI_ex)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   406
  by blast
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   407
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   408
lemma has_integral_const [intro]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   409
  fixes a b :: "'a::euclidean_space"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   410
  shows "((\<lambda>x. c) has_integral (content (cbox a b) *\<^sub>R c)) (cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   411
  using eventually_division_filter_tagged_division[of "cbox a b"]
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   412
     additive_content_tagged_division[of _ a b]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   413
  by (auto simp: has_integral_cbox split_beta' scaleR_sum_left[symmetric]
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   414
           elim!: eventually_mono intro!: tendsto_cong[THEN iffD1, OF _ tendsto_const])
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   415
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   416
lemma has_integral_const_real [intro]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   417
  fixes a b :: real
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
   418
  shows "((\<lambda>x. c) has_integral (content {a..b} *\<^sub>R c)) {a..b}"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   419
  by (metis box_real(2) has_integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   420
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   421
lemma has_integral_integrable_integral: "(f has_integral i) s \<longleftrightarrow> f integrable_on s \<and> integral s f = i"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   422
  by blast
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   423
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   424
lemma integral_const [simp]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   425
  fixes a b :: "'a::euclidean_space"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   426
  shows "integral (cbox a b) (\<lambda>x. c) = content (cbox a b) *\<^sub>R c"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   427
  by (rule integral_unique) (rule has_integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   428
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   429
lemma integral_const_real [simp]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   430
  fixes a b :: real
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
   431
  shows "integral {a..b} (\<lambda>x. c) = content {a..b} *\<^sub>R c"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   432
  by (metis box_real(2) integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   433
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   434
lemma has_integral_is_0_cbox:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   435
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   436
  assumes "\<And>x. x \<in> cbox a b \<Longrightarrow> f x = 0"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   437
  shows "(f has_integral 0) (cbox a b)"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   438
    unfolding has_integral_cbox
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   439
    using eventually_division_filter_tagged_division[of "cbox a b"] assms
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   440
    by (subst tendsto_cong[where g="\<lambda>_. 0"])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   441
       (auto elim!: eventually_mono intro!: sum.neutral simp: tag_in_interval)
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   442
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   443
lemma has_integral_is_0:
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   444
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   445
  assumes "\<And>x. x \<in> S \<Longrightarrow> f x = 0"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   446
  shows "(f has_integral 0) S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   447
proof (cases "(\<exists>a b. S = cbox a b)")
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   448
  case True with assms has_integral_is_0_cbox show ?thesis
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   449
    by blast
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   450
next
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   451
  case False
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   452
  have *: "(\<lambda>x. if x \<in> S then f x else 0) = (\<lambda>x. 0)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   453
    by (auto simp add: assms)
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   454
  show ?thesis
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   455
    using has_integral_is_0_cbox False
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   456
    by (subst has_integral_alt) (force simp add: *)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   457
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   458
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   459
lemma has_integral_0[simp]: "((\<lambda>x::'n::euclidean_space. 0) has_integral 0) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   460
  by (rule has_integral_is_0) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   461
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   462
lemma has_integral_0_eq[simp]: "((\<lambda>x. 0) has_integral i) S \<longleftrightarrow> i = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   463
  using has_integral_unique[OF has_integral_0] by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   464
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   465
lemma has_integral_linear_cbox:
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   466
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   467
  assumes f: "(f has_integral y) (cbox a b)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   468
    and h: "bounded_linear h"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   469
  shows "((h \<circ> f) has_integral (h y)) (cbox a b)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   470
proof -
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   471
  interpret bounded_linear h using h .
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   472
  show ?thesis
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   473
    unfolding has_integral_cbox using tendsto [OF f [unfolded has_integral_cbox]]
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   474
    by (simp add: sum scaleR split_beta')
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   475
qed
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   476
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   477
lemma has_integral_linear:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   478
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   479
  assumes f: "(f has_integral y) S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   480
    and h: "bounded_linear h"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   481
  shows "((h \<circ> f) has_integral (h y)) S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   482
proof (cases "(\<exists>a b. S = cbox a b)")
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   483
  case True with f h has_integral_linear_cbox show ?thesis 
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   484
    by blast
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   485
next
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   486
  case False
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   487
  interpret bounded_linear h using h .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   488
  from pos_bounded obtain B where B: "0 < B" "\<And>x. norm (h x) \<le> norm x * B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   489
    by blast
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   490
  let ?S = "\<lambda>f x. if x \<in> S then f x else 0"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   491
  show ?thesis
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   492
  proof (subst has_integral_alt, clarsimp simp: False)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   493
    fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   494
    assume e: "e > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
   495
    have *: "0 < e/B" using e B(1) by simp
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   496
    obtain M where M:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   497
      "M > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   498
      "\<And>a b. ball 0 M \<subseteq> cbox a b \<Longrightarrow>
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   499
        \<exists>z. (?S f has_integral z) (cbox a b) \<and> norm (z - y) < e/B"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   500
      using has_integral_altD[OF f False *] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   501
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   502
      (\<exists>z. (?S(h \<circ> f) has_integral z) (cbox a b) \<and> norm (z - h y) < e)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   503
    proof (rule exI, intro allI conjI impI)
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   504
      show "M > 0" using M by metis
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   505
    next
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   506
      fix a b::'n
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   507
      assume sb: "ball 0 M \<subseteq> cbox a b"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   508
      obtain z where z: "(?S f has_integral z) (cbox a b)" "norm (z - y) < e/B"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   509
        using M(2)[OF sb] by blast
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   510
      have *: "?S(h \<circ> f) = h \<circ> ?S f"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   511
        using zero by auto
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   512
      show "\<exists>z. (?S(h \<circ> f) has_integral z) (cbox a b) \<and> norm (z - h y) < e"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   513
        apply (rule_tac x="h z" in exI)
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   514
        apply (simp add: * has_integral_linear_cbox[OF z(1) h])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   515
        apply (metis B diff le_less_trans pos_less_divide_eq z(2))
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   516
        done
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   517
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   518
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   519
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   520
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   521
lemma has_integral_scaleR_left:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   522
  "(f has_integral y) S \<Longrightarrow> ((\<lambda>x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) S"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   523
  using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   524
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   525
lemma integrable_on_scaleR_left:
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   526
  assumes "f integrable_on A"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   527
  shows "(\<lambda>x. f x *\<^sub>R y) integrable_on A"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   528
  using assms has_integral_scaleR_left unfolding integrable_on_def by blast
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   529
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   530
lemma has_integral_mult_left:
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   531
  fixes c :: "_ :: real_normed_algebra"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   532
  shows "(f has_integral y) S \<Longrightarrow> ((\<lambda>x. f x * c) has_integral (y * c)) S"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   533
  using has_integral_linear[OF _ bounded_linear_mult_left] by (simp add: comp_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   534
70688
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
   535
lemma has_integral_divide:
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
   536
  fixes c :: "_ :: real_normed_div_algebra"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
   537
  shows "(f has_integral y) S \<Longrightarrow> ((\<lambda>x. f x / c) has_integral (y / c)) S"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
   538
  unfolding divide_inverse by (simp add: has_integral_mult_left)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
   539
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69529
diff changeset
   540
text\<open>The case analysis eliminates the condition \<^term>\<open>f integrable_on S\<close> at the cost
62837
237ef2bab6c7 isabelle update_cartouches -c -t;
wenzelm
parents: 62626
diff changeset
   541
     of the type class constraint \<open>division_ring\<close>\<close>
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   542
corollary integral_mult_left [simp]:
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   543
  fixes c:: "'a::{real_normed_algebra,division_ring}"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   544
  shows "integral S (\<lambda>x. f x * c) = integral S f * c"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   545
proof (cases "f integrable_on S \<or> c = 0")
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   546
  case True then show ?thesis
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   547
    by (force intro: has_integral_mult_left)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   548
next
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   549
  case False then have "\<not> (\<lambda>x. f x * c) integrable_on S"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   550
    using has_integral_mult_left [of "(\<lambda>x. f x * c)" _ S "inverse c"]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   551
    by (auto simp add: mult.assoc)
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   552
  with False show ?thesis by (simp add: not_integrable_integral)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   553
qed
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   554
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   555
corollary integral_mult_right [simp]:
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   556
  fixes c:: "'a::{real_normed_field}"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   557
  shows "integral S (\<lambda>x. c * f x) = c * integral S f"
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   558
by (simp add: mult.commute [of c])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   559
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   560
corollary integral_divide [simp]:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   561
  fixes z :: "'a::real_normed_field"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   562
  shows "integral S (\<lambda>x. f x / z) = integral S (\<lambda>x. f x) / z"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   563
using integral_mult_left [of S f "inverse z"]
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   564
  by (simp add: divide_inverse_commute)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   565
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   566
lemma has_integral_mult_right:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   567
  fixes c :: "'a :: real_normed_algebra"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   568
  shows "(f has_integral y) i \<Longrightarrow> ((\<lambda>x. c * f x) has_integral (c * y)) i"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   569
  using has_integral_linear[OF _ bounded_linear_mult_right] by (simp add: comp_def)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   570
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   571
lemma has_integral_cmul: "(f has_integral k) S \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   572
  unfolding o_def[symmetric]
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   573
  by (metis has_integral_linear bounded_linear_scaleR_right)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   574
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   575
lemma has_integral_cmult_real:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   576
  fixes c :: real
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   577
  assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   578
  shows "((\<lambda>x. c * f x) has_integral c * x) A"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   579
proof (cases "c = 0")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   580
  case True
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   581
  then show ?thesis by simp
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   582
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   583
  case False
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   584
  from has_integral_cmul[OF assms[OF this], of c] show ?thesis
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   585
    unfolding real_scaleR_def .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   586
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   587
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   588
lemma has_integral_neg: "(f has_integral k) S \<Longrightarrow> ((\<lambda>x. -(f x)) has_integral -k) S"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   589
  by (drule_tac c="-1" in has_integral_cmul) auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   590
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   591
lemma has_integral_neg_iff: "((\<lambda>x. - f x) has_integral k) S \<longleftrightarrow> (f has_integral - k) S"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   592
  using has_integral_neg[of f "- k"] has_integral_neg[of "\<lambda>x. - f x" k] by auto
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   593
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   594
lemma has_integral_add_cbox:
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   595
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   596
  assumes "(f has_integral k) (cbox a b)" "(g has_integral l) (cbox a b)"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   597
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) (cbox a b)"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   598
  using assms
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   599
    unfolding has_integral_cbox
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   600
    by (simp add: split_beta' scaleR_add_right sum.distrib[abs_def] tendsto_add)
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   601
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   602
lemma has_integral_add:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   603
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   604
  assumes f: "(f has_integral k) S" and g: "(g has_integral l) S"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   605
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) S"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   606
proof (cases "\<exists>a b. S = cbox a b")
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   607
  case True with has_integral_add_cbox assms show ?thesis
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   608
    by blast 
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   609
next
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   610
  let ?S = "\<lambda>f x. if x \<in> S then f x else 0"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   611
  case False
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   612
  then show ?thesis
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
   613
  proof (subst has_integral_alt, clarsimp, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   614
    case (1 e)
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   615
    then have e2: "e/2 > 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   616
      by auto
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   617
    obtain Bf where "0 < Bf"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   618
      and Bf: "\<And>a b. ball 0 Bf \<subseteq> cbox a b \<Longrightarrow>
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   619
                     \<exists>z. (?S f has_integral z) (cbox a b) \<and> norm (z - k) < e/2"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   620
      using has_integral_altD[OF f False e2] by blast
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   621
    obtain Bg where "0 < Bg"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   622
      and Bg: "\<And>a b. ball 0 Bg \<subseteq> (cbox a b) \<Longrightarrow>
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   623
                     \<exists>z. (?S g has_integral z) (cbox a b) \<and> norm (z - l) < e/2"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   624
      using has_integral_altD[OF g False e2] by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   625
    show ?case
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   626
    proof (rule_tac x="max Bf Bg" in exI, clarsimp simp add: max.strict_coboundedI1 \<open>0 < Bf\<close>)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   627
      fix a b
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   628
      assume "ball 0 (max Bf Bg) \<subseteq> cbox a (b::'n)"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   629
      then have fs: "ball 0 Bf \<subseteq> cbox a (b::'n)" and gs: "ball 0 Bg \<subseteq> cbox a (b::'n)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   630
        by auto
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   631
      obtain w where w: "(?S f has_integral w) (cbox a b)" "norm (w - k) < e/2"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   632
        using Bf[OF fs] by blast
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   633
      obtain z where z: "(?S g has_integral z) (cbox a b)" "norm (z - l) < e/2"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   634
        using Bg[OF gs] by blast
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   635
      have *: "\<And>x. (if x \<in> S then f x + g x else 0) = (?S f x) + (?S g x)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   636
        by auto
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   637
      show "\<exists>z. (?S(\<lambda>x. f x + g x) has_integral z) (cbox a b) \<and> norm (z - (k + l)) < e"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   638
        apply (rule_tac x="w + z" in exI)
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
   639
        apply (simp add: has_integral_add_cbox[OF w(1) z(1), unfolded *[symmetric]])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   640
        using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   641
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   642
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   643
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   644
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   645
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   646
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   647
lemma has_integral_diff:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   648
  "(f has_integral k) S \<Longrightarrow> (g has_integral l) S \<Longrightarrow>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   649
    ((\<lambda>x. f x - g x) has_integral (k - l)) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   650
  using has_integral_add[OF _ has_integral_neg, of f k S g l]
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
   651
  by (auto simp: algebra_simps)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   652
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   653
lemma integral_0 [simp]:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   654
  "integral S (\<lambda>x::'n::euclidean_space. 0::'m::real_normed_vector) = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   655
  by (rule integral_unique has_integral_0)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   656
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   657
lemma integral_add: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   658
    integral S (\<lambda>x. f x + g x) = integral S f + integral S g"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   659
  by (rule integral_unique) (metis integrable_integral has_integral_add)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   660
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   661
lemma integral_cmul [simp]: "integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   662
proof (cases "f integrable_on S \<or> c = 0")
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   663
  case True with has_integral_cmul integrable_integral show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   664
    by fastforce
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   665
next
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   666
  case False then have "\<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   667
    using has_integral_cmul [of "(\<lambda>x. c *\<^sub>R f x)" _ S "inverse c"] by auto
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   668
  with False show ?thesis by (simp add: not_integrable_integral)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   669
qed
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   670
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
   671
lemma integral_mult:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
   672
  fixes K::real
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
   673
  shows "f integrable_on X \<Longrightarrow> K * integral X f = integral X (\<lambda>x. K * f x)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
   674
  unfolding real_scaleR_def[symmetric] integral_cmul ..
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
   675
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   676
lemma integral_neg [simp]: "integral S (\<lambda>x. - f x) = - integral S f"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   677
proof (cases "f integrable_on S")
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   678
  case True then show ?thesis
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   679
    by (simp add: has_integral_neg integrable_integral integral_unique)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   680
next
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69313
diff changeset
   681
  case False then have "\<not> (\<lambda>x. - f x) integrable_on S"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   682
    using has_integral_neg [of "(\<lambda>x. - f x)" _ S ] by auto
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   683
  with False show ?thesis by (simp add: not_integrable_integral)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   684
qed
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   685
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   686
lemma integral_diff: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   687
    integral S (\<lambda>x. f x - g x) = integral S f - integral S g"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   688
  by (rule integral_unique) (metis integrable_integral has_integral_diff)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   689
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   690
lemma integrable_0: "(\<lambda>x. 0) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   691
  unfolding integrable_on_def using has_integral_0 by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   692
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   693
lemma integrable_add: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow> (\<lambda>x. f x + g x) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   694
  unfolding integrable_on_def by(auto intro: has_integral_add)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   695
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   696
lemma integrable_cmul: "f integrable_on S \<Longrightarrow> (\<lambda>x. c *\<^sub>R f(x)) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   697
  unfolding integrable_on_def by(auto intro: has_integral_cmul)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   698
67970
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   699
lemma integrable_on_scaleR_iff [simp]:
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   700
  fixes c :: real
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   701
  assumes "c \<noteq> 0"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   702
  shows "(\<lambda>x. c *\<^sub>R f x) integrable_on S \<longleftrightarrow> f integrable_on S"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   703
  using integrable_cmul[of "\<lambda>x. c *\<^sub>R f x" S "1 / c"] integrable_cmul[of f S c] \<open>c \<noteq> 0\<close>
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   704
  by auto
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   705
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   706
lemma integrable_on_cmult_iff [simp]:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   707
  fixes c :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   708
  assumes "c \<noteq> 0"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   709
  shows "(\<lambda>x. c * f x) integrable_on S \<longleftrightarrow> f integrable_on S"
67970
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   710
  using integrable_on_scaleR_iff [of c f] assms by simp
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   711
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   712
lemma integrable_on_cmult_left:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   713
  assumes "f integrable_on S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   714
  shows "(\<lambda>x. of_real c * f x) integrable_on S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   715
    using integrable_cmul[of f S "of_real c"] assms
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   716
    by (simp add: scaleR_conv_of_real)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   717
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   718
lemma integrable_neg: "f integrable_on S \<Longrightarrow> (\<lambda>x. -f(x)) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   719
  unfolding integrable_on_def by(auto intro: has_integral_neg)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   720
67970
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   721
lemma integrable_neg_iff: "(\<lambda>x. -f(x)) integrable_on S \<longleftrightarrow> f integrable_on S"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   722
  using integrable_neg by fastforce
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
   723
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
   724
lemma integrable_diff:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   725
  "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow> (\<lambda>x. f x - g x) integrable_on S"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   726
  unfolding integrable_on_def by(auto intro: has_integral_diff)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   727
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   728
lemma integrable_linear:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   729
  "f integrable_on S \<Longrightarrow> bounded_linear h \<Longrightarrow> (h \<circ> f) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   730
  unfolding integrable_on_def by(auto intro: has_integral_linear)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   731
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   732
lemma integral_linear:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   733
  "f integrable_on S \<Longrightarrow> bounded_linear h \<Longrightarrow> integral S (h \<circ> f) = h (integral S f)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   734
  apply (rule has_integral_unique [where i=S and f = "h \<circ> f"])
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   735
  apply (simp_all add: integrable_integral integrable_linear has_integral_linear )
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   736
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   737
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   738
lemma integrable_on_cnj_iff:
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   739
  "(\<lambda>x. cnj (f x)) integrable_on A \<longleftrightarrow> f integrable_on A"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   740
  using integrable_linear[OF _ bounded_linear_cnj, of f A]
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   741
        integrable_linear[OF _ bounded_linear_cnj, of "cnj \<circ> f" A]
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   742
  by (auto simp: o_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   743
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   744
lemma integral_cnj: "cnj (integral A f) = integral A (\<lambda>x. cnj (f x))"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   745
  by (cases "f integrable_on A")
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   746
     (simp_all add: integral_linear[OF _ bounded_linear_cnj, symmetric]
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   747
                    o_def integrable_on_cnj_iff not_integrable_integral)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
   748
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   749
lemma integral_component_eq[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   750
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   751
  assumes "f integrable_on S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   752
  shows "integral S (\<lambda>x. f x \<bullet> k) = integral S f \<bullet> k"
63938
f6ce08859d4c More mainly topological results
paulson <lp15@cam.ac.uk>
parents: 63928
diff changeset
   753
  unfolding integral_linear[OF assms(1) bounded_linear_inner_left,unfolded o_def] ..
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   754
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   755
lemma has_integral_sum:
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
   756
  assumes "finite T"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
   757
    and "\<And>a. a \<in> T \<Longrightarrow> ((f a) has_integral (i a)) S"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
   758
  shows "((\<lambda>x. sum (\<lambda>a. f a x) T) has_integral (sum i T)) S"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
   759
  using assms(1) subset_refl[of T]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   760
proof (induct rule: finite_subset_induct)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   761
  case empty
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   762
  then show ?case by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   763
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   764
  case (insert x F)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   765
  with assms show ?case
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   766
    by (simp add: has_integral_add)
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   767
qed
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   768
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   769
lemma integral_sum:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   770
  "\<lbrakk>finite I;  \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   771
   integral S (\<lambda>x. \<Sum>a\<in>I. f a x) = (\<Sum>a\<in>I. integral S (f a))"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   772
  by (simp add: has_integral_sum integrable_integral integral_unique)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   773
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   774
lemma integrable_sum:
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   775
  "\<lbrakk>finite I;  \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. \<Sum>a\<in>I. f a x) integrable_on S"
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   776
  unfolding integrable_on_def using has_integral_sum[of I] by metis
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   777
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   778
lemma has_integral_eq:
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   779
  assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   780
    and "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   781
  shows "(g has_integral k) s"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   782
  using has_integral_diff[OF assms(2), of "\<lambda>x. f x - g x" 0]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   783
  using has_integral_is_0[of s "\<lambda>x. f x - g x"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   784
  using assms(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   785
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   786
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
   787
lemma integrable_eq: "\<lbrakk>f integrable_on s; \<And>x. x \<in> s \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> g integrable_on s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   788
  unfolding integrable_on_def
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   789
  using has_integral_eq[of s f g] has_integral_eq by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   790
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   791
lemma has_integral_cong:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   792
  assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   793
  shows "(f has_integral i) s = (g has_integral i) s"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   794
  using has_integral_eq[of s f g] has_integral_eq[of s g f] assms
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   795
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   796
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   797
lemma integral_cong:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   798
  assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   799
  shows "integral s f = integral s g"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   800
  unfolding integral_def
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   801
by (metis (full_types, hide_lams) assms has_integral_cong integrable_eq)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   802
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   803
lemma integrable_on_cmult_left_iff [simp]:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   804
  assumes "c \<noteq> 0"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   805
  shows "(\<lambda>x. of_real c * f x) integrable_on s \<longleftrightarrow> f integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   806
        (is "?lhs = ?rhs")
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   807
proof
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   808
  assume ?lhs
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   809
  then have "(\<lambda>x. of_real (1 / c) * (of_real c * f x)) integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   810
    using integrable_cmul[of "\<lambda>x. of_real c * f x" s "1 / of_real c"]
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   811
    by (simp add: scaleR_conv_of_real)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   812
  then have "(\<lambda>x. (of_real (1 / c) * of_real c * f x)) integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   813
    by (simp add: algebra_simps)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   814
  with \<open>c \<noteq> 0\<close> show ?rhs
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   815
    by (metis (no_types, lifting) integrable_eq mult.left_neutral nonzero_divide_eq_eq of_real_1 of_real_mult)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   816
qed (blast intro: integrable_on_cmult_left)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   817
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   818
lemma integrable_on_cmult_right:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   819
  fixes f :: "_ \<Rightarrow> 'b :: {comm_ring,real_algebra_1,real_normed_vector}"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   820
  assumes "f integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   821
  shows "(\<lambda>x. f x * of_real c) integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   822
using integrable_on_cmult_left [OF assms] by (simp add: mult.commute)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   823
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   824
lemma integrable_on_cmult_right_iff [simp]:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   825
  fixes f :: "_ \<Rightarrow> 'b :: {comm_ring,real_algebra_1,real_normed_vector}"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   826
  assumes "c \<noteq> 0"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   827
  shows "(\<lambda>x. f x * of_real c) integrable_on s \<longleftrightarrow> f integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   828
using integrable_on_cmult_left_iff [OF assms] by (simp add: mult.commute)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   829
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   830
lemma integrable_on_cdivide:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   831
  fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   832
  assumes "f integrable_on s"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   833
  shows "(\<lambda>x. f x / of_real c) integrable_on s"
68403
223172b97d0b reorient -> split; documented split
nipkow
parents: 68361
diff changeset
   834
by (simp add: integrable_on_cmult_right divide_inverse assms flip: of_real_inverse)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   835
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   836
lemma integrable_on_cdivide_iff [simp]:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   837
  fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   838
  assumes "c \<noteq> 0"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   839
  shows "(\<lambda>x. f x / of_real c) integrable_on s \<longleftrightarrow> f integrable_on s"
68403
223172b97d0b reorient -> split; documented split
nipkow
parents: 68361
diff changeset
   840
by (simp add: divide_inverse assms flip: of_real_inverse)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   841
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   842
lemma has_integral_null [intro]: "content(cbox a b) = 0 \<Longrightarrow> (f has_integral 0) (cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   843
  unfolding has_integral_cbox
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   844
  using eventually_division_filter_tagged_division[of "cbox a b"]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   845
  by (subst tendsto_cong[where g="\<lambda>_. 0"]) (auto elim: eventually_mono intro: sum_content_null)
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   846
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
   847
lemma has_integral_null_real [intro]: "content {a..b::real} = 0 \<Longrightarrow> (f has_integral 0) {a..b}"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   848
  by (metis box_real(2) has_integral_null)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   849
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   850
lemma has_integral_null_eq[simp]: "content (cbox a b) = 0 \<Longrightarrow> (f has_integral i) (cbox a b) \<longleftrightarrow> i = 0"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   851
  by (auto simp add: has_integral_null dest!: integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   852
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   853
lemma integral_null [simp]: "content (cbox a b) = 0 \<Longrightarrow> integral (cbox a b) f = 0"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   854
  by (metis has_integral_null integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   855
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   856
lemma integrable_on_null [intro]: "content (cbox a b) = 0 \<Longrightarrow> f integrable_on (cbox a b)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   857
  by (simp add: has_integral_integrable)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   858
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   859
lemma has_integral_empty[intro]: "(f has_integral 0) {}"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
   860
  by (meson ex_in_conv has_integral_is_0)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   861
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   862
lemma has_integral_empty_eq[simp]: "(f has_integral i) {} \<longleftrightarrow> i = 0"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   863
  by (auto simp add: has_integral_empty has_integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   864
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   865
lemma integrable_on_empty[intro]: "f integrable_on {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   866
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   867
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   868
lemma integral_empty[simp]: "integral {} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   869
  by (rule integral_unique) (rule has_integral_empty)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   870
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   871
lemma has_integral_refl[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   872
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   873
  shows "(f has_integral 0) (cbox a a)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   874
    and "(f has_integral 0) {a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   875
proof -
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   876
  show "(f has_integral 0) (cbox a a)"
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   877
     by (rule has_integral_null) simp
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   878
  then show "(f has_integral 0) {a}"
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   879
    by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   880
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   881
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   882
lemma integrable_on_refl[intro]: "f integrable_on cbox a a"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   883
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   884
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   885
lemma integral_refl [simp]: "integral (cbox a a) f = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   886
  by (rule integral_unique) auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   887
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   888
lemma integral_singleton [simp]: "integral {a} f = 0"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   889
  by auto
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   890
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   891
lemma integral_blinfun_apply:
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   892
  assumes "f integrable_on s"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   893
  shows "integral s (\<lambda>x. blinfun_apply h (f x)) = blinfun_apply h (integral s f)"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   894
  by (subst integral_linear[symmetric, OF assms blinfun.bounded_linear_right]) (simp add: o_def)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   895
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   896
lemma blinfun_apply_integral:
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   897
  assumes "f integrable_on s"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   898
  shows "blinfun_apply (integral s f) x = integral s (\<lambda>y. blinfun_apply (f y) x)"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   899
  by (metis (no_types, lifting) assms blinfun.prod_left.rep_eq integral_blinfun_apply integral_cong)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   900
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   901
lemma has_integral_componentwise_iff:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   902
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   903
  shows "(f has_integral y) A \<longleftrightarrow> (\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   904
proof safe
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   905
  fix b :: 'b assume "(f has_integral y) A"
63938
f6ce08859d4c More mainly topological results
paulson <lp15@cam.ac.uk>
parents: 63928
diff changeset
   906
  from has_integral_linear[OF this(1) bounded_linear_inner_left, of b]
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   907
    show "((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A" by (simp add: o_def)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   908
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   909
  assume "(\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   910
  hence "\<forall>b\<in>Basis. (((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. f x \<bullet> b)) has_integral ((y \<bullet> b) *\<^sub>R b)) A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   911
    by (intro ballI has_integral_linear) (simp_all add: bounded_linear_scaleR_left)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   912
  hence "((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (y \<bullet> b) *\<^sub>R b)) A"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   913
    by (intro has_integral_sum) (simp_all add: o_def)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   914
  thus "(f has_integral y) A" by (simp add: euclidean_representation)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   915
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   916
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   917
lemma has_integral_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   918
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   919
  shows "(\<And>b. b \<in> Basis \<Longrightarrow> ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A) \<Longrightarrow> (f has_integral y) A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   920
  by (subst has_integral_componentwise_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   921
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   922
lemma integrable_componentwise_iff:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   923
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   924
  shows "f integrable_on A \<longleftrightarrow> (\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   925
proof
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   926
  assume "f integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   927
  then obtain y where "(f has_integral y) A" by (auto simp: integrable_on_def)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   928
  hence "(\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   929
    by (subst (asm) has_integral_componentwise_iff)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   930
  thus "(\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)" by (auto simp: integrable_on_def)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   931
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   932
  assume "(\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   933
  then obtain y where "\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral y b) A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   934
    unfolding integrable_on_def by (subst (asm) bchoice_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   935
  hence "\<forall>b\<in>Basis. (((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. f x \<bullet> b)) has_integral (y b *\<^sub>R b)) A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   936
    by (intro ballI has_integral_linear) (simp_all add: bounded_linear_scaleR_left)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   937
  hence "((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. y b *\<^sub>R b)) A"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   938
    by (intro has_integral_sum) (simp_all add: o_def)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   939
  thus "f integrable_on A" by (auto simp: integrable_on_def o_def euclidean_representation)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   940
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   941
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   942
lemma integrable_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   943
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   944
  shows "(\<And>b. b \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> b) integrable_on A) \<Longrightarrow> f integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   945
  by (subst integrable_componentwise_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   946
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   947
lemma integral_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   948
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   949
  assumes "f integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   950
  shows "integral A f = (\<Sum>b\<in>Basis. integral A (\<lambda>x. (f x \<bullet> b) *\<^sub>R b))"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   951
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   952
  from assms have integrable: "\<forall>b\<in>Basis. (\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. (f x \<bullet> b)) integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   953
    by (subst (asm) integrable_componentwise_iff, intro integrable_linear ballI)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   954
       (simp_all add: bounded_linear_scaleR_left)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   955
  have "integral A f = integral A (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   956
    by (simp add: euclidean_representation)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   957
  also from integrable have "\<dots> = (\<Sum>a\<in>Basis. integral A (\<lambda>x. (f x \<bullet> a) *\<^sub>R a))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   958
    by (subst integral_sum) (simp_all add: o_def)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   959
  finally show ?thesis .
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   960
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   961
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   962
lemma integrable_component:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   963
  "f integrable_on A \<Longrightarrow> (\<lambda>x. f x \<bullet> (y :: 'b :: euclidean_space)) integrable_on A"
63938
f6ce08859d4c More mainly topological results
paulson <lp15@cam.ac.uk>
parents: 63928
diff changeset
   964
  by (drule integrable_linear[OF _ bounded_linear_inner_left[of y]]) (simp add: o_def)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   965
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   966
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   967
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
   968
subsection \<open>Cauchy-type criterion for integrability\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   969
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   970
proposition integrable_Cauchy:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   971
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::{real_normed_vector,complete_space}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   972
  shows "f integrable_on cbox a b \<longleftrightarrow>
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   973
        (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   974
          (\<forall>\<D>1 \<D>2. \<D>1 tagged_division_of (cbox a b) \<and> \<gamma> fine \<D>1 \<and>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   975
            \<D>2 tagged_division_of (cbox a b) \<and> \<gamma> fine \<D>2 \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   976
            norm ((\<Sum>(x,K)\<in>\<D>1. content K *\<^sub>R f x) - (\<Sum>(x,K)\<in>\<D>2. content K *\<^sub>R f x)) < e))"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   977
  (is "?l = (\<forall>e>0. \<exists>\<gamma>. ?P e \<gamma>)")
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   978
proof (intro iffI allI impI)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   979
  assume ?l
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   980
  then obtain y
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   981
    where y: "\<And>e. e > 0 \<Longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   982
        \<exists>\<gamma>. gauge \<gamma> \<and>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   983
            (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   984
                 norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - y) < e)"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   985
    by (auto simp: integrable_on_def has_integral)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   986
  show "\<exists>\<gamma>. ?P e \<gamma>" if "e > 0" for e
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   987
  proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   988
    have "e/2 > 0" using that by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   989
    with y obtain \<gamma> where "gauge \<gamma>"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   990
      and \<gamma>: "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<Longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
   991
                  norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f x) - y) < e/2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   992
      by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   993
    show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   994
    apply (rule_tac x=\<gamma> in exI, clarsimp simp: \<open>gauge \<gamma>\<close>)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   995
        by (blast intro!: \<gamma> dist_triangle_half_l[where y=y,unfolded dist_norm])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   996
    qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   997
next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   998
  assume "\<forall>e>0. \<exists>\<gamma>. ?P e \<gamma>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   999
  then have "\<forall>n::nat. \<exists>\<gamma>. ?P (1 / (n + 1)) \<gamma>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1000
    by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1001
  then obtain \<gamma> :: "nat \<Rightarrow> 'n \<Rightarrow> 'n set" where \<gamma>:
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1002
    "\<And>m. gauge (\<gamma> m)"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1003
    "\<And>m \<D>1 \<D>2. \<lbrakk>\<D>1 tagged_division_of cbox a b;
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1004
              \<gamma> m fine \<D>1; \<D>2 tagged_division_of cbox a b; \<gamma> m fine \<D>2\<rbrakk>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1005
              \<Longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>1. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> \<D>2. content K *\<^sub>R f x))
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1006
                  < 1 / (m + 1)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1007
    by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1008
  have "\<And>n. gauge (\<lambda>x. \<Inter>{\<gamma> i x |i. i \<in> {0..n}})"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1009
    apply (rule gauge_Inter)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1010
    using \<gamma> by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1011
  then have "\<forall>n. \<exists>p. p tagged_division_of (cbox a b) \<and> (\<lambda>x. \<Inter>{\<gamma> i x |i. i \<in> {0..n}}) fine p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1012
    by (meson fine_division_exists)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1013
  then obtain p where p: "\<And>z. p z tagged_division_of cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1014
                         "\<And>z. (\<lambda>x. \<Inter>{\<gamma> i x |i. i \<in> {0..z}}) fine p z"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1015
    by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1016
  have dp: "\<And>i n. i\<le>n \<Longrightarrow> \<gamma> i fine p n"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1017
    using p unfolding fine_Inter
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1018
    using atLeastAtMost_iff by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1019
  have "Cauchy (\<lambda>n. sum (\<lambda>(x,K). content K *\<^sub>R (f x)) (p n))"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1020
  proof (rule CauchyI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1021
    fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1022
    assume "0 < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1023
    then obtain N where "N \<noteq> 0" and N: "inverse (real N) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1024
      using real_arch_inverse[of e] by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1025
    show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm ((\<Sum>(x,K) \<in> p m. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p n. content K *\<^sub>R f x)) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1026
    proof (intro exI allI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1027
      fix m n
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1028
      assume mn: "N \<le> m" "N \<le> n"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1029
      have "norm ((\<Sum>(x,K) \<in> p m. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p n. content K *\<^sub>R f x)) < 1 / (real N + 1)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1030
        by (simp add: p(1) dp mn \<gamma>)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1031
      also have "... < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1032
        using  N \<open>N \<noteq> 0\<close> \<open>0 < e\<close> by (auto simp: field_simps)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1033
      finally show "norm ((\<Sum>(x,K) \<in> p m. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p n. content K *\<^sub>R f x)) < e" .
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1034
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1035
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1036
  then obtain y where y: "\<exists>no. \<forall>n\<ge>no. norm ((\<Sum>(x,K) \<in> p n. content K *\<^sub>R f x) - y) < r" if "r > 0" for r
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1037
    by (auto simp: convergent_eq_Cauchy[symmetric] dest: LIMSEQ_D)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1038
  show ?l
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1039
    unfolding integrable_on_def has_integral
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  1040
  proof (rule_tac x=y in exI, clarify)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1041
    fix e :: real
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1042
    assume "e>0"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1043
    then have e2: "e/2 > 0" by auto
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  1044
    then obtain N1::nat where N1: "N1 \<noteq> 0" "inverse (real N1) < e/2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1045
      using real_arch_inverse by blast
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  1046
    obtain N2::nat where N2: "\<And>n. n \<ge> N2 \<Longrightarrow> norm ((\<Sum>(x,K) \<in> p n. content K *\<^sub>R f x) - y) < e/2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1047
      using y[OF e2] by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1048
    show "\<exists>\<gamma>. gauge \<gamma> \<and>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1049
              (\<forall>\<D>. \<D> tagged_division_of (cbox a b) \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1050
                norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - y) < e)"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1051
    proof (intro exI conjI allI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1052
      show "gauge (\<gamma> (N1+N2))"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1053
        using \<gamma> by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1054
      show "norm ((\<Sum>(x,K) \<in> q. content K *\<^sub>R f x) - y) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1055
           if "q tagged_division_of cbox a b \<and> \<gamma> (N1+N2) fine q" for q
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1056
      proof (rule norm_triangle_half_r)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1057
        have "norm ((\<Sum>(x,K) \<in> p (N1+N2). content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> q. content K *\<^sub>R f x))
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1058
               < 1 / (real (N1+N2) + 1)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1059
          by (rule \<gamma>; simp add: dp p that)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1060
        also have "... < e/2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1061
          using N1 \<open>0 < e\<close> by (auto simp: field_simps intro: less_le_trans)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  1062
        finally show "norm ((\<Sum>(x,K) \<in> p (N1+N2). content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> q. content K *\<^sub>R f x)) < e/2" .
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1063
        show "norm ((\<Sum>(x,K) \<in> p (N1+N2). content K *\<^sub>R f x) - y) < e/2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1064
          using N2 le_add_same_cancel2 by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1065
      qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1066
    qed
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1067
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1068
qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1069
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1070
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1071
subsection \<open>Additivity of integral on abutting intervals\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1072
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1073
lemma tagged_division_split_left_inj_content:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1074
  assumes \<D>: "\<D> tagged_division_of S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1075
    and "(x1, K1) \<in> \<D>" "(x2, K2) \<in> \<D>" "K1 \<noteq> K2" "K1 \<inter> {x. x\<bullet>k \<le> c} = K2 \<inter> {x. x\<bullet>k \<le> c}" "k \<in> Basis"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1076
  shows "content (K1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1077
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1078
  from tagged_division_ofD(4)[OF \<D> \<open>(x1, K1) \<in> \<D>\<close>] obtain a b where K1: "K1 = cbox a b"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1079
    by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1080
  then have "interior (K1 \<inter> {x. x \<bullet> k \<le> c}) = {}"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  1081
    by (metis tagged_division_split_left_inj assms)
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1082
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1083
    unfolding K1 interval_split[OF \<open>k \<in> Basis\<close>] by (auto simp: content_eq_0_interior)
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1084
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1085
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1086
lemma tagged_division_split_right_inj_content:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1087
  assumes \<D>: "\<D> tagged_division_of S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1088
    and "(x1, K1) \<in> \<D>" "(x2, K2) \<in> \<D>" "K1 \<noteq> K2" "K1 \<inter> {x. x\<bullet>k \<ge> c} = K2 \<inter> {x. x\<bullet>k \<ge> c}" "k \<in> Basis"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1089
  shows "content (K1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1090
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1091
  from tagged_division_ofD(4)[OF \<D> \<open>(x1, K1) \<in> \<D>\<close>] obtain a b where K1: "K1 = cbox a b"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1092
    by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1093
  then have "interior (K1 \<inter> {x. c \<le> x \<bullet> k}) = {}"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  1094
    by (metis tagged_division_split_right_inj assms)
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1095
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1096
    unfolding K1 interval_split[OF \<open>k \<in> Basis\<close>]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1097
    by (auto simp: content_eq_0_interior)
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1098
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1099
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1100
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1101
proposition has_integral_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1102
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1103
  assumes fi: "(f has_integral i) (cbox a b \<inter> {x. x\<bullet>k \<le> c})"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1104
      and fj: "(f has_integral j) (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1105
      and k: "k \<in> Basis"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1106
shows "(f has_integral (i + j)) (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1107
  unfolding has_integral
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1108
proof clarify
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1109
  fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1110
  assume "0 < e"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1111
  then have e: "e/2 > 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1112
    by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1113
    obtain \<gamma>1 where \<gamma>1: "gauge \<gamma>1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1114
      and \<gamma>1norm:
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1115
        "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}; \<gamma>1 fine \<D>\<rbrakk>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1116
             \<Longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - i) < e/2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1117
       apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1118
       apply (simp add: interval_split[symmetric] k)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1119
      done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1120
    obtain \<gamma>2 where \<gamma>2: "gauge \<gamma>2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1121
      and \<gamma>2norm:
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1122
        "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}; \<gamma>2 fine \<D>\<rbrakk>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1123
             \<Longrightarrow> norm ((\<Sum>(x, k) \<in> \<D>. content k *\<^sub>R f x) - j) < e/2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1124
       apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1125
       apply (simp add: interval_split[symmetric] k)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1126
       done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1127
  let ?\<gamma> = "\<lambda>x. if x\<bullet>k = c then (\<gamma>1 x \<inter> \<gamma>2 x) else ball x \<bar>x\<bullet>k - c\<bar> \<inter> \<gamma>1 x \<inter> \<gamma>2 x"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1128
  have "gauge ?\<gamma>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1129
    using \<gamma>1 \<gamma>2 unfolding gauge_def by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1130
  then show "\<exists>\<gamma>. gauge \<gamma> \<and>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1131
                 (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  1132
                      norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - (i + j)) < e)"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1133
  proof (rule_tac x="?\<gamma>" in exI, safe)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1134
    fix p
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1135
    assume p: "p tagged_division_of (cbox a b)" and "?\<gamma> fine p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1136
    have ab_eqp: "cbox a b = \<Union>{K. \<exists>x. (x, K) \<in> p}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1137
      using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1138
    have xk_le_c: "x\<bullet>k \<le> c" if as: "(x,K) \<in> p" and K: "K \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}" for x K
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1139
    proof (rule ccontr)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1140
      assume **: "\<not> x \<bullet> k \<le> c"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1141
      then have "K \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1142
        using \<open>?\<gamma> fine p\<close> as by (fastforce simp: not_le algebra_simps)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1143
      with K obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1144
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1145
      then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1146
        using Basis_le_norm[OF k, of "x - y"]
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1147
        by (auto simp add: dist_norm inner_diff_left intro: le_less_trans)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1148
      with y show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1149
        using ** by (auto simp add: field_simps)
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1150
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1151
    have xk_ge_c: "x\<bullet>k \<ge> c" if as: "(x,K) \<in> p" and K: "K \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}" for x K
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1152
    proof (rule ccontr)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1153
      assume **: "\<not> x \<bullet> k \<ge> c"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1154
      then have "K \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1155
        using \<open>?\<gamma> fine p\<close> as by (fastforce simp: not_le algebra_simps)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1156
      with K obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1157
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1158
      then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1159
        using Basis_le_norm[OF k, of "x - y"]
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1160
        by (auto simp add: dist_norm inner_diff_left intro: le_less_trans)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1161
      with y show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1162
        using ** by (auto simp add: field_simps)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1163
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1164
    have fin_finite: "finite {(x,f K) | x K. (x,K) \<in> s \<and> P x K}"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1165
      if "finite s" for s and f :: "'a set \<Rightarrow> 'a set" and P :: "'a \<Rightarrow> 'a set \<Rightarrow> bool"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1166
    proof -
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1167
      from that have "finite ((\<lambda>(x,K). (x, f K)) ` s)"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  1168
        by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1169
      then show ?thesis
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  1170
        by (rule rev_finite_subset) auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1171
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1172
    { fix \<G> :: "'a set \<Rightarrow> 'a set"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1173
      fix i :: "'a \<times> 'a set"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1174
      assume "i \<in> (\<lambda>(x, k). (x, \<G> k)) ` p - {(x, \<G> k) |x k. (x, k) \<in> p \<and> \<G> k \<noteq> {}}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1175
      then obtain x K where xk: "i = (x, \<G> K)"  "(x,K) \<in> p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1176
                                 "(x, \<G> K) \<notin> {(x, \<G> K) |x K. (x,K) \<in> p \<and> \<G> K \<noteq> {}}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1177
        by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1178
      have "content (\<G> K) = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1179
        using xk using content_empty by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1180
      then have "(\<lambda>(x,K). content K *\<^sub>R f x) i = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1181
        unfolding xk split_conv by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1182
    } note [simp] = this
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1183
    have "finite p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1184
      using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1185
    let ?M1 = "{(x, K \<inter> {x. x\<bullet>k \<le> c}) |x K. (x,K) \<in> p \<and> K \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1186
    have \<gamma>1_fine: "\<gamma>1 fine ?M1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1187
      using \<open>?\<gamma> fine p\<close> by (fastforce simp: fine_def split: if_split_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1188
    have "norm ((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) < e/2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1189
    proof (rule \<gamma>1norm [OF tagged_division_ofI \<gamma>1_fine])
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1190
      show "finite ?M1"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1191
        by (rule fin_finite) (use p in blast)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1192
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M1} = cbox a b \<inter> {x. x\<bullet>k \<le> c}"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1193
        by (auto simp: ab_eqp)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1194
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1195
      fix x L
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1196
      assume xL: "(x, L) \<in> ?M1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1197
      then obtain x' L' where xL': "x = x'" "L = L' \<inter> {x. x \<bullet> k \<le> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1198
                                   "(x', L') \<in> p" "L' \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1199
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1200
      then obtain a' b' where ab': "L' = cbox a' b'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1201
        using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1202
      show "x \<in> L" "L \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<le> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1203
        using p xk_le_c xL' by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1204
      show "\<exists>a b. L = cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1205
        using p xL' ab' by (auto simp add: interval_split[OF k,where c=c])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1206
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1207
      fix y R
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1208
      assume yR: "(y, R) \<in> ?M1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1209
      then obtain y' R' where yR': "y = y'" "R = R' \<inter> {x. x \<bullet> k \<le> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1210
                                   "(y', R') \<in> p" "R' \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1211
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1212
      assume as: "(x, L) \<noteq> (y, R)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1213
      show "interior L \<inter> interior R = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1214
      proof (cases "L' = R' \<longrightarrow> x' = y'")
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1215
        case False
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1216
        have "interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1217
          by (metis (no_types) False Pair_inject inf.idem tagged_division_ofD(5) [OF p] xL'(3) yR'(3))
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1218
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1219
          using yR' by simp
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1220
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1221
        case True
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1222
        then have "L' \<noteq> R'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1223
          using as unfolding xL' yR' by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1224
        have "interior L' \<inter> interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1225
          by (metis (no_types) Pair_inject \<open>L' \<noteq> R'\<close> p tagged_division_ofD(5) xL'(3) yR'(3))
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1226
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1227
          using xL'(2) yR'(2) by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1228
      qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1229
    qed
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1230
    moreover
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1231
    let ?M2 = "{(x,K \<inter> {x. x\<bullet>k \<ge> c}) |x K. (x,K) \<in> p \<and> K \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1232
    have \<gamma>2_fine: "\<gamma>2 fine ?M2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1233
      using \<open>?\<gamma> fine p\<close> by (fastforce simp: fine_def split: if_split_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1234
    have "norm ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) < e/2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1235
    proof (rule \<gamma>2norm [OF tagged_division_ofI \<gamma>2_fine])
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1236
      show "finite ?M2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1237
        by (rule fin_finite) (use p in blast)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1238
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M2} = cbox a b \<inter> {x. x\<bullet>k \<ge> c}"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1239
        by (auto simp: ab_eqp)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1240
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1241
      fix x L
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1242
      assume xL: "(x, L) \<in> ?M2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1243
      then obtain x' L' where xL': "x = x'" "L = L' \<inter> {x. x \<bullet> k \<ge> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1244
                                   "(x', L') \<in> p" "L' \<inter> {x. x \<bullet> k \<ge> c} \<noteq> {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1245
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1246
      then obtain a' b' where ab': "L' = cbox a' b'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1247
        using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1248
      show "x \<in> L" "L \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<ge> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1249
        using p xk_ge_c xL' by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1250
      show "\<exists>a b. L = cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1251
        using p xL' ab' by (auto simp add: interval_split[OF k,where c=c])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1252
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1253
      fix y R
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1254
      assume yR: "(y, R) \<in> ?M2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1255
      then obtain y' R' where yR': "y = y'" "R = R' \<inter> {x. x \<bullet> k \<ge> c}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1256
                                   "(y', R') \<in> p" "R' \<inter> {x. x \<bullet> k \<ge> c} \<noteq> {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1257
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1258
      assume as: "(x, L) \<noteq> (y, R)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1259
      show "interior L \<inter> interior R = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1260
      proof (cases "L' = R' \<longrightarrow> x' = y'")
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1261
        case False
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1262
        have "interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1263
          by (metis (no_types) False Pair_inject inf.idem tagged_division_ofD(5) [OF p] xL'(3) yR'(3))
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1264
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1265
          using yR' by simp
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1266
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1267
        case True
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1268
        then have "L' \<noteq> R'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1269
          using as unfolding xL' yR' by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1270
        have "interior L' \<inter> interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1271
          by (metis (no_types) Pair_inject \<open>L' \<noteq> R'\<close> p tagged_division_ofD(5) xL'(3) yR'(3))
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1272
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1273
          using xL'(2) yR'(2) by auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1274
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1275
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1276
    ultimately
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1277
    have "norm (((\<Sum>(x,K) \<in> ?M1. content K *\<^sub>R f x) - i) + ((\<Sum>(x,K) \<in> ?M2. content K *\<^sub>R f x) - j)) < e/2 + e/2"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  1278
      using norm_add_less by blast
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1279
    moreover have "((\<Sum>(x,K) \<in> ?M1. content K *\<^sub>R f x) - i) +
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1280
                   ((\<Sum>(x,K) \<in> ?M2. content K *\<^sub>R f x) - j) =
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1281
                   (\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f x) - (i + j)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1282
    proof -
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1283
      have eq0: "\<And>x y. x = (0::real) \<Longrightarrow> x *\<^sub>R (y::'b) = 0"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1284
         by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1285
      have cont_eq: "\<And>g. (\<lambda>(x,l). content l *\<^sub>R f x) \<circ> (\<lambda>(x,l). (x,g l)) = (\<lambda>(x,l). content (g l) *\<^sub>R f x)"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1286
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1287
      have *: "\<And>\<G> :: 'a set \<Rightarrow> 'a set.
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1288
                  (\<Sum>(x,K)\<in>{(x, \<G> K) |x K. (x,K) \<in> p \<and> \<G> K \<noteq> {}}. content K *\<^sub>R f x) =
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1289
                  (\<Sum>(x,K)\<in>(\<lambda>(x,K). (x, \<G> K)) ` p. content K *\<^sub>R f x)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1290
        by (rule sum.mono_neutral_left) (auto simp: \<open>finite p\<close>)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1291
      have "((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) + ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) =
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1292
        (\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - (i + j)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1293
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1294
      moreover have "\<dots> = (\<Sum>(x,K) \<in> p. content (K \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) +
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1295
        (\<Sum>(x,K) \<in> p. content (K \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) - (i + j)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1296
        unfolding *
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1297
        apply (subst (1 2) sum.reindex_nontrivial)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1298
           apply (auto intro!: k p eq0 tagged_division_split_left_inj_content tagged_division_split_right_inj_content
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1299
                       simp: cont_eq \<open>finite p\<close>)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1300
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1301
      moreover have "\<And>x. x \<in> p \<Longrightarrow> (\<lambda>(a,B). content (B \<inter> {a. a \<bullet> k \<le> c}) *\<^sub>R f a) x +
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1302
                                (\<lambda>(a,B). content (B \<inter> {a. c \<le> a \<bullet> k}) *\<^sub>R f a) x =
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1303
                                (\<lambda>(a,B). content B *\<^sub>R f a) x"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1304
      proof clarify
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1305
        fix a B
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1306
        assume "(a, B) \<in> p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1307
        with p obtain u v where uv: "B = cbox u v" by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1308
        then show "content (B \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f a + content (B \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f a = content B *\<^sub>R f a"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1309
          by (auto simp: scaleR_left_distrib uv content_split[OF k,of u v c])
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1310
      qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1311
      ultimately show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1312
        by (auto simp: sum.distrib[symmetric])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1313
      qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1314
    ultimately show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (i + j)) < e"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1315
      by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1316
  qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1317
qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1318
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1319
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1320
subsection \<open>A sort of converse, integrability on subintervals\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1321
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1322
lemma has_integral_separate_sides:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1323
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1324
  assumes f: "(f has_integral i) (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1325
    and "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1326
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1327
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1328
    "\<forall>p1 p2. p1 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<and> d fine p1 \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1329
        p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) \<and> d fine p2 \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1330
        norm ((sum (\<lambda>(x,k). content k *\<^sub>R f x) p1 + sum (\<lambda>(x,k). content k *\<^sub>R f x) p2) - i) < e"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1331
proof -
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1332
  obtain \<gamma> where d: "gauge \<gamma>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1333
      "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma> fine p\<rbrakk>
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1334
            \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < e"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1335
    using has_integralD[OF f \<open>e > 0\<close>] by metis
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1336
  { fix p1 p2
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1337
    assume tdiv1: "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" and "\<gamma> fine p1"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1338
    note p1=tagged_division_ofD[OF this(1)] 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1339
    assume tdiv2: "p2 tagged_division_of (cbox a b) \<inter> {x. c \<le> x \<bullet> k}" and "\<gamma> fine p2"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1340
    note p2=tagged_division_ofD[OF this(1)] 
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  1341
    note tagged_division_Un_interval[OF tdiv1 tdiv2] 
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1342
    note p12 = tagged_division_ofD[OF this] this
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1343
    { fix a b
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1344
      assume ab: "(a, b) \<in> p1 \<inter> p2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1345
      have "(a, b) \<in> p1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1346
        using ab by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1347
      obtain u v where uv: "b = cbox u v"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1348
        using \<open>(a, b) \<in> p1\<close> p1(4) by moura
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1349
      have "b \<subseteq> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1350
        using ab p1(3)[of a b] p2(3)[of a b] by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1351
      moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1352
      have "interior {x::'a. x \<bullet> k = c} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1353
      proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1354
        assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1355
        then obtain x where x: "x \<in> interior {x::'a. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1356
          by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1357
        then obtain \<epsilon> where "0 < \<epsilon>" and \<epsilon>: "ball x \<epsilon> \<subseteq> {x. x \<bullet> k = c}"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1358
          using mem_interior by metis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1359
        have x: "x\<bullet>k = c"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1360
          using x interior_subset by fastforce
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  1361
        have *: "\<And>i. i \<in> Basis \<Longrightarrow> \<bar>(x - (x + (\<epsilon>/2) *\<^sub>R k)) \<bullet> i\<bar> = (if i = k then \<epsilon>/2 else 0)"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1362
          using \<open>0 < \<epsilon>\<close> k by (auto simp: inner_simps inner_not_same_Basis)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  1363
        have "(\<Sum>i\<in>Basis. \<bar>(x - (x + (\<epsilon>/2 ) *\<^sub>R k)) \<bullet> i\<bar>) =
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  1364
              (\<Sum>i\<in>Basis. (if i = k then \<epsilon>/2 else 0))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1365
          using "*" by (blast intro: sum.cong)
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1366
        also have "\<dots> < \<epsilon>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1367
          by (subst sum.delta) (use \<open>0 < \<epsilon>\<close> in auto)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1368
        finally have "x + (\<epsilon>/2) *\<^sub>R k \<in> ball x \<epsilon>"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1369
          unfolding mem_ball dist_norm by(rule le_less_trans[OF norm_le_l1])
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1370
        then have "x + (\<epsilon>/2) *\<^sub>R k \<in> {x. x\<bullet>k = c}"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1371
          using \<epsilon> by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1372
        then show False
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1373
          using \<open>0 < \<epsilon>\<close> x k by (auto simp: inner_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1374
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1375
      ultimately have "content b = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1376
        unfolding uv content_eq_0_interior
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1377
        using interior_mono by blast
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1378
      then have "content b *\<^sub>R f a = 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1379
        by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1380
    }
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1381
    then have "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - i) =
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1382
               norm ((\<Sum>(x, k)\<in>p1 \<union> p2. content k *\<^sub>R f x) - i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1383
      by (subst sum.union_inter_neutral) (auto simp: p1 p2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1384
    also have "\<dots> < e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1385
      using d(2) p12 by (simp add: fine_Un k \<open>\<gamma> fine p1\<close> \<open>\<gamma> fine p2\<close>)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1386
    finally have "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - i) < e" .
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1387
   }
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1388
  then show ?thesis
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1389
    using d(1) that by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1390
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1391
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1392
lemma integrable_split [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1393
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1394
  assumes f: "f integrable_on cbox a b"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1395
      and k: "k \<in> Basis"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1396
    shows "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<le> c})"   (is ?thesis1)
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1397
    and   "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"   (is ?thesis2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1398
proof -
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1399
  obtain y where y: "(f has_integral y) (cbox a b)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1400
    using f by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  1401
  define a' where "a' = (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i)*\<^sub>R i)"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1402
  define b' where "b' = (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i)*\<^sub>R i)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1403
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1404
            (\<forall>p1 p2. p1 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c} \<and> d fine p1 \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1405
                     p2 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c} \<and> d fine p2 \<longrightarrow>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1406
                     norm ((\<Sum>(x,K) \<in> p1. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p2. content K *\<^sub>R f x)) < e)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1407
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1408
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1409
    have "e/2 > 0" using that by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1410
  with has_integral_separate_sides[OF y this k, of c]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1411
  obtain d
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1412
    where "gauge d"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1413
         and d: "\<And>p1 p2. \<lbrakk>p1 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}; d fine p1;
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1414
                          p2 tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}; d fine p2\<rbrakk>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1415
                  \<Longrightarrow> norm ((\<Sum>(x,K)\<in>p1. content K *\<^sub>R f x) + (\<Sum>(x,K)\<in>p2. content K *\<^sub>R f x) - y) < e/2"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1416
    by metis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1417
  show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1418
    proof (rule_tac x=d in exI, clarsimp simp add: \<open>gauge d\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1419
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1420
      assume as: "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p1"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1421
                 "p2 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1422
      show "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1423
      proof (rule fine_division_exists[OF \<open>gauge d\<close>, of a' b])
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1424
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1425
        assume "p tagged_division_of cbox a' b" "d fine p"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1426
        then show ?thesis
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1427
          using as norm_triangle_half_l[OF d[of p1 p] d[of p2 p]]
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1428
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1429
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1430
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1431
    qed
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1432
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1433
  with f show ?thesis1
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1434
    by (simp add: interval_split[OF k] integrable_Cauchy)
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1435
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1436
            (\<forall>p1 p2. p1 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<ge> c} \<and> d fine p1 \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1437
                     p2 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<ge> c} \<and> d fine p2 \<longrightarrow>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1438
                     norm ((\<Sum>(x,K) \<in> p1. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p2. content K *\<^sub>R f x)) < e)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1439
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1440
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1441
    have "e/2 > 0" using that by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1442
  with has_integral_separate_sides[OF y this k, of c]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1443
  obtain d
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1444
    where "gauge d"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1445
         and d: "\<And>p1 p2. \<lbrakk>p1 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}; d fine p1;
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1446
                          p2 tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}; d fine p2\<rbrakk>
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1447
                  \<Longrightarrow> norm ((\<Sum>(x,K)\<in>p1. content K *\<^sub>R f x) + (\<Sum>(x,K)\<in>p2. content K *\<^sub>R f x) - y) < e/2"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1448
    by metis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1449
  show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1450
    proof (rule_tac x=d in exI, clarsimp simp add: \<open>gauge d\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1451
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1452
      assume as: "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<ge> c}" "d fine p1"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1453
                 "p2 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<ge> c}" "d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1454
      show "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1455
      proof (rule fine_division_exists[OF \<open>gauge d\<close>, of a b'])
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1456
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1457
        assume "p tagged_division_of cbox a b'" "d fine p"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1458
        then show ?thesis
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1459
          using as norm_triangle_half_l[OF d[of p p1] d[of p p2]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1460
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  1461
          by (auto simp add: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1462
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1463
    qed
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1464
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1465
  with f show ?thesis2
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1466
    by (simp add: interval_split[OF k] integrable_Cauchy)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1467
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1468
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  1469
lemma operative_integralI:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1470
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  1471
  shows "operative (lift_option (+)) (Some 0)
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1472
    (\<lambda>i. if f integrable_on i then Some (integral i f) else None)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1473
proof -
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1474
  interpret comm_monoid "lift_option plus" "Some (0::'b)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1475
    by (rule comm_monoid_lift_option)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1476
      (rule add.comm_monoid_axioms)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1477
  show ?thesis
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  1478
  proof
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1479
    fix a b c
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1480
    fix k :: 'a
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1481
    assume k: "k \<in> Basis"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1482
    show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) =
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  1483
          lift_option (+) (if f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c} then Some (integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f) else None)
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1484
          (if f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k} then Some (integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f) else None)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1485
    proof (cases "f integrable_on cbox a b")
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1486
      case True
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1487
      with k show ?thesis
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1488
        apply (simp add: integrable_split)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1489
        apply (rule integral_unique [OF has_integral_split[OF _ _ k]])
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  1490
        apply (auto intro: integrable_integral)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1491
        done
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1492
    next
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1493
    case False
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1494
      have "\<not> (f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}) \<or> \<not> ( f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k})"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1495
      proof (rule ccontr)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1496
        assume "\<not> ?thesis"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1497
        then have "f integrable_on cbox a b"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1498
          unfolding integrable_on_def
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1499
          apply (rule_tac x="integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. x \<bullet> k \<ge> c}) f" in exI)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1500
          apply (rule has_integral_split[OF _ _ k])
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1501
          apply (auto intro: integrable_integral)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1502
          done
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1503
        then show False
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1504
          using False by auto
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1505
      qed
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1506
      then show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1507
        using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1508
    qed
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1509
  next
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1510
    fix a b :: 'a
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1511
    assume "box a b = {}"
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1512
    then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1513
      using has_integral_null_eq
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1514
      by (auto simp: integrable_on_null content_eq_0_interior)
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1515
  qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1516
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1517
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1518
subsection \<open>Bounds on the norm of Riemann sums and the integral itself\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1519
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1520
lemma dsum_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1521
  assumes "p division_of (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1522
    and "norm c \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1523
  shows "norm (sum (\<lambda>l. content l *\<^sub>R c) p) \<le> e * content(cbox a b)"
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1524
proof -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1525
  have sumeq: "(\<Sum>i\<in>p. \<bar>content i\<bar>) = sum content p"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1526
    apply (rule sum.cong)
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1527
    using assms
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1528
    apply simp
71633
07bec530f02e cleaned proofs
nipkow
parents: 71192
diff changeset
  1529
    apply (metis abs_of_nonneg content_pos_le)
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1530
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1531
  have e: "0 \<le> e"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1532
    using assms(2) norm_ge_zero order_trans by blast
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1533
  have "norm (sum (\<lambda>l. content l *\<^sub>R c) p) \<le> (\<Sum>i\<in>p. norm (content i *\<^sub>R c))"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1534
    using norm_sum by blast
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1535
  also have "...  \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1536
    by (simp add: sum_distrib_left[symmetric] mult.commute assms(2) mult_right_mono sum_nonneg)
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1537
  also have "... \<le> e * content (cbox a b)"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1538
    apply (rule mult_left_mono [OF _ e])
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1539
    apply (simp add: sumeq)
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1540
    using additive_content_division assms(1) eq_iff apply blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1541
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1542
  finally show ?thesis .
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1543
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1544
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1545
lemma rsum_bound:
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1546
  assumes p: "p tagged_division_of (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1547
      and "\<forall>x\<in>cbox a b. norm (f x) \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1548
    shows "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> e * content (cbox a b)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1549
proof (cases "cbox a b = {}")
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1550
  case True show ?thesis
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1551
    using p unfolding True tagged_division_of_trivial by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1552
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1553
  case False
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1554
  then have e: "e \<ge> 0"
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  1555
    by (meson ex_in_conv assms(2) norm_ge_zero order_trans)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1556
  have sum_le: "sum (content \<circ> snd) p \<le> content (cbox a b)"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1557
    unfolding additive_content_tagged_division[OF p, symmetric] split_def
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1558
    by (auto intro: eq_refl)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1559
  have con: "\<And>xk. xk \<in> p \<Longrightarrow> 0 \<le> content (snd xk)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1560
    using tagged_division_ofD(4) [OF p] content_pos_le
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1561
    by force
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1562
  have norm: "\<And>xk. xk \<in> p \<Longrightarrow> norm (f (fst xk)) \<le> e"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1563
    unfolding fst_conv using tagged_division_ofD(2,3)[OF p] assms
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1564
    by (metis prod.collapse subset_eq)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1565
  have "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1566
    by (rule norm_sum)
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1567
  also have "...  \<le> e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1568
    unfolding split_def norm_scaleR
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1569
    apply (rule order_trans[OF sum_mono])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1570
    apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e])
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1571
    apply (metis norm)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1572
    unfolding sum_distrib_right[symmetric]
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1573
    using con sum_le
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1574
    apply (auto simp: mult.commute intro: mult_left_mono [OF _ e])
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1575
    done
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1576
  finally show ?thesis .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1577
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1578
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1579
lemma rsum_diff_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1580
  assumes "p tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1581
    and "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1582
  shows "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - sum (\<lambda>(x,k). content k *\<^sub>R g x) p) \<le>
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1583
         e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1584
  apply (rule order_trans[OF _ rsum_bound[OF assms]])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1585
  apply (simp add: split_def scaleR_diff_right sum_subtractf eq_refl)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1586
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1587
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1588
lemma has_integral_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1589
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1590
  assumes "0 \<le> B"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1591
      and f: "(f has_integral i) (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1592
      and "\<And>x. x\<in>cbox a b \<Longrightarrow> norm (f x) \<le> B"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1593
    shows "norm i \<le> B * content (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1594
proof (rule ccontr)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1595
  assume "\<not> ?thesis"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1596
  then have "norm i - B * content (cbox a b) > 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1597
    by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1598
  with f[unfolded has_integral]
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1599
  obtain \<gamma> where "gauge \<gamma>" and \<gamma>:
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1600
    "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma> fine p\<rbrakk>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1601
          \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - i) < norm i - B * content (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1602
    by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1603
  then obtain p where p: "p tagged_division_of cbox a b" and "\<gamma> fine p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1604
    using fine_division_exists by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1605
  have "\<And>s B. norm s \<le> B \<Longrightarrow> \<not> norm (s - i) < norm i - B"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1606
    unfolding not_less
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1607
    by (metis diff_left_mono dist_commute dist_norm norm_triangle_ineq2 order_trans)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1608
  then show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1609
    using \<gamma> [OF p \<open>\<gamma> fine p\<close>] rsum_bound[OF p] assms by metis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1610
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1611
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1612
corollary integrable_bound:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1613
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1614
  assumes "0 \<le> B"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1615
      and "f integrable_on (cbox a b)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1616
      and "\<And>x. x\<in>cbox a b \<Longrightarrow> norm (f x) \<le> B"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1617
    shows "norm (integral (cbox a b) f) \<le> B * content (cbox a b)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1618
by (metis integrable_integral has_integral_bound assms)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1619
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1620
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1621
subsection \<open>Similar theorems about relationship among components\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1622
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1623
lemma rsum_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1624
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1625
  assumes p: "p tagged_division_of (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1626
      and "\<And>x. x \<in> cbox a b \<Longrightarrow> (f x)\<bullet>i \<le> (g x)\<bullet>i"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1627
    shows "(\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) \<bullet> i \<le> (\<Sum>(x, K)\<in>p. content K *\<^sub>R g x) \<bullet> i"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1628
unfolding inner_sum_left
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1629
proof (rule sum_mono, clarify)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1630
  fix x K
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1631
  assume ab: "(x, K) \<in> p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1632
  with p obtain u v where K: "K = cbox u v"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1633
    by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1634
  then show "(content K *\<^sub>R f x) \<bullet> i \<le> (content K *\<^sub>R g x) \<bullet> i"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1635
    by (metis ab assms inner_scaleR_left measure_nonneg mult_left_mono tag_in_interval)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1636
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1637
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1638
lemma has_integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1639
  fixes f g :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1640
  assumes k: "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1641
  assumes "(f has_integral i) S" "(g has_integral j) S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1642
    and f_le_g: "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> (g x)\<bullet>k"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1643
  shows "i\<bullet>k \<le> j\<bullet>k"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  1644
proof -
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1645
  have ik_le_jk: "i\<bullet>k \<le> j\<bullet>k"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1646
    if f_i: "(f has_integral i) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1647
    and g_j: "(g has_integral j) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1648
    and le: "\<forall>x\<in>cbox a b. (f x)\<bullet>k \<le> (g x)\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1649
    for a b i and j :: 'b and f g :: "'a \<Rightarrow> 'b"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  1650
  proof (rule ccontr)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1651
    assume "\<not> ?thesis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1652
    then have *: "0 < (i\<bullet>k - j\<bullet>k) / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1653
      by auto
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1654
    obtain \<gamma>1 where "gauge \<gamma>1" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1655
      and \<gamma>1: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>1 fine p\<rbrakk>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1656
                \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1657
      using f_i[unfolded has_integral,rule_format,OF *] by fastforce 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1658
    obtain \<gamma>2 where "gauge \<gamma>2" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1659
      and \<gamma>2: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; \<gamma>2 fine p\<rbrakk>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1660
                \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1661
      using g_j[unfolded has_integral,rule_format,OF *] by fastforce 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1662
    obtain p where p: "p tagged_division_of cbox a b" and "\<gamma>1 fine p" "\<gamma>2 fine p"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1663
       using fine_division_exists[OF gauge_Int[OF \<open>gauge \<gamma>1\<close> \<open>gauge \<gamma>2\<close>], of a b] unfolding fine_Int
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1664
       by metis
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1665
    then have "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1666
         "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1667
      using le_less_trans[OF Basis_le_norm[OF k]] k \<gamma>1 \<gamma>2 by metis+ 
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1668
    then show False
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1669
      unfolding inner_simps
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1670
      using rsum_component_le[OF p] le
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1671
      by (fastforce simp add: abs_real_def split: if_split_asm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1672
  qed
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1673
  show ?thesis
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1674
  proof (cases "\<exists>a b. S = cbox a b")
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1675
    case True
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1676
    with ik_le_jk assms show ?thesis
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1677
      by auto
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1678
  next
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1679
    case False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1680
    show ?thesis
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1681
    proof (rule ccontr)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1682
      assume "\<not> i\<bullet>k \<le> j\<bullet>k"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1683
      then have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1684
        by auto
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1685
      obtain B1 where "0 < B1" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1686
           and B1: "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1687
                    \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b) \<and>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1688
                        norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1689
        using has_integral_altD[OF _ False ij] assms by blast
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1690
      obtain B2 where "0 < B2" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1691
           and B2: "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1692
                    \<exists>z. ((\<lambda>x. if x \<in> S then g x else 0) has_integral z) (cbox a b) \<and>
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1693
                        norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1694
        using has_integral_altD[OF _ False ij] assms by blast
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1695
      have "bounded (ball 0 B1 \<union> ball (0::'a) B2)"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1696
        unfolding bounded_Un by(rule conjI bounded_ball)+
68120
2f161c6910f7 tidying more messy proofs
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
  1697
      from bounded_subset_cbox_symmetric[OF this] 
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1698
      obtain a b::'a where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b"
68120
2f161c6910f7 tidying more messy proofs
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
  1699
        by (meson Un_subset_iff)
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1700
      then obtain w1 w2 where int_w1: "((\<lambda>x. if x \<in> S then f x else 0) has_integral w1) (cbox a b)"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1701
                        and norm_w1:  "norm (w1 - i) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1702
                        and int_w2: "((\<lambda>x. if x \<in> S then g x else 0) has_integral w2) (cbox a b)"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1703
                        and norm_w2: "norm (w2 - j) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1704
        using B1 B2 by blast
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1705
      have *: "\<And>w1 w2 j i::real .\<bar>w1 - i\<bar> < (i - j) / 3 \<Longrightarrow> \<bar>w2 - j\<bar> < (i - j) / 3 \<Longrightarrow> w1 \<le> w2 \<Longrightarrow> False"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
  1706
        by (simp add: abs_real_def split: if_split_asm)
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1707
      have "\<bar>(w1 - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1708
           "\<bar>(w2 - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1709
        using Basis_le_norm k le_less_trans norm_w1 norm_w2 by blast+
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1710
      moreover
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1711
      have "w1\<bullet>k \<le> w2\<bullet>k"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1712
        using ik_le_jk int_w1 int_w2 f_le_g by auto
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1713
      ultimately show False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1714
        unfolding inner_simps by(rule *)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1715
    qed
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1716
  qed
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1717
qed
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  1718
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1719
lemma integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1720
  fixes g f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1721
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1722
    and "f integrable_on S" "g integrable_on S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1723
    and "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> (g x)\<bullet>k"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1724
  shows "(integral S f)\<bullet>k \<le> (integral S g)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1725
  apply (rule has_integral_component_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1726
  using integrable_integral assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1727
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1728
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1729
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1730
lemma has_integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1731
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1732
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1733
    and "(f has_integral i) S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1734
    and "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> (f x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1735
  shows "0 \<le> i\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1736
  using has_integral_component_le[OF assms(1) has_integral_0 assms(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1737
  using assms(3-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1738
  by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1739
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1740
lemma integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1741
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1742
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1743
    and  "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> (f x)\<bullet>k"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1744
  shows "0 \<le> (integral S f)\<bullet>k"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1745
proof (cases "f integrable_on S")
62463
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1746
  case True show ?thesis
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1747
    apply (rule has_integral_component_nonneg)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1748
    using assms True
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1749
    apply auto
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1750
    done
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1751
next
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1752
  case False then show ?thesis by (simp add: not_integrable_integral)
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  1753
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1754
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1755
lemma has_integral_component_neg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1756
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1757
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1758
    and "(f has_integral i) S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1759
    and "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1760
  shows "i\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1761
  using has_integral_component_le[OF assms(1,2) has_integral_0] assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1762
  by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1763
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1764
lemma has_integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1765
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1766
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1767
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1768
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1769
  shows "B * content (cbox a b) \<le> i\<bullet>k"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1770
  using has_integral_component_le[OF assms(3) has_integral_const assms(1),of "(\<Sum>i\<in>Basis. B *\<^sub>R i)::'b"] assms(2-)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1771
  by (auto simp add: field_simps)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1772
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1773
lemma has_integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1774
  fixes f::"'a::euclidean_space => 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1775
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1776
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1777
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1778
  shows "i\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1779
  using has_integral_component_le[OF assms(3,1) has_integral_const, of "\<Sum>i\<in>Basis. B *\<^sub>R i"] assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1780
  by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1781
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1782
lemma integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1783
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1784
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1785
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1786
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1787
  shows "B * content (cbox a b) \<le> (integral(cbox a b) f)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1788
  apply (rule has_integral_component_lbound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1789
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1790
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1791
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1792
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1793
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1794
lemma integral_component_lbound_real:
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1795
  assumes "f integrable_on {a ::real..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1796
    and "\<forall>x\<in>{a..b}. B \<le> f(x)\<bullet>k"
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1797
    and "k \<in> Basis"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1798
  shows "B * content {a..b} \<le> (integral {a..b} f)\<bullet>k"
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1799
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1800
  by (metis box_real(2) integral_component_lbound)
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1801
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1802
lemma integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1803
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1804
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1805
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1806
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1807
  shows "(integral (cbox a b) f)\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1808
  apply (rule has_integral_component_ubound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1809
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1810
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1811
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1812
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1813
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1814
lemma integral_component_ubound_real:
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1815
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1816
  assumes "f integrable_on {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1817
    and "\<forall>x\<in>{a..b}. f x\<bullet>k \<le> B"
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1818
    and "k \<in> Basis"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  1819
  shows "(integral {a..b} f)\<bullet>k \<le> B * content {a..b}"
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1820
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1821
  by (metis box_real(2) integral_component_ubound)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1822
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1823
subsection \<open>Uniform limit of integrable functions is integrable\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1824
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1825
lemma real_arch_invD:
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1826
  "0 < (e::real) \<Longrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e)"
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1827
  by (subst(asm) real_arch_inverse)
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1828
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1829
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1830
lemma integrable_uniform_limit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1831
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1832
  assumes "\<And>e. e > 0 \<Longrightarrow> \<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1833
  shows "f integrable_on cbox a b"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1834
proof (cases "content (cbox a b) > 0")
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1835
  case False then show ?thesis
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1836
    using has_integral_null by (simp add: content_lt_nz integrable_on_def)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1837
next
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1838
  case True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1839
  have "1 / (real n + 1) > 0" for n
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1840
    by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1841
  then have "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> 1 / (real n + 1)) \<and> g integrable_on cbox a b" for n
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1842
    using assms by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1843
  then obtain g where g_near_f: "\<And>n x. x \<in> cbox a b \<Longrightarrow> norm (f x - g n x) \<le> 1 / (real n + 1)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1844
                  and int_g: "\<And>n. g n integrable_on cbox a b"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1845
    by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1846
  then obtain h where h: "\<And>n. (g n has_integral h n) (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1847
    unfolding integrable_on_def by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1848
  have "Cauchy h"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1849
    unfolding Cauchy_def
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1850
  proof clarify
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1851
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1852
    assume "e>0"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1853
    then have "e/4 / content (cbox a b) > 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1854
      using True by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1855
    then obtain M where "M \<noteq> 0" and M: "1 / (real M) < e/4 / content (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1856
      by (metis inverse_eq_divide real_arch_inverse)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1857
    show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (h m) (h n) < e"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1858
    proof (rule exI [where x=M], clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1859
      fix m n
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1860
      assume m: "M \<le> m" and n: "M \<le> n"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1861
      have "e/4>0" using \<open>e>0\<close> by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1862
      then obtain gm gn where "gauge gm" "gauge gn"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1863
              and gm: "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> gm fine \<D> 
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1864
                            \<Longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g m x) - h m) < e/4"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1865
              and gn: "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> gn fine \<D> \<Longrightarrow>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1866
                      norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g n x) - h n) < e/4"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1867
        using h[unfolded has_integral] by meson
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1868
      then obtain \<D> where \<D>: "\<D> tagged_division_of cbox a b" "(\<lambda>x. gm x \<inter> gn x) fine \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1869
        by (metis (full_types) fine_division_exists gauge_Int)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1870
      have triangle3: "norm (i1 - i2) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1871
        if no: "norm(s2 - s1) \<le> e/2" "norm (s1 - i1) < e/4" "norm (s2 - i2) < e/4" for s1 s2 i1 and i2::'b
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1872
      proof -
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1873
        have "norm (i1 - i2) \<le> norm (i1 - s1) + norm (s1 - s2) + norm (s2 - i2)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1874
          using norm_triangle_ineq[of "i1 - s1" "s1 - i2"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1875
          using norm_triangle_ineq[of "s1 - s2" "s2 - i2"]
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1876
          by (auto simp: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1877
        also have "\<dots> < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1878
          using no by (auto simp: algebra_simps norm_minus_commute)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1879
        finally show ?thesis .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1880
      qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1881
      have finep: "gm fine \<D>" "gn fine \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1882
        using fine_Int \<D>  by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1883
      have norm_le: "norm (g n x - g m x) \<le> 2 / real M" if x: "x \<in> cbox a b" for x
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1884
      proof -
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1885
        have "norm (f x - g n x) + norm (f x - g m x) \<le> 1 / (real n + 1) + 1 / (real m + 1)"          
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1886
          using g_near_f[OF x, of n] g_near_f[OF x, of m] by simp
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1887
        also have "\<dots> \<le> 1 / (real M) + 1 / (real M)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1888
          apply (rule add_mono)
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  1889
          using \<open>M \<noteq> 0\<close> m n by (auto simp: field_split_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1890
        also have "\<dots> = 2 / real M"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1891
          by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1892
        finally show "norm (g n x - g m x) \<le> 2 / real M"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1893
          using norm_triangle_le[of "g n x - f x" "f x - g m x" "2 / real M"]
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1894
          by (auto simp: algebra_simps simp add: norm_minus_commute)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1895
      qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1896
      have "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g n x) - (\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g m x)) \<le> 2 / real M * content (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1897
        by (blast intro: norm_le rsum_diff_bound[OF \<D>(1), where e="2 / real M"])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1898
      also have "... \<le> e/2"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1899
        using M True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1900
        by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1901
      finally have le_e2: "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g n x) - (\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g m x)) \<le> e/2" .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1902
      then show "dist (h m) (h n) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1903
        unfolding dist_norm using gm gn \<D> finep by (auto intro!: triangle3)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1904
    qed
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1905
  qed
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1906
  then obtain s where s: "h \<longlonglongrightarrow> s"
64287
d85d88722745 more from moretop.ml
paulson <lp15@cam.ac.uk>
parents: 64272
diff changeset
  1907
    using convergent_eq_Cauchy[symmetric] by blast
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1908
  show ?thesis
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1909
    unfolding integrable_on_def has_integral
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1910
  proof (rule_tac x=s in exI, clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1911
    fix e::real
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1912
    assume e: "0 < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1913
    then have "e/3 > 0" by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1914
    then obtain N1 where N1: "\<forall>n\<ge>N1. norm (h n - s) < e/3"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1915
      using LIMSEQ_D [OF s] by metis
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1916
    from e True have "e/3 / content (cbox a b) > 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1917
      by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1918
    then obtain N2 :: nat
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1919
         where "N2 \<noteq> 0" and N2: "1 / (real N2) < e/3 / content (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1920
      by (metis inverse_eq_divide real_arch_inverse)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1921
    obtain g' where "gauge g'"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1922
            and g': "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> g' fine \<D> \<Longrightarrow>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1923
                    norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g (N1 + N2) x) - h (N1 + N2)) < e/3"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1924
      by (metis h has_integral \<open>e/3 > 0\<close>)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1925
    have *: "norm (sf - s) < e" 
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1926
        if no: "norm (sf - sg) \<le> e/3" "norm(h - s) < e/3" "norm (sg - h) < e/3" for sf sg h
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1927
    proof -
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1928
      have "norm (sf - s) \<le> norm (sf - sg) + norm (sg - h) + norm (h - s)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1929
        using norm_triangle_ineq[of "sf - sg" "sg - s"]
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1930
        using norm_triangle_ineq[of "sg -  h" " h - s"]
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1931
        by (auto simp: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1932
      also have "\<dots> < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1933
        using no by (auto simp: algebra_simps norm_minus_commute)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1934
      finally show ?thesis .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1935
    qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1936
    { fix \<D>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1937
      assume ptag: "\<D> tagged_division_of (cbox a b)" and "g' fine \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1938
      then have norm_less: "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g (N1 + N2) x) - h (N1 + N2)) < e/3"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1939
        using g' by blast
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1940
      have "content (cbox a b) < e/3 * (of_nat N2)"
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  1941
        using \<open>N2 \<noteq> 0\<close> N2 using True by (auto simp: field_split_simps)
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1942
      moreover have "e/3 * of_nat N2 \<le> e/3 * (of_nat (N1 + N2) + 1)"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1943
        using \<open>e>0\<close> by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1944
      ultimately have "content (cbox a b) < e/3 * (of_nat (N1 + N2) + 1)"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1945
        by linarith
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1946
      then have le_e3: "1 / (real (N1 + N2) + 1) * content (cbox a b) \<le> e/3"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1947
        unfolding inverse_eq_divide
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1948
        by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1949
      have ne3: "norm (h (N1 + N2) - s) < e/3"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1950
        using N1 by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1951
      have "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R g (N1 + N2) x))
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1952
            \<le> 1 / (real (N1 + N2) + 1) * content (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1953
        by (blast intro: g_near_f rsum_diff_bound[OF ptag])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1954
      then have "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - s) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1955
        by (rule *[OF order_trans [OF _ le_e3] ne3 norm_less])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1956
    }
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1957
    then show "\<exists>d. gauge d \<and>
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1958
             (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> d fine \<D> \<longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - s) < e)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1959
      by (blast intro: g' \<open>gauge g'\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1960
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1961
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1962
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  1963
lemmas integrable_uniform_limit_real = integrable_uniform_limit [where 'a=real, simplified]
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  1964
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1965
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1966
subsection \<open>Negligible sets\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1967
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1968
definition "negligible (s:: 'a::euclidean_space set) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1969
  (\<forall>a b. ((indicator s :: 'a\<Rightarrow>real) has_integral 0) (cbox a b))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1970
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1971
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  1972
subsubsection \<open>Negligibility of hyperplane\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1973
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1974
lemma content_doublesplit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1975
  fixes a :: "'a::euclidean_space"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1976
  assumes "0 < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1977
    and k: "k \<in> Basis"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  1978
  obtains d where "0 < d" and "content (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d}) < e"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1979
proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1980
  assume *: "a \<bullet> k \<le> c \<and> c \<le> b \<bullet> k \<and> (\<forall>j\<in>Basis. a \<bullet> j \<le> b \<bullet> j)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1981
  define a' where "a' d = (\<Sum>j\<in>Basis. (if j = k then max (a\<bullet>j) (c - d) else a\<bullet>j) *\<^sub>R j)" for d
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1982
  define b' where "b' d = (\<Sum>j\<in>Basis. (if j = k then min (b\<bullet>j) (c + d) else b\<bullet>j) *\<^sub>R j)" for d
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1983
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1984
  have "((\<lambda>d. \<Prod>j\<in>Basis. (b' d - a' d) \<bullet> j) \<longlongrightarrow> (\<Prod>j\<in>Basis. (b' 0 - a' 0) \<bullet> j)) (at_right 0)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1985
    by (auto simp: b'_def a'_def intro!: tendsto_min tendsto_max tendsto_eq_intros)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1986
  also have "(\<Prod>j\<in>Basis. (b' 0 - a' 0) \<bullet> j) = 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1987
    using k *
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  1988
    by (intro prod_zero bexI[OF _ k])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1989
       (auto simp: b'_def a'_def inner_diff inner_sum_left inner_not_same_Basis intro!: sum.cong)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1990
  also have "((\<lambda>d. \<Prod>j\<in>Basis. (b' d - a' d) \<bullet> j) \<longlongrightarrow> 0) (at_right 0) =
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1991
    ((\<lambda>d. content (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d})) \<longlongrightarrow> 0) (at_right 0)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1992
  proof (intro tendsto_cong eventually_at_rightI)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1993
    fix d :: real assume d: "d \<in> {0<..<1}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1994
    have "cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d} = cbox (a' d) (b' d)" for d
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1995
      using * d k by (auto simp add: cbox_def set_eq_iff Int_def ball_conj_distrib abs_diff_le_iff a'_def b'_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1996
    moreover have "j \<in> Basis \<Longrightarrow> a' d \<bullet> j \<le> b' d \<bullet> j" for j
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1997
      using * d k by (auto simp: a'_def b'_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1998
    ultimately show "(\<Prod>j\<in>Basis. (b' d - a' d) \<bullet> j) = content (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d})"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1999
      by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2000
  qed simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2001
  finally have "((\<lambda>d. content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) \<longlongrightarrow> 0) (at_right 0)" .
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2002
  from order_tendstoD(2)[OF this \<open>0<e\<close>]
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2003
  obtain d' where "0 < d'" and d': "\<And>y. y > 0 \<Longrightarrow> y < d' \<Longrightarrow> content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> y}) < e"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2004
    by (subst (asm) eventually_at_right[of _ 1]) auto
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2005
  show ?thesis
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2006
    by (rule that[of "d'/2"], insert \<open>0<d'\<close> d'[of "d'/2"], auto)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2007
next
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2008
  assume *: "\<not> (a \<bullet> k \<le> c \<and> c \<le> b \<bullet> k \<and> (\<forall>j\<in>Basis. a \<bullet> j \<le> b \<bullet> j))"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2009
  then have "(\<exists>j\<in>Basis. b \<bullet> j < a \<bullet> j) \<or> (c < a \<bullet> k \<or> b \<bullet> k < c)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2010
    by (auto simp: not_le)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2011
  show thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2012
  proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2013
    assume "\<exists>j\<in>Basis. b \<bullet> j < a \<bullet> j"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2014
    then have [simp]: "cbox a b = {}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2015
      using box_ne_empty(1)[of a b] by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2016
    show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2017
      by (rule that[of 1]) (simp_all add: \<open>0<e\<close>)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2018
  next
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2019
    assume "\<not> (\<exists>j\<in>Basis. b \<bullet> j < a \<bullet> j)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2020
    with * have "c < a \<bullet> k \<or> b \<bullet> k < c"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2021
      by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2022
    then show thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2023
    proof
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2024
      assume c: "c < a \<bullet> k"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2025
      moreover have "x \<in> cbox a b \<Longrightarrow> c \<le> x \<bullet> k" for x
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2026
        using k c by (auto simp: cbox_def)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2027
      ultimately have "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> (a \<bullet> k - c)/2} = {}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2028
        using k by (auto simp: cbox_def)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2029
      with \<open>0<e\<close> c that[of "(a \<bullet> k - c)/2"] show ?thesis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2030
        by auto
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  2031
    next
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2032
      assume c: "b \<bullet> k < c"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2033
      moreover have "x \<in> cbox a b \<Longrightarrow> x \<bullet> k \<le> c" for x
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2034
        using k c by (auto simp: cbox_def)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2035
      ultimately have "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> (c - b \<bullet> k)/2} = {}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2036
        using k by (auto simp: cbox_def)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2037
      with \<open>0<e\<close> c that[of "(c - b \<bullet> k)/2"] show ?thesis
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2038
        by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2039
    qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2040
  qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2041
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2042
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2043
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2044
proposition negligible_standard_hyperplane[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2045
  fixes k :: "'a::euclidean_space"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2046
  assumes k: "k \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2047
  shows "negligible {x. x\<bullet>k = c}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2048
  unfolding negligible_def has_integral
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2049
proof clarsimp
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2050
  fix a b and e::real assume "e > 0"
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2051
  with k obtain d where "0 < d" and d: "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2052
    by (metis content_doublesplit)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2053
  let ?i = "indicator {x::'a. x\<bullet>k = c} :: 'a\<Rightarrow>real"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2054
  show "\<exists>\<gamma>. gauge \<gamma> \<and>
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2055
           (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2056
                 \<bar>\<Sum>(x,K) \<in> \<D>. content K * ?i x\<bar> < e)"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2057
  proof (intro exI, safe)
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2058
    show "gauge (\<lambda>x. ball x d)"
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2059
      using \<open>0 < d\<close> by blast
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2060
  next
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2061
    fix \<D>
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2062
    assume p: "\<D> tagged_division_of (cbox a b)" "(\<lambda>x. ball x d) fine \<D>"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2063
    have "content L = content (L \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})" 
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2064
      if "(x, L) \<in> \<D>" "?i x \<noteq> 0" for x L
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2065
    proof -
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2066
      have xk: "x\<bullet>k = c"
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2067
        using that by (simp add: indicator_def split: if_split_asm)
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2068
      have "L \<subseteq> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2069
      proof 
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2070
        fix y
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2071
        assume y: "y \<in> L"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2072
        have "L \<subseteq> ball x d"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2073
          using p(2) that(1) by auto
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2074
        then have "norm (x - y) < d"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2075
          by (simp add: dist_norm subset_iff y)
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2076
        then have "\<bar>(x - y) \<bullet> k\<bar> < d"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2077
          using k norm_bound_Basis_lt by blast
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2078
        then show "y \<in> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2079
          unfolding inner_simps xk by auto
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2080
      qed 
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2081
      then show "content L = content (L \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2082
        by (metis inf.orderE)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2083
    qed
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2084
    then have *: "(\<Sum>(x,K)\<in>\<D>. content K * ?i x) = (\<Sum>(x,K)\<in>\<D>. content (K \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d}) *\<^sub>R ?i x)"
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2085
      by (force simp add: split_paired_all intro!: sum.cong [OF refl])
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2086
    note p'= tagged_division_ofD[OF p(1)] and p''=division_of_tagged_division[OF p(1)]
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2087
    have "(\<Sum>(x,K)\<in>\<D>. content (K \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * indicator {x. x \<bullet> k = c} x) < e"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2088
    proof -
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2089
      have "(\<Sum>(x,K)\<in>\<D>. content (K \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) \<le> (\<Sum>(x,K)\<in>\<D>. content (K \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}))"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2090
        by (force simp add: indicator_def intro!: sum_mono)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2091
      also have "\<dots> < e"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2092
      proof (subst sum.over_tagged_division_lemma[OF p(1)])
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2093
        fix u v::'a
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2094
        assume "box u v = {}"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2095
        then have *: "content (cbox u v) = 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2096
          unfolding content_eq_0_interior by simp
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2097
        have "cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<subseteq> cbox u v"
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2098
          by auto
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2099
        then have "content (cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<le> content (cbox u v)"
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2100
          unfolding interval_doublesplit[OF k] by (rule content_subset)
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2101
        then show "content (cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 0"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2102
          unfolding * interval_doublesplit[OF k]
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  2103
          by (blast intro: antisym)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2104
      next
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2105
        have "(\<Sum>l\<in>snd ` \<D>. content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) =
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2106
          sum content ((\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` \<D>. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2107
        proof (subst (2) sum.reindex_nontrivial)
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2108
          fix x y assume "x \<in> {l \<in> snd ` \<D>. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}" "y \<in> {l \<in> snd ` \<D>. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2109
            "x \<noteq> y" and eq: "x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2110
          then obtain x' y' where "(x', x) \<in> \<D>" "x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}" "(y', y) \<in> \<D>" "y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2111
            by (auto)
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2112
          from p'(5)[OF \<open>(x', x) \<in> \<D>\<close> \<open>(y', y) \<in> \<D>\<close>] \<open>x \<noteq> y\<close> have "interior (x \<inter> y) = {}"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2113
            by auto
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2114
          moreover have "interior ((x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<inter> (y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) \<subseteq> interior (x \<inter> y)"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2115
            by (auto intro: interior_mono)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2116
          ultimately have "interior (x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = {}"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2117
            by (auto simp: eq)
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2118
          then show "content (x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 0"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2119
            using p'(4)[OF \<open>(x', x) \<in> \<D>\<close>] by (auto simp: interval_doublesplit[OF k] content_eq_0_interior simp del: interior_Int)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2120
        qed (insert p'(1), auto intro!: sum.mono_neutral_right)
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2121
        also have "\<dots> \<le> norm (\<Sum>l\<in>(\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` \<D>. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}. content l *\<^sub>R 1::real)"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2122
          by simp
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2123
        also have "\<dots> \<le> 1 * content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})"
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2124
          using division_doublesplit[OF p'' k, unfolded interval_doublesplit[OF k]]
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2125
          unfolding interval_doublesplit[OF k] by (intro dsum_bound) auto
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2126
        also have "\<dots> < e"
66537
e2249cd6df67 sorted out cases in negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66536
diff changeset
  2127
          using d by simp
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2128
        finally show "(\<Sum>K\<in>snd ` \<D>. content (K \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) < e" .
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2129
      qed
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2130
      finally show "(\<Sum>(x, K)\<in>\<D>. content (K \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) < e" .
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2131
    qed
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2132
    then show "\<bar>\<Sum>(x, K)\<in>\<D>. content K * ?i x\<bar> < e"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2133
      unfolding * 
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2134
      apply (subst abs_of_nonneg)
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2135
      using measure_nonneg       
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  2136
      by (force simp add: indicator_def intro: sum_nonneg)+
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2137
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2138
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2139
67984
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2140
corollary negligible_standard_hyperplane_cart:
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2141
  fixes k :: "'a::finite"
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2142
  shows "negligible {x. x$k = (0::real)}"
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2143
  by (simp add: cart_eq_inner_axis negligible_standard_hyperplane)
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2144
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2145
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2146
subsubsection \<open>Hence the main theorem about negligible sets\<close>
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2147
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2148
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2149
lemma has_integral_negligible_cbox:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2150
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2151
  assumes negs: "negligible S"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2152
    and 0: "\<And>x. x \<notin> S \<Longrightarrow> f x = 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2153
  shows "(f has_integral 0) (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2154
  unfolding has_integral
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2155
proof clarify
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2156
  fix e::real
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2157
  assume "e > 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2158
  then have nn_gt0: "e/2 / ((real n+1) * (2 ^ n)) > 0" for n
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2159
    by simp
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2160
  then have "\<exists>\<gamma>. gauge \<gamma> \<and>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2161
                   (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2162
                        \<bar>\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R indicator S x\<bar>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2163
                        < e/2 / ((real n + 1) * 2 ^ n))" for n
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2164
    using negs [unfolded negligible_def has_integral] by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2165
  then obtain \<gamma> where 
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2166
    gd: "\<And>n. gauge (\<gamma> n)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2167
    and \<gamma>: "\<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> n fine \<D>\<rbrakk>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2168
                  \<Longrightarrow> \<bar>\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R indicator S x\<bar> < e/2 / ((real n + 1) * 2 ^ n)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2169
    by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2170
  show "\<exists>\<gamma>. gauge \<gamma> \<and>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2171
             (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2172
                  norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - 0) < e)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2173
  proof (intro exI, safe)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2174
    show "gauge (\<lambda>x. \<gamma> (nat \<lfloor>norm (f x)\<rfloor>) x)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2175
      using gd by (auto simp: gauge_def)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2176
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2177
    show "norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - 0) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2178
      if "\<D> tagged_division_of (cbox a b)" "(\<lambda>x. \<gamma> (nat \<lfloor>norm (f x)\<rfloor>) x) fine \<D>" for \<D>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2179
    proof (cases "\<D> = {}")
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2180
      case True with \<open>0 < e\<close> show ?thesis by simp
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2181
    next
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2182
      case False
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2183
      obtain N where "Max ((\<lambda>(x, K). norm (f x)) ` \<D>) \<le> real N"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2184
        using real_arch_simple by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2185
      then have N: "\<And>x. x \<in> (\<lambda>(x, K). norm (f x)) ` \<D> \<Longrightarrow> x \<le> real N"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2186
        by (meson Max_ge that(1) dual_order.trans finite_imageI tagged_division_of_finite)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2187
      have "\<forall>i. \<exists>q. q tagged_division_of (cbox a b) \<and> (\<gamma> i) fine q \<and> (\<forall>(x,K) \<in> \<D>. K \<subseteq> (\<gamma> i) x \<longrightarrow> (x, K) \<in> q)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2188
        by (auto intro: tagged_division_finer[OF that(1) gd])
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  2189
      from choice[OF this] 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  2190
      obtain q where q: "\<And>n. q n tagged_division_of cbox a b"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2191
                        "\<And>n. \<gamma> n fine q n"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2192
                        "\<And>n x K. \<lbrakk>(x, K) \<in> \<D>; K \<subseteq> \<gamma> n x\<rbrakk> \<Longrightarrow> (x, K) \<in> q n"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  2193
        by fastforce
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2194
      have "finite \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2195
        using that(1) by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2196
      then have sum_le_inc: "\<lbrakk>finite T; \<And>x y. (x,y) \<in> T \<Longrightarrow> (0::real) \<le> g(x,y);
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2197
                      \<And>y. y\<in>\<D> \<Longrightarrow> \<exists>x. (x,y) \<in> T \<and> f(y) \<le> g(x,y)\<rbrakk> \<Longrightarrow> sum f \<D> \<le> sum g T" for f g T
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2198
        by (rule sum_le_included[of \<D> T g snd f]; force)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2199
      have "norm (\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) \<le> (\<Sum>(x,K) \<in> \<D>. norm (content K *\<^sub>R f x))"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2200
        unfolding split_def by (rule norm_sum)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2201
      also have "... \<le> (\<Sum>(i, j) \<in> Sigma {..N + 1} q.
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2202
                          (real i + 1) * (case j of (x, K) \<Rightarrow> content K *\<^sub>R indicator S x))"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2203
      proof (rule sum_le_inc, safe)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2204
        show "finite (Sigma {..N+1} q)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2205
          by (meson finite_SigmaI finite_atMost tagged_division_of_finite q(1)) 
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2206
      next
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2207
        fix x K
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2208
        assume xk: "(x, K) \<in> \<D>"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2209
        define n where "n = nat \<lfloor>norm (f x)\<rfloor>"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2210
        have *: "norm (f x) \<in> (\<lambda>(x, K). norm (f x)) ` \<D>"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2211
          using xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2212
        have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2213
          unfolding n_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2214
        then have "n \<in> {0..N + 1}"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2215
          using N[OF *] by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2216
        moreover have "K \<subseteq> \<gamma> (nat \<lfloor>norm (f x)\<rfloor>) x"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2217
          using that(2) xk by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2218
        moreover then have "(x, K) \<in> q (nat \<lfloor>norm (f x)\<rfloor>)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2219
          by (simp add: q(3) xk)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2220
        moreover then have "(x, K) \<in> q n"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2221
          using n_def by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2222
        moreover
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2223
        have "norm (content K *\<^sub>R f x) \<le> (real n + 1) * (content K * indicator S x)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2224
        proof (cases "x \<in> S")
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2225
          case False
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2226
          then show ?thesis by (simp add: 0)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2227
        next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2228
          case True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2229
          have *: "content K \<ge> 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2230
            using tagged_division_ofD(4)[OF that(1) xk] by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2231
          moreover have "content K * norm (f x) \<le> content K * (real n + 1)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2232
            by (simp add: mult_left_mono nfx(2))
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2233
          ultimately show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2234
            using nfx True by (auto simp: field_simps)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2235
        qed
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2236
        ultimately show "\<exists>y. (y, x, K) \<in> (Sigma {..N + 1} q) \<and> norm (content K *\<^sub>R f x) \<le>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2237
          (real y + 1) * (content K *\<^sub>R indicator S x)"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  2238
          by force
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2239
      qed auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2240
      also have "... = (\<Sum>i\<le>N + 1. \<Sum>j\<in>q i. (real i + 1) * (case j of (x, K) \<Rightarrow> content K *\<^sub>R indicator S x))"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2241
        apply (rule sum_Sigma_product [symmetric])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2242
        using q(1) apply auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2243
        done
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2244
      also have "... \<le> (\<Sum>i\<le>N + 1. (real i + 1) * \<bar>\<Sum>(x,K) \<in> q i. content K *\<^sub>R indicator S x\<bar>)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2245
        by (rule sum_mono) (simp add: sum_distrib_left [symmetric])
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2246
      also have "... \<le> (\<Sum>i\<le>N + 1. e/2/2 ^ i)"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2247
      proof (rule sum_mono)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2248
        show "(real i + 1) * \<bar>\<Sum>(x,K) \<in> q i. content K *\<^sub>R indicator S x\<bar> \<le> e/2/2 ^ i"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2249
          if "i \<in> {..N + 1}" for i
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2250
          using \<gamma>[of "q i" i] q by (simp add: divide_simps mult.left_commute)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2251
      qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2252
      also have "... = e/2 * (\<Sum>i\<le>N + 1. (1/2) ^ i)"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2253
        unfolding sum_distrib_left by (metis divide_inverse inverse_eq_divide power_one_over)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2254
      also have "\<dots> < e/2 * 2"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2255
      proof (rule mult_strict_left_mono)
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2256
        have "sum (power (1/2)) {..N + 1} = sum (power (1/2::real)) {..<N + 2}"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2257
          using lessThan_Suc_atMost by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2258
        also have "... < 2"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2259
          by (auto simp: geometric_sum)
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2260
        finally show "sum (power (1/2::real)) {..N + 1} < 2" .
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2261
      qed (use \<open>0 < e\<close> in auto)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2262
      finally  show ?thesis by auto
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2263
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2264
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2265
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2266
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2267
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2268
proposition has_integral_negligible:
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2269
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2270
  assumes negs: "negligible S"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2271
    and "\<And>x. x \<in> (T - S) \<Longrightarrow> f x = 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2272
  shows "(f has_integral 0) T"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2273
proof (cases "\<exists>a b. T = cbox a b")
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2274
  case True
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2275
  then have "((\<lambda>x. if x \<in> T then f x else 0) has_integral 0) T"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2276
    using assms by (auto intro!: has_integral_negligible_cbox)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2277
  then show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2278
    by (rule has_integral_eq [rotated]) auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2279
next
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2280
  case False
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2281
  let ?f = "(\<lambda>x. if x \<in> T then f x else 0)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2282
  have "((\<lambda>x. if x \<in> T then f x else 0) has_integral 0) T"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2283
    apply (auto simp: False has_integral_alt [of ?f])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2284
    apply (rule_tac x=1 in exI, auto)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2285
    apply (rule_tac x=0 in exI, simp add: has_integral_negligible_cbox [OF negs] assms)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2286
    done
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2287
  then show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2288
    by (rule_tac f="?f" in has_integral_eq) auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2289
qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2290
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2291
lemma
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2292
  assumes "negligible S"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2293
  shows integrable_negligible: "f integrable_on S" and integral_negligible: "integral S f = 0"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2294
  using has_integral_negligible [OF assms]
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2295
  by (auto simp: has_integral_iff)
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2296
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2297
lemma has_integral_spike:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2298
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector"
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2299
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2300
    and gf: "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2301
    and fint: "(f has_integral y) T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2302
  shows "(g has_integral y) T"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2303
proof -
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2304
  have *: "(g has_integral y) (cbox a b)"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2305
       if "(f has_integral y) (cbox a b)" "\<forall>x \<in> cbox a b - S. g x = f x" for a b f and g:: "'b \<Rightarrow> 'a" and y
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2306
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2307
    have "((\<lambda>x. f x + (g x - f x)) has_integral (y + 0)) (cbox a b)"
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2308
      using that by (intro has_integral_add has_integral_negligible) (auto intro!: \<open>negligible S\<close>)
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2309
    then show ?thesis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2310
      by auto
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2311
  qed
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2312
  show ?thesis
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2313
    using fint gf
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2314
    apply (subst has_integral_alt)
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2315
    apply (subst (asm) has_integral_alt)
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2316
    apply (simp split: if_split_asm)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2317
     apply (blast dest: *)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2318
      apply (erule_tac V = "\<forall>a b. T \<noteq> cbox a b" in thin_rl)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2319
    apply (elim all_forward imp_forward ex_forward all_forward conj_forward asm_rl)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2320
     apply (auto dest!: *[where f="\<lambda>x. if x\<in>T then f x else 0" and g="\<lambda>x. if x \<in> T then g x else 0"])
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2321
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2322
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2323
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2324
lemma has_integral_spike_eq:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2325
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2326
    and gf: "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2327
  shows "(f has_integral y) T \<longleftrightarrow> (g has_integral y) T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2328
    using has_integral_spike [OF \<open>negligible S\<close>] gf
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2329
    by metis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2330
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2331
lemma integrable_spike:
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2332
  assumes "f integrable_on T" "negligible S" "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2333
    shows "g integrable_on T"
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2334
  using assms unfolding integrable_on_def by (blast intro: has_integral_spike)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2335
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2336
lemma integral_spike:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2337
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2338
    and "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2339
  shows "integral T f = integral T g"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2340
  using has_integral_spike_eq[OF assms]
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2341
    by (auto simp: integral_def integrable_on_def)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2342
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2343
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2344
subsection \<open>Some other trivialities about negligible sets\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2345
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2346
lemma negligible_subset:
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2347
  assumes "negligible s" "t \<subseteq> s"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2348
  shows "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2349
  unfolding negligible_def
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2350
    by (metis (no_types) Diff_iff assms contra_subsetD has_integral_negligible indicator_simps(2))
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2351
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2352
lemma negligible_diff[intro?]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2353
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2354
  shows "negligible (s - t)"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2355
  using assms by (meson Diff_subset negligible_subset)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2356
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2357
lemma negligible_Int:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2358
  assumes "negligible s \<or> negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2359
  shows "negligible (s \<inter> t)"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2360
  using assms negligible_subset by force
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2361
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2362
lemma negligible_Un:
67970
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2363
  assumes "negligible S" and T: "negligible T"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2364
  shows "negligible (S \<union> T)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2365
proof -
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2366
  have "(indicat_real (S \<union> T) has_integral 0) (cbox a b)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2367
    if S0: "(indicat_real S has_integral 0) (cbox a b)" 
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2368
      and  "(indicat_real T has_integral 0) (cbox a b)" for a b
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2369
  proof (subst has_integral_spike_eq[OF T])
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2370
    show "indicat_real S x = indicat_real (S \<union> T) x" if "x \<in> cbox a b - T" for x
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2371
      by (metis Diff_iff Un_iff indicator_def that)
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2372
    show "(indicat_real S has_integral 0) (cbox a b)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2373
      by (simp add: S0)
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2374
  qed
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2375
  with assms show ?thesis
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  2376
    unfolding negligible_def by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2377
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2378
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2379
lemma negligible_Un_eq[simp]: "negligible (s \<union> t) \<longleftrightarrow> negligible s \<and> negligible t"
63956
b235e845c8e8 HOL-Analysis: add cover lemma ported by L. C. Paulson
hoelzl
parents: 63945
diff changeset
  2380
  using negligible_Un negligible_subset by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2381
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2382
lemma negligible_sing[intro]: "negligible {a::'a::euclidean_space}"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2383
  using negligible_standard_hyperplane[OF SOME_Basis, of "a \<bullet> (SOME i. i \<in> Basis)"] negligible_subset by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2384
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2385
lemma negligible_insert[simp]: "negligible (insert a s) \<longleftrightarrow> negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2386
  apply (subst insert_is_Un)
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2387
  unfolding negligible_Un_eq
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2388
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2389
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2390
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2391
lemma negligible_empty[iff]: "negligible {}"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2392
  using negligible_insert by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2393
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2394
text\<open>Useful in this form for backchaining\<close>
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2395
lemma empty_imp_negligible: "S = {} \<Longrightarrow> negligible S"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2396
  by simp
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2397
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2398
lemma negligible_finite[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2399
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2400
  shows "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2401
  using assms by (induct s) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2402
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  2403
lemma negligible_Union[intro]:
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  2404
  assumes "finite \<T>"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  2405
    and "\<And>t. t \<in> \<T> \<Longrightarrow> negligible t"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  2406
  shows "negligible(\<Union>\<T>)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2407
  using assms by induct auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2408
67984
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2409
lemma negligible: "negligible S \<longleftrightarrow> (\<forall>T. (indicat_real S has_integral 0) T)"
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2410
proof (intro iffI allI)
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2411
  fix T
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2412
  assume "negligible S"
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2413
  then show "(indicator S has_integral 0) T"
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2414
    by (meson Diff_iff has_integral_negligible indicator_simps(2))
adc1a992c470 a few more results
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  2415
qed (simp add: negligible_def)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2416
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2417
subsection \<open>Finite case of the spike theorem is quite commonly needed\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2418
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2419
lemma has_integral_spike_finite:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2420
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2421
    and "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2422
    and "(f has_integral y) T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2423
  shows "(g has_integral y) T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2424
  using assms has_integral_spike negligible_finite by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2425
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2426
lemma has_integral_spike_finite_eq:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2427
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2428
    and "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2429
  shows "((f has_integral y) T \<longleftrightarrow> (g has_integral y) T)"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2430
  by (metis assms has_integral_spike_finite)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2431
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2432
lemma integrable_spike_finite:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2433
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2434
    and "\<And>x. x \<in> T - S \<Longrightarrow> g x = f x"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2435
    and "f integrable_on T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2436
  shows "g integrable_on T"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2437
  using assms has_integral_spike_finite by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2438
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2439
lemma has_integral_bound_spike_finite:
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2440
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2441
  assumes "0 \<le> B" "finite S"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2442
      and f: "(f has_integral i) (cbox a b)"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2443
      and leB: "\<And>x. x \<in> cbox a b - S \<Longrightarrow> norm (f x) \<le> B"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2444
    shows "norm i \<le> B * content (cbox a b)"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2445
proof -
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2446
  define g where "g \<equiv> (\<lambda>x. if x \<in> S then 0 else f x)"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2447
  then have "\<And>x. x \<in> cbox a b - S \<Longrightarrow> norm (g x) \<le> B"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2448
    using leB by simp
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2449
  moreover have "(g has_integral i) (cbox a b)"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2450
    using has_integral_spike_finite [OF \<open>finite S\<close> _ f]
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2451
    by (simp add: g_def)
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2452
  ultimately show ?thesis
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2453
    by (simp add: \<open>0 \<le> B\<close> g_def has_integral_bound)
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2454
qed
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2455
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2456
corollary has_integral_bound_real:
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2457
  fixes f :: "real \<Rightarrow> 'b::real_normed_vector"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2458
  assumes "0 \<le> B" "finite S"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2459
      and "(f has_integral i) {a..b}"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2460
      and "\<And>x. x \<in> {a..b} - S \<Longrightarrow> norm (f x) \<le> B"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2461
    shows "norm i \<le> B * content {a..b}"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2462
  by (metis assms box_real(2) has_integral_bound_spike_finite)
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  2463
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2464
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2465
subsection \<open>In particular, the boundary of an interval is negligible\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2466
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2467
lemma negligible_frontier_interval: "negligible(cbox (a::'a::euclidean_space) b - box a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2468
proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2469
  let ?A = "\<Union>((\<lambda>k. {x. x\<bullet>k = a\<bullet>k} \<union> {x::'a. x\<bullet>k = b\<bullet>k}) ` Basis)"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2470
  have "negligible ?A"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2471
    by (force simp add: negligible_Union[OF finite_imageI])
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2472
  moreover have "cbox a b - box a b \<subseteq> ?A"
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2473
    by (force simp add: mem_box)
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2474
  ultimately show ?thesis
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2475
    by (rule negligible_subset)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2476
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2477
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2478
lemma has_integral_spike_interior:
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2479
  assumes f: "(f has_integral y) (cbox a b)" and gf: "\<And>x. x \<in> box a b \<Longrightarrow> g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2480
  shows "(g has_integral y) (cbox a b)"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2481
  apply (rule has_integral_spike[OF negligible_frontier_interval _ f])
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2482
  using gf by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2483
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2484
lemma has_integral_spike_interior_eq:
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2485
  assumes "\<And>x. x \<in> box a b \<Longrightarrow> g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2486
  shows "(f has_integral y) (cbox a b) \<longleftrightarrow> (g has_integral y) (cbox a b)"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2487
  by (metis assms has_integral_spike_interior)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2488
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2489
lemma integrable_spike_interior:
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2490
  assumes "\<And>x. x \<in> box a b \<Longrightarrow> g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2491
    and "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2492
  shows "g integrable_on cbox a b"
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  2493
  using assms has_integral_spike_interior_eq by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2494
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2495
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2496
subsection \<open>Integrability of continuous functions\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2497
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2498
lemma operative_approximableI:
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2499
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2500
  assumes "0 \<le> e"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2501
  shows "operative conj True (\<lambda>i. \<exists>g. (\<forall>x\<in>i. norm (f x - g (x::'b)) \<le> e) \<and> g integrable_on i)"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2502
proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2503
  interpret comm_monoid conj True
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2504
    by standard auto
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2505
  show ?thesis
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2506
  proof (standard, safe)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2507
    fix a b :: 'b
66365
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2508
    show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2509
      if "box a b = {}" for a b
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2510
      apply (rule_tac x=f in exI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2511
      using assms that by (auto simp: content_eq_0_interior)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2512
    {
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2513
      fix c g and k :: 'b
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2514
      assume fg: "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e" and g: "g integrable_on cbox a b"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2515
      assume k: "k \<in> Basis"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2516
      show "\<exists>g. (\<forall>x\<in>cbox a b \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2517
           "\<exists>g. (\<forall>x\<in>cbox a b \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2518
         apply (rule_tac[!] x=g in exI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2519
        using fg integrable_split[OF g k] by auto
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2520
    }
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2521
    show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2522
      if fg1: "\<forall>x\<in>cbox a b \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g1 x) \<le> e" 
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2523
        and g1: "g1 integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2524
        and fg2: "\<forall>x\<in>cbox a b \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g2 x) \<le> e" 
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2525
        and g2: "g2 integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}" 
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2526
        and k: "k \<in> Basis"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2527
      for c k g1 g2
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2528
    proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2529
      let ?g = "\<lambda>x. if x\<bullet>k = c then f x else if x\<bullet>k \<le> c then g1 x else g2 x"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2530
      show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2531
      proof (intro exI conjI ballI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2532
        show "norm (f x - ?g x) \<le> e" if "x \<in> cbox a b" for x
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2533
          by (auto simp: that assms fg1 fg2)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2534
        show "?g integrable_on cbox a b"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2535
        proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2536
          have "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}" "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<ge> c}"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  2537
            by(rule integrable_spike[OF _ negligible_standard_hyperplane[of k c]], use k g1 g2 in auto)+
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2538
          with has_integral_split[OF _ _ k] show ?thesis
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2539
            unfolding integrable_on_def by blast
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2540
        qed
66365
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2541
      qed
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2542
    qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2543
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2544
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2545
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  2546
lemma comm_monoid_set_F_and: "comm_monoid_set.F (\<and>) True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))"
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2547
proof -
71938
e1b262e7480c interpretations for boolean operators
haftmann
parents: 71633
diff changeset
  2548
  interpret bool: comm_monoid_set \<open>(\<and>)\<close> True ..
63593
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2549
  show ?thesis
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2550
    by (induction s rule: infinite_finite_induct) auto
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2551
qed
bbcb05504fdc HOL-Multivariate_Analysis: replace neutral, monoidal, and iterate by the comm_monoid_set versions. Changed operative to comm_monoid_set. Renamed support_on to support and changed to comm_monoid_add.
hoelzl
parents: 63540
diff changeset
  2552
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2553
lemma approximable_on_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2554
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2555
  assumes "0 \<le> e"
66365
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2556
    and d: "d division_of (cbox a b)"
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2557
    and f: "\<forall>i\<in>d. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2558
  obtains g where "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e" "g integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2559
proof -
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2560
  interpret operative conj True "\<lambda>i. \<exists>g. (\<forall>x\<in>i. norm (f x - g (x::'b)) \<le> e) \<and> g integrable_on i"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2561
    using \<open>0 \<le> e\<close> by (rule operative_approximableI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  2562
  from f local.division [OF d] that show thesis
66365
d77a4ab4fe59 more Henstock_Kurzweil_Integration cleanup
paulson <lp15@cam.ac.uk>
parents: 66359
diff changeset
  2563
    by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2564
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2565
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2566
lemma integrable_continuous:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2567
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2568
  assumes "continuous_on (cbox a b) f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2569
  shows "f integrable_on cbox a b"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2570
proof (rule integrable_uniform_limit)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2571
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2572
  assume e: "e > 0"
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2573
  then obtain d where "0 < d" and d: "\<And>x x'. \<lbrakk>x \<in> cbox a b; x' \<in> cbox a b; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2574
    using compact_uniformly_continuous[OF assms compact_cbox] unfolding uniformly_continuous_on_def by metis
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2575
  obtain p where ptag: "p tagged_division_of cbox a b" and finep: "(\<lambda>x. ball x d) fine p"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2576
    using fine_division_exists[OF gauge_ball[OF \<open>0 < d\<close>], of a b] .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2577
  have *: "\<forall>i\<in>snd ` p. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2578
  proof (safe, unfold snd_conv)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2579
    fix x l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2580
    assume as: "(x, l) \<in> p"
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2581
    obtain a b where l: "l = cbox a b"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2582
      using as ptag by blast
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2583
    then have x: "x \<in> cbox a b"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2584
      using as ptag by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2585
    show "\<exists>g. (\<forall>x\<in>l. norm (f x - g x) \<le> e) \<and> g integrable_on l"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2586
      apply (rule_tac x="\<lambda>y. f x" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2587
    proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2588
      show "(\<lambda>y. f x) integrable_on l"
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2589
        unfolding integrable_on_def l by blast
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2590
    next
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2591
      fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2592
      assume y: "y \<in> l"
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2593
      then have "y \<in> ball x d"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2594
        using as finep by fastforce
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2595
      then show "norm (f y - f x) \<le> e"
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2596
        using d x y as l
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2597
        by (metis dist_commute dist_norm less_imp_le mem_ball ptag subsetCE tagged_division_ofD(3))
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2598
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2599
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2600
  from e have "e \<ge> 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2601
    by auto
65578
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2602
  from approximable_on_division[OF this division_of_tagged_division[OF ptag] *]
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2603
  show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
e4997c181cce New material from PNT proof, as well as more default [simp] declarations. Also removed duplicate theorems about geometric series
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2604
    by metis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2605
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2606
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2607
lemma integrable_continuous_interval:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2608
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2609
  assumes "continuous_on {a..b} f"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2610
  shows "f integrable_on {a..b}"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2611
  by (metis assms integrable_continuous interval_cbox)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2612
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2613
lemmas integrable_continuous_real = integrable_continuous_interval[where 'b=real]
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2614
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2615
lemma integrable_continuous_closed_segment:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2616
  fixes f :: "real \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2617
  assumes "continuous_on (closed_segment a b) f"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2618
  shows "f integrable_on (closed_segment a b)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2619
  using assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2620
  by (auto intro!: integrable_continuous_interval simp: closed_segment_eq_real_ivl)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2621
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2622
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2623
subsection \<open>Specialization of additivity to one dimension\<close>
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2624
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2625
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2626
subsection \<open>A useful lemma allowing us to factor out the content size\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2627
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2628
lemma has_integral_factor_content:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2629
  "(f has_integral i) (cbox a b) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2630
    (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2631
      norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content (cbox a b)))"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2632
proof (cases "content (cbox a b) = 0")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2633
  case True
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2634
  have "\<And>e p. p tagged_division_of cbox a b \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)) \<le> e * content (cbox a b)"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2635
    unfolding sum_content_null[OF True] True by force
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2636
  moreover have "i = 0" 
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2637
    if "\<And>e. e > 0 \<Longrightarrow> \<exists>d. gauge d \<and>
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2638
              (\<forall>p. p tagged_division_of cbox a b \<and>
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2639
                   d fine p \<longrightarrow>
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2640
                   norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<le> e * content (cbox a b))"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2641
    using that [of 1]
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2642
    by (force simp add: True sum_content_null[OF True] intro: fine_division_exists[of _ a b])
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2643
  ultimately show ?thesis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2644
    unfolding has_integral_null_eq[OF True]
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2645
    by (force simp add: )
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2646
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2647
  case False
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2648
  then have F: "0 < content (cbox a b)"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2649
    using zero_less_measure_iff by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2650
  let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2651
    (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> opp (norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i)) e)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2652
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2653
    apply (subst has_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2654
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2655
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2656
    assume e: "e > 0"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2657
    { assume "\<forall>e>0. ?P e (<)"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  2658
      then show "?P (e * content (cbox a b)) (\<le>)"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2659
        apply (rule allE [where x="e * content (cbox a b)"])
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2660
        apply (elim impE ex_forward conj_forward)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2661
        using F e apply (auto simp add: algebra_simps)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2662
        done }
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2663
    { assume "\<forall>e>0. ?P (e * content (cbox a b)) (\<le>)"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  2664
      then show "?P e (<)"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2665
        apply (rule allE [where x="e/2 / content (cbox a b)"])
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2666
        apply (elim impE ex_forward conj_forward)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2667
        using F e apply (auto simp add: algebra_simps)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  2668
        done }
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2669
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2670
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2671
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2672
lemma has_integral_factor_content_real:
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2673
  "(f has_integral i) {a..b::real} \<longleftrightarrow>
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2674
    (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b}  \<and> d fine p \<longrightarrow>
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2675
      norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content {a..b} ))"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2676
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2677
  by (rule has_integral_factor_content)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2678
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2679
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2680
subsection \<open>Fundamental theorem of calculus\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2681
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2682
lemma interval_bounds_real:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2683
  fixes q b :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2684
  assumes "a \<le> b"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2685
  shows "Sup {a..b} = b"
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2686
    and "Inf {a..b} = a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2687
  using assms by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2688
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2689
theorem fundamental_theorem_of_calculus:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2690
  fixes f :: "real \<Rightarrow> 'a::banach"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2691
  assumes "a \<le> b" 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2692
      and vecd: "\<And>x. x \<in> {a..b} \<Longrightarrow> (f has_vector_derivative f' x) (at x within {a..b})"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2693
  shows "(f' has_integral (f b - f a)) {a..b}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2694
  unfolding has_integral_factor_content box_real[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2695
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2696
  fix e :: real
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2697
  assume "e > 0"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2698
  then have "\<forall>x. \<exists>d>0. x \<in> {a..b} \<longrightarrow>
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2699
         (\<forall>y\<in>{a..b}. norm (y-x) < d \<longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e * norm (y-x))"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2700
    using vecd[unfolded has_vector_derivative_def has_derivative_within_alt] by blast
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2701
  then obtain d where d: "\<And>x. 0 < d x"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  2702
                 "\<And>x y. \<lbrakk>x \<in> {a..b}; y \<in> {a..b}; norm (y-x) < d x\<rbrakk>
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  2703
                        \<Longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e * norm (y-x)"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2704
    by metis  
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2705
  show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2706
    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b))"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2707
  proof (rule exI, safe)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2708
    show "gauge (\<lambda>x. ball x (d x))"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2709
      using d(1) gauge_ball_dependent by blast
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2710
  next
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2711
    fix p
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2712
    assume ptag: "p tagged_division_of cbox a b" and finep: "(\<lambda>x. ball x (d x)) fine p"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2713
    have ba: "b - a = (\<Sum>(x,K)\<in>p. Sup K - Inf K)" "f b - f a = (\<Sum>(x,K)\<in>p. f(Sup K) - f(Inf K))"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2714
      using additive_tagged_division_1[where f= "\<lambda>x. x"] additive_tagged_division_1[where f= f]
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2715
            \<open>a \<le> b\<close> ptag by auto
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2716
    have "norm (\<Sum>(x, K) \<in> p. (content K *\<^sub>R f' x) - (f (Sup K) - f (Inf K)))
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2717
          \<le> (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2718
    proof (rule sum_norm_le,safe)
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2719
      fix x K
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2720
      assume "(x, K) \<in> p"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2721
      then have "x \<in> K" and kab: "K \<subseteq> cbox a b"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2722
        using ptag by blast+
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2723
      then obtain u v where k: "K = cbox u v" and "x \<in> K" and kab: "K \<subseteq> cbox a b"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2724
        using ptag \<open>(x, K) \<in> p\<close> by auto 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2725
      have "u \<le> v"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2726
        using \<open>x \<in> K\<close> unfolding k by auto
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2727
      have ball: "\<forall>y\<in>K. y \<in> ball x (d x)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2728
        using finep \<open>(x, K) \<in> p\<close> by blast
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2729
      have "u \<in> K" "v \<in> K"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2730
        by (simp_all add: \<open>u \<le> v\<close> k)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2731
      have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) = norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x))"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2732
        by (auto simp add: algebra_simps)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2733
      also have "... \<le> norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2734
        by (rule norm_triangle_ineq4)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2735
      finally have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) \<le>
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2736
        norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)" .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2737
      also have "\<dots> \<le> e * norm (u - x) + e * norm (v - x)"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2738
      proof (rule add_mono)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2739
        show "norm (f u - f x - (u - x) *\<^sub>R f' x) \<le> e * norm (u - x)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2740
          apply (rule d(2)[of x u])
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2741
          using \<open>x \<in> K\<close> kab \<open>u \<in> K\<close> ball dist_real_def by (auto simp add:dist_real_def)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2742
        show "norm (f v - f x - (v - x) *\<^sub>R f' x) \<le> e * norm (v - x)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2743
          apply (rule d(2)[of x v])
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2744
          using \<open>x \<in> K\<close> kab \<open>v \<in> K\<close> ball dist_real_def by (auto simp add:dist_real_def)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2745
      qed
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2746
      also have "\<dots> \<le> e * (Sup K - Inf K)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2747
        using \<open>x \<in> K\<close> by (auto simp: k interval_bounds_real[OF \<open>u \<le> v\<close>] field_simps)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2748
      finally show "norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (Sup K - Inf K)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2749
        using \<open>u \<le> v\<close> by (simp add: k)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2750
    qed
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2751
    with \<open>a \<le> b\<close> show "norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2752
      by (auto simp: ba split_def sum_subtractf [symmetric] sum_distrib_left)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2753
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2754
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2755
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2756
lemma ident_has_integral:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2757
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2758
  assumes "a \<le> b"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2759
  shows "((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2)/2) {a..b}"
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2760
proof -
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2761
  have "((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  2762
    apply (rule fundamental_theorem_of_calculus [OF assms])
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2763
    unfolding power2_eq_square
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2764
    by (rule derivative_eq_intros | simp)+
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2765
  then show ?thesis
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2766
    by (simp add: field_simps)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2767
qed
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2768
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2769
lemma integral_ident [simp]:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2770
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2771
  assumes "a \<le> b"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2772
  shows "integral {a..b} (\<lambda>x. x) = (if a \<le> b then (b\<^sup>2 - a\<^sup>2)/2 else 0)"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2773
  by (metis assms ident_has_integral integral_unique)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2774
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2775
lemma ident_integrable_on:
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2776
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2777
  shows "(\<lambda>x. x) integrable_on {a..b}"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2778
by (metis atLeastatMost_empty_iff integrable_on_def has_integral_empty ident_has_integral)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2779
70688
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2780
lemma integral_sin [simp]:
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2781
  fixes a::real
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2782
  assumes "a \<le> b" shows "integral {a..b} sin = cos a - cos b"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2783
proof -
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2784
  have "(sin has_integral (- cos b - - cos a)) {a..b}"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2785
  proof (rule fundamental_theorem_of_calculus)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2786
    show "((\<lambda>a. - cos a) has_vector_derivative sin x) (at x within {a..b})" for x
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2787
      unfolding has_field_derivative_iff_has_vector_derivative [symmetric]
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2788
      by (rule derivative_eq_intros | force)+
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2789
  qed (use assms in auto)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2790
  then show ?thesis
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2791
    by (simp add: integral_unique)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2792
qed
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2793
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2794
lemma integral_cos [simp]:
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2795
  fixes a::real
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2796
  assumes "a \<le> b" shows "integral {a..b} cos = sin b - sin a"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2797
proof -
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2798
  have "(cos has_integral (sin b - sin a)) {a..b}"
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2799
  proof (rule fundamental_theorem_of_calculus)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2800
    show "(sin has_vector_derivative cos x) (at x within {a..b})" for x
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2801
      unfolding has_field_derivative_iff_has_vector_derivative [symmetric]
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2802
      by (rule derivative_eq_intros | force)+
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2803
  qed (use assms in auto)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2804
  then show ?thesis
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2805
    by (simp add: integral_unique)
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2806
qed
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  2807
70760
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2808
lemma has_integral_sin_nx: "((\<lambda>x. sin(real_of_int n * x)) has_integral 0) {-pi..pi}"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2809
proof (cases "n = 0")
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2810
  case False
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2811
  have "((\<lambda>x. sin (n * x)) has_integral (- cos (n * pi)/n - - cos (n * - pi)/n)) {-pi..pi}"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2812
  proof (rule fundamental_theorem_of_calculus)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2813
    show "((\<lambda>x. - cos (n * x) / n) has_vector_derivative sin (n * a)) (at a within {-pi..pi})"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2814
      if "a \<in> {-pi..pi}" for a :: real
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2815
      using that False
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2816
      apply (simp only: has_vector_derivative_def)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2817
      apply (rule derivative_eq_intros | force)+
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2818
      done
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2819
  qed auto
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2820
  then show ?thesis
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2821
    by simp
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2822
qed auto
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2823
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2824
lemma integral_sin_nx:
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2825
   "integral {-pi..pi} (\<lambda>x. sin(x * real_of_int n)) = 0"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2826
  using has_integral_sin_nx [of n] by (force simp: mult.commute)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2827
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2828
lemma has_integral_cos_nx:
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2829
  "((\<lambda>x. cos(real_of_int n * x)) has_integral (if n = 0 then 2 * pi else 0)) {-pi..pi}"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2830
proof (cases "n = 0")
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2831
  case True
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2832
  then show ?thesis
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2833
    using has_integral_const_real [of "1::real" "-pi" pi] by auto
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2834
next
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2835
  case False
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2836
  have "((\<lambda>x. cos (n * x)) has_integral (sin (n * pi)/n - sin (n * - pi)/n)) {-pi..pi}"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2837
  proof (rule fundamental_theorem_of_calculus)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2838
    show "((\<lambda>x. sin (n * x) / n) has_vector_derivative cos (n * x)) (at x within {-pi..pi})"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2839
      if "x \<in> {-pi..pi}"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2840
      for x :: real
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2841
      using that False
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2842
      apply (simp only: has_vector_derivative_def)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2843
      apply (rule derivative_eq_intros | force)+
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2844
      done
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2845
  qed auto
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2846
  with False show ?thesis
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2847
    by (simp add: mult.commute)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2848
qed
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2849
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2850
lemma integral_cos_nx:
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2851
   "integral {-pi..pi} (\<lambda>x. cos(x * real_of_int n)) = (if n = 0 then 2 * pi else 0)"
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2852
  using has_integral_cos_nx [of n] by (force simp: mult.commute)
ffbe7784cc85 A little more material from the Fourier AFP entry, and the correction of two very slow proof lines
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
  2853
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2854
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2855
subsection \<open>Taylor series expansion\<close>
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2856
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2857
lemma mvt_integral:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2858
  fixes f::"'a::real_normed_vector\<Rightarrow>'b::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2859
  assumes f'[derivative_intros]:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2860
    "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2861
  assumes line_in: "\<And>t. t \<in> {0..1} \<Longrightarrow> x + t *\<^sub>R y \<in> S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2862
  shows "f (x + y) - f x = integral {0..1} (\<lambda>t. f' (x + t *\<^sub>R y) y)" (is ?th1)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2863
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2864
  from assms have subset: "(\<lambda>xa. x + xa *\<^sub>R y) ` {0..1} \<subseteq> S" by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2865
  note [derivative_intros] =
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2866
    has_derivative_subset[OF _ subset]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2867
    has_derivative_in_compose[where f="(\<lambda>xa. x + xa *\<^sub>R y)" and g = f]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2868
  note [continuous_intros] =
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2869
    continuous_on_compose2[where f="(\<lambda>xa. x + xa *\<^sub>R y)"]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2870
    continuous_on_subset[OF _ subset]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2871
  have "\<And>t. t \<in> {0..1} \<Longrightarrow>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2872
    ((\<lambda>t. f (x + t *\<^sub>R y)) has_vector_derivative f' (x + t *\<^sub>R y) y)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2873
    (at t within {0..1})"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2874
    using assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2875
    by (auto simp: has_vector_derivative_def
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2876
        linear_cmul[OF has_derivative_linear[OF f'], symmetric]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2877
      intro!: derivative_eq_intros)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2878
  from fundamental_theorem_of_calculus[rule_format, OF _ this]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2879
  show ?th1
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2880
    by (auto intro!: integral_unique[symmetric])
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2881
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  2882
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2883
lemma (in bounded_bilinear) sum_prod_derivatives_has_vector_derivative:
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2884
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2885
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2886
  and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2887
    (Df m has_vector_derivative Df (Suc m) t) (at t within {a..b})"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2888
  and g0: "Dg 0 = g"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2889
  and Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2890
    (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a..b})"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2891
  and ivl: "a \<le> t" "t \<le> b"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2892
  shows "((\<lambda>t. \<Sum>i<p. (-1)^i *\<^sub>R prod (Df i t) (Dg (p - Suc i) t))
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2893
    has_vector_derivative
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2894
      prod (f t) (Dg p t) - (-1)^p *\<^sub>R prod (Df p t) (g t))
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2895
    (at t within {a..b})"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2896
  using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2897
proof cases
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2898
  assume p: "p \<noteq> 1"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2899
  define p' where "p' = p - 2"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2900
  from assms p have p': "{..<p} = {..Suc p'}" "p = Suc (Suc p')"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2901
    by (auto simp: p'_def)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2902
  have *: "\<And>i. i \<le> p' \<Longrightarrow> Suc (Suc p' - i) = (Suc (Suc p') - i)"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2903
    by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2904
  let ?f = "\<lambda>i. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg ((p - i)) t))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2905
  have "(\<Sum>i<p. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg (Suc (p - Suc i)) t) +
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2906
    prod (Df (Suc i) t) (Dg (p - Suc i) t))) =
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2907
    (\<Sum>i\<le>(Suc p'). ?f i - ?f (Suc i))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2908
    by (auto simp: algebra_simps p'(2) numeral_2_eq_2 * lessThan_Suc_atMost)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2909
  also note sum_telescope
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2910
  finally
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2911
  have "(\<Sum>i<p. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg (Suc (p - Suc i)) t) +
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2912
    prod (Df (Suc i) t) (Dg (p - Suc i) t)))
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2913
    = prod (f t) (Dg p t) - (- 1) ^ p *\<^sub>R prod (Df p t) (g t)"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2914
    unfolding p'[symmetric]
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2915
    by (simp add: assms)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2916
  thus ?thesis
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2917
    using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2918
    by (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2919
qed (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2920
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2921
lemma
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2922
  fixes f::"real\<Rightarrow>'a::banach"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2923
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2924
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2925
  and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2926
    (Df m has_vector_derivative Df (Suc m) t) (at t within {a..b})"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2927
  and ivl: "a \<le> b"
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2928
  defines "i \<equiv> \<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69517
diff changeset
  2929
  shows Taylor_has_integral:
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2930
    "(i has_integral f b - (\<Sum>i<p. ((b-a) ^ i / fact i) *\<^sub>R Df i a)) {a..b}"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69517
diff changeset
  2931
  and Taylor_integral:
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2932
    "f b = (\<Sum>i<p. ((b-a) ^ i / fact i) *\<^sub>R Df i a) + integral {a..b} i"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69517
diff changeset
  2933
  and Taylor_integrable:
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2934
    "i integrable_on {a..b}"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2935
proof goal_cases
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2936
  case 1
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2937
  interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2938
    by (rule bounded_bilinear_scaleR)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2939
  define g where "g s = (b - s)^(p - 1)/fact (p - 1)" for s
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2940
  define Dg where [abs_def]:
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2941
    "Dg n s = (if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0)" for n s
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2942
  have g0: "Dg 0 = g"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2943
    using \<open>p > 0\<close>
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  2944
    by (auto simp add: Dg_def field_split_simps g_def split: if_split_asm)
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2945
  {
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2946
    fix m
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2947
    assume "p > Suc m"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2948
    hence "p - Suc m = Suc (p - Suc (Suc m))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2949
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2950
    hence "real (p - Suc m) * fact (p - Suc (Suc m)) = fact (p - Suc m)"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2951
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2952
  } note fact_eq = this
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2953
  have Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2954
    (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a..b})"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2955
    unfolding Dg_def
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  2956
    by (auto intro!: derivative_eq_intros simp: has_vector_derivative_def fact_eq field_split_simps)
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2957
  let ?sum = "\<lambda>t. \<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i t *\<^sub>R Df (p - Suc i) t"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2958
  from sum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df,
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2959
      OF \<open>p > 0\<close> g0 Dg f0 Df]
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2960
  have deriv: "\<And>t. a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2961
    (?sum has_vector_derivative
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2962
      g t *\<^sub>R Df p t - (- 1) ^ p *\<^sub>R Dg p t *\<^sub>R f t) (at t within {a..b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2963
    by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2964
  from fundamental_theorem_of_calculus[rule_format, OF \<open>a \<le> b\<close> deriv]
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  2965
  have "(i has_integral ?sum b - ?sum a) {a..b}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  2966
    using atLeastatMost_empty'[simp del]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2967
    by (simp add: i_def g_def Dg_def)
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2968
  also
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2969
  have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2970
    and "{..<p} \<inter> {i. p = Suc i} = {p - 1}"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2971
    for p'
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  2972
    using \<open>p > 0\<close>
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2973
    by (auto simp: power_mult_distrib[symmetric])
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2974
  then have "?sum b = f b"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  2975
    using Suc_pred'[OF \<open>p > 0\<close>]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2976
    by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67998
diff changeset
  2977
        if_distribR sum.If_cases f0)
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2978
  also
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2979
  have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2980
  proof safe
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2981
    fix x
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2982
    assume "x < p"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2983
    thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2984
      by (auto intro!: image_eqI[where x = "p - x - 1"])
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2985
  qed simp
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2986
  from _ this
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  2987
  have "?sum a = (\<Sum>i<p. ((b-a) ^ i / fact i) *\<^sub>R Df i a)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2988
    by (rule sum.reindex_cong) (auto simp add: inj_on_def Dg_def one)
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2989
  finally show c: ?case .
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2990
  case 2 show ?case using c integral_unique
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2991
    by (metis (lifting) add.commute diff_eq_eq integral_unique)
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2992
  case 3 show ?case using c by force
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2993
qed
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2994
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2995
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  2996
subsection \<open>Only need trivial subintervals if the interval itself is trivial\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2997
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  2998
proposition division_of_nontrivial:
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  2999
  fixes \<D> :: "'a::euclidean_space set set"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3000
  assumes sdiv: "\<D> division_of (cbox a b)"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3001
     and cont0: "content (cbox a b) \<noteq> 0"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3002
  shows "{k. k \<in> \<D> \<and> content k \<noteq> 0} division_of (cbox a b)"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3003
  using sdiv
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3004
proof (induction "card \<D>" arbitrary: \<D> rule: less_induct)
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3005
  case less
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3006
  note \<D> = division_ofD[OF less.prems]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3007
  {
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3008
    presume *: "{k \<in> \<D>. content k \<noteq> 0} \<noteq> \<D> \<Longrightarrow> ?case"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3009
    then show ?case
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3010
      using less.prems by fastforce
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3011
  }
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3012
  assume noteq: "{k \<in> \<D>. content k \<noteq> 0} \<noteq> \<D>"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3013
  then obtain K c d where "K \<in> \<D>" and contk: "content K = 0" and keq: "K = cbox c d"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3014
    using \<D>(4) by blast 
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3015
  then have "card \<D> > 0"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3016
    unfolding card_gt_0_iff using less by auto
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3017
  then have card: "card (\<D> - {K}) < card \<D>"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3018
    using less \<open>K \<in> \<D>\<close> by (simp add: \<D>(1))
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3019
  have closed: "closed (\<Union>(\<D> - {K}))"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3020
    using less.prems by auto
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3021
  have "x islimpt \<Union>(\<D> - {K})" if "x \<in> K" for x 
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3022
    unfolding islimpt_approachable
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3023
  proof (intro allI impI)
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3024
    fix e::real
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3025
    assume "e > 0"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3026
    obtain i where i: "c\<bullet>i = d\<bullet>i" "i\<in>Basis"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3027
      using contk \<D>(3) [OF \<open>K \<in> \<D>\<close>] unfolding box_ne_empty keq
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3028
      by (meson content_eq_0 dual_order.antisym)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3029
    then have xi: "x\<bullet>i = d\<bullet>i"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3030
      using \<open>x \<in> K\<close> unfolding keq mem_box by (metis antisym)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3031
    define y where "y = (\<Sum>j\<in>Basis. (if j = i then if c\<bullet>i \<le> (a\<bullet>i + b\<bullet>i)/2 then c\<bullet>i +
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3032
      min e (b\<bullet>i - c\<bullet>i)/2 else c\<bullet>i - min e (c\<bullet>i - a\<bullet>i)/2 else x\<bullet>j) *\<^sub>R j)"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3033
    show "\<exists>x'\<in>\<Union>(\<D> - {K}). x' \<noteq> x \<and> dist x' x < e"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3034
    proof (intro bexI conjI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3035
      have "d \<in> cbox c d"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3036
        using \<D>(3)[OF \<open>K \<in> \<D>\<close>] by (simp add: box_ne_empty(1) keq mem_box(2))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3037
      then have "d \<in> cbox a b"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3038
        using \<D>(2)[OF \<open>K \<in> \<D>\<close>] by (auto simp: keq)
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3039
      then have di: "a \<bullet> i \<le> d \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3040
        using \<open>i \<in> Basis\<close> mem_box(2) by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3041
      then have xyi: "y\<bullet>i \<noteq> x\<bullet>i"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3042
        unfolding y_def i xi using \<open>e > 0\<close> cont0 \<open>i \<in> Basis\<close>
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3043
        by (auto simp: content_eq_0 elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3044
      then show "y \<noteq> x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3045
        unfolding euclidean_eq_iff[where 'a='a] using i by auto
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3046
      have "norm (y-x) \<le> (\<Sum>b\<in>Basis. \<bar>(y - x) \<bullet> b\<bar>)"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3047
        by (rule norm_le_l1)
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3048
      also have "... = \<bar>(y - x) \<bullet> i\<bar> + (\<Sum>b \<in> Basis - {i}. \<bar>(y - x) \<bullet> b\<bar>)"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3049
        by (meson finite_Basis i(2) sum.remove)
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3050
      also have "... <  e + sum (\<lambda>i. 0) Basis"
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3051
      proof (rule add_less_le_mono)
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3052
        show "\<bar>(y-x) \<bullet> i\<bar> < e"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3053
          using di \<open>e > 0\<close> y_def i xi by (auto simp: inner_simps)
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3054
        show "(\<Sum>i\<in>Basis - {i}. \<bar>(y-x) \<bullet> i\<bar>) \<le> (\<Sum>i\<in>Basis. 0)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3055
          unfolding y_def by (auto simp: inner_simps)
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3056
      qed 
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3057
      finally have "norm (y-x) < e + sum (\<lambda>i. 0) Basis" .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3058
      then show "dist y x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3059
        unfolding dist_norm by auto
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3060
      have "y \<notin> K"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3061
        unfolding keq mem_box using i(1) i(2) xi xyi by fastforce
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3062
      moreover have "y \<in> \<Union>\<D>"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3063
        using subsetD[OF \<D>(2)[OF \<open>K \<in> \<D>\<close>] \<open>x \<in> K\<close>] \<open>e > 0\<close> di i
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3064
        by (auto simp: \<D> mem_box y_def field_simps elim!: ballE[of _ _ i])
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3065
      ultimately show "y \<in> \<Union>(\<D> - {K})" by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3066
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3067
  qed
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3068
  then have "K \<subseteq> \<Union>(\<D> - {K})"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3069
    using closed closed_limpt by blast
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3070
  then have "\<Union>(\<D> - {K}) = cbox a b"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3071
    unfolding \<D>(6)[symmetric] by auto
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3072
  then have "\<D> - {K} division_of cbox a b"
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3073
    by (metis Diff_subset less.prems division_of_subset \<D>(6))
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3074
  then have "{ka \<in> \<D> - {K}. content ka \<noteq> 0} division_of (cbox a b)"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3075
    using card less.hyps by blast
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3076
  moreover have "{ka \<in> \<D> - {K}. content ka \<noteq> 0} = {K \<in> \<D>. content K \<noteq> 0}"
66523
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3077
    using contk by auto
5a1a2ac950c2 division_of_nontrivial partial cleanup
paulson <lp15@cam.ac.uk>
parents: 66519
diff changeset
  3078
  ultimately show ?case by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3079
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3080
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3081
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3082
subsection \<open>Integrability on subintervals\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3083
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3084
lemma operative_integrableI:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3085
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3086
  assumes "0 \<le> e"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3087
  shows "operative conj True (\<lambda>i. f integrable_on i)"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3088
proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3089
  interpret comm_monoid conj True
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3090
    by standard auto
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3091
  have 1: "\<And>a b. box a b = {} \<Longrightarrow> f integrable_on cbox a b"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3092
    by (simp add: content_eq_0_interior integrable_on_null)
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3093
  have 2: "\<And>a b c k.
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3094
       \<lbrakk>k \<in> Basis;
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3095
        f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c};
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3096
        f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}\<rbrakk>
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3097
       \<Longrightarrow> f integrable_on cbox a b"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3098
    unfolding integrable_on_def by (auto intro!: has_integral_split)
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3099
  show ?thesis
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3100
    apply standard
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3101
    using 1 2 by blast+
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3102
qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3103
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3104
lemma integrable_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3105
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3106
  assumes f: "f integrable_on cbox a b"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3107
    and cd: "cbox c d \<subseteq> cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3108
  shows "f integrable_on cbox c d"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3109
proof -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3110
  interpret operative conj True "\<lambda>i. f integrable_on i"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3111
    using order_refl by (rule operative_integrableI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3112
  show ?thesis
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3113
  proof (cases "cbox c d = {}")
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3114
    case True
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3115
    then show ?thesis
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3116
      using division [symmetric] f by (auto simp: comm_monoid_set_F_and)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3117
  next
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3118
    case False
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3119
    then show ?thesis
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3120
      by (metis cd comm_monoid_set_F_and division division_of_finite f partial_division_extend_1)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  3121
  qed
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3122
qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3123
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3124
lemma integrable_subinterval_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3125
  fixes f :: "real \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3126
  assumes "f integrable_on {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3127
    and "{c..d} \<subseteq> {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3128
  shows "f integrable_on {c..d}"
66524
0d8dab1f6903 some tidying of division_of_nontrivial
paulson <lp15@cam.ac.uk>
parents: 66523
diff changeset
  3129
  by (metis assms box_real(2) integrable_subinterval)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3130
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3131
subsection \<open>Combining adjacent intervals in 1 dimension\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3132
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3133
lemma has_integral_combine:
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3134
  fixes a b c :: real and j :: "'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3135
  assumes "a \<le> c"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3136
      and "c \<le> b"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3137
      and ac: "(f has_integral i) {a..c}"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3138
      and cb: "(f has_integral j) {c..b}"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3139
  shows "(f has_integral (i + j)) {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3140
proof -
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3141
  interpret operative_real "lift_option plus" "Some 0"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3142
    "\<lambda>i. if f integrable_on i then Some (integral i f) else None"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3143
    using operative_integralI by (rule operative_realI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3144
  from \<open>a \<le> c\<close> \<open>c \<le> b\<close> ac cb coalesce_less_eq
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  3145
  have *: "lift_option (+)
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3146
             (if f integrable_on {a..c} then Some (integral {a..c} f) else None)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3147
             (if f integrable_on {c..b} then Some (integral {c..b} f) else None) =
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3148
            (if f integrable_on {a..b} then Some (integral {a..b} f) else None)"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3149
    by (auto simp: split: if_split_asm)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3150
  then have "f integrable_on cbox a b"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3151
    using ac cb by (auto split: if_split_asm)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3152
  with *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3153
  show ?thesis
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3154
    using ac cb by (auto simp add: integrable_on_def integral_unique split: if_split_asm)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3155
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3156
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3157
lemma integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3158
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3159
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3160
    and "c \<le> b"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3161
    and ab: "f integrable_on {a..b}"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3162
  shows "integral {a..c} f + integral {c..b} f = integral {a..b} f"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3163
proof -
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3164
  have "(f has_integral integral {a..c} f) {a..c}"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3165
    using ab \<open>c \<le> b\<close> integrable_subinterval_real by fastforce
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3166
  moreover
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3167
  have "(f has_integral integral {c..b} f) {c..b}"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3168
    using ab \<open>a \<le> c\<close> integrable_subinterval_real by fastforce
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3169
  ultimately have "(f has_integral integral {a..c} f + integral {c..b} f) {a..b}"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3170
    using \<open>a \<le> c\<close> \<open>c \<le> b\<close> has_integral_combine by blast
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3171
  then show ?thesis
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3172
    by (simp add: has_integral_integrable_integral)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3173
qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3174
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3175
lemma integrable_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3176
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3177
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3178
    and "c \<le> b"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3179
    and "f integrable_on {a..c}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3180
    and "f integrable_on {c..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3181
  shows "f integrable_on {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3182
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3183
  unfolding integrable_on_def
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  3184
  by (auto intro!: has_integral_combine)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3185
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3186
lemma integral_minus_sets:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3187
  fixes f::"real \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3188
  shows "c \<le> a \<Longrightarrow> c \<le> b \<Longrightarrow> f integrable_on {c .. max a b} \<Longrightarrow>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3189
    integral {c .. a} f - integral {c .. b} f =
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3190
    (if a \<le> b then - integral {a .. b} f else integral {b .. a} f)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3191
  using integral_combine[of c a b f]  integral_combine[of c b a f]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3192
  by (auto simp: algebra_simps max_def)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3193
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3194
lemma integral_minus_sets':
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3195
  fixes f::"real \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3196
  shows "c \<ge> a \<Longrightarrow> c \<ge> b \<Longrightarrow> f integrable_on {min a b .. c} \<Longrightarrow>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3197
    integral {a .. c} f - integral {b .. c} f =
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3198
    (if a \<le> b then integral {a .. b} f else - integral {b .. a} f)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3199
  using integral_combine[of b a c f] integral_combine[of a b c f]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3200
  by (auto simp: algebra_simps min_def)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3201
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3202
subsection \<open>Reduce integrability to "local" integrability\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3203
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3204
lemma integrable_on_little_subintervals:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3205
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3206
  assumes "\<forall>x\<in>cbox a b. \<exists>d>0. \<forall>u v. x \<in> cbox u v \<and> cbox u v \<subseteq> ball x d \<and> cbox u v \<subseteq> cbox a b \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3207
    f integrable_on cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3208
  shows "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3209
proof -
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3210
  interpret operative conj True "\<lambda>i. f integrable_on i"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3211
    using order_refl by (rule operative_integrableI)
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3212
  have "\<forall>x. \<exists>d>0. x\<in>cbox a b \<longrightarrow> (\<forall>u v. x \<in> cbox u v \<and> cbox u v \<subseteq> ball x d \<and> cbox u v \<subseteq> cbox a b \<longrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3213
    f integrable_on cbox u v)"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3214
    using assms by (metis zero_less_one)
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3215
  then obtain d where d: "\<And>x. 0 < d x"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3216
     "\<And>x u v. \<lbrakk>x \<in> cbox a b; x \<in> cbox u v; cbox u v \<subseteq> ball x (d x); cbox u v \<subseteq> cbox a b\<rbrakk> 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3217
               \<Longrightarrow> f integrable_on cbox u v"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3218
    by metis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3219
  obtain p where p: "p tagged_division_of cbox a b" "(\<lambda>x. ball x (d x)) fine p"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3220
    using fine_division_exists[OF gauge_ball_dependent,of d a b] d(1) by blast 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3221
  then have sndp: "snd ` p division_of cbox a b"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3222
    by (metis division_of_tagged_division)
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3223
  have "f integrable_on k" if "(x, k) \<in> p" for x k
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3224
    using tagged_division_ofD(2-4)[OF p(1) that] fineD[OF p(2) that] d[of x] by auto
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3225
  then show ?thesis
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  3226
    unfolding division [symmetric, OF sndp] comm_monoid_set_F_and
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3227
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3228
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3229
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3230
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3231
subsection \<open>Second FTC or existence of antiderivative\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3232
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3233
lemma integrable_const[intro]: "(\<lambda>x. c) integrable_on cbox a b"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3234
  unfolding integrable_on_def by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3235
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3236
lemma integral_has_vector_derivative_continuous_at:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3237
  fixes f :: "real \<Rightarrow> 'a::banach"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3238
  assumes f: "f integrable_on {a..b}"
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3239
     and x: "x \<in> {a..b} - S"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3240
     and "finite S"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3241
     and fx: "continuous (at x within ({a..b} - S)) f"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3242
 shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within ({a..b} - S))"
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3243
proof -
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3244
  let ?I = "\<lambda>a b. integral {a..b} f"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61524
diff changeset
  3245
  { fix e::real
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3246
    assume "e > 0"
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3247
    obtain d where "d>0" and d: "\<And>x'. \<lbrakk>x' \<in> {a..b} - S; \<bar>x' - x\<bar> < d\<rbrakk> \<Longrightarrow> norm(f x' - f x) \<le> e"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3248
      using \<open>e>0\<close> fx by (auto simp: continuous_within_eps_delta dist_norm less_imp_le)
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3249
    have "norm (integral {a..y} f - integral {a..x} f - (y-x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>"
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3250
           if y: "y \<in> {a..b} - S" and yx: "\<bar>y - x\<bar> < d" for y
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3251
    proof (cases "y < x")
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3252
      case False
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3253
      have "f integrable_on {a..y}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3254
        using f y by (simp add: integrable_subinterval_real)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61524
diff changeset
  3255
      then have Idiff: "?I a y - ?I a x = ?I x y"
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3256
        using False x by (simp add: algebra_simps integral_combine)
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3257
      have fux_int: "((\<lambda>u. f u - f x) has_integral integral {x..y} f - (y-x) *\<^sub>R f x) {x..y}"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  3258
        apply (rule has_integral_diff)
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  3259
        using x y apply (auto intro: integrable_integral [OF integrable_subinterval_real [OF f]])
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3260
        using has_integral_const_real [of "f x" x y] False
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3261
        apply simp
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3262
        done
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3263
      have "\<And>xa. y - x < d \<Longrightarrow> (\<And>x'. a \<le> x' \<and> x' \<le> b \<and> x' \<notin> S \<Longrightarrow> \<bar>x' - x\<bar> < d \<Longrightarrow> norm (f x' - f x) \<le> e) \<Longrightarrow> 0 < e \<Longrightarrow> xa \<notin> S \<Longrightarrow> a \<le> x \<Longrightarrow> x \<notin> S \<Longrightarrow> y \<le> b \<Longrightarrow> y \<notin> S \<Longrightarrow> x \<le> xa \<Longrightarrow> xa \<le> y \<Longrightarrow> norm (f xa - f x) \<le> e"
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3264
        using assms by auto
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3265
      show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3266
        using False
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3267
        apply (simp add: abs_eq_content del: content_real_if measure_lborel_Icc)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3268
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3269
        using yx False d x y \<open>e>0\<close> assms by (auto simp: Idiff fux_int)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3270
    next
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3271
      case True
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3272
      have "f integrable_on {a..x}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3273
        using f x by (simp add: integrable_subinterval_real)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61524
diff changeset
  3274
      then have Idiff: "?I a x - ?I a y = ?I y x"
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3275
        using True x y by (simp add: algebra_simps integral_combine)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3276
      have fux_int: "((\<lambda>u. f u - f x) has_integral integral {y..x} f - (x - y) *\<^sub>R f x) {y..x}"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  3277
        apply (rule has_integral_diff)
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  3278
        using x y apply (auto intro: integrable_integral [OF integrable_subinterval_real [OF f]])
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3279
        using has_integral_const_real [of "f x" y x] True
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3280
        apply simp
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3281
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3282
      have "norm (integral {a..x} f - integral {a..y} f - (x - y) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3283
        using True
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3284
        apply (simp add: abs_eq_content del: content_real_if measure_lborel_Icc)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3285
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3286
        using yx True d x y \<open>e>0\<close> assms by (auto simp: Idiff fux_int)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3287
      then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3288
        by (simp add: algebra_simps norm_minus_commute)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3289
    qed
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3290
    then have "\<exists>d>0. \<forall>y\<in>{a..b} - S. \<bar>y - x\<bar> < d \<longrightarrow> norm (integral {a..y} f - integral {a..x} f - (y-x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61524
diff changeset
  3291
      using \<open>d>0\<close> by blast
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61524
diff changeset
  3292
  }
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3293
  then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3294
    by (simp add: has_vector_derivative_def has_derivative_within_alt bounded_linear_scaleR_left)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3295
qed
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3296
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3297
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3298
lemma integral_has_vector_derivative:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3299
  fixes f :: "real \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3300
  assumes "continuous_on {a..b} f"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3301
    and "x \<in> {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3302
  shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f(x)) (at x within {a..b})"
66708
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3303
using assms integral_has_vector_derivative_continuous_at [OF integrable_continuous_real]
015a95f15040 New results for Green's theorem
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  3304
  by (fastforce simp: continuous_on_eq_continuous_within)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3305
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3306
lemma integral_has_real_derivative:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3307
  assumes "continuous_on {a..b} g"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3308
  assumes "t \<in> {a..b}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3309
  shows "((\<lambda>x. integral {a..x} g) has_real_derivative g t) (at t within {a..b})"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3310
  using integral_has_vector_derivative[of a b g t] assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3311
  by (auto simp: has_field_derivative_iff_has_vector_derivative)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3312
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3313
lemma antiderivative_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3314
  fixes q b :: real
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3315
  assumes "continuous_on {a..b} f"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3316
  obtains g where "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative (f x::_::banach)) (at x within {a..b})"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3317
  using integral_has_vector_derivative[OF assms] by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3318
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3319
subsection \<open>Combined fundamental theorem of calculus\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3320
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3321
lemma antiderivative_integral_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3322
  fixes f :: "real \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3323
  assumes "continuous_on {a..b} f"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3324
  obtains g where "\<forall>u\<in>{a..b}. \<forall>v \<in> {a..b}. u \<le> v \<longrightarrow> (f has_integral (g v - g u)) {u..v}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3325
proof -
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3326
  obtain g 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3327
    where g: "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative f x) (at x within {a..b})" 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3328
    using  antiderivative_continuous[OF assms] by metis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3329
  have "(f has_integral g v - g u) {u..v}" if "u \<in> {a..b}" "v \<in> {a..b}" "u \<le> v" for u v
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3330
  proof -
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3331
    have "\<And>x. x \<in> cbox u v \<Longrightarrow> (g has_vector_derivative f x) (at x within cbox u v)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3332
      by (metis atLeastAtMost_iff atLeastatMost_subset_iff box_real(2) g
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  3333
          has_vector_derivative_within_subset subsetCE that(1,2))
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3334
    then show ?thesis
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3335
      by (metis box_real(2) that(3) fundamental_theorem_of_calculus)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3336
  qed
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3337
  then show ?thesis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3338
    using that by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3339
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3340
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3341
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3342
subsection \<open>General "twiddling" for interval-to-interval function image\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3343
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3344
lemma has_integral_twiddle:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3345
  assumes "0 < r"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3346
    and hg: "\<And>x. h(g x) = x"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3347
    and gh: "\<And>x. g(h x) = x"
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3348
    and contg: "\<And>x. continuous (at x) g"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3349
    and g: "\<And>u v. \<exists>w z. g ` cbox u v = cbox w z"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3350
    and h: "\<And>u v. \<exists>w z. h ` cbox u v = cbox w z"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3351
    and r: "\<And>u v. content(g ` cbox u v) = r * content (cbox u v)"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3352
    and intfi: "(f has_integral i) (cbox a b)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3353
  shows "((\<lambda>x. f(g x)) has_integral (1 / r) *\<^sub>R i) (h ` cbox a b)"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3354
proof (cases "cbox a b = {}")
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3355
  case True
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3356
  then show ?thesis 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3357
    using intfi by auto
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3358
next
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3359
  case False
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3360
  obtain w z where wz: "h ` cbox a b = cbox w z"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3361
    using h by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3362
  have inj: "inj g" "inj h"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3363
    using hg gh injI by metis+
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
  3364
  from h obtain ha hb where h_eq: "h ` cbox a b = cbox ha hb" by blast
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3365
  have "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` cbox a b \<and> d fine p 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3366
              \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3367
    if "e > 0" for e
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3368
  proof -
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3369
    have "e * r > 0" using that \<open>0 < r\<close> by simp
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3370
    with intfi[unfolded has_integral]
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3371
    obtain d where "gauge d"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3372
               and d: "\<And>p. p tagged_division_of cbox a b \<and> d fine p 
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3373
                        \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) < e * r" 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3374
      by metis
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3375
    define d' where "d' x = g -` d (g x)" for x
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3376
    show ?thesis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3377
    proof (rule_tac x=d' in exI, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3378
      show "gauge d'"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3379
        using \<open>gauge d\<close> continuous_open_vimage[OF _ contg] by (auto simp: gauge_def d'_def)
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3380
    next
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3381
      fix p
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3382
      assume ptag: "p tagged_division_of h ` cbox a b" and finep: "d' fine p"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3383
      note p = tagged_division_ofD[OF ptag]
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3384
      have gab: "g y \<in> cbox a b" if "y \<in> K" "(x, K) \<in> p" for x y K
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3385
        by (metis hg inj(2) inj_image_mem_iff p(3) subsetCE that that)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3386
      have gimp: "(\<lambda>(x,K). (g x, g ` K)) ` p tagged_division_of (cbox a b) \<and> 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3387
                  d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3388
        unfolding tagged_division_of
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3389
      proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3390
        show "finite ((\<lambda>(x, k). (g x, g ` k)) ` p)"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3391
          using ptag by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3392
        show "d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3393
          using finep unfolding fine_def d'_def by auto
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3394
      next
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3395
        fix x k
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3396
        assume xk: "(x, k) \<in> p"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3397
        show "g x \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3398
          using p(2)[OF xk] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3399
        show "\<exists>u v. g ` k = cbox u v"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3400
          using p(4)[OF xk] using assms(5-6) by auto
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3401
        fix x' K' u
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3402
        assume xk': "(x', K') \<in> p" and u: "u \<in> interior (g ` k)" "u \<in> interior (g ` K')"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3403
        have "interior k \<inter> interior K' \<noteq> {}"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3404
        proof 
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3405
          assume "interior k \<inter> interior K' = {}"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3406
          moreover have "u \<in> g ` (interior k \<inter> interior K')"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3407
            using interior_image_subset[OF \<open>inj g\<close> contg] u
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3408
            unfolding image_Int[OF inj(1)] by blast
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3409
          ultimately show False by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3410
        qed
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3411
        then have same: "(x, k) = (x', K')"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3412
          using ptag xk' xk by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3413
        then show "g x = g x'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3414
          by auto
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3415
        show "g u \<in> g ` K'"if "u \<in> k" for u
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3416
          using that same by auto
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3417
        show "g u \<in> g ` k"if "u \<in> K'" for u
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3418
          using that same by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3419
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3420
        fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3421
        assume "x \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3422
        then have "h x \<in>  \<Union>{k. \<exists>x. (x, k) \<in> p}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3423
          using p(6) by auto
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3424
        then obtain X y where "h x \<in> X" "(y, X) \<in> p" by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3425
        then show "x \<in> \<Union>{k. \<exists>x. (x, k) \<in> (\<lambda>(x, k). (g x, g ` k)) ` p}"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3426
          apply clarsimp
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3427
          by (metis (no_types, lifting) assms(3) image_eqI pair_imageI)
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3428
      qed (use gab in auto)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3429
      have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3430
        using inj(1) unfolding inj_on_def by fastforce
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3431
      have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _")
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3432
        using r
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3433
        apply (simp only: algebra_simps add_left_cancel scaleR_right.sum)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3434
        apply (subst sum.reindex_bij_betw[symmetric, where h="\<lambda>(x, k). (g x, g ` k)" and S=p])
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3435
         apply (auto intro!: * sum.cong simp: bij_betw_def dest!: p(4))
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3436
        done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3437
      also have "\<dots> = r *\<^sub>R ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r")
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3438
        using \<open>0 < r\<close> by (auto simp: scaleR_diff_right)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3439
      finally have eq: "?l = ?r" .
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3440
      show "norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  3441
        using d[OF gimp] \<open>0 < r\<close> by (auto simp add: eq)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3442
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3443
  qed
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3444
  then show ?thesis
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  3445
    by (auto simp: h_eq has_integral)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3446
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3447
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3448
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3449
subsection \<open>Special case of a basic affine transformation\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3450
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3451
lemma AE_lborel_inner_neq:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3452
  assumes k: "k \<in> Basis"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3453
  shows "AE x in lborel. x \<bullet> k \<noteq> c"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3454
proof -
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3455
  interpret finite_product_sigma_finite "\<lambda>_. lborel" Basis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3456
    proof qed simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3457
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3458
  have "emeasure lborel {x\<in>space lborel. x \<bullet> k = c} = emeasure (\<Pi>\<^sub>M j::'a\<in>Basis. lborel) (\<Pi>\<^sub>E j\<in>Basis. if j = k then {c} else UNIV)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3459
    using k
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3460
    by (auto simp add: lborel_eq[where 'a='a] emeasure_distr intro!: arg_cong2[where f=emeasure])
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3461
       (auto simp: space_PiM PiE_iff extensional_def split: if_split_asm)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3462
  also have "\<dots> = (\<Prod>j\<in>Basis. emeasure lborel (if j = k then {c} else UNIV))"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3463
    by (intro measure_times) auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3464
  also have "\<dots> = 0"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3465
    by (intro prod_zero bexI[OF _ k]) auto
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3466
  finally show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3467
    by (subst AE_iff_measurable[OF _ refl]) auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3468
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3469
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3470
lemma content_image_stretch_interval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3471
  fixes m :: "'a::euclidean_space \<Rightarrow> real"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3472
  defines "s f x \<equiv> (\<Sum>k::'a\<in>Basis. (f k * (x\<bullet>k)) *\<^sub>R k)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3473
  shows "content (s m ` cbox a b) = \<bar>\<Prod>k\<in>Basis. m k\<bar> * content (cbox a b)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3474
proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3475
  have s[measurable]: "s f \<in> borel \<rightarrow>\<^sub>M borel" for f
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3476
    by (auto simp: s_def[abs_def])
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3477
  assume m: "\<forall>k\<in>Basis. m k \<noteq> 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3478
  then have s_comp_s: "s (\<lambda>k. 1 / m k) \<circ> s m = id" "s m \<circ> s (\<lambda>k. 1 / m k) = id"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3479
    by (auto simp: s_def[abs_def] fun_eq_iff euclidean_representation)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3480
  then have "inv (s (\<lambda>k. 1 / m k)) = s m" "bij (s (\<lambda>k. 1 / m k))"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3481
    by (auto intro: inv_unique_comp o_bij)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3482
  then have eq: "s m ` cbox a b = s (\<lambda>k. 1 / m k) -` cbox a b"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3483
    using bij_vimage_eq_inv_image[OF \<open>bij (s (\<lambda>k. 1 / m k))\<close>, of "cbox a b"] by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3484
  show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3485
    using m unfolding eq measure_def
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3486
    by (subst lborel_affine_euclidean[where c=m and t=0])
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3487
       (simp_all add: emeasure_density measurable_sets_borel[OF s] abs_prod nn_integral_cmult
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3488
                      s_def[symmetric] emeasure_distr vimage_comp s_comp_s enn2real_mult prod_nonneg)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3489
next
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3490
  assume "\<not> (\<forall>k\<in>Basis. m k \<noteq> 0)"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3491
  then obtain k where k: "k \<in> Basis" "m k = 0" by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3492
  then have [simp]: "(\<Prod>k\<in>Basis. m k) = 0"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3493
    by (intro prod_zero) auto
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3494
  have "emeasure lborel {x\<in>space lborel. x \<in> s m ` cbox a b} = 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3495
  proof (rule emeasure_eq_0_AE)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3496
    show "AE x in lborel. x \<notin> s m ` cbox a b"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3497
      using AE_lborel_inner_neq[OF \<open>k\<in>Basis\<close>]
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3498
    proof eventually_elim
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3499
      show "x \<bullet> k \<noteq> 0 \<Longrightarrow> x \<notin> s m ` cbox a b " for x
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3500
        using k by (auto simp: s_def[abs_def] cbox_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3501
    qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3502
  qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3503
  then show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3504
    by (simp add: measure_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3505
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3506
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3507
lemma interval_image_affinity_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3508
  "\<exists>u v. (\<lambda>x. m *\<^sub>R (x::'a::euclidean_space) + c) ` cbox a b = cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3509
  unfolding image_affinity_cbox
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3510
  by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3511
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3512
lemma content_image_affinity_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3513
  "content((\<lambda>x::'a::euclidean_space. m *\<^sub>R x + c) ` cbox a b) =
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  3514
    \<bar>m\<bar> ^ DIM('a) * content (cbox a b)" (is "?l = ?r")
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3515
proof (cases "cbox a b = {}")
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3516
  case True then show ?thesis by simp
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3517
next
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3518
  case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3519
  show ?thesis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3520
  proof (cases "m \<ge> 0")
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3521
    case True
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3522
    with \<open>cbox a b \<noteq> {}\<close> have "cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3523
      unfolding box_ne_empty
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3524
      apply (intro ballI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3525
      apply (erule_tac x=i in ballE)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3526
      apply (auto simp: inner_simps mult_left_mono)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3527
      done
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3528
    moreover from True have *: "\<And>i. (m *\<^sub>R b + c) \<bullet> i - (m *\<^sub>R a + c) \<bullet> i = m *\<^sub>R (b-a) \<bullet> i"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3529
      by (simp add: inner_simps field_simps)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3530
    ultimately show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3531
      by (simp add: image_affinity_cbox True content_cbox'
71174
nipkow
parents: 71172
diff changeset
  3532
        prod.distrib inner_diff_left)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3533
  next
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3534
    case False
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3535
    with \<open>cbox a b \<noteq> {}\<close> have "cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c) \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3536
      unfolding box_ne_empty
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3537
      apply (intro ballI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3538
      apply (erule_tac x=i in ballE)
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3539
      apply (auto simp: inner_simps mult_left_mono)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3540
      done
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3541
    moreover from False have *: "\<And>i. (m *\<^sub>R a + c) \<bullet> i - (m *\<^sub>R b + c) \<bullet> i = (-m) *\<^sub>R (b-a) \<bullet> i"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3542
      by (simp add: inner_simps field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  3543
    ultimately show ?thesis using False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3544
      by (simp add: image_affinity_cbox content_cbox'
68403
223172b97d0b reorient -> split; documented split
nipkow
parents: 68361
diff changeset
  3545
        prod.distrib[symmetric] inner_diff_left flip: prod_constant)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3546
  qed
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3547
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3548
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3549
lemma has_integral_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3550
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3551
  assumes "(f has_integral i) (cbox a b)"
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3552
      and "m \<noteq> 0"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  3553
  shows "((\<lambda>x. f(m *\<^sub>R x + c)) has_integral ((1 / (\<bar>m\<bar> ^ DIM('a))) *\<^sub>R i)) ((\<lambda>x. (1 / m) *\<^sub>R x + -((1 / m) *\<^sub>R c)) ` cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3554
  apply (rule has_integral_twiddle)
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3555
  using assms
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3556
  apply (safe intro!: interval_image_affinity_interval content_image_affinity_cbox)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3557
  apply (rule zero_less_power)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3558
  unfolding scaleR_right_distrib
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3559
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3560
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3561
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3562
lemma integrable_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3563
  assumes "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3564
    and "m \<noteq> 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3565
  shows "(\<lambda>x. f(m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x + -((1/m) *\<^sub>R c)) ` cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3566
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3567
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3568
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3569
  apply (drule has_integral_affinity)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3570
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3571
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3572
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3573
lemmas has_integral_affinity01 = has_integral_affinity [of _ _ 0 "1::real", simplified]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3574
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3575
lemma integrable_on_affinity:
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3576
  assumes "m \<noteq> 0" "f integrable_on (cbox a b)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3577
  shows   "(\<lambda>x. f (m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x - ((1 / m) *\<^sub>R c)) ` cbox a b)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3578
proof -
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3579
  from assms obtain I where "(f has_integral I) (cbox a b)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3580
    by (auto simp: integrable_on_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3581
  from has_integral_affinity[OF this assms(1), of c] show ?thesis
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3582
    by (auto simp: integrable_on_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3583
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3584
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3585
lemma has_integral_cmul_iff:
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3586
  assumes "c \<noteq> 0"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3587
  shows   "((\<lambda>x. c *\<^sub>R f x) has_integral (c *\<^sub>R I)) A \<longleftrightarrow> (f has_integral I) A"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3588
  using assms has_integral_cmul[of f I A c]
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3589
        has_integral_cmul[of "\<lambda>x. c *\<^sub>R f x" "c *\<^sub>R I" A "inverse c"] by (auto simp: field_simps)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3590
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3591
lemma has_integral_affinity':
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3592
  fixes a :: "'a::euclidean_space"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3593
  assumes "(f has_integral i) (cbox a b)" and "m > 0"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3594
  shows "((\<lambda>x. f(m *\<^sub>R x + c)) has_integral (i /\<^sub>R m ^ DIM('a)))
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3595
           (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3596
proof (cases "cbox a b = {}")
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3597
  case True
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3598
  hence "(cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) = {}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3599
    using \<open>m > 0\<close> unfolding box_eq_empty by (auto simp: algebra_simps)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3600
  with True and assms show ?thesis by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3601
next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3602
  case False
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3603
  have "((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (1 / \<bar>m\<bar> ^ DIM('a)) *\<^sub>R i)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3604
          ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3605
    using assms by (intro has_integral_affinity) auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3606
  also have "((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b) =
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3607
               ((\<lambda>x.  - ((1 / m) *\<^sub>R c) + x) ` (\<lambda>x. (1 / m) *\<^sub>R x) ` cbox a b)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3608
    by (simp add: image_image algebra_simps)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3609
  also have "(\<lambda>x. (1 / m) *\<^sub>R x) ` cbox a b = cbox ((1 / m) *\<^sub>R a) ((1 / m) *\<^sub>R b)" using \<open>m > 0\<close> False
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3610
    by (subst image_smult_cbox) simp_all
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3611
  also have "(\<lambda>x. - ((1 / m) *\<^sub>R c) + x) ` \<dots> = cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3612
    by (subst cbox_translation [symmetric]) (simp add: field_simps vector_add_divide_simps)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3613
  finally show ?thesis using \<open>m > 0\<close> by (simp add: field_simps)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3614
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3615
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3616
lemma has_integral_affinity_iff:
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3617
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: real_normed_vector"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3618
  assumes "m > 0"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3619
  shows   "((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (I /\<^sub>R m ^ DIM('a)))
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3620
               (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) \<longleftrightarrow>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3621
           (f has_integral I) (cbox a b)" (is "?lhs = ?rhs")
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3622
proof
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3623
  assume ?lhs
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3624
  from has_integral_affinity'[OF this, of "1 / m" "-c /\<^sub>R m"] and \<open>m > 0\<close>
70802
160eaf566bcb formally augmented corresponding rules for field_simps
haftmann
parents: 70760
diff changeset
  3625
    show ?rhs by (simp add: vector_add_divide_simps) (simp add: field_simps)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3626
next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3627
  assume ?rhs
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3628
  from has_integral_affinity'[OF this, of m c] and \<open>m > 0\<close>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3629
  show ?lhs by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3630
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3631
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68527
diff changeset
  3632
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3633
subsection \<open>Special case of stretching coordinate axes separately\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3634
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3635
lemma has_integral_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3636
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3637
  assumes "(f has_integral i) (cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3638
    and "\<forall>k\<in>Basis. m k \<noteq> 0"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3639
  shows "((\<lambda>x. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) has_integral
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3640
         ((1/ \<bar>prod m Basis\<bar>) *\<^sub>R i)) ((\<lambda>x. (\<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k)) ` cbox a b)"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3641
  apply (rule has_integral_twiddle[where f=f])
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3642
  unfolding zero_less_abs_iff content_image_stretch_interval
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3643
  unfolding image_stretch_interval empty_as_interval euclidean_eq_iff[where 'a='a]
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3644
  using assms
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3645
  by auto
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3646
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3647
lemma has_integral_stretch_real:
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3648
  fixes f :: "real \<Rightarrow> 'b::real_normed_vector"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3649
  assumes "(f has_integral i) {a..b}" and "m \<noteq> 0"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3650
  shows "((\<lambda>x. f (m * x)) has_integral (1 / \<bar>m\<bar>) *\<^sub>R i) ((\<lambda>x. x / m) ` {a..b})"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3651
  using has_integral_stretch [of f i a b "\<lambda>b. m"] assms by simp
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3652
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3653
lemma integrable_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3654
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3655
  assumes "f integrable_on cbox a b"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3656
    and "\<forall>k\<in>Basis. m k \<noteq> 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3657
  shows "(\<lambda>x::'a. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) integrable_on
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3658
    ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k) ` cbox a b)"
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3659
  using assms unfolding integrable_on_def
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3660
  by (force dest: has_integral_stretch)
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3661
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3662
lemma vec_lambda_eq_sum:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3663
  shows "(\<chi> k. f k (x $ k)) = (\<Sum>k\<in>Basis. (f (axis_index k) (x \<bullet> k)) *\<^sub>R k)"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3664
    apply (simp add: Basis_vec_def cart_eq_inner_axis UNION_singleton_eq_range sum.reindex axis_eq_axis inj_on_def)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3665
    apply (simp add: vec_eq_iff axis_def if_distrib cong: if_cong)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3666
    done
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3667
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3668
lemma has_integral_stretch_cart:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3669
  fixes m :: "'n::finite \<Rightarrow> real"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3670
  assumes f: "(f has_integral i) (cbox a b)" and m: "\<And>k. m k \<noteq> 0"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3671
  shows "((\<lambda>x. f(\<chi> k. m k * x$k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3672
            ((\<lambda>x. \<chi> k. x$k / m k) ` (cbox a b))"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3673
proof -
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3674
  have *: "\<forall>k:: real^'n \<in> Basis. m (axis_index k) \<noteq> 0"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3675
    using axis_index by (simp add: m)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3676
  have eqp: "(\<Prod>k:: real^'n \<in> Basis. m (axis_index k)) = prod m UNIV"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3677
    by (simp add: Basis_vec_def UNION_singleton_eq_range prod.reindex axis_eq_axis inj_on_def)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3678
  show ?thesis
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3679
    using has_integral_stretch [OF f *] vec_lambda_eq_sum [where f="\<lambda>i x. m i * x"] vec_lambda_eq_sum [where f="\<lambda>i x. x / m i"]
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3680
    by (simp add: field_simps eqp)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3681
qed
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3682
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3683
lemma image_stretch_interval_cart:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3684
  fixes m :: "'n::finite \<Rightarrow> real"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3685
  shows "(\<lambda>x. \<chi> k. m k * x$k) ` cbox a b =
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3686
            (if cbox a b = {} then {}
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3687
            else cbox (\<chi> k. min (m k * a$k) (m k * b$k)) (\<chi> k. max (m k * a$k) (m k * b$k)))"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3688
proof -
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3689
  have *: "(\<Sum>k\<in>Basis. min (m (axis_index k) * (a \<bullet> k)) (m (axis_index k) * (b \<bullet> k)) *\<^sub>R k)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3690
           = (\<chi> k. min (m k * a $ k) (m k * b $ k))"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3691
          "(\<Sum>k\<in>Basis. max (m (axis_index k) * (a \<bullet> k)) (m (axis_index k) * (b \<bullet> k)) *\<^sub>R k)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3692
           = (\<chi> k. max (m k * a $ k) (m k * b $ k))"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3693
    apply (simp_all add: Basis_vec_def cart_eq_inner_axis UNION_singleton_eq_range sum.reindex axis_eq_axis inj_on_def)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3694
    apply (simp_all add: vec_eq_iff axis_def if_distrib cong: if_cong)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3695
    done
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3696
  show ?thesis
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3697
    by (simp add: vec_lambda_eq_sum [where f="\<lambda>i x. m i * x"] image_stretch_interval eq_cbox *)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3698
qed
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67980
diff changeset
  3699
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3700
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3701
subsection \<open>even more special cases\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3702
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3703
lemma uminus_interval_vector[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3704
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3705
  shows "uminus ` cbox a b = cbox (-b) (-a)"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3706
  apply safe
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3707
   apply (simp add: mem_box(2))
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3708
  apply (rule_tac x="-x" in image_eqI)
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3709
   apply (auto simp add: mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3710
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3711
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3712
lemma has_integral_reflect_lemma[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3713
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3714
  shows "((\<lambda>x. f(-x)) has_integral i) (cbox (-b) (-a))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3715
  using has_integral_affinity[OF assms, of "-1" 0]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3716
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3717
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3718
lemma has_integral_reflect_lemma_real[intro]:
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3719
  assumes "(f has_integral i) {a..b::real}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3720
  shows "((\<lambda>x. f(-x)) has_integral i) {-b .. -a}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3721
  using assms
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3722
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3723
  by (rule has_integral_reflect_lemma)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3724
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3725
lemma has_integral_reflect[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3726
  "((\<lambda>x. f (-x)) has_integral i) (cbox (-b) (-a)) \<longleftrightarrow> (f has_integral i) (cbox a b)"
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  3727
  by (auto dest: has_integral_reflect_lemma)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3728
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3729
lemma has_integral_reflect_real[simp]:
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3730
  fixes a b::real
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3731
  shows "((\<lambda>x. f (-x)) has_integral i) {-b..-a} \<longleftrightarrow> (f has_integral i) {a..b}"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3732
  by (metis has_integral_reflect interval_cbox)
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  3733
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3734
lemma integrable_reflect[simp]: "(\<lambda>x. f(-x)) integrable_on cbox (-b) (-a) \<longleftrightarrow> f integrable_on cbox a b"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3735
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3736
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3737
lemma integrable_reflect_real[simp]: "(\<lambda>x. f(-x)) integrable_on {-b .. -a} \<longleftrightarrow> f integrable_on {a..b::real}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3738
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3739
  by (rule integrable_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3740
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3741
lemma integral_reflect[simp]: "integral (cbox (-b) (-a)) (\<lambda>x. f (-x)) = integral (cbox a b) f"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3742
  unfolding integral_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3743
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3744
lemma integral_reflect_real[simp]: "integral {-b .. -a} (\<lambda>x. f (-x)) = integral {a..b::real} f"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3745
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3746
  by (rule integral_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3747
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  3748
subsection \<open>Stronger form of FCT; quite a tedious proof\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3749
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3750
lemma split_minus[simp]: "(\<lambda>(x, k). f x k) x - (\<lambda>(x, k). g x k) x = (\<lambda>(x, k). f x k - g x k) x"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3751
  by (simp add: split_def)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3752
66382
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3753
theorem fundamental_theorem_of_calculus_interior:
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3754
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3755
  assumes "a \<le> b"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3756
    and contf: "continuous_on {a..b} f"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3757
    and derf: "\<And>x. x \<in> {a <..< b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  3758
  shows "(f' has_integral (f b - f a)) {a..b}"
66382
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3759
proof (cases "a = b")
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3760
  case True
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3761
  then have *: "cbox a b = {b}" "f b - f a = 0"
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3762
    by (auto simp add:  order_antisym)
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3763
  with True show ?thesis by auto
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3764
next
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3765
  case False
92b4f0073eea more unknotting
paulson <lp15@cam.ac.uk>
parents: 66365
diff changeset
  3766
  with \<open>a \<le> b\<close> have ab: "a < b" by arith
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3767
  show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3768
    unfolding has_integral_factor_content_real
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3769
  proof (intro allI impI)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3770
    fix e :: real
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3771
    assume e: "e > 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3772
    then have eba8: "(e * (b-a)) / 8 > 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3773
      using ab by (auto simp add: field_simps)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3774
    note derf_exp = derf[unfolded has_vector_derivative_def has_derivative_at_alt]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3775
    have bounded: "\<And>x. x \<in> {a<..<b} \<Longrightarrow> bounded_linear (\<lambda>u. u *\<^sub>R f' x)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3776
      using derf_exp by simp
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3777
    have "\<forall>x \<in> box a b. \<exists>d>0. \<forall>y. norm (y-x) < d \<longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3778
      (is "\<forall>x \<in> box a b. ?Q x")
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3779
    proof
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3780
      fix x assume x: "x \<in> box a b"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3781
      show "?Q x"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3782
        apply (rule allE [where x="e/2", OF derf_exp [THEN conjunct2, of x]])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3783
        using x e by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3784
    qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3785
    from this [unfolded bgauge_existence_lemma]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3786
    obtain d where d: "\<And>x. 0 < d x"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3787
      "\<And>x y. \<lbrakk>x \<in> box a b; norm (y-x) < d x\<rbrakk>
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  3788
               \<Longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3789
      by metis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3790
    have "bounded (f ` cbox a b)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3791
      using compact_cbox assms by (auto simp: compact_imp_bounded compact_continuous_image)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3792
    then obtain B 
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3793
      where "0 < B" and B: "\<And>x. x \<in> f ` cbox a b \<Longrightarrow> norm x \<le> B"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3794
      unfolding bounded_pos by metis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3795
    obtain da where "0 < da"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3796
      and da: "\<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk>
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3797
                          \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> (e * (b-a)) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3798
    proof -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3799
      have "continuous (at a within {a..b}) f"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3800
        using contf continuous_on_eq_continuous_within by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3801
      with eba8 obtain k where "0 < k"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3802
        and k: "\<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x-a); norm (x-a) < k\<rbrakk> \<Longrightarrow> norm (f x - f a) < e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3803
        unfolding continuous_within Lim_within dist_norm by metis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3804
      obtain l where l: "0 < l" "norm (l *\<^sub>R f' a) \<le> e * (b-a) / 8" 
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3805
      proof (cases "f' a = 0")
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3806
        case True with ab e that show ?thesis by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3807
      next
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3808
        case False
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3809
        then show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3810
          apply (rule_tac l="(e * (b-a)) / 8 / norm (f' a)" in that)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3811
          using ab e apply (auto simp add: field_simps)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3812
          done
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3813
      qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3814
      have "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b-a) / 4"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3815
        if "a \<le> c" "{a..c} \<subseteq> {a..b}" and bmin: "{a..c} \<subseteq> ball a (min k l)" for c
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3816
      proof -
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3817
        have minkl: "\<bar>a - x\<bar> < min k l" if "x \<in> {a..c}" for x
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3818
          using bmin dist_real_def that by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3819
        then have lel: "\<bar>c - a\<bar> \<le> \<bar>l\<bar>"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3820
          using that by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3821
        have "norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3822
          by (rule norm_triangle_ineq4)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3823
        also have "\<dots> \<le> e * (b-a) / 8 + e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3824
        proof (rule add_mono)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3825
          have "norm ((c - a) *\<^sub>R f' a) \<le> norm (l *\<^sub>R f' a)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3826
            by (auto intro: mult_right_mono [OF lel])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3827
          also have "... \<le> e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3828
            by (rule l)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3829
          finally show "norm ((c - a) *\<^sub>R f' a) \<le> e * (b-a) / 8" .
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3830
        next
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3831
          have "norm (f c - f a) < e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3832
          proof (cases "a = c")
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3833
            case True then show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3834
              using eba8 by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3835
          next
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3836
            case False show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3837
              by (rule k) (use minkl \<open>a \<le> c\<close> that False in auto)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3838
          qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3839
          then show "norm (f c - f a) \<le> e * (b-a) / 8" by simp
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3840
        qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3841
        finally show "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b-a) / 4"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3842
          unfolding content_real[OF \<open>a \<le> c\<close>] by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3843
      qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3844
      then show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3845
        by (rule_tac da="min k l" in that) (auto simp: l \<open>0 < k\<close>)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3846
    qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3847
    obtain db where "0 < db"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3848
      and db: "\<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk>
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3849
                          \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> (e * (b-a)) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3850
    proof -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3851
      have "continuous (at b within {a..b}) f"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3852
        using contf continuous_on_eq_continuous_within by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3853
      with eba8 obtain k
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3854
        where "0 < k"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3855
          and k: "\<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm(x-b); norm(x-b) < k\<rbrakk>
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3856
                     \<Longrightarrow> norm (f b - f x) < e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3857
        unfolding continuous_within Lim_within dist_norm norm_minus_commute by metis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3858
      obtain l where l: "0 < l" "norm (l *\<^sub>R f' b) \<le> (e * (b-a)) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3859
      proof (cases "f' b = 0")
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3860
        case True thus ?thesis 
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3861
          using ab e that by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3862
      next
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3863
        case False then show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3864
          apply (rule_tac l="(e * (b-a)) / 8 / norm (f' b)" in that)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3865
          using ab e by (auto simp add: field_simps)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3866
      qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3867
      have "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b-a) / 4" 
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3868
        if "c \<le> b" "{c..b} \<subseteq> {a..b}" and bmin: "{c..b} \<subseteq> ball b (min k l)" for c
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3869
      proof -
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3870
        have minkl: "\<bar>b - x\<bar> < min k l" if "x \<in> {c..b}" for x
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3871
          using bmin dist_real_def that by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3872
        then have lel: "\<bar>b - c\<bar> \<le> \<bar>l\<bar>"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3873
          using that by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3874
        have "norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3875
          by (rule norm_triangle_ineq4)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3876
        also have "\<dots> \<le> e * (b-a) / 8 + e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3877
        proof (rule add_mono)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3878
          have "norm ((b - c) *\<^sub>R f' b) \<le> norm (l *\<^sub>R f' b)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3879
            by (auto intro: mult_right_mono [OF lel])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3880
          also have "... \<le> e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3881
            by (rule l)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3882
          finally show "norm ((b - c) *\<^sub>R f' b) \<le> e * (b-a) / 8" .
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3883
        next
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3884
          have "norm (f b - f c) < e * (b-a) / 8"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3885
          proof (cases "b = c")
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3886
            case True with eba8 show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3887
              by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3888
          next
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3889
            case False show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3890
              by (rule k) (use minkl \<open>c \<le> b\<close> that False in auto)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3891
          qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3892
          then show "norm (f b - f c) \<le> e * (b-a) / 8" by simp
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3893
        qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3894
        finally show "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b-a) / 4"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3895
          unfolding content_real[OF \<open>c \<le> b\<close>] by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3896
      qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3897
      then show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3898
        by (rule_tac db="min k l" in that) (auto simp: l \<open>0 < k\<close>)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3899
    qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3900
    let ?d = "(\<lambda>x. ball x (if x=a then da else if x=b then db else d x))"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3901
    show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3902
              norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3903
    proof (rule exI, safe)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3904
      show "gauge ?d"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3905
        using ab \<open>db > 0\<close> \<open>da > 0\<close> d(1) by (auto intro: gauge_ball_dependent)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3906
    next
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3907
      fix p
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3908
      assume ptag: "p tagged_division_of {a..b}" and fine: "?d fine p"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3909
      let ?A = "{t. fst t \<in> {a, b}}"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3910
      note p = tagged_division_ofD[OF ptag]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3911
      have pA: "p = (p \<inter> ?A) \<union> (p - ?A)" "finite (p \<inter> ?A)" "finite (p - ?A)" "(p \<inter> ?A) \<inter> (p - ?A) = {}"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3912
        using ptag fine by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3913
      have le_xz: "\<And>w x y z::real. y \<le> z/2 \<Longrightarrow> w - x \<le> z/2 \<Longrightarrow> w + y \<le> x + z"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3914
        by arith
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3915
      have non: False if xk: "(x,K) \<in> p" and "x \<noteq> a" "x \<noteq> b"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3916
        and less: "e * (Sup K - Inf K)/2 < norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3917
      for x K
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3918
      proof -
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  3919
        obtain u v where k: "K = cbox u v"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3920
          using p(4) xk by blast
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3921
        then have "u \<le> v" and uv: "{u, v} \<subseteq> cbox u v"
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3922
          using p(2)[OF xk] by auto
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3923
        then have result: "e * (v - u)/2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3924
          using less[unfolded k box_real interval_bounds_real content_real] by auto
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3925
        then have "x \<in> box a b"
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3926
          using p(2) p(3) \<open>x \<noteq> a\<close> \<open>x \<noteq> b\<close> xk by fastforce
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3927
        with d have *: "\<And>y. norm (y-x) < d x 
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  3928
                \<Longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3929
          by metis
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3930
        have xd: "norm (u - x) < d x" "norm (v - x) < d x"
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  3931
          using fineD[OF fine xk] \<open>x \<noteq> a\<close> \<open>x \<noteq> b\<close> uv 
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3932
          by (auto simp add: k subset_eq dist_commute dist_real_def)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3933
        have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) =
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3934
              norm ((f u - f x - (u - x) *\<^sub>R f' x) - (f v - f x - (v - x) *\<^sub>R f' x))"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3935
          by (rule arg_cong[where f=norm]) (auto simp: scaleR_left.diff)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  3936
        also have "\<dots> \<le> e/2 * norm (u - x) + e/2 * norm (v - x)"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  3937
          by (metis norm_triangle_le_diff add_mono * xd)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  3938
        also have "\<dots> \<le> e/2 * norm (v - u)"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3939
          using p(2)[OF xk] by (auto simp add: field_simps k)
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3940
        also have "\<dots> < norm ((v - u) *\<^sub>R f' x - (f v - f u))"
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3941
          using result by (simp add: \<open>u \<le> v\<close>)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3942
        finally have "e * (v - u)/2 < e * (v - u)/2"
66384
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3943
          using uv by auto
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3944
        then show False by auto
cc66710c9d48 more cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66383
diff changeset
  3945
      qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3946
      have "norm (\<Sum>(x, K)\<in>p - ?A. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  3947
          \<le> (\<Sum>(x, K)\<in>p - ?A. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3948
        by (auto intro: sum_norm_le)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3949
      also have "... \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)/2)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3950
        using non by (fastforce intro: sum_mono)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3951
      finally have I: "norm (\<Sum>(x, k)\<in>p - ?A.
66383
5eb0faf4477a partly unravelled fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66382
diff changeset
  3952
                  content k *\<^sub>R f' x - (f (Sup k) - f (Inf k)))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3953
             \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3954
        by (simp add: sum_divide_distrib)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3955
      have II: "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) -
66383
5eb0faf4477a partly unravelled fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66382
diff changeset
  3956
             (\<Sum>n\<in>p \<inter> ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3957
             \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3958
      proof -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3959
        have ge0: "0 \<le> e * (Sup k - Inf k)" if xkp: "(x, k) \<in> p \<inter> ?A" for x k
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  3960
        proof -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3961
          obtain u v where uv: "k = cbox u v"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3962
            by (meson Int_iff xkp p(4))
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3963
          with p(2) that uv have "cbox u v \<noteq> {}"
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  3964
            by blast
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3965
          then show "0 \<le> e * ((Sup k) - (Inf k))"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3966
            unfolding uv using e by (auto simp add: field_simps)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3967
        qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3968
        let ?B = "\<lambda>x. {t \<in> p. fst t = x \<and> content (snd t) \<noteq> 0}"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3969
        let ?C = "{t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3970
        have "norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b-a)/2"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3971
        proof -
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3972
          have *: "\<And>S f e. sum f S = sum f (p \<inter> ?C) \<Longrightarrow> norm (sum f (p \<inter> ?C)) \<le> e \<Longrightarrow> norm (sum f S) \<le> e"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3973
            by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3974
          have 1: "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3975
            if "(x,K) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> ?C" for x K
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3976
          proof -
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3977
            have xk: "(x,K) \<in> p" and k0: "content K = 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3978
              using that by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3979
            then obtain u v where uv: "K = cbox u v"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3980
              using p(4) by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3981
            then have "u = v"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3982
              using xk k0 p(2) by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3983
            then show "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3984
              using xk unfolding uv by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3985
          qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3986
          have 2: "norm(\<Sum>(x,K)\<in>p \<inter> ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))  \<le> e * (b-a)/2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3987
          proof -
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3988
            have norm_le: "norm (sum f S) \<le> e"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3989
              if "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x = y" "\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> e" "e > 0"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3990
              for S f and e :: real
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3991
            proof (cases "S = {}")
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3992
              case True
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3993
              with that show ?thesis by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3994
            next
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3995
              case False then obtain x where "x \<in> S"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3996
                by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  3997
              then have "S = {x}"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3998
                using that(1) by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  3999
              then show ?thesis
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4000
                using \<open>x \<in> S\<close> that(2) by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4001
            qed
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4002
            have *: "p \<inter> ?C = ?B a \<union> ?B b"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4003
              by blast
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4004
            then have "norm (\<Sum>(x,K)\<in>p \<inter> ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) =
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4005
                       norm (\<Sum>(x,K) \<in> ?B a \<union> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4006
              by simp
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4007
            also have "... = norm ((\<Sum>(x,K) \<in> ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + 
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4008
                                   (\<Sum>(x,K) \<in> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4009
              apply (subst sum.union_disjoint)
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4010
              using p(1) ab e by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4011
            also have "... \<le> e * (b - a) / 4 + e * (b - a) / 4"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4012
            proof (rule norm_triangle_le [OF add_mono])
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4013
              have pa: "\<exists>v. k = cbox a v \<and> a \<le> v" if "(a, k) \<in> p" for k
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4014
                using p(2) p(3) p(4) that by fastforce
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4015
              show "norm (\<Sum>(x,K) \<in> ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4016
              proof (intro norm_le; clarsimp)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4017
                fix K K'
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4018
                assume K: "(a, K) \<in> p" "(a, K') \<in> p" and ne0: "content K \<noteq> 0" "content K' \<noteq> 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4019
                with pa obtain v v' where v: "K = cbox a v" "a \<le> v" and v': "K' = cbox a v'" "a \<le> v'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4020
                  by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4021
                let ?v = "min v v'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4022
                have "box a ?v \<subseteq> K \<inter> K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4023
                  unfolding v v' by (auto simp add: mem_box)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4024
                then have "interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4025
                  using interior_Int interior_mono by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4026
                moreover have "(a + ?v)/2 \<in> box a ?v"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4027
                  using ne0  unfolding v v' content_eq_0 not_le
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4028
                  by (auto simp add: mem_box)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4029
                ultimately have "(a + ?v)/2 \<in> interior K \<inter> interior K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4030
                  unfolding interior_open[OF open_box] by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4031
                then show "K = K'"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4032
                  using p(5)[OF K] by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4033
              next
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4034
                fix K 
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4035
                assume K: "(a, K) \<in> p" and ne0: "content K \<noteq> 0"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4036
                show "norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b-a)"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4037
                  if "(a, c) \<in> p" and ne0: "content c \<noteq> 0" for c
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4038
                proof -
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4039
                  obtain v where v: "c = cbox a v" and "a \<le> v"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4040
                    using pa[OF \<open>(a, c) \<in> p\<close>] by metis 
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4041
                  then have "a \<in> {a..v}" "v \<le> b"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4042
                    using p(3)[OF \<open>(a, c) \<in> p\<close>] by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4043
                  moreover have "{a..v} \<subseteq> ball a da"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4044
                    using fineD[OF \<open>?d fine p\<close> \<open>(a, c) \<in> p\<close>] by (simp add: v split: if_split_asm)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4045
                  ultimately show ?thesis
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4046
                    unfolding v interval_bounds_real[OF \<open>a \<le> v\<close>] box_real
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4047
                    using da \<open>a \<le> v\<close> by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4048
                qed
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4049
              qed (use ab e in auto)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4050
            next
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4051
              have pb: "\<exists>v. k = cbox v b \<and> b \<ge> v" if "(b, k) \<in> p" for k
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4052
                using p(2) p(3) p(4) that by fastforce
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4053
              show "norm (\<Sum>(x,K) \<in> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4054
              proof (intro norm_le; clarsimp)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4055
                fix K K'
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4056
                assume K: "(b, K) \<in> p" "(b, K') \<in> p" and ne0: "content K \<noteq> 0" "content K' \<noteq> 0"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4057
                with pb obtain v v' where v: "K = cbox v b" "v \<le> b" and v': "K' = cbox v' b" "v' \<le> b"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4058
                  by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4059
                let ?v = "max v v'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4060
                have "box ?v b \<subseteq> K \<inter> K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4061
                  unfolding v v' by (auto simp: mem_box)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4062
                then have "interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4063
                  using interior_Int interior_mono by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4064
                moreover have " ((b + ?v)/2) \<in> box ?v b"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4065
                  using ne0 unfolding v v' content_eq_0 not_le by (auto simp: mem_box)
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4066
                ultimately have "((b + ?v)/2) \<in> interior K \<inter> interior K'"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4067
                  unfolding interior_open[OF open_box] by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4068
                then show "K = K'"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4069
                  using p(5)[OF K] by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4070
              next
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4071
                fix K 
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4072
                assume K: "(b, K) \<in> p" and ne0: "content K \<noteq> 0"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4073
                show "norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b-a)"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4074
                  if "(b, c) \<in> p" and ne0: "content c \<noteq> 0" for c
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4075
                proof -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4076
                obtain v where v: "c = cbox v b" and "v \<le> b"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4077
                  using \<open>(b, c) \<in> p\<close> pb by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4078
                then have "v \<ge> a""b \<in> {v.. b}"  
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4079
                  using p(3)[OF \<open>(b, c) \<in> p\<close>] by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4080
                moreover have "{v..b} \<subseteq> ball b db"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4081
                  using fineD[OF \<open>?d fine p\<close> \<open>(b, c) \<in> p\<close>] box_real(2) v False by force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4082
                ultimately show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4083
                  using db v by auto
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4084
                qed
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4085
              qed (use ab e in auto)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4086
            qed
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4087
            also have "... = e * (b-a)/2"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4088
              by simp
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4089
            finally show "norm (\<Sum>(x,k)\<in>p \<inter> ?C.
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4090
                        content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b-a)/2" .
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4091
          qed
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4092
          show "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x - (f ((Sup k)) - f ((Inf k)))) \<le> e * (b-a)/2"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4093
            apply (rule * [OF sum.mono_neutral_right[OF pA(2)]])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4094
            using 1 2 by (auto simp: split_paired_all)
66400
abb7f0a71e74 even more horrible proofs disentangled
paulson
parents: 66388
diff changeset
  4095
        qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4096
        also have "... = (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4097
          unfolding sum_distrib_left[symmetric]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4098
          apply (subst additive_tagged_division_1[OF \<open>a \<le> b\<close> ptag])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4099
          by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4100
        finally have norm_le: "norm (\<Sum>(x,K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4101
                \<le> (\<Sum>n\<in>p. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K))/2" .
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4102
        have le2: "\<And>x s1 s2::real. 0 \<le> s1 \<Longrightarrow> x \<le> (s1 + s2)/2 \<Longrightarrow> x - s1 \<le> s2/2"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4103
          by auto
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4104
        show ?thesis
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4105
          apply (rule le2 [OF sum_nonneg])
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4106
          using ge0 apply force
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4107
          unfolding sum.union_disjoint[OF pA(2-), symmetric] pA(1)[symmetric]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4108
          by (metis norm_le)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4109
      qed
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4110
      note * = additive_tagged_division_1[OF assms(1) ptag, symmetric]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4111
      have "norm (\<Sum>(x,K)\<in>p \<inter> ?A \<union> (p - ?A). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4112
               \<le> e * (\<Sum>(x,K)\<in>p \<inter> ?A \<union> (p - ?A). Sup K - Inf K)"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4113
        unfolding sum_distrib_left
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4114
        unfolding sum.union_disjoint[OF pA(2-)]
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4115
        using le_xz norm_triangle_le I II by blast
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4116
      then
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4117
      show "norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}"
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4118
        by (simp only: content_real[OF \<open>a \<le> b\<close>] *[of "\<lambda>x. x"] *[of f] sum_subtractf[symmetric] split_minus pA(1) [symmetric])
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4119
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4120
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4121
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4122
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4123
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  4124
subsection \<open>Stronger form with finite number of exceptional points\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4125
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4126
lemma fundamental_theorem_of_calculus_interior_strong:
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4127
 fixes f :: "real \<Rightarrow> 'a::banach"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4128
 assumes "finite S"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4129
   and "a \<le> b" "\<And>x. x \<in> {a <..< b} - S \<Longrightarrow> (f has_vector_derivative f'(x)) (at x)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4130
   and "continuous_on {a .. b} f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4131
 shows "(f' has_integral (f b - f a)) {a .. b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4132
  using assms
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4133
proof (induction arbitrary: a b)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4134
case empty
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4135
  then show ?case
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4136
    using fundamental_theorem_of_calculus_interior by force
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4137
next
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4138
case (insert x S)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4139
  show ?case
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4140
  proof (cases "x \<in> {a<..<b}")
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4141
    case False then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4142
      using insert by blast
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4143
  next
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4144
    case True then have "a < x" "x < b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4145
      by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4146
    have "(f' has_integral f x - f a) {a..x}" "(f' has_integral f b - f x) {x..b}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4147
      using \<open>continuous_on {a..b} f\<close> \<open>a < x\<close> \<open>x < b\<close> continuous_on_subset by (force simp: intro!: insert)+
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4148
    then have "(f' has_integral f x - f a + (f b - f x)) {a..b}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4149
      using \<open>a < x\<close> \<open>x < b\<close> has_integral_combine less_imp_le by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4150
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4151
      by simp
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4152
  qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4153
qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4154
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4155
corollary fundamental_theorem_of_calculus_strong:
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4156
  fixes f :: "real \<Rightarrow> 'a::banach"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4157
  assumes "finite S"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4158
    and "a \<le> b"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4159
    and vec: "\<And>x. x \<in> {a..b} - S \<Longrightarrow> (f has_vector_derivative f'(x)) (at x)"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4160
    and "continuous_on {a..b} f"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4161
  shows "(f' has_integral (f b - f a)) {a..b}"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  4162
  by (rule fundamental_theorem_of_calculus_interior_strong [OF \<open>finite S\<close>]) (force simp: assms)+
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4163
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4164
proposition indefinite_integral_continuous_left:
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4165
  fixes f:: "real \<Rightarrow> 'a::banach"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4166
  assumes intf: "f integrable_on {a..b}" and "a < c" "c \<le> b" "e > 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4167
  obtains d where "d > 0"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4168
    and "\<forall>t. c - d < t \<and> t \<le> c \<longrightarrow> norm (integral {a..c} f - integral {a..t} f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4169
proof -
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4170
  obtain w where "w > 0" and w: "\<And>t. \<lbrakk>c - w < t; t < c\<rbrakk> \<Longrightarrow> norm (f c) * norm(c - t) < e/3"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4171
  proof (cases "f c = 0")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4172
    case False
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4173
    hence e3: "0 < e/3 / norm (f c)" using \<open>e>0\<close> by simp
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4174
    moreover have "norm (f c) * norm (c - t) < e/3" 
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4175
      if "t < c" and "c - e/3 / norm (f c) < t" for t
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4176
    proof -
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4177
      have "norm (c - t) < e/3 / norm (f c)"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4178
        using that by auto
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4179
      then show "norm (f c) * norm (c - t) < e/3"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4180
        by (metis e3 mult.commute norm_not_less_zero pos_less_divide_eq zero_less_divide_iff)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4181
    qed
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4182
    ultimately show ?thesis
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4183
      using that by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4184
  next
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4185
    case True then show ?thesis
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4186
      using \<open>e > 0\<close> that by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4187
  qed
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4188
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4189
  let ?SUM = "\<lambda>p. (\<Sum>(x,K) \<in> p. content K *\<^sub>R f x)"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4190
  have e3: "e/3 > 0"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4191
    using \<open>e > 0\<close> by auto
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4192
  have "f integrable_on {a..c}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4193
    apply (rule integrable_subinterval_real[OF intf])
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4194
    using \<open>a < c\<close> \<open>c \<le> b\<close> by auto
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4195
  then obtain d1 where "gauge d1" and d1:
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4196
    "\<And>p. \<lbrakk>p tagged_division_of {a..c}; d1 fine p\<rbrakk> \<Longrightarrow> norm (?SUM p - integral {a..c} f) < e/3"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4197
    using integrable_integral has_integral_real e3 by metis
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4198
  define d where [abs_def]: "d x = ball x w \<inter> d1 x" for x
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4199
  have "gauge d"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4200
    unfolding d_def using \<open>w > 0\<close> \<open>gauge d1\<close> by auto
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4201
  then obtain k where "0 < k" and k: "ball c k \<subseteq> d c"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4202
    by (meson gauge_def open_contains_ball)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4203
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4204
  let ?d = "min k (c - a)/2"
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4205
  show thesis
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4206
  proof (intro that[of ?d] allI impI, safe)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4207
    show "?d > 0"
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4208
      using \<open>0 < k\<close> \<open>a < c\<close> by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4209
  next
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4210
    fix t
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4211
    assume t: "c - ?d < t" "t \<le> c"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4212
    show "norm (integral ({a..c}) f - integral ({a..t}) f) < e"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4213
    proof (cases "t < c")
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4214
      case False with \<open>t \<le> c\<close> show ?thesis
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4215
        by (simp add: \<open>e > 0\<close>)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4216
    next
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4217
      case True
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4218
      have "f integrable_on {a..t}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4219
        apply (rule integrable_subinterval_real[OF intf])
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4220
        using \<open>t < c\<close> \<open>c \<le> b\<close> by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4221
      then obtain d2 where d2: "gauge d2"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4222
        "\<And>p. p tagged_division_of {a..t} \<and> d2 fine p \<Longrightarrow> norm (?SUM p - integral {a..t} f) < e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4223
        using integrable_integral has_integral_real e3 by metis
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4224
      define d3 where "d3 x = (if x \<le> t then d1 x \<inter> d2 x else d1 x)" for x
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4225
      have "gauge d3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4226
        using \<open>gauge d1\<close> \<open>gauge d2\<close> unfolding d3_def gauge_def by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4227
      then obtain p where ptag: "p tagged_division_of {a..t}" and pfine: "d3 fine p"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4228
        by (metis box_real(2) fine_division_exists)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4229
      note p' = tagged_division_ofD[OF ptag]
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4230
      have pt: "(x,K)\<in>p \<Longrightarrow> x \<le> t" for x K
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4231
        by (meson atLeastAtMost_iff p'(2) p'(3) subsetCE)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4232
      with pfine have "d2 fine p"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4233
        unfolding fine_def d3_def by fastforce
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4234
      then have d2_fin: "norm (?SUM p - integral {a..t} f) < e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4235
        using d2(2) ptag by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4236
      have eqs: "{a..c} \<inter> {x. x \<le> t} = {a..t}" "{a..c} \<inter> {x. x \<ge> t} = {t..c}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4237
        using t by (auto simp add: field_simps)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4238
      have "p \<union> {(c, {t..c})} tagged_division_of {a..c}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4239
        apply (rule tagged_division_Un_interval_real[of _ _ _ 1 "t"])
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4240
        using  \<open>t \<le> c\<close> by (auto simp: eqs ptag tagged_division_of_self_real)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4241
      moreover
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4242
      have "d1 fine p \<union> {(c, {t..c})}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4243
        unfolding fine_def
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4244
      proof safe
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4245
        fix x K y
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4246
        assume "(x,K) \<in> p" and "y \<in> K" then show "y \<in> d1 x"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4247
          by (metis Int_iff d3_def subsetD fineD pfine)
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4248
      next
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4249
        fix x assume "x \<in> {t..c}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4250
        then have "dist c x < k"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4251
          using t(1) by (auto simp add: field_simps dist_real_def)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4252
        with k show "x \<in> d1 c"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4253
          unfolding d_def by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4254
      qed  
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4255
      ultimately have d1_fin: "norm (?SUM(p \<union> {(c, {t..c})}) - integral {a..c} f) < e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4256
        using d1 by metis
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4257
      have SUMEQ: "?SUM(p \<union> {(c, {t..c})}) = (c - t) *\<^sub>R f c + ?SUM p"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4258
      proof -
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4259
        have "?SUM(p \<union> {(c, {t..c})}) = (content{t..c} *\<^sub>R f c) + ?SUM p"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4260
        proof (subst sum.union_disjoint)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4261
          show "p \<inter> {(c, {t..c})} = {}"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4262
            using \<open>t < c\<close> pt by force
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4263
        qed (use p'(1) in auto)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4264
        also have "... = (c - t) *\<^sub>R f c + ?SUM p"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4265
          using \<open>t \<le> c\<close> by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4266
        finally show ?thesis .
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4267
      qed
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4268
      have "c - k < t"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4269
        using \<open>k>0\<close> t(1) by (auto simp add: field_simps)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4270
      moreover have "k \<le> w"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4271
      proof (rule ccontr)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4272
        assume "\<not> k \<le> w"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4273
        then have "c + (k + w) / 2 \<notin> d c"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4274
          by (auto simp add: field_simps not_le not_less dist_real_def d_def)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4275
        then have "c + (k + w) / 2 \<notin> ball c k"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4276
          using k by blast
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4277
        then show False
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4278
          using \<open>0 < w\<close> \<open>\<not> k \<le> w\<close> dist_real_def by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4279
      qed
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4280
      ultimately have cwt: "c - w < t"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4281
        by (auto simp add: field_simps)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4282
      have eq: "integral {a..c} f - integral {a..t} f = -(((c - t) *\<^sub>R f c + ?SUM p) -
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4283
             integral {a..c} f) + (?SUM p - integral {a..t} f) + (c - t) *\<^sub>R f c"
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4284
        by auto
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4285
      have "norm (integral {a..c} f - integral {a..t} f) < e/3 + e/3 + e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4286
        unfolding eq
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4287
      proof (intro norm_triangle_lt add_strict_mono)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4288
        show "norm (- ((c - t) *\<^sub>R f c + ?SUM p - integral {a..c} f)) < e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4289
          by (metis SUMEQ d1_fin norm_minus_cancel)
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4290
        show "norm (?SUM p - integral {a..t} f) < e/3"
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4291
          using d2_fin by blast
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4292
        show "norm ((c - t) *\<^sub>R f c) < e/3"
70802
160eaf566bcb formally augmented corresponding rules for field_simps
haftmann
parents: 70760
diff changeset
  4293
          using w cwt \<open>t < c\<close> by simp (simp add: field_simps)
66533
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4294
      qed
c485474cd91d Giant cleanup of fundamental_theorem_of_calculus_interior
paulson <lp15@cam.ac.uk>
parents: 66532
diff changeset
  4295
      then show ?thesis by simp
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4296
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4297
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4298
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4299
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4300
lemma indefinite_integral_continuous_right:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4301
  fixes f :: "real \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4302
  assumes "f integrable_on {a..b}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4303
    and "a \<le> c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4304
    and "c < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4305
    and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4306
  obtains d where "0 < d"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4307
    and "\<forall>t. c \<le> t \<and> t < c + d \<longrightarrow> norm (integral {a..c} f - integral {a..t} f) < e"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4308
proof -
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4309
  have intm: "(\<lambda>x. f (- x)) integrable_on {-b .. -a}" "- b < - c" "- c \<le> - a"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4310
    using assms by auto
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4311
  from indefinite_integral_continuous_left[OF intm \<open>e>0\<close>]
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4312
  obtain d where "0 < d"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4313
    and d: "\<And>t. \<lbrakk>- c - d < t; t \<le> -c\<rbrakk> 
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4314
             \<Longrightarrow> norm (integral {- b..- c} (\<lambda>x. f (-x)) - integral {- b..t} (\<lambda>x. f (-x))) < e"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4315
    by metis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4316
  let ?d = "min d (b - c)" 
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4317
  show ?thesis
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4318
  proof (intro that[of "?d"] allI impI)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4319
    show "0 < ?d"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4320
      using \<open>0 < d\<close> \<open>c < b\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4321
    fix t :: real
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4322
    assume t: "c \<le> t \<and> t < c + ?d"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4323
    have *: "integral {a..c} f = integral {a..b} f - integral {c..b} f"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4324
            "integral {a..t} f = integral {a..b} f - integral {t..b} f"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
  4325
      apply (simp_all only: algebra_simps)
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4326
      using assms t by (auto simp: integral_combine)
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4327
    have "(- c) - d < (- t)" "- t \<le> - c"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4328
      using t by auto 
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4329
    from d[OF this] show "norm (integral {a..c} f - integral {a..t} f) < e"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4330
      by (auto simp add: algebra_simps norm_minus_commute *)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4331
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4332
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4333
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4334
lemma indefinite_integral_continuous_1:
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4335
  fixes f :: "real \<Rightarrow> 'a::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4336
  assumes "f integrable_on {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4337
  shows "continuous_on {a..b} (\<lambda>x. integral {a..x} f)"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4338
proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4339
  have "\<exists>d>0. \<forall>x'\<in>{a..b}. dist x' x < d \<longrightarrow> dist (integral {a..x'} f) (integral {a..x} f) < e" 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4340
       if x: "x \<in> {a..b}" and "e > 0" for x e :: real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4341
  proof (cases "a = b")
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4342
    case True
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4343
    with that show ?thesis by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4344
  next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4345
    case False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4346
    with x have "a < b" by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4347
    with x consider "x = a" | "x = b" | "a < x" "x < b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4348
      by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4349
    then show ?thesis 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4350
    proof cases
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4351
      case 1 show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4352
        apply (rule indefinite_integral_continuous_right [OF assms _ \<open>a < b\<close> \<open>e > 0\<close>], force)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4353
        using \<open>x = a\<close> apply (force simp: dist_norm algebra_simps)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4354
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4355
    next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4356
      case 2 show ?thesis 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4357
        apply (rule indefinite_integral_continuous_left [OF assms \<open>a < b\<close> _ \<open>e > 0\<close>], force)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4358
        using \<open>x = b\<close> apply (force simp: dist_norm norm_minus_commute algebra_simps)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4359
        done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4360
    next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4361
      case 3
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4362
      obtain d1 where "0 < d1" 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4363
        and d1: "\<And>t. \<lbrakk>x - d1 < t; t \<le> x\<rbrakk> \<Longrightarrow> norm (integral {a..x} f - integral {a..t} f) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4364
        using 3 by (auto intro: indefinite_integral_continuous_left [OF assms \<open>a < x\<close> _ \<open>e > 0\<close>])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4365
      obtain d2 where "0 < d2" 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4366
        and d2: "\<And>t. \<lbrakk>x \<le> t; t < x + d2\<rbrakk> \<Longrightarrow> norm (integral {a..x} f - integral {a..t} f) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4367
        using 3 by (auto intro: indefinite_integral_continuous_right [OF assms _ \<open>x < b\<close> \<open>e > 0\<close>])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4368
      show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4369
      proof (intro exI ballI conjI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4370
        show "0 < min d1 d2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4371
          using \<open>0 < d1\<close> \<open>0 < d2\<close> by simp
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4372
        show "dist (integral {a..y} f) (integral {a..x} f) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4373
             if "y \<in> {a..b}" "dist y x < min d1 d2" for y
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4374
        proof (cases "y < x")
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4375
          case True
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4376
          with that d1 show ?thesis by (auto simp: dist_commute dist_norm)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4377
        next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4378
          case False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4379
          with that d2 show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4380
            by (auto simp: dist_commute dist_norm)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4381
        qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4382
      qed
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4383
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4384
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4385
  then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4386
    by (auto simp: continuous_on_iff)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4387
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4388
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4389
lemma indefinite_integral_continuous_1':
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4390
  fixes f::"real \<Rightarrow> 'a::banach"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4391
  assumes "f integrable_on {a..b}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4392
  shows "continuous_on {a..b} (\<lambda>x. integral {x..b} f)"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4393
proof -
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4394
  have "integral {a..b} f - integral {a..x} f = integral {x..b} f" if "x \<in> {a..b}" for x
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4395
    using integral_combine[OF _ _ assms, of x] that
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4396
    by (auto simp: algebra_simps)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4397
  with _ show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4398
    by (rule continuous_on_eq) (auto intro!: continuous_intros indefinite_integral_continuous_1 assms)
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4399
qed
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4400
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4401
theorem integral_has_vector_derivative':
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4402
  fixes f :: "real \<Rightarrow> 'b::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4403
  assumes "continuous_on {a..b} f"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4404
    and "x \<in> {a..b}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4405
  shows "((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4406
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4407
  have *: "integral {x..b} f = integral {a .. b} f - integral {a .. x} f" if "a \<le> x" "x \<le> b" for x
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4408
    using integral_combine[of a x b for x, OF that integrable_continuous_real[OF assms(1)]]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4409
    by (simp add: algebra_simps)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4410
  show ?thesis
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4411
    using \<open>x \<in> _\<close> *
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4412
    by (rule has_vector_derivative_transform)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4413
      (auto intro!: derivative_eq_intros assms integral_has_vector_derivative)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4414
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4415
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4416
lemma integral_has_real_derivative':
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4417
  assumes "continuous_on {a..b} g"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4418
  assumes "t \<in> {a..b}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4419
  shows "((\<lambda>x. integral {x..b} g) has_real_derivative -g t) (at t within {a..b})"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4420
  using integral_has_vector_derivative'[OF assms]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4421
  by (auto simp: has_field_derivative_iff_has_vector_derivative)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  4422
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4423
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  4424
subsection \<open>This doesn't directly involve integration, but that gives an easy proof\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4425
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4426
lemma has_derivative_zero_unique_strong_interval:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4427
  fixes f :: "real \<Rightarrow> 'a::banach"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4428
  assumes "finite k"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4429
    and contf: "continuous_on {a..b} f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4430
    and "f a = y"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4431
    and fder: "\<And>x. x \<in> {a..b} - k \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within {a..b})"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4432
    and x: "x \<in> {a..b}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4433
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4434
proof -
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4435
  have "a \<le> b" "a \<le> x"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4436
    using assms by auto
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  4437
  have "((\<lambda>x. 0::'a) has_integral f x - f a) {a..x}"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4438
  proof (rule fundamental_theorem_of_calculus_interior_strong[OF \<open>finite k\<close> \<open>a \<le> x\<close>]; clarify?)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4439
    have "{a..x} \<subseteq> {a..b}"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4440
      using x by auto
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4441
    then show "continuous_on {a..x} f"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4442
      by (rule continuous_on_subset[OF contf])
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4443
    show "(f has_vector_derivative 0) (at z)" if z: "z \<in> {a<..<x}" and notin: "z \<notin> k" for z
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4444
      unfolding has_vector_derivative_def
70999
5b753486c075 Inverse function theorem + lemmas
paulson <lp15@cam.ac.uk>
parents: 70817
diff changeset
  4445
    proof (simp add: at_within_open[OF z, symmetric])
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4446
      show "(f has_derivative (\<lambda>x. 0)) (at z within {a<..<x})"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4447
        by (rule has_derivative_within_subset [OF fder]) (use x z notin in auto)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4448
    qed
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4449
  qed
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4450
  from has_integral_unique[OF has_integral_0 this]
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4451
  show ?thesis
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4452
    unfolding assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4453
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4454
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4455
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  4456
subsection \<open>Generalize a bit to any convex set\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4457
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4458
lemma has_derivative_zero_unique_strong_convex:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4459
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4460
  assumes "convex S" "finite K"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4461
    and contf: "continuous_on S f"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4462
    and "c \<in> S" "f c = y"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4463
    and derf: "\<And>x. x \<in> S - K \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4464
    and "x \<in> S"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4465
  shows "f x = y"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4466
proof (cases "x = c")
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4467
  case True with \<open>f c = y\<close> show ?thesis
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4468
    by blast
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4469
next
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4470
  case False
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4471
  let ?\<phi> = "\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4472
  have contf': "continuous_on {0 ..1} (f \<circ> ?\<phi>)"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4473
  proof (rule continuous_intros continuous_on_subset[OF contf])+
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4474
    show "(\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x) ` {0..1} \<subseteq> S"
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4475
      using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> by (auto simp add: convex_alt algebra_simps)
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4476
  qed
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4477
  have "t = u" if "?\<phi> t = ?\<phi> u" for t u
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4478
  proof -
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4479
    from that have "(t - u) *\<^sub>R x = (t - u) *\<^sub>R c"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4480
      by (auto simp add: algebra_simps)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4481
    then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4482
      using \<open>x \<noteq> c\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4483
  qed
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4484
  then have eq: "(SOME t. ?\<phi> t = ?\<phi> u) = u" for u
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4485
    by blast
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4486
  then have "(?\<phi> -` K) \<subseteq> (\<lambda>z. SOME t. ?\<phi> t = z) ` K"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4487
    by (clarsimp simp: image_iff) (metis (no_types) eq)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4488
  then have fin: "finite (?\<phi> -` K)"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4489
    by (rule finite_surj[OF \<open>finite K\<close>])
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4490
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4491
  have derf': "((\<lambda>u. f (?\<phi> u)) has_derivative (\<lambda>h. 0)) (at t within {0..1})"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4492
               if "t \<in> {0..1} - {t. ?\<phi> t \<in> K}" for t
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4493
  proof -
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4494
    have df: "(f has_derivative (\<lambda>h. 0)) (at (?\<phi> t) within ?\<phi> ` {0..1})"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4495
      apply (rule has_derivative_within_subset [OF derf])
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4496
      using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> that by (auto simp add: convex_alt algebra_simps)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4497
    have "(f \<circ> ?\<phi> has_derivative (\<lambda>x. 0) \<circ> (\<lambda>z. (0 - z *\<^sub>R c) + z *\<^sub>R x)) (at t within {0..1})"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4498
      by (rule derivative_eq_intros df | simp)+
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4499
    then show ?thesis
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4500
      unfolding o_def .
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4501
  qed
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4502
  have "(f \<circ> ?\<phi>) 1 = y"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4503
    apply (rule has_derivative_zero_unique_strong_interval[OF fin contf'])
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4504
    unfolding o_def using \<open>f c = y\<close> derf' by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4505
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4506
    by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4507
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4508
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4509
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4510
text \<open>Also to any open connected set with finite set of exceptions. Could
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4511
 generalize to locally convex set with limpt-free set of exceptions.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4512
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4513
lemma has_derivative_zero_unique_strong_connected:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4514
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4515
  assumes "connected S"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4516
    and "open S"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4517
    and "finite K"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4518
    and contf: "continuous_on S f"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4519
    and "c \<in> S"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4520
    and "f c = y"
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4521
    and derf: "\<And>x. x \<in> S - K \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4522
    and "x \<in> S"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4523
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4524
proof -
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  4525
  have "\<exists>e>0. ball x e \<subseteq> (S \<inter> f -` {f x})" if "x \<in> S" for x
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4526
  proof -
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4527
    obtain e where "0 < e" and e: "ball x e \<subseteq> S"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4528
      using \<open>x \<in> S\<close> \<open>open S\<close> open_contains_ball by blast
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4529
    have "ball x e \<subseteq> {u \<in> S. f u \<in> {f x}}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4530
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4531
      fix y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4532
      assume y: "y \<in> ball x e"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4533
      then show "y \<in> S"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4534
        using e by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4535
      show "f y = f x"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4536
      proof (rule has_derivative_zero_unique_strong_convex[OF convex_ball \<open>finite K\<close>])
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4537
        show "continuous_on (ball x e) f"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4538
          using contf continuous_on_subset e by blast
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4539
        show "(f has_derivative (\<lambda>h. 0)) (at u within ball x e)"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4540
             if "u \<in> ball x e - K" for u
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4541
          by (metis Diff_iff contra_subsetD derf e has_derivative_within_subset that)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4542
      qed (use y e \<open>0 < e\<close> in auto)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4543
    qed
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  4544
    then show "\<exists>e>0. ball x e \<subseteq> (S \<inter> f -` {f x})"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4545
      using \<open>0 < e\<close> by blast
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4546
  qed
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69668
diff changeset
  4547
  then have "openin (top_of_set S) (S \<inter> f -` {y})"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4548
    by (auto intro!: open_openin_trans[OF \<open>open S\<close>] simp: open_contains_ball)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69668
diff changeset
  4549
  moreover have "closedin (top_of_set S) (S \<inter> f -` {y})"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4550
    by (force intro!: continuous_closedin_preimage [OF contf])
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  4551
  ultimately have "(S \<inter> f -` {y}) = {} \<or> (S \<inter> f -` {y}) = S"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  4552
    using \<open>connected S\<close> by (simp add: connected_clopen)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4553
  then show ?thesis
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4554
    using \<open>x \<in> S\<close> \<open>f c = y\<close> \<open>c \<in> S\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4555
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4556
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4557
lemma has_derivative_zero_connected_constant:
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4558
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4559
  assumes "connected S"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4560
      and "open S"
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4561
      and "finite k"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4562
      and "continuous_on S f"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4563
      and "\<forall>x\<in>(S - k). (f has_derivative (\<lambda>h. 0)) (at x within S)"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4564
    obtains c where "\<And>x. x \<in> S \<Longrightarrow> f(x) = c"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4565
proof (cases "S = {}")
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4566
  case True
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4567
  then show ?thesis
70196
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4568
    by (metis empty_iff that)
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4569
next
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4570
  case False
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  4571
  then obtain c where "c \<in> S"
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4572
    by (metis equals0I)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4573
  then show ?thesis
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4574
    by (metis has_derivative_zero_unique_strong_connected assms that)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4575
qed
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4576
70196
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4577
lemma DERIV_zero_connected_constant:
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4578
  fixes f :: "'a::{real_normed_field,euclidean_space} \<Rightarrow> 'a"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4579
  assumes "connected S"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4580
      and "open S"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4581
      and "finite K"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4582
      and "continuous_on S f"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4583
      and "\<forall>x\<in>(S - K). DERIV f x :> 0"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4584
    obtains c where "\<And>x. x \<in> S \<Longrightarrow> f(x) = c"
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4585
  using has_derivative_zero_connected_constant [OF assms(1-4)] assms
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4586
  by (metis DERIV_const has_derivative_const Diff_iff at_within_open frechet_derivative_at has_field_derivative_def)
b7ef9090feed Added embedding_map_into_euclideanreal; reduced dependence on Equivalence_Lebesgue_Henstock_Integration in Analysis theories by moving a few lemmas
paulson <lp15@cam.ac.uk>
parents: 69922
diff changeset
  4587
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4588
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4589
subsection \<open>Integrating characteristic function of an interval\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4590
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4591
lemma has_integral_restrict_open_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4592
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4593
  assumes intf: "(f has_integral i) (cbox c d)"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4594
    and cb: "cbox c d \<subseteq> cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4595
  shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)"
66535
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4596
proof (cases "cbox c d = {}")
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4597
  case True
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4598
  then have "box c d = {}"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4599
    by (metis bot.extremum_uniqueI box_subset_cbox)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4600
  then show ?thesis
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4601
    using True intf by auto
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4602
next
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4603
  case False
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4604
  then obtain p where pdiv: "p division_of cbox a b" and inp: "cbox c d \<in> p"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4605
    using cb partial_division_extend_1 by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4606
  define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  4607
  interpret operative "lift_option plus" "Some (0 :: 'b)"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  4608
    "\<lambda>i. if g integrable_on i then Some (integral i g) else None"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  4609
    by (fact operative_integralI)
66535
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4610
  note operat = division [OF pdiv, symmetric]
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4611
  show ?thesis
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4612
  proof (cases "(g has_integral i) (cbox a b)")
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4613
    case True then show ?thesis
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4614
      by (simp add: g_def)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4615
  next
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4616
    case False
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4617
    have iterate:"F (\<lambda>i. if g integrable_on i then Some (integral i g) else None) (p - {cbox c d}) = Some 0"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4618
    proof (intro neutral ballI)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4619
      fix x
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4620
      assume x: "x \<in> p - {cbox c d}"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4621
      then have "x \<in> p"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4622
        by auto
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4623
      then obtain u v where uv: "x = cbox u v"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4624
        using pdiv by blast
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4625
      have "interior x \<inter> interior (cbox c d) = {}"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4626
        using pdiv inp x by blast 
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4627
      then have "(g has_integral 0) x"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4628
        unfolding uv using has_integral_spike_interior[where f="\<lambda>x. 0"]
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4629
        by (metis (no_types, lifting) disjoint_iff_not_equal g_def has_integral_0_eq interior_cbox)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4630
      then show "(if g integrable_on x then Some (integral x g) else None) = Some 0"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4631
        by auto
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4632
    qed
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4633
    interpret comm_monoid_set "lift_option plus" "Some (0 :: 'b)"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4634
      by (intro comm_monoid_set.intro comm_monoid_lift_option add.comm_monoid_axioms)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4635
    have intg: "g integrable_on cbox c d"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4636
      using integrable_spike_interior[where f=f]
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4637
      by (meson g_def has_integral_integrable intf)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4638
    moreover have "integral (cbox c d) g = i"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4639
    proof (rule has_integral_unique[OF has_integral_spike_interior intf])
66539
0ad3fc48c9ec final cleanup of negligible_standard_hyperplane and other things
paulson <lp15@cam.ac.uk>
parents: 66537
diff changeset
  4640
      show "\<And>x. x \<in> box c d \<Longrightarrow> f x = g x"
66535
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4641
        by (auto simp: g_def)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4642
      show "(g has_integral integral (cbox c d) g) (cbox c d)"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4643
        by (rule integrable_integral[OF intg])
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4644
    qed
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4645
    ultimately have "F (\<lambda>A. if g integrable_on A then Some (integral A g) else None) p = Some i"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4646
      by (metis (full_types, lifting) division_of_finite inp iterate pdiv remove right_neutral)
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4647
    then
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4648
    have "(g has_integral i) (cbox a b)"
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4649
      by (metis integrable_on_def integral_unique operat option.inject option.simps(3))
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4650
    with False show ?thesis
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4651
      by blast
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4652
  qed
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4653
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4654
66535
64035d9161d3 unscrambled has_integral_restrict_open_subinterval
paulson <lp15@cam.ac.uk>
parents: 66533
diff changeset
  4655
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4656
lemma has_integral_restrict_closed_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4657
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4658
  assumes "(f has_integral i) (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4659
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4660
  shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4661
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4662
  note has_integral_restrict_open_subinterval[OF assms]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4663
  note * = has_integral_spike[OF negligible_frontier_interval _ this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4664
  show ?thesis
68053
56ff7c3e5550 getting rid of "defer"
paulson <lp15@cam.ac.uk>
parents: 68046
diff changeset
  4665
    by (rule *[of c d]) (use box_subset_cbox[of c d] in auto)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4666
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4667
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4668
lemma has_integral_restrict_closed_subintervals_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4669
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4670
  assumes "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4671
  shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b) \<longleftrightarrow> (f has_integral i) (cbox c d)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4672
  (is "?l = ?r")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4673
proof (cases "cbox c d = {}")
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4674
  case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4675
  let ?g = "\<lambda>x. if x \<in> cbox c d then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4676
  show ?thesis
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4677
  proof 
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4678
    assume ?l
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4679
    then have "?g integrable_on cbox c d"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4680
      using assms has_integral_integrable integrable_subinterval by blast
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4681
    then have "f integrable_on cbox c d"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  4682
      by (rule integrable_eq) auto
66536
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4683
    moreover then have "i = integral (cbox c d) f"
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4684
      by (meson \<open>((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b)\<close> assms has_integral_restrict_closed_subinterval has_integral_unique integrable_integral)
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4685
    ultimately show ?r by auto
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4686
  next
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4687
    assume ?r then show ?l
9c95b2b54337 Unscrambling continues as far as negligible_standard_hyperplane
paulson <lp15@cam.ac.uk>
parents: 66535
diff changeset
  4688
      by (rule has_integral_restrict_closed_subinterval[OF _ assms])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4689
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4690
qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4691
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4692
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4693
text \<open>Hence we can apply the limit process uniformly to all integrals.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4694
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4695
lemma has_integral':
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4696
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4697
  shows "(f has_integral i) S \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4698
    (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4699
      (\<exists>z. ((\<lambda>x. if x \<in> S then f(x) else 0) has_integral z) (cbox a b) \<and> norm(z - i) < e))"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4700
  (is "?l \<longleftrightarrow> (\<forall>e>0. ?r e)")
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4701
proof (cases "\<exists>a b. S = cbox a b")
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4702
  case False then show ?thesis 
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4703
    by (simp add: has_integral_alt)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4704
next
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4705
  case True
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4706
  then obtain a b where S: "S = cbox a b"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4707
    by blast 
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4708
  obtain B where " 0 < B" and B: "\<And>x. x \<in> cbox a b \<Longrightarrow> norm x \<le> B"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4709
    using bounded_cbox[unfolded bounded_pos] by blast
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4710
  show ?thesis
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  4711
  proof safe
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4712
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4713
    assume ?l and "e > 0"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4714
    have "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) (cbox c d)"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4715
      if "ball 0 (B+1) \<subseteq> cbox c d" for c d
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4716
        unfolding S using B that
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4717
        by (force intro: \<open>?l\<close>[unfolded S] has_integral_restrict_closed_subinterval)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4718
    then show "?r e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4719
      apply (rule_tac x="B+1" in exI)
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4720
      using \<open>B>0\<close> \<open>e>0\<close> by force
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4721
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4722
    assume as: "\<forall>e>0. ?r e"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4723
    then obtain C 
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4724
      where C: "\<And>a b. ball 0 C \<subseteq> cbox a b \<Longrightarrow>
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4725
                \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b)"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4726
      by (meson zero_less_one)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4727
    define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4728
    define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4729
    have "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" if "norm x \<le> B" "i \<in> Basis" for x i
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4730
      using that and Basis_le_norm[OF \<open>i\<in>Basis\<close>, of x]
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4731
      by (auto simp add: field_simps sum_negf c_def d_def)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4732
    then have c_d: "cbox a b \<subseteq> cbox c d"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4733
      by (meson B mem_box(2) subsetI)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4734
    have "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4735
      if x: "norm (0 - x) < C" and i: "i \<in> Basis" for x i
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4736
        using Basis_le_norm[OF i, of x] x i by (auto simp: sum_negf c_def d_def)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4737
      then have "ball 0 C \<subseteq> cbox c d"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4738
        by (auto simp: mem_box dist_norm)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4739
    with C obtain y where y: "(f has_integral y) (cbox a b)"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4740
      using c_d has_integral_restrict_closed_subintervals_eq S by blast
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4741
    have "y = i"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4742
    proof (rule ccontr)
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4743
      assume "y \<noteq> i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4744
      then have "0 < norm (y - i)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4745
        by auto
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4746
      from as[rule_format,OF this]
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4747
      obtain C where C: "\<And>a b. ball 0 C \<subseteq> cbox a b \<Longrightarrow> 
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4748
           \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b) \<and> norm (z-i) < norm (y-i)"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4749
        by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4750
      define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4751
      define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4752
      have "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4753
        if "norm x \<le> B" and "i \<in> Basis" for x i
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4754
          using that Basis_le_norm[of i x] by (auto simp add: field_simps sum_negf c_def d_def)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4755
        then have c_d: "cbox a b \<subseteq> cbox c d"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4756
        by (simp add: B mem_box(2) subset_eq)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4757
      have "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" if "norm (0 - x) < C" and "i \<in> Basis" for x i
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4758
        using Basis_le_norm[of i x] that by (auto simp: sum_negf c_def d_def)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4759
      then have "ball 0 C \<subseteq> cbox c d"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4760
        by (auto simp: mem_box dist_norm)
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4761
      with C obtain z where z: "(f has_integral z) (cbox a b)" "norm (z-i) < norm (y-i)"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4762
        using has_integral_restrict_closed_subintervals_eq[OF c_d] S by blast
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4763
      moreover then have "z = y" 
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4764
        by (blast intro: has_integral_unique[OF _ y])
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4765
      ultimately show False
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4766
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4767
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4768
    then show ?l
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4769
      using y by (auto simp: S)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4770
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4771
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4772
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4773
lemma has_integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4774
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4775
  assumes fg: "(f has_integral i) S" "(g has_integral j) S"
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4776
    and le: "\<And>x. x \<in> S \<Longrightarrow> f x \<le> g x"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4777
  shows "i \<le> j"
66504
04b3a4548323 tidying up has_integral'
paulson <lp15@cam.ac.uk>
parents: 66503
diff changeset
  4778
  using has_integral_component_le[OF _ fg, of 1] le  by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4779
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4780
lemma integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4781
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4782
  assumes "f integrable_on S"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4783
    and "g integrable_on S"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4784
    and "\<And>x. x \<in> S \<Longrightarrow> f x \<le> g x"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4785
  shows "integral S f \<le> integral S g"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4786
  by (rule has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4787
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4788
lemma has_integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4789
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4790
  assumes "(f has_integral i) S"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4791
    and "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4792
  shows "0 \<le> i"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4793
  using has_integral_component_nonneg[of 1 f i S]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4794
  unfolding o_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4795
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4796
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4797
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4798
lemma integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4799
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4800
  assumes f: "f integrable_on S" and 0: "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  4801
  shows "0 \<le> integral S f"
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  4802
  by (rule has_integral_nonneg[OF f[unfolded has_integral_integral] 0])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4803
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4804
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4805
text \<open>Hence a general restriction property.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4806
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4807
lemma has_integral_restrict [simp]:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4808
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4809
  assumes "S \<subseteq> T"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4810
  shows "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) T \<longleftrightarrow> (f has_integral i) S"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4811
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4812
  have *: "\<And>x. (if x \<in> T then if x \<in> S then f x else 0 else 0) =  (if x\<in>S then f x else 0)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4813
    using assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4814
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4815
    apply (subst(2) has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4816
    apply (subst has_integral')
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4817
      apply (simp add: *)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4818
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4819
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4820
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4821
corollary has_integral_restrict_UNIV:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4822
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4823
  shows "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) UNIV \<longleftrightarrow> (f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4824
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4825
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4826
lemma has_integral_restrict_Int:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4827
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4828
  shows "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) T \<longleftrightarrow> (f has_integral i) (S \<inter> T)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4829
proof -
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4830
  have "((\<lambda>x. if x \<in> T then if x \<in> S then f x else 0 else 0) has_integral i) UNIV =
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4831
        ((\<lambda>x. if x \<in> S \<inter> T then f x else 0) has_integral i) UNIV"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4832
    by (rule has_integral_cong) auto
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4833
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4834
    using has_integral_restrict_UNIV by fastforce
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4835
qed
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4836
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4837
lemma integral_restrict_Int:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4838
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4839
  shows "integral T (\<lambda>x. if x \<in> S then f x else 0) = integral (S \<inter> T) f"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4840
  by (metis (no_types, lifting) has_integral_cong has_integral_restrict_Int integrable_integral integral_unique not_integrable_integral)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4841
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4842
lemma integrable_restrict_Int:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4843
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4844
  shows "(\<lambda>x. if x \<in> S then f x else 0) integrable_on T \<longleftrightarrow> f integrable_on (S \<inter> T)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4845
  using has_integral_restrict_Int by fastforce
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4846
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4847
lemma has_integral_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4848
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4849
  assumes f: "(f has_integral i) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4850
      and "\<And>x. x \<notin> S \<Longrightarrow> f x = 0"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4851
      and "S \<subseteq> T"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4852
    shows "(f has_integral i) T"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4853
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4854
  have "(\<lambda>x. if x \<in> S then f x else 0) = (\<lambda>x. if x \<in> T then f x else 0)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4855
    using assms by fastforce
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4856
  with f show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4857
    by (simp only: has_integral_restrict_UNIV [symmetric, of f])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4858
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4859
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4860
lemma integrable_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4861
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  4862
  assumes "f integrable_on S"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  4863
    and "\<And>x. x \<notin> S \<Longrightarrow> f x = 0"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  4864
    and "S \<subseteq> t"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4865
  shows "f integrable_on t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4866
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4867
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4868
  by (auto intro:has_integral_on_superset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4869
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4870
lemma integral_restrict_UNIV:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4871
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4872
  shows "integral UNIV (\<lambda>x. if x \<in> S then f x else 0) = integral S f"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4873
  by (simp add: integral_restrict_Int)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4874
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  4875
lemma integrable_restrict_UNIV:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4876
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4877
  shows "(\<lambda>x. if x \<in> s then f x else 0) integrable_on UNIV \<longleftrightarrow> f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4878
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4879
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4880
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4881
lemma has_integral_subset_component_le:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4882
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4883
  assumes k: "k \<in> Basis"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4884
    and as: "S \<subseteq> T" "(f has_integral i) S" "(f has_integral j) T" "\<And>x. x\<in>T \<Longrightarrow> 0 \<le> f(x)\<bullet>k"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4885
  shows "i\<bullet>k \<le> j\<bullet>k"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4886
proof -
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4887
  have "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) UNIV"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4888
        "((\<lambda>x. if x \<in> T then f x else 0) has_integral j) UNIV"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4889
    by (simp_all add: assms)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4890
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4891
    apply (rule has_integral_component_le[OF k])
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4892
    using as by auto
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4893
qed
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4894
67719
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4895
subsection\<open>Integrals on set differences\<close>
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4896
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4897
lemma has_integral_setdiff:
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4898
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4899
  assumes S: "(f has_integral i) S" and T: "(f has_integral j) T"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4900
    and neg: "negligible (T - S)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4901
  shows "(f has_integral (i - j)) (S - T)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4902
proof -
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4903
  show ?thesis
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4904
    unfolding has_integral_restrict_UNIV [symmetric, of f]
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4905
  proof (rule has_integral_spike [OF neg])
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4906
    have eq: "(\<lambda>x. (if x \<in> S then f x else 0) - (if x \<in> T then f x else 0)) =
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4907
            (\<lambda>x. if x \<in> T - S then - f x else if x \<in> S - T then f x else 0)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4908
      by (force simp add: )
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4909
    have "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) UNIV"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4910
      "((\<lambda>x. if x \<in> T then f x else 0) has_integral j) UNIV"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4911
      using S T has_integral_restrict_UNIV by auto
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4912
    from has_integral_diff [OF this]
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4913
    show "((\<lambda>x. if x \<in> T - S then - f x else if x \<in> S - T then f x else 0)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4914
                   has_integral i-j) UNIV"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4915
      by (simp add: eq)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4916
  qed force
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4917
qed
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4918
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4919
lemma integral_setdiff:
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4920
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4921
  assumes "f integrable_on S" "f integrable_on T" "negligible(T - S)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4922
 shows "integral (S - T) f = integral S f - integral T f"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4923
  by (rule integral_unique) (simp add: assms has_integral_setdiff integrable_integral)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4924
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4925
lemma integrable_setdiff:
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4926
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4927
  assumes "(f has_integral i) S" "(f has_integral j) T" "negligible (T - S)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4928
  shows "f integrable_on (S - T)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4929
  using has_integral_setdiff [OF assms]
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4930
  by (simp add: has_integral_iff)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4931
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4932
lemma negligible_setdiff [simp]: "T \<subseteq> S \<Longrightarrow> negligible (T - S)"
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4933
  by (metis Diff_eq_empty_iff negligible_empty)
bffb7482faaa new material on matrices, etc., and consolidating duplicate results about of_nat
paulson <lp15@cam.ac.uk>
parents: 67686
diff changeset
  4934
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4935
lemma negligible_on_intervals: "negligible s \<longleftrightarrow> (\<forall>a b. negligible(s \<inter> cbox a b))" (is "?l \<longleftrightarrow> ?r")
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4936
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4937
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4938
  show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4939
    unfolding negligible_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4940
  proof safe
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4941
    fix a b
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4942
    show "(indicator s has_integral 0) (cbox a b)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4943
      apply (rule has_integral_negligible[OF \<open>?r\<close>[rule_format,of a b]])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4944
      unfolding indicator_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4945
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4946
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4947
  qed
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  4948
qed (simp add: negligible_Int)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4949
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4950
lemma negligible_translation:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4951
  assumes "negligible S"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  4952
    shows "negligible ((+) c ` S)"
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4953
proof -
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  4954
  have inj: "inj ((+) c)"
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4955
    by simp
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4956
  show ?thesis
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4957
  using assms
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4958
  proof (clarsimp simp: negligible_def)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4959
    fix a b
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4960
    assume "\<forall>x y. (indicator S has_integral 0) (cbox x y)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4961
    then have *: "(indicator S has_integral 0) (cbox (a-c) (b-c))"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4962
      by (meson Diff_iff assms has_integral_negligible indicator_simps(2))
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  4963
    have eq: "indicator ((+) c ` S) = (\<lambda>x. indicator S (x - c))"
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4964
      by (force simp add: indicator_def)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  4965
    show "(indicator ((+) c ` S) has_integral 0) (cbox a b)"
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4966
      using has_integral_affinity [OF *, of 1 "-c"]
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4967
            cbox_translation [of "c" "-c+a" "-c+b"]
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69597
diff changeset
  4968
      by (simp add: eq) (simp add: ac_simps)
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4969
  qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4970
qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4971
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4972
lemma negligible_translation_rev:
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67371
diff changeset
  4973
  assumes "negligible ((+) c ` S)"
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4974
    shows "negligible S"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4975
by (metis negligible_translation [OF assms, of "-c"] translation_galois)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  4976
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4977
lemma has_integral_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4978
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4979
  assumes "negligible {x \<in> S - T. f x \<noteq> 0}" "negligible {x \<in> T - S. f x \<noteq> 0}"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  4980
  shows "(f has_integral y) S \<longleftrightarrow> (f has_integral y) T"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4981
proof -
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4982
  have "((\<lambda>x. if x \<in> S then f x else 0) has_integral y) UNIV =
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4983
        ((\<lambda>x. if x \<in> T then f x else 0) has_integral y) UNIV"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4984
  proof (rule has_integral_spike_eq)
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4985
    show "negligible ({x \<in> S - T. f x \<noteq> 0} \<union> {x \<in> T - S. f x \<noteq> 0})"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4986
      by (rule negligible_Un [OF assms])
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4987
  qed auto
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4988
  then show ?thesis
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4989
    by (simp add: has_integral_restrict_UNIV)
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4990
qed
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4991
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4992
corollary integral_spike_set:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4993
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4994
  assumes "negligible {x \<in> S - T. f x \<noteq> 0}" "negligible {x \<in> T - S. f x \<noteq> 0}"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4995
  shows "integral S f = integral T f"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4996
  using has_integral_spike_set_eq [OF assms]
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  4997
  by (metis eq_integralD integral_unique)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4998
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  4999
lemma integrable_spike_set:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5000
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5001
  assumes f: "f integrable_on S" and neg: "negligible {x \<in> S - T. f x \<noteq> 0}" "negligible {x \<in> T - S. f x \<noteq> 0}"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5002
  shows "f integrable_on T"
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5003
  using has_integral_spike_set_eq [OF neg] f by blast
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5004
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5005
lemma integrable_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5006
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5007
  assumes "negligible ((S - T) \<union> (T - S))"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5008
  shows "f integrable_on S \<longleftrightarrow> f integrable_on T"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5009
  by (blast intro: integrable_spike_set assms negligible_subset)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5010
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  5011
lemma integrable_on_insert_iff: "f integrable_on (insert x X) \<longleftrightarrow> f integrable_on X"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  5012
  for f::"_ \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  5013
  by (rule integrable_spike_set_eq) (auto simp: insert_Diff_if)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  5014
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5015
lemma has_integral_interior:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5016
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5017
  shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (interior S) \<longleftrightarrow> (f has_integral y) S"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5018
  by (rule has_integral_spike_set_eq [OF empty_imp_negligible negligible_subset])
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5019
     (use interior_subset in \<open>auto simp: frontier_def closure_def\<close>)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5020
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5021
lemma has_integral_closure:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5022
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5023
  shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (closure S) \<longleftrightarrow> (f has_integral y) S"
67980
a8177d098b74 a few new theorems and some fixes
paulson <lp15@cam.ac.uk>
parents: 67979
diff changeset
  5024
  by (rule has_integral_spike_set_eq [OF negligible_subset empty_imp_negligible]) (auto simp: closure_Un_frontier )
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5025
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5026
lemma has_integral_open_interval:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5027
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5028
  shows "(f has_integral y) (box a b) \<longleftrightarrow> (f has_integral y) (cbox a b)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5029
  unfolding interior_cbox [symmetric]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5030
  by (metis frontier_cbox has_integral_interior negligible_frontier_interval)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5031
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5032
lemma integrable_on_open_interval:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5033
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5034
  shows "f integrable_on box a b \<longleftrightarrow> f integrable_on cbox a b"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5035
  by (simp add: has_integral_open_interval integrable_on_def)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5036
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5037
lemma integral_open_interval:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5038
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5039
  shows "integral(box a b) f = integral(cbox a b) f"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5040
  by (metis has_integral_integrable_integral has_integral_open_interval not_integrable_integral)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5041
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5042
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5043
subsection \<open>More lemmas that are useful later\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5044
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5045
lemma has_integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5046
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5047
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5048
    and "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5049
    and "(f has_integral j) t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5050
    and "\<forall>x\<in>t. 0 \<le> f x"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5051
  shows "i \<le> j"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5052
  using has_integral_subset_component_le[OF _ assms(1), of 1 f i j]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5053
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5054
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5055
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5056
lemma integral_subset_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5057
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5058
  assumes "k \<in> Basis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5059
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5060
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5061
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5062
    and "\<forall>x \<in> t. 0 \<le> f x \<bullet> k"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5063
  shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5064
  apply (rule has_integral_subset_component_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5065
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5066
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5067
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5068
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5069
lemma integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5070
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5071
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5072
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5073
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5074
    and "\<forall>x \<in> t. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5075
  shows "integral s f \<le> integral t f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5076
  apply (rule has_integral_subset_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5077
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5078
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5079
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5080
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5081
lemma has_integral_alt':
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5082
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5083
  shows "(f has_integral i) s \<longleftrightarrow> 
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5084
          (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b) \<and>
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5085
          (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5086
            norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5087
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5088
proof
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5089
  assume rhs: ?r
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5090
  show ?l
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5091
  proof (subst has_integral', intro allI impI)
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5092
    fix e::real
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5093
    assume "e > 0"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5094
    from rhs[THEN conjunct2,rule_format,OF this] 
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5095
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5096
                   (\<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z)
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5097
                         (cbox a b) \<and> norm (z - i) < e)"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5098
      apply (rule ex_forward)
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5099
      using rhs by blast
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5100
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5101
next
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5102
  let ?\<Phi> = "\<lambda>e a b. \<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z) (cbox a b) \<and> norm (z - i) < e"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5103
  assume ?l 
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5104
  then have lhs: "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> ?\<Phi> e a b" if "e > 0" for e
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5105
    using that has_integral'[of f] by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5106
  let ?f = "\<lambda>x. if x \<in> s then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5107
  show ?r
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5108
  proof (intro conjI allI impI)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5109
    fix a b :: 'n
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5110
    from lhs[OF zero_less_one]
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5111
    obtain B where "0 < B" and B: "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> ?\<Phi> 1 a b"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5112
      by blast
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5113
    let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5114
    let ?b = "\<Sum>i\<in>Basis. max (b\<bullet>i) B *\<^sub>R i::'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5115
    show "?f integrable_on cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5116
    proof (rule integrable_subinterval[of _ ?a ?b])
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5117
      have "?a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> ?b \<bullet> i" if "norm (0 - x) < B" "i \<in> Basis" for x i
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5118
        using Basis_le_norm[of i x] that by (auto simp add:field_simps)
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5119
      then have "ball 0 B \<subseteq> cbox ?a ?b"
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5120
        by (auto simp: mem_box dist_norm)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5121
      then show "?f integrable_on cbox ?a ?b"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5122
        unfolding integrable_on_def using B by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5123
      show "cbox a b \<subseteq> cbox ?a ?b"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5124
        by (force simp: mem_box)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5125
    qed
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5126
  
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5127
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5128
    assume "e > 0"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5129
    with lhs show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5130
      norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e"
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5131
      by (metis (no_types, lifting) has_integral_integrable_integral)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5132
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5133
qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5134
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
  5135
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67719
diff changeset
  5136
subsection \<open>Continuity of the integral (for a 1-dimensional interval)\<close>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5137
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5138
lemma integrable_alt:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5139
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5140
  shows "f integrable_on s \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5141
    (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b) \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5142
    (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5143
    norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5144
      integral (cbox c d)  (\<lambda>x. if x \<in> s then f x else 0)) < e)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5145
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5146
proof
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5147
  let ?F = "\<lambda>x. if x \<in> s then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5148
  assume ?l
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5149
  then obtain y where intF: "\<And>a b. ?F integrable_on cbox a b"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5150
          and y: "\<And>e. 0 < e \<Longrightarrow>
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5151
              \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) ?F - y) < e"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5152
    unfolding integrable_on_def has_integral_alt'[of f] by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5153
  show ?r
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5154
  proof (intro conjI allI impI intF)
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5155
    fix e::real
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5156
    assume "e > 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5157
    then have "e/2 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5158
      by auto
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5159
    obtain B where "0 < B" 
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5160
       and B: "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> norm (integral (cbox a b) ?F - y) < e/2"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5161
      using \<open>0 < e/2\<close> y by blast
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5162
    show "\<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5163
                  norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5164
    proof (intro conjI exI impI allI, rule \<open>0 < B\<close>)
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5165
      fix a b c d::'n
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5166
      assume sub: "ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5167
      show "norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5168
        using sub by (auto intro: norm_triangle_half_l dest: B)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5169
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5170
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5171
next
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5172
  let ?F = "\<lambda>x. if x \<in> s then f x else 0"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5173
  assume rhs: ?r
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5174
  let ?cube = "\<lambda>n. cbox (\<Sum>i\<in>Basis. - real n *\<^sub>R i::'n) (\<Sum>i\<in>Basis. real n *\<^sub>R i)"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5175
  have "Cauchy (\<lambda>n. integral (?cube n) ?F)"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5176
    unfolding Cauchy_def
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5177
  proof (intro allI impI)
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5178
    fix e::real
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5179
    assume "e > 0"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5180
    with rhs obtain B where "0 < B" 
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5181
      and B: "\<And>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d 
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5182
                        \<Longrightarrow> norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5183
      by blast
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5184
    obtain N where N: "B \<le> real N"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5185
      using real_arch_simple by blast
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5186
    have "ball 0 B \<subseteq> ?cube n" if n: "n \<ge> N" for n
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5187
    proof -
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68721
diff changeset
  5188
      have "sum ((*\<^sub>R) (- real n)) Basis \<bullet> i \<le> x \<bullet> i \<and>
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68721
diff changeset
  5189
            x \<bullet> i \<le> sum ((*\<^sub>R) (real n)) Basis \<bullet> i"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5190
        if "norm x < B" "i \<in> Basis" for x i::'n
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5191
          using Basis_le_norm[of i x] n N that by (auto simp add: field_simps sum_negf)
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5192
      then show ?thesis
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5193
        by (auto simp: mem_box dist_norm)
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5194
    qed
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5195
    then show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (?cube m) ?F) (integral (?cube n) ?F) < e"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5196
      by (fastforce simp add: dist_norm intro!: B)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5197
  qed
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5198
  then obtain i where i: "(\<lambda>n. integral (?cube n) ?F) \<longlonglongrightarrow> i"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5199
    using convergent_eq_Cauchy by blast
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5200
  have "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) ?F - i) < e"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5201
    if "e > 0" for e
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5202
  proof -
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5203
    have *: "e/2 > 0" using that by auto
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  5204
    then obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> norm (i - integral (?cube n) ?F) < e/2"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5205
      using i[THEN LIMSEQ_D, simplified norm_minus_commute] by meson
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5206
    obtain B where "0 < B" 
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5207
      and B: "\<And>a b c d. \<lbrakk>ball 0 B \<subseteq> cbox a b; ball 0 B \<subseteq> cbox c d\<rbrakk> \<Longrightarrow>
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  5208
                  norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e/2"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5209
      using rhs * by meson
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5210
    let ?B = "max (real N) B"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5211
    show ?thesis
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5212
    proof (intro exI conjI allI impI)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5213
      show "0 < ?B"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5214
        using \<open>B > 0\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5215
      fix a b :: 'n
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5216
      assume "ball 0 ?B \<subseteq> cbox a b"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5217
      moreover obtain n where n: "max (real N) B \<le> real n"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5218
        using real_arch_simple by blast
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5219
      moreover have "ball 0 B \<subseteq> ?cube n"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5220
      proof 
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5221
        fix x :: 'n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5222
        assume x: "x \<in> ball 0 B"
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5223
        have "\<lbrakk>norm (0 - x) < B; i \<in> Basis\<rbrakk>
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68721
diff changeset
  5224
              \<Longrightarrow> sum ((*\<^sub>R) (-n)) Basis \<bullet> i\<le> x \<bullet> i \<and> x \<bullet> i \<le> sum ((*\<^sub>R) n) Basis \<bullet> i" for i
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5225
          using Basis_le_norm[of i x] n by (auto simp add: field_simps sum_negf)
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5226
        then show "x \<in> ?cube n"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5227
          using x by (auto simp: mem_box dist_norm)
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5228
      qed 
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5229
      ultimately show "norm (integral (cbox a b) ?F - i) < e"
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5230
        using norm_triangle_half_l [OF B N] by force
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5231
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5232
  qed
66508
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5233
  then show ?l unfolding integrable_on_def has_integral_alt'[of f]
29d684ce2325 unscrambling of integrable_alt
paulson <lp15@cam.ac.uk>
parents: 66505
diff changeset
  5234
    using rhs by blast
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5235
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5236
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5237
lemma integrable_altD:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5238
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5239
  assumes "f integrable_on s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5240
  shows "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5241
    and "\<And>e. e > 0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5242
      norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d)  (\<lambda>x. if x \<in> s then f x else 0)) < e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5243
  using assms[unfolded integrable_alt[of f]] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5244
67998
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5245
lemma integrable_alt_subset:
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5246
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5247
  shows
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5248
     "f integrable_on S \<longleftrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5249
      (\<forall>a b. (\<lambda>x. if x \<in> S then f x else 0) integrable_on cbox a b) \<and>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5250
      (\<forall>e>0. \<exists>B>0. \<forall>a b c d.
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5251
                      ball 0 B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5252
                      \<longrightarrow> norm(integral (cbox a b) (\<lambda>x. if x \<in> S then f x else 0) -
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5253
                               integral (cbox c d) (\<lambda>x. if x \<in> S then f x else 0)) < e)"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5254
      (is "_ = ?rhs")
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5255
proof -
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5256
  let ?g = "\<lambda>x. if x \<in> S then f x else 0"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5257
  have "f integrable_on S \<longleftrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5258
        (\<forall>a b. ?g integrable_on cbox a b) \<and>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5259
        (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5260
           norm (integral (cbox a b) ?g - integral (cbox c d)  ?g) < e)"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5261
    by (rule integrable_alt)
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5262
  also have "\<dots> = ?rhs"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5263
  proof -
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5264
    { fix e :: "real"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5265
      assume e: "\<And>e. e>0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5266
                                   norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5267
        and "e > 0"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5268
      obtain B where "B > 0"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5269
        and B: "\<And>a b c d. \<lbrakk>ball 0 B \<subseteq> cbox a b; cbox a b \<subseteq> cbox c d\<rbrakk> \<Longrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5270
                           norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e/2"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5271
        using \<open>e > 0\<close> e [of "e/2"] by force
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5272
      have "\<exists>B>0. \<forall>a b c d.
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5273
               ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5274
               norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5275
      proof (intro exI allI conjI impI)
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5276
        fix a b c d :: "'a"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5277
        let ?\<alpha> = "\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5278
        let ?\<beta> = "\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5279
        show "norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5280
          if ball: "ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5281
        proof -
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5282
          have B': "norm (integral (cbox a b \<inter> cbox c d) ?g - integral (cbox x y) ?g) < e/2"
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5283
            if "cbox a b \<inter> cbox c d \<subseteq> cbox x y" for x y
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5284
            using B [of ?\<alpha> ?\<beta> x y] ball that by (simp add: Int_interval [symmetric])
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5285
          show ?thesis
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5286
            using B' [of a b] B' [of c d] norm_triangle_half_r by blast
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5287
        qed
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5288
      qed (use \<open>B > 0\<close> in auto)}
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68120
diff changeset
  5289
    then show ?thesis
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68120
diff changeset
  5290
      by force
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68120
diff changeset
  5291
  qed
67998
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5292
  finally show ?thesis .
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5293
qed
73a5a33486ee Change of variables proof
paulson <lp15@cam.ac.uk>
parents: 67984
diff changeset
  5294
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5295
lemma integrable_on_subcbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5296
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5297
  assumes intf: "f integrable_on S"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5298
    and sub: "cbox a b \<subseteq> S"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5299
  shows "f integrable_on cbox a b"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5300
proof -
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5301
  have "(\<lambda>x. if x \<in> S then f x else 0) integrable_on cbox a b"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5302
    by (simp add: intf integrable_altD(1))
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5303
then show ?thesis
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5304
  by (metis (mono_tags) sub integrable_restrict_Int le_inf_iff order_refl subset_antisym)
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  5305
qed
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5306
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5307
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5308
subsection \<open>A straddling criterion for integrability\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5309
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5310
lemma integrable_straddle_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5311
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5312
  assumes "\<And>e. e>0 \<Longrightarrow> \<exists>g h i j. (g has_integral i) (cbox a b) \<and> (h has_integral j) (cbox a b) \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5313
                            \<bar>i - j\<bar> < e \<and> (\<forall>x\<in>cbox a b. (g x) \<le> f x \<and> f x \<le> h x)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5314
  shows "f integrable_on cbox a b"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5315
proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5316
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5317
            (\<forall>p1 p2. p1 tagged_division_of cbox a b \<and> d fine p1 \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5318
                     p2 tagged_division_of cbox a b \<and> d fine p2 \<longrightarrow>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5319
                     \<bar>(\<Sum>(x,K)\<in>p1. content K *\<^sub>R f x) - (\<Sum>(x,K)\<in>p2. content K *\<^sub>R f x)\<bar> < e)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5320
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5321
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5322
    have e: "e/3 > 0"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5323
      using that by auto
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5324
    then obtain g h i j where ij: "\<bar>i - j\<bar> < e/3"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5325
            and "(g has_integral i) (cbox a b)"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5326
            and "(h has_integral j) (cbox a b)"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5327
            and fgh: "\<And>x. x \<in> cbox a b \<Longrightarrow> g x \<le> f x \<and> f x \<le> h x"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5328
      using assms real_norm_def by metis
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5329
    then obtain d1 d2 where "gauge d1" "gauge d2"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5330
            and d1: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; d1 fine p\<rbrakk> \<Longrightarrow>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5331
                          \<bar>(\<Sum>(x,K)\<in>p. content K *\<^sub>R g x) - i\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5332
            and d2: "\<And>p. \<lbrakk>p tagged_division_of cbox a b; d2 fine p\<rbrakk> \<Longrightarrow>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5333
                          \<bar>(\<Sum>(x,K) \<in> p. content K *\<^sub>R h x) - j\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5334
      by (metis e has_integral real_norm_def)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5335
    have "\<bar>(\<Sum>(x,K) \<in> p1. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p2. content K *\<^sub>R f x)\<bar> < e"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5336
      if p1: "p1 tagged_division_of cbox a b" and 11: "d1 fine p1" and 21: "d2 fine p1"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5337
       and p2: "p2 tagged_division_of cbox a b" and 12: "d1 fine p2" and 22: "d2 fine p2" for p1 p2
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5338
    proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5339
      have *: "\<And>g1 g2 h1 h2 f1 f2.
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5340
                  \<lbrakk>\<bar>g2 - i\<bar> < e/3; \<bar>g1 - i\<bar> < e/3; \<bar>h2 - j\<bar> < e/3; \<bar>h1 - j\<bar> < e/3;
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5341
                   g1 - h2 \<le> f1 - f2; f1 - f2 \<le> h1 - g2\<rbrakk>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5342
                  \<Longrightarrow> \<bar>f1 - f2\<bar> < e"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5343
        using \<open>e > 0\<close> ij by arith
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5344
      have 0: "(\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R g x) \<ge> 0"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5345
              "0 \<le> (\<Sum>(x, k)\<in>p2. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5346
              "(\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R g x) \<ge> 0"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5347
              "0 \<le> (\<Sum>(x, k)\<in>p1. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x)"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5348
        unfolding sum_subtractf[symmetric]
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5349
           apply (auto intro!: sum_nonneg)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5350
           apply (meson fgh measure_nonneg mult_left_mono tag_in_interval that sum_nonneg)+
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5351
        done
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5352
      show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5353
      proof (rule *)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5354
        show "\<bar>(\<Sum>(x,K) \<in> p2. content K *\<^sub>R g x) - i\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5355
          by (rule d1[OF p2 12])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5356
        show "\<bar>(\<Sum>(x,K) \<in> p1. content K *\<^sub>R g x) - i\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5357
          by (rule d1[OF p1 11])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5358
        show "\<bar>(\<Sum>(x,K) \<in> p2. content K *\<^sub>R h x) - j\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5359
          by (rule d2[OF p2 22])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5360
        show "\<bar>(\<Sum>(x,K) \<in> p1. content K *\<^sub>R h x) - j\<bar> < e/3"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5361
          by (rule d2[OF p1 21])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5362
      qed (use 0 in auto)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5363
    qed
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5364
    then show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5365
      by (rule_tac x="\<lambda>x. d1 x \<inter> d2 x" in exI)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5366
        (auto simp: fine_Int intro: \<open>gauge d1\<close> \<open>gauge d2\<close> d1 d2)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5367
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5368
  then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5369
    by (simp add: integrable_Cauchy)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5370
qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5371
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5372
lemma integrable_straddle:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5373
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5374
  assumes "\<And>e. e>0 \<Longrightarrow> \<exists>g h i j. (g has_integral i) s \<and> (h has_integral j) s \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5375
                     \<bar>i - j\<bar> < e \<and> (\<forall>x\<in>s. g x \<le> f x \<and> f x \<le> h x)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5376
  shows "f integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5377
proof -
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5378
  let ?fs = "(\<lambda>x. if x \<in> s then f x else 0)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5379
  have "?fs integrable_on cbox a b" for a b
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5380
  proof (rule integrable_straddle_interval)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5381
    fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5382
    assume "e > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5383
    then have *: "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5384
      by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5385
    with assms obtain g h i j where g: "(g has_integral i) s" and h: "(h has_integral j) s"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5386
                 and ij: "\<bar>i - j\<bar> < e/4"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5387
                 and fgh: "\<And>x. x \<in> s \<Longrightarrow> g x \<le> f x \<and> f x \<le> h x"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5388
      by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5389
    let ?gs = "(\<lambda>x. if x \<in> s then g x else 0)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5390
    let ?hs = "(\<lambda>x. if x \<in> s then h x else 0)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5391
    obtain Bg where Bg: "\<And>a b. ball 0 Bg \<subseteq> cbox a b \<Longrightarrow> \<bar>integral (cbox a b) ?gs - i\<bar> < e/4"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5392
              and int_g: "\<And>a b. ?gs integrable_on cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5393
      using g * unfolding has_integral_alt' real_norm_def by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5394
    obtain Bh where
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5395
          Bh: "\<And>a b. ball 0 Bh \<subseteq> cbox a b \<Longrightarrow> \<bar>integral (cbox a b) ?hs - j\<bar> < e/4"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5396
         and int_h: "\<And>a b. ?hs integrable_on cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5397
      using h * unfolding has_integral_alt' real_norm_def by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5398
    define c where "c = (\<Sum>i\<in>Basis. min (a\<bullet>i) (- (max Bg Bh)) *\<^sub>R i)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5399
    define d where "d = (\<Sum>i\<in>Basis. max (b\<bullet>i) (max Bg Bh) *\<^sub>R i)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5400
    have "\<lbrakk>norm (0 - x) < Bg; i \<in> Basis\<rbrakk> \<Longrightarrow> c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" for x i
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5401
      using Basis_le_norm[of i x] unfolding c_def d_def by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5402
    then have ballBg: "ball 0 Bg \<subseteq> cbox c d"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5403
      by (auto simp: mem_box dist_norm)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5404
    have "\<lbrakk>norm (0 - x) < Bh; i \<in> Basis\<rbrakk> \<Longrightarrow> c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" for x i
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5405
      using Basis_le_norm[of i x] unfolding c_def d_def by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5406
    then have ballBh: "ball 0 Bh \<subseteq> cbox c d"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5407
      by (auto simp: mem_box dist_norm)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5408
    have ab_cd: "cbox a b \<subseteq> cbox c d"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5409
      by (auto simp: c_def d_def subset_box_imp)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5410
    have **: "\<And>ch cg ag ah::real. \<lbrakk>\<bar>ah - ag\<bar> \<le> \<bar>ch - cg\<bar>; \<bar>cg - i\<bar> < e/4; \<bar>ch - j\<bar> < e/4\<rbrakk>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5411
       \<Longrightarrow> \<bar>ag - ah\<bar> < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5412
      using ij by arith
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5413
    show "\<exists>g h i j. (g has_integral i) (cbox a b) \<and> (h has_integral j) (cbox a b) \<and> \<bar>i - j\<bar> < e \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5414
          (\<forall>x\<in>cbox a b. g x \<le> (if x \<in> s then f x else 0) \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5415
                        (if x \<in> s then f x else 0) \<le> h x)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5416
    proof (intro exI ballI conjI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5417
      have eq: "\<And>x f g. (if x \<in> s then f x else 0) - (if x \<in> s then g x else 0) =
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5418
                       (if x \<in> s then f x - g x else (0::real))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5419
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5420
      have int_hg: "(\<lambda>x. if x \<in> s then h x - g x else 0) integrable_on cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5421
                   "(\<lambda>x. if x \<in> s then h x - g x else 0) integrable_on cbox c d"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5422
        by (metis (no_types) integrable_diff g h has_integral_integrable integrable_altD(1))+
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5423
      show "(?gs has_integral integral (cbox a b) ?gs) (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5424
           "(?hs has_integral integral (cbox a b) ?hs) (cbox a b)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5425
        by (intro integrable_integral int_g int_h)+
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5426
      then have "integral (cbox a b) ?gs \<le> integral (cbox a b) ?hs"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5427
        apply (rule has_integral_le)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5428
        using fgh by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5429
      then have "0 \<le> integral (cbox a b) ?hs - integral (cbox a b) ?gs"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5430
        by simp
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5431
      then have "\<bar>integral (cbox a b) ?hs - integral (cbox a b) ?gs\<bar>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5432
              \<le> \<bar>integral (cbox c d) ?hs - integral (cbox c d) ?gs\<bar>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5433
        apply (simp add: integral_diff [symmetric] int_g int_h)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5434
        apply (subst abs_of_nonneg[OF integral_nonneg[OF integrable_diff, OF int_h int_g]])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5435
        using fgh apply (force simp: eq intro!: integral_subset_le [OF ab_cd int_hg])+
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5436
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5437
      then show "\<bar>integral (cbox a b) ?gs - integral (cbox a b) ?hs\<bar> < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5438
        apply (rule **)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5439
         apply (rule Bg ballBg Bh ballBh)+
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5440
        done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5441
      show "\<And>x. x \<in> cbox a b \<Longrightarrow> ?gs x \<le> ?fs x" "\<And>x. x \<in> cbox a b \<Longrightarrow> ?fs x \<le> ?hs x"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5442
        using fgh by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5443
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5444
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5445
  then have int_f: "?fs integrable_on cbox a b" for a b
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5446
    by simp
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5447
  have "\<exists>B>0. \<forall>a b c d.
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5448
                  ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5449
                  abs (integral (cbox a b) ?fs - integral (cbox c d) ?fs) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5450
      if "0 < e" for e
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5451
  proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5452
    have *: "e/3 > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5453
      using that by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5454
    with assms obtain g h i j where g: "(g has_integral i) s" and h: "(h has_integral j) s"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5455
                 and ij: "\<bar>i - j\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5456
                 and fgh: "\<And>x. x \<in> s \<Longrightarrow> g x \<le> f x \<and> f x \<le> h x"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5457
      by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5458
    let ?gs = "(\<lambda>x. if x \<in> s then g x else 0)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5459
    let ?hs = "(\<lambda>x. if x \<in> s then h x else 0)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5460
    obtain Bg where "Bg > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5461
              and Bg: "\<And>a b. ball 0 Bg \<subseteq> cbox a b \<Longrightarrow> \<bar>integral (cbox a b) ?gs - i\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5462
              and int_g: "\<And>a b. ?gs integrable_on cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5463
      using g * unfolding has_integral_alt' real_norm_def by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5464
    obtain Bh where "Bh > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5465
              and Bh: "\<And>a b. ball 0 Bh \<subseteq> cbox a b \<Longrightarrow> \<bar>integral (cbox a b) ?hs - j\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5466
              and int_h: "\<And>a b. ?hs integrable_on cbox a b"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5467
      using h * unfolding has_integral_alt' real_norm_def by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5468
    { fix a b c d :: 'n
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5469
      assume as: "ball 0 (max Bg Bh) \<subseteq> cbox a b" "ball 0 (max Bg Bh) \<subseteq> cbox c d"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5470
      have **: "ball 0 Bg \<subseteq> ball (0::'n) (max Bg Bh)" "ball 0 Bh \<subseteq> ball (0::'n) (max Bg Bh)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5471
        by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5472
      have *: "\<And>ga gc ha hc fa fc. \<lbrakk>\<bar>ga - i\<bar> < e/3; \<bar>gc - i\<bar> < e/3; \<bar>ha - j\<bar> < e/3;
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5473
                     \<bar>hc - j\<bar> < e/3; ga \<le> fa; fa \<le> ha; gc \<le> fc; fc \<le> hc\<rbrakk> \<Longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5474
        \<bar>fa - fc\<bar> < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5475
        using ij by arith
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5476
      have "abs (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5477
        (\<lambda>x. if x \<in> s then f x else 0)) < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5478
      proof (rule *)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5479
        show "\<bar>integral (cbox a b) ?gs - i\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5480
          using "**" Bg as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5481
        show "\<bar>integral (cbox c d) ?gs - i\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5482
          using "**" Bg as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5483
        show "\<bar>integral (cbox a b) ?hs - j\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5484
          using "**" Bh as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5485
        show "\<bar>integral (cbox c d) ?hs - j\<bar> < e/3"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5486
          using "**" Bh as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5487
      qed (use int_f int_g int_h fgh in \<open>simp_all add: integral_le\<close>)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5488
    }
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5489
    then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5490
      apply (rule_tac x="max Bg Bh" in exI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5491
        using \<open>Bg > 0\<close> by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5492
  qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5493
  then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5494
    unfolding integrable_alt[of f] real_norm_def by (blast intro: int_f)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5495
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5496
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5497
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5498
subsection \<open>Adding integrals over several sets\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5499
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5500
lemma has_integral_Un:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5501
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
67970
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5502
  assumes f: "(f has_integral i) S" "(f has_integral j) T"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5503
    and neg: "negligible (S \<inter> T)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5504
  shows "(f has_integral (i + j)) (S \<union> T)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5505
  unfolding has_integral_restrict_UNIV[symmetric, of f]
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5506
proof (rule has_integral_spike[OF neg])
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5507
  let ?f = "\<lambda>x. (if x \<in> S then f x else 0) + (if x \<in> T then f x else 0)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5508
  show "(?f has_integral i + j) UNIV"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5509
    by (simp add: f has_integral_add)
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5510
qed auto
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5511
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5512
lemma integral_Un [simp]:
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5513
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5514
  assumes "f integrable_on S" "f integrable_on T" "negligible (S \<inter> T)"
8c012a49293a A couple of new results
paulson <lp15@cam.ac.uk>
parents: 67719
diff changeset
  5515
  shows "integral (S \<union> T) f = integral S f + integral T f"
67979
53323937ee25 new material about vec, real^1, etc.
paulson <lp15@cam.ac.uk>
parents: 67971
diff changeset
  5516
  by (simp add: has_integral_Un assms integrable_integral integral_unique)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5517
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5518
lemma integrable_Un:
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5519
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5520
  assumes "negligible (A \<inter> B)" "f integrable_on A" "f integrable_on B"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5521
  shows   "f integrable_on (A \<union> B)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5522
proof -
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  5523
  from assms obtain y z where "(f has_integral y) A" "(f has_integral z) B"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5524
     by (auto simp: integrable_on_def)
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5525
  from has_integral_Un[OF this assms(1)] show ?thesis by (auto simp: integrable_on_def)
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5526
qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5527
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5528
lemma integrable_Un':
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5529
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5530
  assumes "f integrable_on A" "f integrable_on B" "negligible (A \<inter> B)" "C = A \<union> B"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5531
  shows   "f integrable_on C"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5532
  using integrable_Un[of A B f] assms by simp
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5533
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5534
lemma has_integral_Union:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5535
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5536
  assumes \<T>: "finite \<T>"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5537
    and int: "\<And>S. S \<in> \<T> \<Longrightarrow> (f has_integral (i S)) S"
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  5538
    and neg: "pairwise (\<lambda>S S'. negligible (S \<inter> S')) \<T>"
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5539
  shows "(f has_integral (sum i \<T>)) (\<Union>\<T>)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5540
proof -
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5541
  let ?\<U> = "((\<lambda>(a,b). a \<inter> b) ` {(a,b). a \<in> \<T> \<and> b \<in> {y. y \<in> \<T> \<and> a \<noteq> y}})"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5542
  have "((\<lambda>x. if x \<in> \<Union>\<T> then f x else 0) has_integral sum i \<T>) UNIV"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5543
  proof (rule has_integral_spike)
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5544
    show "negligible (\<Union>?\<U>)"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5545
    proof (rule negligible_Union)
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5546
      have "finite (\<T> \<times> \<T>)"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5547
        by (simp add: \<T>)
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5548
      moreover have "{(a, b). a \<in> \<T> \<and> b \<in> {y \<in> \<T>. a \<noteq> y}} \<subseteq> \<T> \<times> \<T>"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5549
        by auto
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5550
      ultimately show "finite ?\<U>"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5551
        by (blast intro: finite_subset[of _ "\<T> \<times> \<T>"])
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5552
      show "\<And>t. t \<in> ?\<U> \<Longrightarrow> negligible t"
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  5553
        using neg unfolding pairwise_def by auto
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5554
    qed
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5555
  next
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5556
    show "(if x \<in> \<Union>\<T> then f x else 0) = (\<Sum>A\<in>\<T>. if x \<in> A then f x else 0)"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5557
      if "x \<in> UNIV - (\<Union>?\<U>)" for x
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5558
    proof clarsimp
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5559
      fix S assume "S \<in> \<T>" "x \<in> S"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5560
      moreover then have "\<forall>b\<in>\<T>. x \<in> b \<longleftrightarrow> b = S"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5561
        using that by blast
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5562
      ultimately show "f x = (\<Sum>A\<in>\<T>. if x \<in> A then f x else 0)"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5563
        by (simp add: sum.delta[OF \<T>])
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  5564
    qed
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5565
  next
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5566
    show "((\<lambda>x. \<Sum>A\<in>\<T>. if x \<in> A then f x else 0) has_integral (\<Sum>A\<in>\<T>. i A)) UNIV"
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5567
      apply (rule has_integral_sum [OF \<T>])
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5568
      using int by (simp add: has_integral_restrict_UNIV)
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5569
  qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5570
  then show ?thesis
66560
116f658195af unscrambled has_integral_Union
paulson <lp15@cam.ac.uk>
parents: 66552
diff changeset
  5571
    using has_integral_restrict_UNIV by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5572
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5573
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5574
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5575
text \<open>In particular adding integrals over a division, maybe not of an interval.\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5576
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5577
lemma has_integral_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5578
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5579
  assumes "\<D> division_of S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5580
    and "\<And>k. k \<in> \<D> \<Longrightarrow> (f has_integral (i k)) k"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5581
  shows "(f has_integral (sum i \<D>)) S"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5582
proof -
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5583
  note \<D> = division_ofD[OF assms(1)]
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5584
  have neg: "negligible (S \<inter> s')" if "S \<in> \<D>" "s' \<in> \<D>" "S \<noteq> s'" for S s'
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5585
  proof -
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5586
    obtain a c b \<D> where obt: "S = cbox a b" "s' = cbox c \<D>"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5587
      by (meson \<open>S \<in> \<D>\<close> \<open>s' \<in> \<D>\<close> \<D>(4))
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5588
    from \<D>(5)[OF that] show ?thesis
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5589
      unfolding obt interior_cbox
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5590
      by (metis (no_types, lifting) Diff_empty Int_interval box_Int_box negligible_frontier_interval)
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5591
  qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5592
  show ?thesis
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5593
    unfolding \<D>(6)[symmetric]
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  5594
    by (auto intro: \<D> neg assms has_integral_Union pairwiseI)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5595
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5596
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5597
lemma integral_combine_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5598
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5599
  assumes "\<D> division_of S" "\<And>k. k \<in> \<D> \<Longrightarrow> f integrable_on k"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5600
  shows "integral S f = sum (\<lambda>i. integral i f) \<D>"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5601
  apply (rule integral_unique)
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5602
  by (meson assms has_integral_combine_division has_integral_integrable_integral)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5603
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5604
lemma has_integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5605
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5606
  assumes f: "f integrable_on S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5607
    and \<D>: "\<D> division_of K"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5608
    and "K \<subseteq> S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5609
  shows "(f has_integral (sum (\<lambda>i. integral i f) \<D>)) K"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5610
proof -
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5611
  have "f integrable_on L" if "L \<in> \<D>" for L
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5612
  proof -
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5613
    have "L \<subseteq> S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5614
      using \<open>K \<subseteq> S\<close> \<D> that by blast
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5615
    then show "f integrable_on L"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5616
      using that by (metis (no_types) f \<D> division_ofD(4) integrable_on_subcbox)
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5617
  qed
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5618
  then show ?thesis
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5619
    by (meson \<D> has_integral_combine_division has_integral_integrable_integral)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5620
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5621
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5622
lemma integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5623
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5624
  assumes "f integrable_on S"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5625
    and "\<D> division_of S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5626
  shows "integral S f = sum (\<lambda>i. integral i f) \<D>"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5627
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5628
  apply (rule has_integral_combine_division_topdown)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5629
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5630
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5631
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5632
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5633
lemma integrable_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5634
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5635
  assumes \<D>: "\<D> division_of S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5636
    and f: "\<And>i. i \<in> \<D> \<Longrightarrow> f integrable_on i"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5637
  shows "f integrable_on S"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5638
  using f unfolding integrable_on_def by (metis has_integral_combine_division[OF \<D>])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5639
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5640
lemma integrable_on_subdivision:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5641
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5642
  assumes \<D>: "\<D> division_of i"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5643
    and f: "f integrable_on S"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5644
    and "i \<subseteq> S"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5645
  shows "f integrable_on i"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5646
proof -
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5647
  have "f integrable_on i" if "i \<in> \<D>" for i
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5648
proof -
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5649
  have "i \<subseteq> S"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5650
    using assms that by auto
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5651
  then show "f integrable_on i"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5652
    using that by (metis (no_types) \<D> f division_ofD(4) integrable_on_subcbox)
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5653
qed
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5654
  then show ?thesis
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5655
    using \<D> integrable_combine_division by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5656
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5657
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5658
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5659
subsection \<open>Also tagged divisions\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5660
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5661
lemma has_integral_combine_tagged_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5662
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5663
  assumes "p tagged_division_of S"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5664
    and "\<forall>(x,k) \<in> p. (f has_integral (i k)) k"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5665
  shows "(f has_integral (\<Sum>(x,k)\<in>p. i k)) S"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5666
proof -
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5667
  have *: "(f has_integral (\<Sum>k\<in>snd`p. integral k f)) S"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5668
    using assms(2)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5669
    apply (intro has_integral_combine_division)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5670
    apply (auto simp: has_integral_integral[symmetric] intro: division_of_tagged_division[OF assms(1)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5671
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5672
    done
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5673
  also have "(\<Sum>k\<in>snd`p. integral k f) = (\<Sum>(x, k)\<in>p. integral k f)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5674
    by (intro sum.over_tagged_division_lemma[OF assms(1), symmetric] integral_null)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5675
       (simp add: content_eq_0_interior)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5676
  finally show ?thesis
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5677
    using assms by (auto simp add: has_integral_iff intro!: sum.cong)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5678
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5679
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5680
lemma integral_combine_tagged_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5681
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5682
  assumes "p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5683
    and "\<forall>(x,k)\<in>p. f integrable_on k"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5684
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5685
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5686
  apply (rule has_integral_combine_tagged_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5687
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5688
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5689
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5690
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5691
lemma has_integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5692
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5693
  assumes f: "f integrable_on cbox a b"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5694
    and p: "p tagged_division_of (cbox a b)"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5695
  shows "(f has_integral (sum (\<lambda>(x,K). integral K f) p)) (cbox a b)"
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5696
proof -
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5697
  have "(f has_integral integral K f) K" if "(x,K) \<in> p" for x K
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5698
    by (metis assms integrable_integral integrable_on_subcbox tagged_division_ofD(3,4) that)
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5699
  then show ?thesis
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5700
    by (metis assms case_prodI2 has_integral_integrable_integral integral_combine_tagged_division_bottomup)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5701
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5702
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5703
lemma integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5704
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5705
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5706
    and "p tagged_division_of (cbox a b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5707
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
66561
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5708
  apply (rule integral_unique [OF has_integral_combine_tagged_division_topdown])
8f12f7e0d997 eliminated some goal_cases
paulson <lp15@cam.ac.uk>
parents: 66560
diff changeset
  5709
  using assms apply auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5710
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5711
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5712
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5713
subsection \<open>Henstock's lemma\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5714
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5715
lemma Henstock_lemma_part1:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5716
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5717
  assumes intf: "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5718
    and "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5719
    and "gauge d"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5720
    and less_e: "\<And>p. \<lbrakk>p tagged_division_of (cbox a b); d fine p\<rbrakk> \<Longrightarrow>
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5721
                     norm (sum (\<lambda>(x,K). content K *\<^sub>R f x) p - integral(cbox a b) f) < e"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5722
    and p: "p tagged_partial_division_of (cbox a b)" "d fine p"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5723
  shows "norm (sum (\<lambda>(x,K). content K *\<^sub>R f x - integral K f) p) \<le> e" (is "?lhs \<le> e")
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  5724
proof (rule field_le_epsilon)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5725
  fix k :: real
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5726
  assume "k > 0"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5727
  let ?SUM = "\<lambda>p. (\<Sum>(x,K) \<in> p. content K *\<^sub>R f x)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5728
  note p' = tagged_partial_division_ofD[OF p(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5729
  have "\<Union>(snd ` p) \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5730
    using p'(3) by fastforce
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5731
  then obtain q where q: "snd ` p \<subseteq> q" and qdiv: "q division_of cbox a b"
66512
89b6455b63b6 starting to unscramble bounded_variation_absolutely_integrable_interval
paulson <lp15@cam.ac.uk>
parents: 66508
diff changeset
  5732
    by (meson p(1) partial_division_extend_interval partial_division_of_tagged_division)
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5733
  note q' = division_ofD[OF qdiv]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5734
  define r where "r = q - snd ` p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5735
  have "snd ` p \<inter> r = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5736
    unfolding r_def by auto
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5737
  have "finite r"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5738
    using q' unfolding r_def by auto
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5739
  have "\<exists>p. p tagged_division_of i \<and> d fine p \<and>
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5740
        norm (?SUM p - integral i f) < k / (real (card r) + 1)"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5741
    if "i\<in>r" for i
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5742
  proof -
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5743
    have gt0: "k / (real (card r) + 1) > 0" using \<open>k > 0\<close> by simp
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5744
    have i: "i \<in> q"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5745
      using that unfolding r_def by auto
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5746
    then obtain u v where uv: "i = cbox u v"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5747
      using q'(4) by blast
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5748
    then have "cbox u v \<subseteq> cbox a b"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5749
      using i q'(2) by auto  
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5750
    then have "f integrable_on cbox u v"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5751
      by (rule integrable_subinterval[OF intf])
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5752
    with integrable_integral[OF this, unfolded has_integral[of f]]
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5753
    obtain dd where "gauge dd" and dd:
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5754
      "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox u v; dd fine \<D>\<rbrakk> \<Longrightarrow>
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5755
    norm (?SUM \<D> - integral (cbox u v) f) < k / (real (card r) + 1)"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5756
      using gt0 by auto
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5757
    with gauge_Int[OF \<open>gauge d\<close> \<open>gauge dd\<close>]
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5758
    obtain qq where qq: "qq tagged_division_of cbox u v" "(\<lambda>x. d x \<inter> dd x) fine qq"
66513
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5759
      using fine_division_exists by blast
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5760
    with dd[of qq]  show ?thesis
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5761
      by (auto simp: fine_Int uv)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5762
  qed
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5763
  then obtain qq where qq: "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i \<and>
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5764
      d fine qq i \<and> norm (?SUM (qq i) - integral i f) < k / (real (card r) + 1)"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5765
    by metis
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5766
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5767
  let ?p = "p \<union> \<Union>(qq ` r)"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5768
  have "norm (?SUM ?p - integral (cbox a b) f) < e"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5769
  proof (rule less_e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5770
    show "d fine ?p"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5771
      by (metis (mono_tags, hide_lams) qq fine_Un fine_Union imageE p(2))
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5772
    note ptag = tagged_partial_division_of_Union_self[OF p(1)]
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  5773
    have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5774
    proof (rule tagged_division_Un[OF ptag tagged_division_Union [OF \<open>finite r\<close>]])
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5775
      show "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5776
        using qq by auto
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5777
      show "\<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5778
        by (simp add: q'(5) r_def)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69064
diff changeset
  5779
      show "interior (\<Union>(snd ` p)) \<inter> interior (\<Union>r) = {}"
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5780
      proof (rule Int_interior_Union_intervals [OF \<open>finite r\<close>])
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69064
diff changeset
  5781
        show "open (interior (\<Union>(snd ` p)))"
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5782
          by blast
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5783
        show "\<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5784
          by (simp add: q'(4) r_def)
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5785
        have "finite (snd ` p)"
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5786
          by (simp add: p'(1))
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69064
diff changeset
  5787
        then show "\<And>T. T \<in> r \<Longrightarrow> interior (\<Union>(snd ` p)) \<inter> interior T = {}"
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5788
          apply (subst Int_commute)
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5789
          apply (rule Int_interior_Union_intervals)
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5790
          using r_def q'(5) q(1) apply auto
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5791
          by (simp add: p'(4))
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  5792
      qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5793
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5794
    moreover have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5795
      using qdiv q unfolding Union_Un_distrib[symmetric] r_def by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5796
    ultimately show "?p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5797
      by fastforce
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5798
  qed
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5799
  then have "norm (?SUM p + (?SUM (\<Union>(qq ` r))) - integral (cbox a b) f) < e"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5800
  proof (subst sum.union_inter_neutral[symmetric, OF \<open>finite p\<close>], safe)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5801
    show "content L *\<^sub>R f x = 0" if "(x, L) \<in> p" "(x, L) \<in> qq K" "K \<in> r" for x K L 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5802
    proof -
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5803
      obtain u v where uv: "L = cbox u v"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5804
        using \<open>(x,L) \<in> p\<close> p'(4) by blast
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5805
      have "L \<subseteq> K"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5806
        using  qq[OF that(3)] tagged_division_ofD(3) \<open>(x,L) \<in> qq K\<close> by metis
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5807
      have "L \<in> snd ` p" 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5808
        using \<open>(x,L) \<in> p\<close> image_iff by fastforce 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5809
      then have "L \<in> q" "K \<in> q" "L \<noteq> K"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5810
        using that(1,3) q(1) unfolding r_def by auto
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5811
      with q'(5) have "interior L = {}"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5812
        using interior_mono[OF \<open>L \<subseteq> K\<close>] by blast
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5813
      then show "content L *\<^sub>R f x = 0"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5814
        unfolding uv content_eq_0_interior[symmetric] by auto
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5815
    qed
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69064
diff changeset
  5816
    show "finite (\<Union>(qq ` r))"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5817
      by (meson finite_UN qq \<open>finite r\<close> tagged_division_of_finite)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5818
  qed
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5819
  moreover have "content M *\<^sub>R f x = 0" 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5820
      if x: "(x,M) \<in> qq K" "(x,M) \<in> qq L" and KL: "qq K \<noteq> qq L" and r: "K \<in> r" "L \<in> r"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5821
    for x M K L
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5822
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5823
    note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]]
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5824
    obtain u v where uv: "M = cbox u v"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5825
      using \<open>(x, M) \<in> qq L\<close> \<open>L \<in> r\<close> kl(2) by blast
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5826
    have empty: "interior (K \<inter> L) = {}"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5827
      by (metis DiffD1 interior_Int q'(5) r_def KL r)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5828
    have "interior M = {}"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5829
      by (metis (no_types, lifting) Int_assoc empty inf.absorb_iff2 interior_Int kl(1) subset_empty x r)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5830
    then show "content M *\<^sub>R f x = 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5831
      unfolding uv content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5832
      by auto
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5833
  qed 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5834
  ultimately have "norm (?SUM p + sum ?SUM (qq ` r) - integral (cbox a b) f) < e"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5835
    apply (subst (asm) sum.Union_comp)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5836
    using qq by (force simp: split_paired_all)+
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5837
  moreover have "content M *\<^sub>R f x = 0" 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5838
       if "K \<in> r" "L \<in> r" "K \<noteq> L" "qq K = qq L" "(x, M) \<in> qq K" for K L x M
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5839
    using tagged_division_ofD(6) qq that by (metis (no_types, lifting)) 
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5840
  ultimately have less_e: "norm (?SUM p + sum (?SUM \<circ> qq) r - integral (cbox a b) f) < e"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5841
    apply (subst (asm) sum.reindex_nontrivial [OF \<open>finite r\<close>])
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5842
     apply (auto simp: split_paired_all sum.neutral)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5843
    done
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5844
  have norm_le: "norm (cp - ip) \<le> e + k"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5845
                  if "norm ((cp + cr) - i) < e" "norm (cr - ir) < k" "ip + ir = i"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5846
                  for ir ip i cr cp::'a
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5847
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5848
    from that show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5849
      using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5850
      unfolding that(3)[symmetric] norm_minus_cancel
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5851
      by (auto simp add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5852
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5853
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5854
  have "?lhs =  norm (?SUM p - (\<Sum>(x, k)\<in>p. integral k f))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5855
    unfolding split_def sum_subtractf ..
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5856
  also have "\<dots> \<le> e + k"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5857
  proof (rule norm_le[OF less_e])
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5858
    have lessk: "k * real (card r) / (1 + real (card r)) < k"
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5859
      using \<open>k>0\<close> by (auto simp add: field_simps)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5860
    have "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))"
66513
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5861
      unfolding sum_subtractf[symmetric] by (force dest: qq intro!: sum_norm_le)
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5862
    also have "... < k"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5863
      by (simp add: lessk add.commute mult.commute)
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5864
    finally show "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k" .
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5865
  next
66513
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5866
    from q(1) have [simp]: "snd ` p \<union> q = q" by auto
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5867
    have "integral l f = 0"
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5868
      if inp: "(x, l) \<in> p" "(y, m) \<in> p" and ne: "(x, l) \<noteq> (y, m)" and "l = m" for x l y m
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5869
    proof -
66513
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5870
      obtain u v where uv: "l = cbox u v"
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5871
        using inp p'(4) by blast
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5872
      have "content (cbox u v) = 0"
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5873
        unfolding content_eq_0_interior using that p(1) uv by auto
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5874
      then show ?thesis
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5875
        using uv by blast
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5876
    qed
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5877
    then have "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)"
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5878
      apply (subst sum.reindex_nontrivial [OF \<open>finite p\<close>])
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5879
      unfolding split_paired_all split_def by auto
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5880
    then show "(\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f"
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5881
      unfolding integral_combine_division_topdown[OF intf qdiv] r_def
66513
ca8b18baf0e0 unscrambling esp of Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66512
diff changeset
  5882
      using q'(1) p'(1) sum.union_disjoint [of "snd ` p" "q - snd ` p", symmetric]
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5883
        by simp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5884
  qed
66518
5e65236e95aa unscrambled Henstock_lemma_part1
paulson <lp15@cam.ac.uk>
parents: 66513
diff changeset
  5885
  finally show "?lhs \<le> e + k" .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5886
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5887
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5888
lemma Henstock_lemma_part2:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5889
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5890
  assumes fed: "f integrable_on cbox a b" "e > 0" "gauge d"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5891
    and less_e: "\<And>\<D>. \<lbrakk>\<D> tagged_division_of (cbox a b); d fine \<D>\<rbrakk> \<Longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5892
                     norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) \<D> - integral (cbox a b) f) < e"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5893
    and tag: "p tagged_partial_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5894
    and "d fine p"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5895
  shows "sum (\<lambda>(x,k). norm (content k *\<^sub>R f x - integral k f)) p \<le> 2 * real (DIM('n)) * e"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5896
proof -
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5897
  have "finite p"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5898
    using tag by blast
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5899
  then show ?thesis
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5900
    unfolding split_def
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5901
  proof (rule sum_norm_allsubsets_bound)
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5902
    fix Q
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5903
    assume Q: "Q \<subseteq> p"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5904
    then have fine: "d fine Q"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5905
      by (simp add: \<open>d fine p\<close> fine_subset)
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5906
    show "norm (\<Sum>x\<in>Q. content (snd x) *\<^sub>R f (fst x) - integral (snd x) f) \<le> e"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5907
      apply (rule Henstock_lemma_part1[OF fed less_e, unfolded split_def])
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5908
      using Q tag tagged_partial_division_subset apply (force simp add: fine)+
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5909
      done
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5910
  qed
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5911
qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5912
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5913
lemma Henstock_lemma:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5914
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5915
  assumes intf: "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5916
    and "e > 0"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5917
  obtains \<gamma> where "gauge \<gamma>"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5918
    and "\<And>p. \<lbrakk>p tagged_partial_division_of (cbox a b); \<gamma> fine p\<rbrakk> \<Longrightarrow>
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5919
             sum (\<lambda>(x,k). norm(content k *\<^sub>R f x - integral k f)) p < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5920
proof -
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  5921
  have *: "e/(2 * (real DIM('n) + 1)) > 0" using \<open>e > 0\<close> by simp
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5922
  with integrable_integral[OF intf, unfolded has_integral]
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5923
  obtain \<gamma> where "gauge \<gamma>"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5924
    and \<gamma>: "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5925
         norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f x) - integral (cbox a b) f)
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  5926
         < e/(2 * (real DIM('n) + 1))"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5927
    by metis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5928
  show thesis
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5929
  proof (rule that [OF \<open>gauge \<gamma>\<close>])
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5930
    fix p
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5931
    assume p: "p tagged_partial_division_of cbox a b" "\<gamma> fine p"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5932
    have "(\<Sum>(x,K)\<in>p. norm (content K *\<^sub>R f x - integral K f)) 
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  5933
          \<le> 2 * real DIM('n) * (e/(2 * (real DIM('n) + 1)))"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  5934
      using Henstock_lemma_part2[OF intf * \<open>gauge \<gamma>\<close> \<gamma> p] by metis
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5935
    also have "... < e"
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5936
      using \<open>e > 0\<close> by (auto simp add: field_simps)
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5937
    finally
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  5938
    show "(\<Sum>(x,K)\<in>p. norm (content K *\<^sub>R f x - integral K f)) < e" .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5939
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5940
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5941
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5942
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5943
subsection \<open>Monotone convergence (bounded interval first)\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5944
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5945
lemma bounded_increasing_convergent:
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5946
  fixes f :: "nat \<Rightarrow> real"
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5947
  shows "\<lbrakk>bounded (range f); \<And>n. f n \<le> f (Suc n)\<rbrakk> \<Longrightarrow> \<exists>l. f \<longlonglongrightarrow> l"
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5948
  using Bseq_mono_convergent[of f] incseq_Suc_iff[of f]
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5949
  by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def)
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5950
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5951
lemma monotone_convergence_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5952
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5953
  assumes intf: "\<And>k. (f k) integrable_on cbox a b"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5954
    and le: "\<And>k x. x \<in> cbox a b \<Longrightarrow> (f k x) \<le> f (Suc k) x"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5955
    and fg: "\<And>x. x \<in> cbox a b \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5956
    and bou: "bounded (range (\<lambda>k. integral (cbox a b) (f k)))"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5957
  shows "g integrable_on cbox a b \<and> ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> integral (cbox a b) g) sequentially"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5958
proof (cases "content (cbox a b) = 0")
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5959
  case True then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5960
    by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5961
next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5962
  case False
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5963
  have fg1: "(f k x) \<le> (g x)" if x: "x \<in> cbox a b" for x k
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5964
  proof -
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5965
    have "\<forall>\<^sub>F j in sequentially. f k x \<le> f j x"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5966
      apply (rule eventually_sequentiallyI [of k])
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5967
      using le x apply (force intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5968
      done
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5969
    then show "f k x \<le> g x"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5970
      using tendsto_lowerbound [OF fg] x trivial_limit_sequentially by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5971
  qed
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5972
  have int_inc: "\<And>n. integral (cbox a b) (f n) \<le> integral (cbox a b) (f (Suc n))"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5973
    by (metis integral_le intf le)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5974
  then obtain i where i: "(\<lambda>k. integral (cbox a b) (f k)) \<longlonglongrightarrow> i"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5975
    using bounded_increasing_convergent bou by blast
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5976
  have "\<And>k. \<forall>\<^sub>F x in sequentially. integral (cbox a b) (f k) \<le> integral (cbox a b) (f x)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5977
    unfolding eventually_sequentially
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5978
    by (force intro: transitive_stepwise_le int_inc)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5979
  then have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5980
    using tendsto_le [OF trivial_limit_sequentially i] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5981
  have "(g has_integral i) (cbox a b)"
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  5982
    unfolding has_integral real_norm_def
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5983
  proof clarify
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5984
    fix e::real
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5985
    assume e: "e > 0"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5986
    have "\<And>k. (\<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of (cbox a b) \<and> \<gamma> fine \<D> \<longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5987
      abs ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f k x) - integral (cbox a b) (f k)) < e/2 ^ (k + 2)))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5988
      using intf e by (auto simp: has_integral_integral has_integral)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5989
    then obtain c where c: "\<And>x. gauge (c x)"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5990
          "\<And>x \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; c x fine \<D>\<rbrakk> \<Longrightarrow>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5991
              abs ((\<Sum>(u,K)\<in>\<D>. content K *\<^sub>R f x u) - integral (cbox a b) (f x))
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  5992
              < e/2 ^ (x + 2)"
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  5993
      by metis
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5994
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  5995
    have "\<exists>r. \<forall>k\<ge>r. 0 \<le> i - (integral (cbox a b) (f k)) \<and> i - (integral (cbox a b) (f k)) < e/4"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5996
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5997
      have "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5998
        using e by auto
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  5999
      show ?thesis
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6000
        using LIMSEQ_D [OF i \<open>e/4 > 0\<close>] i' by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6001
    qed
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6002
    then obtain r where r: "\<And>k. r \<le> k \<Longrightarrow> 0 \<le> i - integral (cbox a b) (f k)"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6003
                       "\<And>k. r \<le> k \<Longrightarrow> i - integral (cbox a b) (f k) < e/4" 
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6004
      by metis
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6005
    have "\<exists>n\<ge>r. \<forall>k\<ge>n. 0 \<le> (g x) - (f k x) \<and> (g x) - (f k x) < e/(4 * content(cbox a b))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6006
      if "x \<in> cbox a b" for x
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6007
    proof -
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6008
      have "e/(4 * content (cbox a b)) > 0"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
  6009
        by (simp add: False content_lt_nz e)
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6010
      with fg that LIMSEQ_D
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6011
      obtain N where "\<forall>n\<ge>N. norm (f n x - g x) < e/(4 * content (cbox a b))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6012
        by metis
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6013
      then show "\<exists>n\<ge>r.
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6014
            \<forall>k\<ge>n.
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6015
               0 \<le> g x - f k x \<and>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6016
               g x - f k x
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6017
               < e/(4 * content (cbox a b))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6018
        apply (rule_tac x="N + r" in exI)
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6019
        using fg1[OF that] apply (auto simp add: field_simps)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6020
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6021
    qed
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6022
    then obtain m where r_le_m: "\<And>x. x \<in> cbox a b \<Longrightarrow> r \<le> m x"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6023
       and m: "\<And>x k. \<lbrakk>x \<in> cbox a b; m x \<le> k\<rbrakk>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6024
                     \<Longrightarrow> 0 \<le> g x - f k x \<and> g x - f k x < e/(4 * content (cbox a b))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6025
      by metis
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6026
    define d where "d x = c (m x) x" for x
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6027
    show "\<exists>\<gamma>. gauge \<gamma> \<and>
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6028
             (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and>
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6029
                  \<gamma> fine \<D> \<longrightarrow> abs ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - i) < e)"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6030
    proof (rule exI, safe)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6031
      show "gauge d"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6032
        using c(1) unfolding gauge_def d_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6033
    next
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6034
      fix \<D>
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6035
      assume ptag: "\<D> tagged_division_of (cbox a b)" and "d fine \<D>"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6036
      note p'=tagged_division_ofD[OF ptag]
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6037
      obtain s where s: "\<And>x. x \<in> \<D> \<Longrightarrow> m (fst x) \<le> s"
41851
96184364aa6f got rid of lemma upper_bound_finite_set
nipkow
parents: 41601
diff changeset
  6038
        by (metis finite_imageI finite_nat_set_iff_bounded_le p'(1) rev_image_eqI)
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6039
      have *: "\<bar>a - d\<bar> < e" if "\<bar>a - b\<bar> \<le> e/4" "\<bar>b - c\<bar> < e/2" "\<bar>c - d\<bar> < e/4" for a b c d
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6040
        using that norm_triangle_lt[of "a - b" "b - c" "3* e/4"]
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6041
          norm_triangle_lt[of "a - b + (b - c)" "c - d" e]
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6042
        by (auto simp add: algebra_simps)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6043
      show "\<bar>(\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R g x) - i\<bar> < e"
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6044
      proof (rule *)
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6045
        have "\<bar>(\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f (m x) x)\<bar> 
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6046
              \<le> (\<Sum>i\<in>\<D>. \<bar>(case i of (x, K) \<Rightarrow> content K *\<^sub>R g x) - (case i of (x, K) \<Rightarrow> content K *\<^sub>R f (m x) x)\<bar>)"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6047
          by (metis (mono_tags) sum_subtractf sum_abs) 
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6048
        also have "... \<le> (\<Sum>(x, k)\<in>\<D>. content k * (e/(4 * content (cbox a b))))"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6049
        proof (rule sum_mono, simp add: split_paired_all)
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6050
          fix x K
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6051
          assume xk: "(x,K) \<in> \<D>"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6052
          with ptag have x: "x \<in> cbox a b"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6053
            by blast
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6054
          then have "abs (content K * (g x - f (m x) x)) \<le> content K * (e/(4 * content (cbox a b)))"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6055
            by (metis m[OF x] mult_nonneg_nonneg abs_of_nonneg less_eq_real_def measure_nonneg mult_left_mono order_refl)
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  6056
          then show "\<bar>content K * g x - content K * f (m x) x\<bar> \<le> content K * e/(4 * content (cbox a b))"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6057
            by (simp add: algebra_simps)
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6058
        qed
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  6059
        also have "... = (e/(4 * content (cbox a b))) * (\<Sum>(x, k)\<in>\<D>. content k)"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6060
          by (simp add: sum_distrib_left sum_divide_distrib split_def mult.commute)
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6061
        also have "... \<le> e/4"
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6062
          by (metis False additive_content_tagged_division [OF ptag] nonzero_mult_divide_mult_cancel_right order_refl times_divide_eq_left)
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6063
        finally show "\<bar>(\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f (m x) x)\<bar> \<le> e/4" .
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6064
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6065
      next
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6066
        have "norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f (m x) x) - (\<Sum>(x,K)\<in>\<D>. integral K (f (m x))))
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6067
              \<le> norm (\<Sum>j = 0..s. \<Sum>(x,K)\<in>{xk \<in> \<D>. m (fst xk) = j}. content K *\<^sub>R f (m x) x - integral K (f (m x)))"
69510
0f31dd2e540d generalized to big sum
immler
parents: 69508
diff changeset
  6068
          apply (subst sum.group)
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6069
          using s by (auto simp: sum_subtractf split_def p'(1))
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6070
        also have "\<dots> < e/2"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6071
        proof -
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6072
          have "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> \<D>. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6073
                \<le> (\<Sum>i = 0..s. e/2 ^ (i + 2))"
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6074
          proof (rule sum_norm_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6075
            fix t
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6076
            assume "t \<in> {0..s}"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6077
            have "norm (\<Sum>(x,k)\<in>{xk \<in> \<D>. m (fst xk) = t}. content k *\<^sub>R f (m x) x - integral k (f (m x))) =
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6078
                  norm (\<Sum>(x,k)\<in>{xk \<in> \<D>. m (fst xk) = t}. content k *\<^sub>R f t x - integral k (f t))"
66437
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  6079
              by (force intro!: sum.cong arg_cong[where f=norm])
b868bb15edbe tidying up henstock_lemma
paulson <lp15@cam.ac.uk>
parents: 66429
diff changeset
  6080
            also have "... \<le> e/2 ^ (t + 2)"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6081
            proof (rule Henstock_lemma_part1 [OF intf])
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6082
              show "{xk \<in> \<D>. m (fst xk) = t} tagged_partial_division_of cbox a b"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6083
                apply (rule tagged_partial_division_subset[of \<D>])
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6084
                using ptag by (auto simp: tagged_division_of_def)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6085
              show "c t fine {xk \<in> \<D>. m (fst xk) = t}"
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6086
                using \<open>d fine \<D>\<close> by (auto simp: fine_def d_def)
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6087
            qed (use c e in auto)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6088
            finally show "norm (\<Sum>(x,K)\<in>{xk \<in> \<D>. m (fst xk) = t}. content K *\<^sub>R f (m x) x -
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6089
                                integral K (f (m x))) \<le> e/2 ^ (t + 2)" .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6090
          qed
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6091
          also have "... = (e/2/2) * (\<Sum>i = 0..s. (1/2) ^ i)"
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6092
            by (simp add: sum_distrib_left field_simps)
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6093
          also have "\<dots> < e/2"
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6094
            by (simp add: sum_gp mult_strict_left_mono[OF _ e])
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6095
          finally show "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> \<D>.
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6096
            m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x))) < e/2" .
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6097
        qed 
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6098
        finally show "\<bar>(\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f (m x) x) - (\<Sum>(x,K)\<in>\<D>. integral K (f (m x)))\<bar> < e/2"
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6099
          by simp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6100
      next
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6101
        have comb: "integral (cbox a b) (f y) = (\<Sum>(x, k)\<in>\<D>. integral k (f y))" for y
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6102
          using integral_combine_tagged_division_topdown[OF intf ptag] by metis
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6103
        have f_le: "\<And>y m n. \<lbrakk>y \<in> cbox a b; n\<ge>m\<rbrakk> \<Longrightarrow> f m y \<le> f n y"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6104
          using le by (auto intro: transitive_stepwise_le)        
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6105
        have "(\<Sum>(x, k)\<in>\<D>. integral k (f r)) \<le> (\<Sum>(x, K)\<in>\<D>. integral K (f (m x)))"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6106
        proof (rule sum_mono, simp add: split_paired_all)
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6107
          fix x K
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6108
          assume xK: "(x, K) \<in> \<D>"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6109
          show "integral K (f r) \<le> integral K (f (m x))"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6110
          proof (rule integral_le)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6111
            show "f r integrable_on K"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6112
              by (metis integrable_on_subcbox intf p'(3) p'(4) xK)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6113
            show "f (m x) integrable_on K"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6114
              by (metis elementary_interval integrable_on_subdivision intf p'(3) p'(4) xK)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6115
            show "f r y \<le> f (m x) y" if "y \<in> K" for y
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6116
              using that r_le_m[of x] p'(2-3)[OF xK] f_le by auto
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6117
          qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6118
        qed
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6119
        moreover have "(\<Sum>(x, K)\<in>\<D>. integral K (f (m x))) \<le> (\<Sum>(x, k)\<in>\<D>. integral k (f s))"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6120
        proof (rule sum_mono, simp add: split_paired_all)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6121
          fix x K
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6122
          assume xK: "(x, K) \<in> \<D>"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6123
          show "integral K (f (m x)) \<le> integral K (f s)"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6124
          proof (rule integral_le)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6125
            show "f (m x) integrable_on K"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6126
              by (metis elementary_interval integrable_on_subdivision intf p'(3) p'(4) xK)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6127
            show "f s integrable_on K"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6128
              by (metis integrable_on_subcbox intf p'(3) p'(4) xK)
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6129
            show "f (m x) y \<le> f s y" if "y \<in> K" for y
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6130
              using that s xK f_le p'(3) by fastforce
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6131
          qed
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6132
        qed
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  6133
        moreover have "0 \<le> i - integral (cbox a b) (f r)" "i - integral (cbox a b) (f r) < e/4"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6134
          using r by auto
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6135
        ultimately show "\<bar>(\<Sum>(x,K)\<in>\<D>. integral K (f (m x))) - i\<bar> < e/4"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6136
          using comb i'[of s] by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6137
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6138
    qed
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6139
  qed 
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6140
  with i integral_unique show ?thesis
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6141
    by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6142
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6143
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6144
lemma monotone_convergence_increasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6145
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6146
  assumes int_f: "\<And>k. (f k) integrable_on S"
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6147
    and "\<And>k x. x \<in> S \<Longrightarrow> (f k x) \<le> (f (Suc k) x)"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6148
    and fg: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6149
    and bou: "bounded (range (\<lambda>k. integral S (f k)))"
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6150
  shows "g integrable_on S \<and> ((\<lambda>k. integral S (f k)) \<longlongrightarrow> integral S g) sequentially"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6151
proof -
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6152
  have lem: "g integrable_on S \<and> ((\<lambda>k. integral S (f k)) \<longlongrightarrow> integral S g) sequentially"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6153
    if f0: "\<And>k x. x \<in> S \<Longrightarrow> 0 \<le> f k x"
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6154
    and int_f: "\<And>k. (f k) integrable_on S"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6155
    and le: "\<And>k x. x \<in> S \<Longrightarrow> f k x \<le> f (Suc k) x"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6156
    and lim: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6157
    and bou: "bounded (range(\<lambda>k. integral S (f k)))"
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6158
    for f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" and g S
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6159
  proof -
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6160
    have fg: "(f k x) \<le> (g x)" if "x \<in> S" for x k
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6161
      apply (rule tendsto_lowerbound [OF lim [OF that]])
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6162
      apply (rule eventually_sequentiallyI [of k])
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6163
      using le  by (force intro: transitive_stepwise_le that)+
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6164
    obtain i where i: "(\<lambda>k. integral S (f k)) \<longlonglongrightarrow> i"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6165
      using bounded_increasing_convergent [OF bou] le int_f integral_le by blast
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6166
    have i': "(integral S (f k)) \<le> i" for k
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6167
    proof -
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6168
      have "\<And>k. \<And>x. x \<in> S \<Longrightarrow> \<forall>n\<ge>k. f k x \<le> f n x"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6169
        using le  by (force intro: transitive_stepwise_le)
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6170
      then show ?thesis
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6171
        using tendsto_lowerbound [OF i eventually_sequentiallyI trivial_limit_sequentially]
66497
18a6478a574c More tidying, and renaming of theorems
paulson <lp15@cam.ac.uk>
parents: 66495
diff changeset
  6172
        by (meson int_f integral_le)
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6173
    qed
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6174
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6175
    let ?f = "(\<lambda>k x. if x \<in> S then f k x else 0)"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6176
    let ?g = "(\<lambda>x. if x \<in> S then g x else 0)"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6177
    have int: "?f k integrable_on cbox a b" for a b k
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6178
      by (simp add: int_f integrable_altD(1))
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6179
    have int': "\<And>k a b. f k integrable_on cbox a b \<inter> S"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6180
      using int by (simp add: Int_commute integrable_restrict_Int) 
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6181
    have g: "?g integrable_on cbox a b \<and>
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6182
             (\<lambda>k. integral (cbox a b) (?f k)) \<longlonglongrightarrow> integral (cbox a b) ?g" for a b
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6183
    proof (rule monotone_convergence_interval)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6184
      have "norm (integral (cbox a b) (?f k)) \<le> norm (integral S (f k))" for k
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6185
      proof -
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6186
        have "0 \<le> integral (cbox a b) (?f k)"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6187
          by (metis (no_types) integral_nonneg Int_iff f0 inf_commute integral_restrict_Int int')
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6188
        moreover have "0 \<le> integral S (f k)"
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6189
          by (simp add: integral_nonneg f0 int_f)
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6190
        moreover have "integral (S \<inter> cbox a b) (f k) \<le> integral S (f k)"
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6191
          by (metis f0 inf_commute int' int_f integral_subset_le le_inf_iff order_refl)
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6192
        ultimately show ?thesis
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6193
          by (simp add: integral_restrict_Int)
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6194
      qed
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6195
      moreover obtain B where "\<And>x. x \<in> range (\<lambda>k. integral S (f k)) \<Longrightarrow> norm x \<le> B"
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6196
        using bou unfolding bounded_iff by blast
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6197
      ultimately show "bounded (range (\<lambda>k. integral (cbox a b) (?f k)))"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6198
        unfolding bounded_iff by (blast intro: order_trans)
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6199
    qed (use int le lim in auto)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6200
    moreover have "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) ?g - i) < e"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6201
      if "0 < e" for e
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6202
    proof -
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6203
      have "e/4>0"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6204
        using that by auto
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6205
      with LIMSEQ_D [OF i] obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> norm (integral S (f n) - i) < e/4"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6206
        by metis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6207
      with int_f[of N, unfolded has_integral_integral has_integral_alt'[of "f N"]] 
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6208
      obtain B where "0 < B" and B: 
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6209
        "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> norm (integral (cbox a b) (?f N) - integral S (f N)) < e/4"
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6210
        by (meson \<open>0 < e/4\<close>)
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6211
      have "norm (integral (cbox a b) ?g - i) < e" if  ab: "ball 0 B \<subseteq> cbox a b" for a b
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6212
      proof -
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6213
        obtain M where M: "\<And>n. n \<ge> M \<Longrightarrow> abs (integral (cbox a b) (?f n) - integral (cbox a b) ?g) < e/2"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6214
          using \<open>e > 0\<close> g by (fastforce simp add: dest!: LIMSEQ_D [where r = "e/2"])
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6215
        have *: "\<And>\<alpha> \<beta> g. \<lbrakk>\<bar>\<alpha> - i\<bar> < e/2; \<bar>\<beta> - g\<bar> < e/2; \<alpha> \<le> \<beta>; \<beta> \<le> i\<rbrakk> \<Longrightarrow> \<bar>g - i\<bar> < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6216
          unfolding real_inner_1_right by arith
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6217
        show "norm (integral (cbox a b) ?g - i) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6218
          unfolding real_norm_def
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6219
        proof (rule *)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6220
          show "\<bar>integral (cbox a b) (?f N) - i\<bar> < e/2"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6221
          proof (rule abs_triangle_half_l)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  6222
            show "\<bar>integral (cbox a b) (?f N) - integral S (f N)\<bar> < e/2/2"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6223
              using B[OF ab] by simp
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  6224
            show "abs (i - integral S (f N)) < e/2/2"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6225
              using N by (simp add: abs_minus_commute)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6226
          qed
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  6227
          show "\<bar>integral (cbox a b) (?f (M + N)) - integral (cbox a b) ?g\<bar> < e/2"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6228
            by (metis le_add1 M[of "M + N"])
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6229
          show "integral (cbox a b) (?f N) \<le> integral (cbox a b) (?f (M + N))"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6230
          proof (intro ballI integral_le[OF int int])
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6231
            fix x assume "x \<in> cbox a b"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6232
            have "(f m x) \<le> (f n x)" if "x \<in> S" "n \<ge> m" for m n
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6233
              apply (rule transitive_stepwise_le [OF \<open>n \<ge> m\<close> order_refl])
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6234
              using dual_order.trans apply blast
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6235
              by (simp add: le \<open>x \<in> S\<close>)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6236
            then show "(?f N)x \<le> (?f (M+N))x"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6237
              by auto
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6238
          qed
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6239
          have "integral (cbox a b \<inter> S) (f (M + N)) \<le> integral S (f (M + N))"
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6240
            by (metis Int_lower1 f0 inf_commute int' int_f integral_subset_le)
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6241
          then have "integral (cbox a b) (?f (M + N)) \<le> integral S (f (M + N))"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6242
            by (metis (no_types) inf_commute integral_restrict_Int)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6243
          also have "... \<le> i"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6244
            using i'[of "M + N"] by auto
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6245
          finally show "integral (cbox a b) (?f (M + N)) \<le> i" .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6246
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6247
      qed
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6248
      then show ?thesis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6249
        using \<open>0 < B\<close> by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6250
    qed
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6251
    ultimately have "(g has_integral i) S"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6252
      unfolding has_integral_alt' by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6253
    then show ?thesis
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6254
      using has_integral_integrable_integral i integral_unique by metis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6255
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6256
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6257
  have sub: "\<And>k. integral S (\<lambda>x. f k x - f 0 x) = integral S (f k) - integral S (f 0)"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6258
    by (simp add: integral_diff int_f)
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  6259
  have *: "\<And>x m n. x \<in> S \<Longrightarrow> n\<ge>m \<Longrightarrow> f m x \<le> f n x"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6260
    using assms(2) by (force intro: transitive_stepwise_le)
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6261
  have gf: "(\<lambda>x. g x - f 0 x) integrable_on S \<and> ((\<lambda>k. integral S (\<lambda>x. f (Suc k) x - f 0 x)) \<longlongrightarrow>
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6262
    integral S (\<lambda>x. g x - f 0 x)) sequentially"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6263
  proof (rule lem)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6264
    show "\<And>k. (\<lambda>x. f (Suc k) x - f 0 x) integrable_on S"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6265
      by (simp add: integrable_diff int_f)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6266
    show "(\<lambda>k. f (Suc k) x - f 0 x) \<longlonglongrightarrow> g x - f 0 x" if "x \<in> S" for x
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6267
    proof -
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6268
      have "(\<lambda>n. f (Suc n) x) \<longlonglongrightarrow> g x"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6269
        using LIMSEQ_ignore_initial_segment[OF fg[OF \<open>x \<in> S\<close>], of 1] by simp
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6270
      then show ?thesis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6271
        by (simp add: tendsto_diff)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6272
    qed
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6273
    show "bounded (range (\<lambda>k. integral S (\<lambda>x. f (Suc k) x - f 0 x)))"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6274
    proof -
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6275
      obtain B where B: "\<And>k. norm (integral S (f k)) \<le> B"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6276
        using  bou by (auto simp: bounded_iff)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6277
      then have "norm (integral S (\<lambda>x. f (Suc k) x - f 0 x))
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6278
              \<le> B + norm (integral S (f 0))" for k
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6279
        unfolding sub by (meson add_le_cancel_right norm_triangle_le_diff)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6280
      then show ?thesis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6281
        unfolding bounded_iff by blast
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6282
    qed
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6283
  qed (use * in auto)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6284
  then have "(\<lambda>x. integral S (\<lambda>xa. f (Suc x) xa - f 0 xa) + integral S (f 0))
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6285
             \<longlonglongrightarrow> integral S (\<lambda>x. g x - f 0 x) + integral S (f 0)"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6286
    by (auto simp add: tendsto_add)
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6287
  moreover have "(\<lambda>x. g x - f 0 x + f 0 x) integrable_on S"
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6288
    using gf integrable_add int_f [of 0] by metis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6289
  ultimately show ?thesis
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6290
    by (simp add: integral_diff int_f LIMSEQ_imp_Suc sub)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6291
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6292
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6293
lemma has_integral_monotone_convergence_increasing:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6294
  fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow> real"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6295
  assumes f: "\<And>k. (f k has_integral x k) s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6296
  assumes "\<And>k x. x \<in> s \<Longrightarrow> f k x \<le> f (Suc k) x"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
  6297
  assumes "\<And>x. x \<in> s \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> g x"
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
  6298
  assumes "x \<longlonglongrightarrow> x'"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6299
  shows "(g has_integral x') s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6300
proof -
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6301
  have x_eq: "x = (\<lambda>i. integral s (f i))"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6302
    by (simp add: integral_unique[OF f])
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6303
  then have x: "range(\<lambda>k. integral s (f k)) = range x"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6304
    by auto
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63492
diff changeset
  6305
  have *: "g integrable_on s \<and> (\<lambda>k. integral s (f k)) \<longlonglongrightarrow> integral s g"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6306
  proof (intro monotone_convergence_increasing allI ballI assms)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6307
    show "bounded (range(\<lambda>k. integral s (f k)))"
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6308
      using x convergent_imp_bounded assms by metis
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6309
  qed (use f in auto)
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63492
diff changeset
  6310
  then have "integral s g = x'"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
  6311
    by (intro LIMSEQ_unique[OF _ \<open>x \<longlonglongrightarrow> x'\<close>]) (simp add: x_eq)
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63492
diff changeset
  6312
  with * show ?thesis
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6313
    by (simp add: has_integral_integral)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6314
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6315
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6316
lemma monotone_convergence_decreasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6317
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6318
  assumes intf: "\<And>k. (f k) integrable_on S"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6319
    and le: "\<And>k x. x \<in> S \<Longrightarrow> f (Suc k) x \<le> f k x"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6320
    and fg: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6321
    and bou: "bounded (range(\<lambda>k. integral S (f k)))"
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6322
  shows "g integrable_on S \<and> (\<lambda>k. integral S (f k)) \<longlonglongrightarrow> integral S g"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6323
proof -
69064
5840724b1d71 Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents: 68721
diff changeset
  6324
  have *: "range(\<lambda>k. integral S (\<lambda>x. - f k x)) = (*\<^sub>R) (- 1) ` (range(\<lambda>k. integral S (f k)))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6325
    by force
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6326
  have "(\<lambda>x. - g x) integrable_on S \<and> (\<lambda>k. integral S (\<lambda>x. - f k x)) \<longlonglongrightarrow> integral S (\<lambda>x. - g x)"
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6327
  proof (rule monotone_convergence_increasing)
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6328
    show "\<And>k. (\<lambda>x. - f k x) integrable_on S"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6329
      by (blast intro: integrable_neg intf)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6330
    show "\<And>k x. x \<in> S \<Longrightarrow> - f k x \<le> - f (Suc k) x"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6331
      by (simp add: le)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6332
    show "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>k. - f k x) \<longlonglongrightarrow> - g x"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6333
      by (simp add: fg tendsto_minus)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6334
    show "bounded (range(\<lambda>k. integral S (\<lambda>x. - f k x)))"
66429
beaeb40a1217 tackling another nightmare proof
paulson <lp15@cam.ac.uk>
parents: 66422
diff changeset
  6335
      using "*" bou bounded_scaling by auto
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6336
  qed
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6337
  then show ?thesis
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  6338
    by (force dest: integrable_neg tendsto_minus)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6339
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6340
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6341
lemma integral_norm_bound_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6342
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6343
  assumes int_f: "f integrable_on S"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6344
    and int_g: "g integrable_on S"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6345
    and le_g: "\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> g x"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6346
  shows "norm (integral S f) \<le> integral S g"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6347
proof -
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6348
  have norm: "norm \<eta> \<le> y + e"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6349
    if "norm \<zeta> \<le> x" and "\<bar>x - y\<bar> < e/2" and "norm (\<zeta> - \<eta>) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6350
    for e x y and \<zeta> \<eta> :: 'a
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6351
  proof -
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6352
    have "norm (\<eta> - \<zeta>) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6353
      by (metis norm_minus_commute that(3))
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6354
    moreover have "x \<le> y + e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6355
      using that(2) by linarith
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6356
    ultimately show ?thesis
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6357
      using that(1) le_less_trans[OF norm_triangle_sub[of \<eta> \<zeta>]] by (auto simp: less_imp_le)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6358
  qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6359
  have lem: "norm (integral(cbox a b) f) \<le> integral (cbox a b) g"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6360
    if f: "f integrable_on cbox a b"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6361
    and g: "g integrable_on cbox a b"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6362
    and nle: "\<And>x. x \<in> cbox a b \<Longrightarrow> norm (f x) \<le> g x"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6363
    for f :: "'n \<Rightarrow> 'a" and g a b
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6364
  proof (rule field_le_epsilon)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6365
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6366
    assume "e > 0"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6367
    then have e: "e/2 > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6368
      by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6369
    with integrable_integral[OF f,unfolded has_integral[of f]]
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6370
    obtain \<gamma> where \<gamma>: "gauge \<gamma>"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6371
              "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> 
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6372
           \<Longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - integral (cbox a b) f) < e/2"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6373
      by meson 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6374
    moreover
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6375
    from integrable_integral[OF g,unfolded has_integral[of g]] e
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6376
    obtain \<delta> where \<delta>: "gauge \<delta>"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6377
              "\<And>\<D>. \<D> tagged_division_of cbox a b \<and> \<delta> fine \<D> 
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6378
           \<Longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R g x) - integral (cbox a b) g) < e/2"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6379
      by meson
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6380
    ultimately have "gauge (\<lambda>x. \<gamma> x \<inter> \<delta> x)"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6381
      using gauge_Int by blast
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6382
    with fine_division_exists obtain \<D> 
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6383
      where p: "\<D> tagged_division_of cbox a b" "(\<lambda>x. \<gamma> x \<inter> \<delta> x) fine \<D>" 
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6384
      by metis
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6385
    have "\<gamma> fine \<D>" "\<delta> fine \<D>"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6386
      using fine_Int p(2) by blast+
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6387
    show "norm (integral (cbox a b) f) \<le> integral (cbox a b) g + e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6388
    proof (rule norm)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6389
      have "norm (content K *\<^sub>R f x) \<le> content K *\<^sub>R g x" if  "(x, K) \<in> \<D>" for x K
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6390
      proof-
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6391
        have K: "x \<in> K" "K \<subseteq> cbox a b"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6392
          using \<open>(x, K) \<in> \<D>\<close> p(1) by blast+
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6393
        obtain u v where  "K = cbox u v"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6394
          using \<open>(x, K) \<in> \<D>\<close> p(1) by blast
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6395
        moreover have "content K * norm (f x) \<le> content K * g x"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6396
          by (metis K subsetD dual_order.antisym measure_nonneg mult_zero_left nle not_le real_mult_le_cancel_iff2)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6397
        then show ?thesis
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6398
          by simp
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6399
      qed
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6400
      then show "norm (\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) \<le> (\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R g x)"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6401
        by (simp add: sum_norm_le split_def)
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6402
      show "norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - integral (cbox a b) f) < e/2"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6403
        using \<open>\<gamma> fine \<D>\<close> \<gamma> p(1) by simp
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6404
      show "\<bar>(\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R g x) - integral (cbox a b) g\<bar> < e/2"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  6405
        using \<open>\<delta> fine \<D>\<close> \<delta> p(1) by simp
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6406
    qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6407
  qed
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6408
  show ?thesis
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6409
  proof (rule field_le_epsilon)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6410
    fix e :: real
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6411
    assume "e > 0"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6412
    then have e: "e/2 > 0"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6413
      by auto
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6414
    let ?f = "(\<lambda>x. if x \<in> S then f x else 0)"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6415
    let ?g = "(\<lambda>x. if x \<in> S then g x else 0)"
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6416
    have f: "?f integrable_on cbox a b" and g: "?g integrable_on cbox a b" for a b
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6417
      using int_f int_g integrable_altD by auto
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6418
    obtain Bf where "0 < Bf"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6419
      and Bf: "\<And>a b. ball 0 Bf \<subseteq> cbox a b \<Longrightarrow>
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6420
        \<exists>z. (?f has_integral z) (cbox a b) \<and> norm (z - integral S f) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6421
      using integrable_integral [OF int_f,unfolded has_integral'[of f]] e that by blast
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6422
    obtain Bg where "0 < Bg"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6423
      and Bg: "\<And>a b. ball 0 Bg \<subseteq> cbox a b \<Longrightarrow>
66420
bc0dab0e7b40 further Hensock tidy-up
paulson <lp15@cam.ac.uk>
parents: 66409
diff changeset
  6424
        \<exists>z. (?g has_integral z) (cbox a b) \<and> norm (z - integral S g) < e/2"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6425
      using integrable_integral [OF int_g,unfolded has_integral'[of g]] e that by blast
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6426
    obtain a b::'n where ab: "ball 0 Bf \<union> ball 0 Bg \<subseteq> cbox a b"
68120
2f161c6910f7 tidying more messy proofs
paulson <lp15@cam.ac.uk>
parents: 68073
diff changeset
  6427
      using ball_max_Un  by (metis bounded_ball bounded_subset_cbox_symmetric)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6428
    have "ball 0 Bf \<subseteq> cbox a b"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6429
      using ab by auto
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6430
    with Bf obtain z where int_fz: "(?f has_integral z) (cbox a b)" and z: "norm (z - integral S f) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6431
      by meson
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6432
    have "ball 0 Bg \<subseteq> cbox a b"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6433
      using ab by auto
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6434
    with Bg obtain w where int_gw: "(?g has_integral w) (cbox a b)" and w: "norm (w - integral S g) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6435
      by meson
66503
7685861f337d more elimination of "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66498
diff changeset
  6436
    show "norm (integral S f) \<le> integral S g + e"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6437
    proof (rule norm)
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6438
      show "norm (integral (cbox a b) ?f) \<le> integral (cbox a b) ?g"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6439
        by (simp add: le_g lem[OF f g, of a b])
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6440
      show "\<bar>integral (cbox a b) ?g - integral S g\<bar> < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6441
        using int_gw integral_unique w by auto
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6442
      show "norm (integral (cbox a b) ?f - integral S f) < e/2"
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6443
        using int_fz integral_unique z by blast
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6444
    qed
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6445
  qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6446
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6447
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6448
lemma continuous_on_imp_absolutely_integrable_on:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6449
  fixes f::"real \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6450
  shows "continuous_on {a..b} f \<Longrightarrow>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6451
    norm (integral {a..b} f) \<le> integral {a..b} (\<lambda>x. norm (f x))"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6452
  by (intro integral_norm_bound_integral integrable_continuous_real continuous_on_norm) auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6453
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6454
lemma integral_bound:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6455
  fixes f::"real \<Rightarrow> 'a::banach"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6456
  assumes "a \<le> b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6457
  assumes "continuous_on {a .. b} f"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6458
  assumes "\<And>t. t \<in> {a .. b} \<Longrightarrow> norm (f t) \<le> B"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6459
  shows "norm (integral {a .. b} f) \<le> B * (b - a)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6460
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6461
  note continuous_on_imp_absolutely_integrable_on[OF assms(2)]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6462
  also have "integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6463
    by (rule integral_le)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6464
      (auto intro!: integrable_continuous_real continuous_intros assms)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6465
  also have "\<dots> = B * (b - a)" using assms by simp
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6466
  finally show ?thesis .
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67399
diff changeset
  6467
qed
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6468
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6469
lemma integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6470
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6471
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6472
  assumes f: "f integrable_on S" and g: "g integrable_on S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6473
    and fg: "\<And>x. x \<in> S \<Longrightarrow> norm(f x) \<le> (g x)\<bullet>k"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6474
  shows "norm (integral S f) \<le> (integral S g)\<bullet>k"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6475
proof -
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6476
  have "norm (integral S f) \<le> integral S ((\<lambda>x. x \<bullet> k) \<circ> g)"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6477
    apply (rule integral_norm_bound_integral[OF f integrable_linear[OF g]])
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6478
    apply (simp add: bounded_linear_inner_left)
66703
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6479
    apply (metis fg o_def)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6480
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6481
  then show ?thesis
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6482
    unfolding o_def integral_component_eq[OF g] .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6483
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6484
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6485
lemma has_integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6486
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6487
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6488
  assumes f: "(f has_integral i) S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6489
    and g: "(g has_integral j) S"
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6490
    and "\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> (g x)\<bullet>k"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6491
  shows "norm i \<le> j\<bullet>k"
66519
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6492
  using integral_norm_bound_integral_component[of f S g k] 
b757c1cc8868 Elimination of some "presume"
paulson <lp15@cam.ac.uk>
parents: 66518
diff changeset
  6493
  unfolding integral_unique[OF f] integral_unique[OF g]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6494
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6495
  by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6496
67371
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6497
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6498
lemma uniformly_convergent_improper_integral:
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6499
  fixes f :: "'b \<Rightarrow> real \<Rightarrow> 'a :: {banach}"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6500
  assumes deriv: "\<And>x. x \<ge> a \<Longrightarrow> (G has_field_derivative g x) (at x within {a..})"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6501
  assumes integrable: "\<And>a' b x. x \<in> A \<Longrightarrow> a' \<ge> a \<Longrightarrow> b \<ge> a' \<Longrightarrow> f x integrable_on {a'..b}"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6502
  assumes G: "convergent G"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6503
  assumes le: "\<And>y x. y \<in> A \<Longrightarrow> x \<ge> a \<Longrightarrow> norm (f y x) \<le> g x"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6504
  shows   "uniformly_convergent_on A (\<lambda>b x. integral {a..b} (f x))"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6505
proof (intro Cauchy_uniformly_convergent uniformly_Cauchy_onI', goal_cases)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6506
  case (1 \<epsilon>)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6507
  from G have "Cauchy G"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6508
    by (auto intro!: convergent_Cauchy)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6509
  with 1 obtain M where M: "dist (G (real m)) (G (real n)) < \<epsilon>" if "m \<ge> M" "n \<ge> M" for m n
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6510
    by (force simp: Cauchy_def)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6511
  define M' where "M' = max (nat \<lceil>a\<rceil>) M"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6512
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6513
  show ?case
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6514
  proof (rule exI[of _ M'], safe, goal_cases)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6515
    case (1 x m n)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6516
    have M': "M' \<ge> a" "M' \<ge> M" unfolding M'_def by linarith+
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6517
    have int_g: "(g has_integral (G (real n) - G (real m))) {real m..real n}"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6518
      using 1 M' by (intro fundamental_theorem_of_calculus) 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6519
                    (auto simp: has_field_derivative_iff_has_vector_derivative [symmetric] 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6520
                          intro!: DERIV_subset[OF deriv])
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6521
    have int_f: "f x integrable_on {a'..real n}" if "a' \<ge> a" for a'
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6522
      using that 1 by (cases "a' \<le> real n") (auto intro: integrable)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6523
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6524
    have "dist (integral {a..real m} (f x)) (integral {a..real n} (f x)) =
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6525
            norm (integral {a..real n} (f x) - integral {a..real m} (f x))"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6526
      by (simp add: dist_norm norm_minus_commute)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6527
    also have "integral {a..real m} (f x) + integral {real m..real n} (f x) = 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6528
                 integral {a..real n} (f x)"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6529
      using M' and 1 by (intro integral_combine int_f) auto
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6530
    hence "integral {a..real n} (f x) - integral {a..real m} (f x) = 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6531
             integral {real m..real n} (f x)"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6532
      by (simp add: algebra_simps)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6533
    also have "norm \<dots> \<le> integral {real m..real n} g"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6534
      using le 1 M' int_f int_g by (intro integral_norm_bound_integral) auto 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6535
    also from int_g have "integral {real m..real n} g = G (real n) - G (real m)"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6536
      by (simp add: has_integral_iff)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6537
    also have "\<dots> \<le> dist (G m) (G n)" 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6538
      by (simp add: dist_norm)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6539
    also from 1 and M' have "\<dots> < \<epsilon>"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6540
      by (intro M) auto
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6541
    finally show ?case .
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6542
  qed
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6543
qed
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6544
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6545
lemma uniformly_convergent_improper_integral':
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6546
  fixes f :: "'b \<Rightarrow> real \<Rightarrow> 'a :: {banach, real_normed_algebra}"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6547
  assumes deriv: "\<And>x. x \<ge> a \<Longrightarrow> (G has_field_derivative g x) (at x within {a..})"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6548
  assumes integrable: "\<And>a' b x. x \<in> A \<Longrightarrow> a' \<ge> a \<Longrightarrow> b \<ge> a' \<Longrightarrow> f x integrable_on {a'..b}"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6549
  assumes G: "convergent G"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6550
  assumes le: "eventually (\<lambda>x. \<forall>y\<in>A. norm (f y x) \<le> g x) at_top"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6551
  shows   "uniformly_convergent_on A (\<lambda>b x. integral {a..b} (f x))"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6552
proof -
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6553
  from le obtain a'' where le: "\<And>y x. y \<in> A \<Longrightarrow> x \<ge> a'' \<Longrightarrow> norm (f y x) \<le> g x"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6554
    by (auto simp: eventually_at_top_linorder)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6555
  define a' where "a' = max a a''"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6556
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6557
  have "uniformly_convergent_on A (\<lambda>b x. integral {a'..real b} (f x))"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6558
  proof (rule uniformly_convergent_improper_integral)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6559
    fix t assume t: "t \<ge> a'"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6560
    hence "(G has_field_derivative g t) (at t within {a..})"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6561
      by (intro deriv) (auto simp: a'_def)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6562
    moreover have "{a'..} \<subseteq> {a..}" unfolding a'_def by auto
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6563
    ultimately show "(G has_field_derivative g t) (at t within {a'..})"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6564
      by (rule DERIV_subset)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6565
  qed (insert le, auto simp: a'_def intro: integrable G)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6566
  hence "uniformly_convergent_on A (\<lambda>b x. integral {a..a'} (f x) + integral {a'..real b} (f x))" 
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6567
    (is ?P) by (intro uniformly_convergent_add) auto
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6568
  also have "eventually (\<lambda>x. \<forall>y\<in>A. integral {a..a'} (f y) + integral {a'..x} (f y) =
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6569
                   integral {a..x} (f y)) sequentially"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6570
    by (intro eventually_mono [OF eventually_ge_at_top[of "nat \<lceil>a'\<rceil>"]] ballI integral_combine)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6571
       (auto simp: a'_def intro: integrable)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6572
  hence "?P \<longleftrightarrow> ?thesis"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6573
    by (intro uniformly_convergent_cong) simp_all
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6574
  finally show ?thesis .
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6575
qed
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6576
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6577
subsection \<open>differentiation under the integral sign\<close>
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6578
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6579
lemma integral_continuous_on_param:
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6580
  fixes f::"'a::topological_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6581
  assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). f x t)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6582
  shows "continuous_on U (\<lambda>x. integral (cbox a b) (f x))"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6583
proof cases
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6584
  assume "content (cbox a b) \<noteq> 0"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6585
  then have ne: "cbox a b \<noteq> {}" by auto
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6586
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6587
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6588
    continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6589
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6590
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6591
  show ?thesis
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6592
    unfolding continuous_on_def
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6593
  proof (safe intro!: tendstoI)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6594
    fix e'::real and x
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6595
    assume "e' > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6596
    define e where "e = e' / (content (cbox a b) + 1)"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6597
    have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6598
    assume "x \<in> U"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6599
    from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x \<in> U\<close> \<open>0 < e\<close>]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6600
    obtain X0 where X0: "x \<in> X0" "open X0"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6601
      and fx_bound: "\<And>y t. y \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (f y t - f x t) \<le> e"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6602
      unfolding split_beta fst_conv snd_conv dist_norm
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6603
      by metis
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6604
    have "\<forall>\<^sub>F y in at x within U. y \<in> X0 \<inter> U"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6605
      using X0(1) X0(2) eventually_at_topological by auto
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6606
    then show "\<forall>\<^sub>F y in at x within U. dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6607
    proof eventually_elim
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6608
      case (elim y)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6609
      have "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6610
        norm (integral (cbox a b) (\<lambda>t. f y t - f x t))"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6611
        using elim \<open>x \<in> U\<close>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6612
        unfolding dist_norm
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6613
        by (subst integral_diff)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6614
           (auto intro!: integrable_continuous continuous_intros)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6615
      also have "\<dots> \<le> e * content (cbox a b)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6616
        using elim \<open>x \<in> U\<close>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6617
        by (intro integrable_bound)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6618
           (auto intro!: fx_bound \<open>x \<in> U \<close> less_imp_le[OF \<open>0 < e\<close>]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6619
              integrable_continuous continuous_intros)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6620
      also have "\<dots> < e'"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6621
        using \<open>0 < e'\<close> \<open>e > 0\<close>
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  6622
        by (auto simp: e_def field_split_simps)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6623
      finally show "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'" .
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6624
    qed
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6625
  qed
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6626
qed (auto intro!: continuous_on_const)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6627
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6628
lemma leibniz_rule:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6629
  fixes f::"'a::banach \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6630
  assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6631
    ((\<lambda>x. f x t) has_derivative blinfun_apply (fx x t)) (at x within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6632
  assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> f x integrable_on cbox a b"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6633
  assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6634
  assumes [intro]: "x0 \<in> U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6635
  assumes "convex U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6636
  shows
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6637
    "((\<lambda>x. integral (cbox a b) (f x)) has_derivative integral (cbox a b) (fx x0)) (at x0 within U)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6638
    (is "(?F has_derivative ?dF) _")
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6639
proof cases
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6640
  assume "content (cbox a b) \<noteq> 0"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6641
  then have ne: "cbox a b \<noteq> {}" by auto
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6642
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6643
    continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6644
      unfolded split_beta fst_conv snd_conv]
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6645
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6646
  proof (intro has_derivativeI bounded_linear_scaleR_left tendstoI, fold norm_conv_dist)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6647
    have cont_f1: "\<And>t. t \<in> cbox a b \<Longrightarrow> continuous_on U (\<lambda>x. f x t)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6648
      by (auto simp: continuous_on_eq_continuous_within intro!: has_derivative_continuous fx)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6649
    note [continuous_intros] = continuous_on_compose2[OF cont_f1]
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6650
    fix e'::real
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6651
    assume "e' > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6652
    define e where "e = e' / (content (cbox a b) + 1)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6653
    have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6654
    from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x0 \<in> U\<close> \<open>e > 0\<close>]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6655
    obtain X0 where X0: "x0 \<in> X0" "open X0"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6656
      and fx_bound: "\<And>x t. x \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (fx x t - fx x0 t) \<le> e"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6657
      unfolding split_beta fst_conv snd_conv
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6658
      by (metis dist_norm)
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6659
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6660
    note eventually_closed_segment[OF \<open>open X0\<close> \<open>x0 \<in> X0\<close>, of U]
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6661
    moreover
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6662
    have "\<forall>\<^sub>F x in at x0 within U. x \<in> X0"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6663
      using \<open>open X0\<close> \<open>x0 \<in> X0\<close> eventually_at_topological by blast
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6664
    moreover have "\<forall>\<^sub>F x in at x0 within U. x \<noteq> x0"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6665
      by (auto simp: eventually_at_filter)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6666
    moreover have "\<forall>\<^sub>F x in at x0 within U. x \<in> U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6667
      by (auto simp: eventually_at_filter)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6668
    ultimately
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6669
    show "\<forall>\<^sub>F x in at x0 within U. norm ((?F x - ?F x0 - ?dF (x - x0)) /\<^sub>R norm (x - x0)) < e'"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6670
    proof eventually_elim
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6671
      case (elim x)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6672
      from elim have "0 < norm (x - x0)" by simp
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6673
      have "closed_segment x0 x \<subseteq> U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6674
        by (rule \<open>convex U\<close>[unfolded convex_contains_segment, rule_format, OF \<open>x0 \<in> U\<close> \<open>x \<in> U\<close>])
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6675
      from elim have [intro]: "x \<in> U" by auto
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6676
      have "?F x - ?F x0 - ?dF (x - x0) =
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6677
        integral (cbox a b) (\<lambda>y. f x y - f x0 y - fx x0 y (x - x0))"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6678
        (is "_ = ?id")
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6679
        using \<open>x \<noteq> x0\<close>
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6680
        by (subst blinfun_apply_integral integral_diff,
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6681
            auto intro!: integrable_diff integrable_f2 continuous_intros
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6682
              intro: integrable_continuous)+
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6683
      also
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6684
      {
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6685
        fix t assume t: "t \<in> (cbox a b)"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6686
        have seg: "\<And>t. t \<in> {0..1} \<Longrightarrow> x0 + t *\<^sub>R (x - x0) \<in> X0 \<inter> U"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6687
          using \<open>closed_segment x0 x \<subseteq> U\<close>
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6688
            \<open>closed_segment x0 x \<subseteq> X0\<close>
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6689
          by (force simp: closed_segment_def algebra_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6690
        from t have deriv:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6691
          "((\<lambda>x. f x t) has_derivative (fx y t)) (at y within X0 \<inter> U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6692
          if "y \<in> X0 \<inter> U" for y
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6693
          unfolding has_vector_derivative_def[symmetric]
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6694
          using that \<open>x \<in> X0\<close>
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6695
          by (intro has_derivative_within_subset[OF fx]) auto
68239
0764ee22a4d1 tidy up of Derivative
paulson <lp15@cam.ac.uk>
parents: 68120
diff changeset
  6696
        have "\<And>x. x \<in> X0 \<inter> U \<Longrightarrow> onorm (blinfun_apply (fx x t) - (fx x0 t)) \<le> e"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6697
          using fx_bound t
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6698
          by (auto simp add: norm_blinfun_def fun_diff_def blinfun.bilinear_simps[symmetric])
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6699
        from differentiable_bound_linearization[OF seg deriv this] X0
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6700
        have "norm (f x t - f x0 t - fx x0 t (x - x0)) \<le> e * norm (x - x0)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6701
          by (auto simp add: ac_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6702
      }
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6703
      then have "norm ?id \<le> integral (cbox a b) (\<lambda>_. e * norm (x - x0))"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6704
        by (intro integral_norm_bound_integral)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6705
          (auto intro!: continuous_intros integrable_diff integrable_f2
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6706
            intro: integrable_continuous)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6707
      also have "\<dots> = content (cbox a b) * e * norm (x - x0)"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6708
        by simp
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6709
      also have "\<dots> < e' * norm (x - x0)"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
  6710
        using \<open>e' > 0\<close>
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  6711
        apply (intro mult_strict_right_mono[OF _ \<open>0 < norm (x - x0)\<close>])
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  6712
        apply (simp add: divide_simps e_def not_less)
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  6713
        done
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6714
      finally have "norm (?F x - ?F x0 - ?dF (x - x0)) < e' * norm (x - x0)" .
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6715
      then show ?case
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6716
        by (auto simp: divide_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6717
    qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6718
  qed (rule blinfun.bounded_linear_right)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6719
qed (auto intro!: derivative_eq_intros simp: blinfun.bilinear_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6720
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  6721
lemma has_vector_derivative_eq_has_derivative_blinfun:
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6722
  "(f has_vector_derivative f') (at x within U) \<longleftrightarrow>
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6723
    (f has_derivative blinfun_scaleR_left f') (at x within U)"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6724
  by (simp add: has_vector_derivative_def)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6725
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6726
lemma leibniz_rule_vector_derivative:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6727
  fixes f::"real \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6728
  assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6729
      ((\<lambda>x. f x t) has_vector_derivative (fx x t)) (at x within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6730
  assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6731
  assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). fx x t)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6732
  assumes U: "x0 \<in> U" "convex U"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6733
  shows "((\<lambda>x. integral (cbox a b) (f x)) has_vector_derivative integral (cbox a b) (fx x0))
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6734
      (at x0 within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6735
proof -
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6736
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6737
    continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6738
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6739
  have *: "blinfun_scaleR_left (integral (cbox a b) (fx x0)) =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6740
    integral (cbox a b) (\<lambda>t. blinfun_scaleR_left (fx x0 t))"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6741
    by (subst integral_linear[symmetric])
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6742
       (auto simp: has_vector_derivative_def o_def
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6743
         intro!: integrable_continuous U continuous_intros bounded_linear_intros)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6744
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6745
    unfolding has_vector_derivative_eq_has_derivative_blinfun
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6746
    apply (rule has_derivative_eq_rhs)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6747
    apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_scaleR_left (fx x t)"])
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6748
    using fx cont_fx
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6749
    apply (auto simp: has_vector_derivative_def * split_beta intro!: continuous_intros)
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6750
    done
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6751
qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6752
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  6753
lemma has_field_derivative_eq_has_derivative_blinfun:
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6754
  "(f has_field_derivative f') (at x within U) \<longleftrightarrow> (f has_derivative blinfun_mult_right f') (at x within U)"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6755
  by (simp add: has_field_derivative_def)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6756
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6757
lemma leibniz_rule_field_derivative:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6758
  fixes f::"'a::{real_normed_field, banach} \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'a"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6759
  assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6760
  assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6761
  assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6762
  assumes U: "x0 \<in> U" "convex U"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6763
  shows "((\<lambda>x. integral (cbox a b) (f x)) has_field_derivative integral (cbox a b) (fx x0)) (at x0 within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6764
proof -
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6765
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6766
    continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6767
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6768
  have *: "blinfun_mult_right (integral (cbox a b) (fx x0)) =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6769
    integral (cbox a b) (\<lambda>t. blinfun_mult_right (fx x0 t))"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6770
    by (subst integral_linear[symmetric])
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6771
      (auto simp: has_vector_derivative_def o_def
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6772
        intro!: integrable_continuous U continuous_intros bounded_linear_intros)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6773
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6774
    unfolding has_field_derivative_eq_has_derivative_blinfun
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6775
    apply (rule has_derivative_eq_rhs)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6776
    apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_mult_right (fx x t)"])
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6777
    using fx cont_fx
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6778
    apply (auto simp: has_field_derivative_def * split_beta intro!: continuous_intros)
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6779
    done
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6780
qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6781
67371
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6782
lemma leibniz_rule_field_differentiable:
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6783
  fixes f::"'a::{real_normed_field, banach} \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'a"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6784
  assumes "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6785
  assumes "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6786
  assumes "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6787
  assumes "x0 \<in> U" "convex U"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6788
  shows "(\<lambda>x. integral (cbox a b) (f x)) field_differentiable at x0 within U"
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6789
  using leibniz_rule_field_derivative[OF assms] by (auto simp: field_differentiable_def)
2d9cf74943e1 moved in some material from Euler-MacLaurin
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
  6790
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6791
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6792
subsection \<open>Exchange uniform limit and integral\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6793
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6794
lemma uniform_limit_integral_cbox:
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6795
  fixes f::"'a \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6796
  assumes u: "uniform_limit (cbox a b) f g F"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6797
  assumes c: "\<And>n. continuous_on (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6798
  assumes [simp]: "F \<noteq> bot"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6799
  obtains I J where
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6800
    "\<And>n. (f n has_integral I n) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6801
    "(g has_integral J) (cbox a b)"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6802
    "(I \<longlongrightarrow> J) F"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6803
proof -
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6804
  have fi[simp]: "f n integrable_on (cbox a b)" for n
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6805
    by (auto intro!: integrable_continuous assms)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6806
  then obtain I where I: "\<And>n. (f n has_integral I n) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6807
    by atomize_elim (auto simp: integrable_on_def intro!: choice)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6808
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6809
  moreover
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6810
  have gi[simp]: "g integrable_on (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6811
    by (auto intro!: integrable_continuous uniform_limit_theorem[OF _ u] eventuallyI c)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6812
  then obtain J where J: "(g has_integral J) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6813
    by blast
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6814
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6815
  moreover
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6816
  have "(I \<longlongrightarrow> J) F"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6817
  proof cases
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6818
    assume "content (cbox a b) = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6819
    hence "I = (\<lambda>_. 0)" "J = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6820
      by (auto intro!: has_integral_unique I J)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6821
    thus ?thesis by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6822
  next
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6823
    assume content_nonzero: "content (cbox a b) \<noteq> 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6824
    show ?thesis
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6825
    proof (rule tendstoI)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6826
      fix e::real
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6827
      assume "e > 0"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  6828
      define e' where "e' = e/2"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6829
      with \<open>e > 0\<close> have "e' > 0" by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6830
      then have "\<forall>\<^sub>F n in F. \<forall>x\<in>cbox a b. norm (f n x - g x) < e' / content (cbox a b)"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
  6831
        using u content_nonzero by (auto simp: uniform_limit_iff dist_norm zero_less_measure_iff)
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6832
      then show "\<forall>\<^sub>F n in F. dist (I n) J < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6833
      proof eventually_elim
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6834
        case (elim n)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6835
        have "I n = integral (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6836
            "J = integral (cbox a b) g"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6837
          using I[of n] J by (simp_all add: integral_unique)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6838
        then have "dist (I n) J = norm (integral (cbox a b) (\<lambda>x. f n x - g x))"
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  6839
          by (simp add: integral_diff dist_norm)
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6840
        also have "\<dots> \<le> integral (cbox a b) (\<lambda>x. (e' / content (cbox a b)))"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6841
          using elim
63941
f353674c2528 move absolutely_integrable_on to Equivalence_Lebesgue_Henstock_Integration, now based on the Lebesgue integral
hoelzl
parents: 63940
diff changeset
  6842
          by (intro integral_norm_bound_integral) (auto intro!: integrable_diff)
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6843
        also have "\<dots> < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6844
          using \<open>0 < e\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6845
          by (simp add: e'_def)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6846
        finally show ?case .
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6847
      qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6848
    qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6849
  qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6850
  ultimately show ?thesis ..
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6851
qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6852
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6853
lemma uniform_limit_integral:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6854
  fixes f::"'a \<Rightarrow> 'b::ordered_euclidean_space \<Rightarrow> 'c::banach"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  6855
  assumes u: "uniform_limit {a..b} f g F"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  6856
  assumes c: "\<And>n. continuous_on {a..b} (f n)"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6857
  assumes [simp]: "F \<noteq> bot"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6858
  obtains I J where
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  6859
    "\<And>n. (f n has_integral I n) {a..b}"
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  6860
    "(g has_integral J) {a..b}"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6861
    "(I \<longlongrightarrow> J) F"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6862
  by (metis interval_cbox assms uniform_limit_integral_cbox)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6863
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  6864
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6865
subsection \<open>Integration by parts\<close>
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6866
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6867
lemma integration_by_parts_interior_strong:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6868
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6869
  assumes bilinear: "bounded_bilinear (prod)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6870
  assumes s: "finite s" and le: "a \<le> b"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6871
  assumes cont [continuous_intros]: "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6872
  assumes deriv: "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6873
                 "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  6874
  assumes int: "((\<lambda>x. prod (f x) (g' x)) has_integral
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6875
                  (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6876
  shows   "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6877
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6878
  interpret bounded_bilinear prod by fact
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6879
  have "((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6880
          (prod (f b) (g b) - prod (f a) (g a))) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6881
    using deriv by (intro fundamental_theorem_of_calculus_interior_strong[OF s le])
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6882
                   (auto intro!: continuous_intros continuous_on has_vector_derivative)
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  6883
  from has_integral_diff[OF this int] show ?thesis by (simp add: algebra_simps)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6884
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6885
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6886
lemma integration_by_parts_interior:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6887
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6888
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6889
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6890
  assumes "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6891
          "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6892
  assumes "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6893
  shows   "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6894
  by (rule integration_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6895
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6896
lemma integration_by_parts:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6897
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6898
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6899
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6900
  assumes "\<And>x. x\<in>{a..b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6901
          "\<And>x. x\<in>{a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6902
  assumes "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6903
  shows   "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6904
  by (rule integration_by_parts_interior[of _ _ _ f g f' g']) (insert assms, simp_all)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6905
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6906
lemma integrable_by_parts_interior_strong:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6907
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6908
  assumes bilinear: "bounded_bilinear (prod)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6909
  assumes s: "finite s" and le: "a \<le> b"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6910
  assumes cont [continuous_intros]: "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6911
  assumes deriv: "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6912
                 "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6913
  assumes int: "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6914
  shows   "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6915
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6916
  from int obtain I where "((\<lambda>x. prod (f x) (g' x)) has_integral I) {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6917
    unfolding integrable_on_def by blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6918
  hence "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6919
           (prod (f b) (g b) - prod (f a) (g a) - I))) {a..b}" by simp
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6920
  from integration_by_parts_interior_strong[OF assms(1-7) this]
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6921
    show ?thesis unfolding integrable_on_def by blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6922
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6923
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6924
lemma integrable_by_parts_interior:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6925
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6926
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6927
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6928
  assumes "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6929
          "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6930
  assumes "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6931
  shows   "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6932
  by (rule integrable_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6933
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6934
lemma integrable_by_parts:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6935
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  6936
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6937
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6938
  assumes "\<And>x. x\<in>{a..b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6939
          "\<And>x. x\<in>{a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6940
  assumes "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6941
  shows   "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6942
  by (rule integrable_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6943
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  6944
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6945
subsection \<open>Integration by substitution\<close>
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6946
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6947
lemma has_integral_substitution_general:
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6948
  fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6949
  assumes s: "finite s" and le: "a \<le> b"
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6950
      and subset: "g ` {a..b} \<subseteq> {c..d}"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6951
      and f [continuous_intros]: "continuous_on {c..d} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6952
      and g [continuous_intros]: "continuous_on {a..b} g"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6953
      and deriv [derivative_intros]:
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6954
              "\<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6955
    shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f - integral {g b..g a} f)) {a..b}"
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6956
proof -
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6957
  let ?F = "\<lambda>x. integral {c..g x} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6958
  have cont_int: "continuous_on {a..b} ?F"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  6959
    by (rule continuous_on_compose2[OF _ g subset] indefinite_integral_continuous_1
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6960
          f integrable_continuous_real)+
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6961
  have deriv: "(((\<lambda>x. integral {c..x} f) \<circ> g) has_vector_derivative g' x *\<^sub>R f (g x))
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6962
                 (at x within {a..b})" if "x \<in> {a..b} - s" for x
66703
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6963
  proof (rule has_vector_derivative_eq_rhs [OF vector_diff_chain_within refl])
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6964
    show "(g has_vector_derivative g' x) (at x within {a..b})"
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6965
      using deriv has_field_derivative_iff_has_vector_derivative that by blast
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6966
    show "((\<lambda>x. integral {c..x} f) has_vector_derivative f (g x)) 
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6967
          (at (g x) within g ` {a..b})"
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6968
      using that le subset
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6969
      by (blast intro: has_vector_derivative_within_subset integral_has_vector_derivative f)
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  6970
  qed
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6971
  have deriv: "(?F has_vector_derivative g' x *\<^sub>R f (g x))
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6972
                  (at x)" if "x \<in> {a..b} - (s \<union> {a,b})" for x
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66709
diff changeset
  6973
    using deriv[of x] that by (simp add: at_within_Icc_at o_def)
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6974
  have "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (?F b - ?F a)) {a..b}"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6975
    using le cont_int s deriv cont_int
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6976
    by (intro fundamental_theorem_of_calculus_interior_strong[of "s \<union> {a,b}"]) simp_all
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6977
  also
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6978
  from subset have "g x \<in> {c..d}" if "x \<in> {a..b}" for x using that by blast
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6979
  from this[of a] this[of b] le have cd: "c \<le> g a" "g b \<le> d" "c \<le> g b" "g a \<le> d" by auto
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6980
  have "integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f - integral {g b..g a} f"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6981
  proof cases
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6982
    assume "g a \<le> g b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6983
    note le = le this
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6984
    from cd have "integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6985
      by (intro integral_combine integrable_continuous_real continuous_on_subset[OF f] le) simp_all
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6986
    with le show ?thesis
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6987
      by (cases "g a = g b") (simp_all add: algebra_simps)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6988
  next
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6989
    assume less: "\<not>g a \<le> g b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6990
    then have "g a \<ge> g b" by simp
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6991
    note le = le this
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6992
    from cd have "integral {c..g b} f + integral {g b..g a} f = integral {c..g a} f"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6993
      by (intro integral_combine integrable_continuous_real continuous_on_subset[OF f] le) simp_all
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6994
    with less show ?thesis
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6995
      by (simp_all add: algebra_simps)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  6996
  qed
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6997
  finally show ?thesis .
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6998
qed
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  6999
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7000
lemma has_integral_substitution_strong:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7001
  fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7002
  assumes s: "finite s" and le: "a \<le> b" "g a \<le> g b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7003
    and subset: "g ` {a..b} \<subseteq> {c..d}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7004
    and f [continuous_intros]: "continuous_on {c..d} f"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7005
    and g [continuous_intros]: "continuous_on {a..b} g"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7006
    and deriv [derivative_intros]:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7007
    "\<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7008
  shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f)) {a..b}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7009
  using has_integral_substitution_general[OF s le(1) subset f g deriv] le(2)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7010
  by (cases "g a = g b") auto
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7011
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7012
lemma has_integral_substitution:
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7013
  fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7014
  assumes "a \<le> b" "g a \<le> g b" "g ` {a..b} \<subseteq> {c..d}"
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7015
      and "continuous_on {c..d} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7016
      and "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7017
    shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f)) {a..b}"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7018
  by (intro has_integral_substitution_strong[of "{}" a b g c d] assms)
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7019
     (auto intro: DERIV_continuous_on assms)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7020
70722
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7021
lemma integral_shift:
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7022
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7023
  assumes cont: "continuous_on {a + c..b + c} f"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7024
  shows "integral {a..b} (f \<circ> (\<lambda>x. x + c)) = integral {a + c..b + c} f"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7025
proof (cases "a \<le> b")
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7026
  case True
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7027
  have "((\<lambda>x. 1 *\<^sub>R f (x + c)) has_integral integral {a+c..b+c} f) {a..b}"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7028
    using True cont
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7029
    by (intro has_integral_substitution[where c = "a + c" and d = "b + c"])
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7030
       (auto intro!: derivative_eq_intros)
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7031
  thus ?thesis by (simp add: has_integral_iff o_def)
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7032
qed auto
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70688
diff changeset
  7033
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7034
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7035
subsection \<open>Compute a double integral using iterated integrals and switching the order of integration\<close>
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7036
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7037
lemma continuous_on_imp_integrable_on_Pair1:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7038
  fixes f :: "_ \<Rightarrow> 'b::banach"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7039
  assumes con: "continuous_on (cbox (a,c) (b,d)) f" and x: "x \<in> cbox a b"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7040
  shows "(\<lambda>y. f (x, y)) integrable_on (cbox c d)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7041
proof -
61736
d6b2d638af23 more symbols;
wenzelm
parents: 61661
diff changeset
  7042
  have "f \<circ> (\<lambda>y. (x, y)) integrable_on (cbox c d)"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7043
    apply (rule integrable_continuous)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7044
    apply (rule continuous_on_compose [OF _ continuous_on_subset [OF con]])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7045
    using x
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7046
    apply (auto intro: continuous_on_Pair continuous_on_const continuous_on_id continuous_on_subset con)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7047
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7048
  then show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7049
    by (simp add: o_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7050
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7051
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7052
lemma integral_integrable_2dim:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7053
  fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7054
  assumes "continuous_on (cbox (a,c) (b,d)) f"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7055
    shows "(\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y))) integrable_on cbox a b"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7056
proof (cases "content(cbox c d) = 0")
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7057
case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7058
  then show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7059
    by (simp add: True integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7060
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7061
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7062
  have uc: "uniformly_continuous_on (cbox (a,c) (b,d)) f"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7063
    by (simp add: assms compact_cbox compact_uniformly_continuous)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7064
  { fix x::'a and e::real
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7065
    assume x: "x \<in> cbox a b" and e: "0 < e"
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  7066
    then have e2_gt: "0 < e/2 / content (cbox c d)" and e2_less: "e/2 / content (cbox c d) * content (cbox c d) < e"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7067
      by (auto simp: False content_lt_nz e)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7068
    then obtain dd
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7069
    where dd: "\<And>x x'. \<lbrakk>x\<in>cbox (a, c) (b, d); x'\<in>cbox (a, c) (b, d); norm (x' - x) < dd\<rbrakk>
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  7070
                       \<Longrightarrow> norm (f x' - f x) \<le> e/(2 * content (cbox c d))"  "dd>0"
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  7071
      using uc [unfolded uniformly_continuous_on_def, THEN spec, of "e/(2 * content (cbox c d))"]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7072
      by (auto simp: dist_norm intro: less_imp_le)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7073
    have "\<exists>delta>0. \<forall>x'\<in>cbox a b. norm (x' - x) < delta \<longrightarrow> norm (integral (cbox c d) (\<lambda>u. f (x', u) - f (x, u))) < e"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7074
      apply (rule_tac x=dd in exI)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7075
      using dd e2_gt assms x
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7076
      apply clarify
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7077
      apply (rule le_less_trans [OF _ e2_less])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7078
      apply (rule integrable_bound)
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7079
      apply (auto intro: integrable_diff continuous_on_imp_integrable_on_Pair1)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7080
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7081
  } note * = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7082
  show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7083
    apply (rule integrable_continuous)
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7084
    apply (simp add: * continuous_on_iff dist_norm integral_diff [symmetric] continuous_on_imp_integrable_on_Pair1 [OF assms])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7085
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7086
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7087
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7088
lemma integral_split:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7089
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7090
  assumes f: "f integrable_on (cbox a b)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7091
      and k: "k \<in> Basis"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7092
  shows "integral (cbox a b) f =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7093
           integral (cbox a b \<inter> {x. x\<bullet>k \<le> c}) f +
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7094
           integral (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) f"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7095
  apply (rule integral_unique [OF has_integral_split [where c=c]])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7096
  using k f
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7097
  apply (auto simp: has_integral_integral [symmetric])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7098
  done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7099
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7100
lemma integral_swap_operativeI:
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7101
  fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7102
  assumes f: "continuous_on s f" and e: "0 < e"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7103
    shows "operative conj True
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7104
           (\<lambda>k. \<forall>a b c d.
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7105
                cbox (a,c) (b,d) \<subseteq> k \<and> cbox (a,c) (b,d) \<subseteq> s
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7106
                \<longrightarrow> norm(integral (cbox (a,c) (b,d)) f -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7107
                         integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f((x,y)))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7108
                    \<le> e * content (cbox (a,c) (b,d)))"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7109
proof (standard, auto)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7110
  fix a::'a and c::'b and b::'a and d::'b and u::'a and v::'a and w::'b and z::'b
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  7111
  assume *: "box (a, c) (b, d) = {}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7112
     and cb1: "cbox (u, w) (v, z) \<subseteq> cbox (a, c) (b, d)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7113
     and cb2: "cbox (u, w) (v, z) \<subseteq> s"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  7114
  then have c0: "content (cbox (a, c) (b, d)) = 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  7115
    using * unfolding content_eq_0_interior by simp
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7116
  have c0': "content (cbox (u, w) (v, z)) = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7117
    by (fact content_0_subset [OF c0 cb1])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7118
  show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7119
          \<le> e * content (cbox (u,w) (v,z))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7120
    using content_cbox_pair_eq0_D [OF c0']
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7121
    by (force simp add: c0')
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7122
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7123
  fix a::'a and c::'b and b::'a and d::'b
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7124
  and M::real and i::'a and j::'b
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7125
  and u::'a and v::'a and w::'b and z::'b
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7126
  assume ij: "(i,j) \<in> Basis"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7127
     and n1: "\<forall>a' b' c' d'.
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7128
                cbox (a',c') (b',d') \<subseteq> cbox (a,c) (b,d) \<and>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7129
                cbox (a',c') (b',d') \<subseteq> {x. x \<bullet> (i,j) \<le> M} \<and> cbox (a',c') (b',d') \<subseteq> s \<longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7130
                norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\<lambda>x. integral (cbox c' d') (\<lambda>y. f (x,y))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7131
                \<le> e * content (cbox (a',c') (b',d'))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7132
     and n2: "\<forall>a' b' c' d'.
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7133
                cbox (a',c') (b',d') \<subseteq> cbox (a,c) (b,d) \<and>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7134
                cbox (a',c') (b',d') \<subseteq> {x. M \<le> x \<bullet> (i,j)} \<and> cbox (a',c') (b',d') \<subseteq> s \<longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7135
                norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\<lambda>x. integral (cbox c' d') (\<lambda>y. f (x,y))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7136
                \<le> e * content (cbox (a',c') (b',d'))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7137
     and subs: "cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)"  "cbox (u,w) (v,z) \<subseteq> s"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7138
  have fcont: "continuous_on (cbox (u, w) (v, z)) f"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7139
    using assms(1) continuous_on_subset  subs(2) by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7140
  then have fint: "f integrable_on cbox (u, w) (v, z)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7141
    by (metis integrable_continuous)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7142
  consider "i \<in> Basis" "j=0" | "j \<in> Basis" "i=0"  using ij
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7143
    by (auto simp: Euclidean_Space.Basis_prod_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7144
  then show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7145
             \<le> e * content (cbox (u,w) (v,z))" (is ?normle)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7146
  proof cases
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7147
    case 1
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7148
    then have e: "e * content (cbox (u, w) (v, z)) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7149
                  e * (content (cbox u v \<inter> {x. x \<bullet> i \<le> M}) * content (cbox w z)) +
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7150
                  e * (content (cbox u v \<inter> {x. M \<le> x \<bullet> i}) * content (cbox w z))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7151
      by (simp add: content_split [where c=M] content_Pair algebra_simps)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7152
    have *: "integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7153
                integral (cbox u v \<inter> {x. x \<bullet> i \<le> M}) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) +
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7154
                integral (cbox u v \<inter> {x. M \<le> x \<bullet> i}) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y)))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7155
      using 1 f subs integral_integrable_2dim continuous_on_subset
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7156
      by (blast intro: integral_split)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7157
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7158
      apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7159
      using 1 subs
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7160
      apply (simp_all add: cbox_Pair_eq setcomp_dot1 [of "\<lambda>u. M\<le>u"] setcomp_dot1 [of "\<lambda>u. u\<le>M"] Sigma_Int_Paircomp1)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7161
      apply (simp_all add: interval_split ij)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7162
      apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7163
      apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7164
      apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7165
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7166
  next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7167
    case 2
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7168
    then have e: "e * content (cbox (u, w) (v, z)) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7169
                  e * (content (cbox u v) * content (cbox w z \<inter> {x. x \<bullet> j \<le> M})) +
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7170
                  e * (content (cbox u v) * content (cbox w z \<inter> {x. M \<le> x \<bullet> j}))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7171
      by (simp add: content_split [where c=M] content_Pair algebra_simps)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7172
    have "(\<lambda>x. integral (cbox w z \<inter> {x. x \<bullet> j \<le> M}) (\<lambda>y. f (x, y))) integrable_on cbox u v"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7173
                "(\<lambda>x. integral (cbox w z \<inter> {x. M \<le> x \<bullet> j}) (\<lambda>y. f (x, y))) integrable_on cbox u v"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7174
      using 2 subs
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7175
      apply (simp_all add: interval_split)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7176
      apply (rule_tac [!] integral_integrable_2dim [OF continuous_on_subset [OF f]])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7177
      apply (auto simp: cbox_Pair_eq interval_split [symmetric])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7178
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7179
    with 2 have *: "integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7180
                   integral (cbox u v) (\<lambda>x. integral (cbox w z \<inter> {x. x \<bullet> j \<le> M}) (\<lambda>y. f (x, y))) +
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7181
                   integral (cbox u v) (\<lambda>x. integral (cbox w z \<inter> {x. M \<le> x \<bullet> j}) (\<lambda>y. f (x, y)))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7182
      by (simp add: integral_add [symmetric] integral_split [symmetric]
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7183
                    continuous_on_imp_integrable_on_Pair1 [OF fcont] cong: integral_cong)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7184
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7185
      apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7186
      using 2 subs
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7187
      apply (simp_all add: cbox_Pair_eq setcomp_dot2 [of "\<lambda>u. M\<le>u"] setcomp_dot2 [of "\<lambda>u. u\<le>M"] Sigma_Int_Paircomp2)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7188
      apply (simp_all add: interval_split ij)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7189
      apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7190
      apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7191
      apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7192
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7193
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7194
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7195
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7196
lemma integral_Pair_const:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7197
    "integral (cbox (a,c) (b,d)) (\<lambda>x. k) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7198
     integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. k))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7199
  by (simp add: content_Pair)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7200
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7201
lemma integral_prod_continuous:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7202
  fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach"
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7203
  assumes "continuous_on (cbox (a, c) (b, d)) f" (is "continuous_on ?CBOX f")
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7204
    shows "integral (cbox (a, c) (b, d)) f = integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x, y)))"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7205
proof (cases "content ?CBOX = 0")
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7206
  case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7207
  then show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7208
    by (auto simp: content_Pair)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7209
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7210
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7211
  then have cbp: "content ?CBOX > 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7212
    using content_lt_nz by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7213
  have "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7214
  proof (rule dense_eq0_I, simp)
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7215
    fix e :: real 
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7216
    assume "0 < e"
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7217
    with \<open>content ?CBOX > 0\<close> have "0 < e/content ?CBOX"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7218
      by simp
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7219
    have f_int_acbd: "f integrable_on ?CBOX"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7220
      by (rule integrable_continuous [OF assms])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7221
    { fix p
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7222
      assume p: "p division_of ?CBOX"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7223
      then have "finite p"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7224
        by blast
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7225
      define e' where "e' = e/content ?CBOX"
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7226
      with \<open>0 < e\<close> \<open>0 < e/content ?CBOX\<close>
66492
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7227
      have "0 < e'"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7228
        by simp
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7229
      interpret operative conj True
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7230
           "\<lambda>k. \<forall>a' b' c' d'.
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7231
                cbox (a', c') (b', d') \<subseteq> k \<and> cbox (a', c') (b', d') \<subseteq> ?CBOX
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7232
                \<longrightarrow> norm (integral (cbox (a', c') (b', d')) f -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7233
                         integral (cbox a' b') (\<lambda>x. integral (cbox c' d') (\<lambda>y. f ((x, y)))))
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7234
                    \<le> e' * content (cbox (a', c') (b', d'))"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7235
        using assms \<open>0 < e'\<close> by (rule integral_swap_operativeI)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7236
      have "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x, y))))
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7237
          \<le> e' * content ?CBOX"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7238
        if "\<And>t u v w z. t \<in> p \<Longrightarrow> cbox (u, w) (v, z) \<subseteq> t \<Longrightarrow> cbox (u, w) (v, z) \<subseteq> ?CBOX
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7239
          \<Longrightarrow> norm (integral (cbox (u, w) (v, z)) f -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7240
              integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))))
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7241
              \<le> e' * content (cbox (u, w) (v, z))"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7242
        using that division [of p "(a, c)" "(b, d)"] p \<open>finite p\<close> by (auto simp add: comm_monoid_set_F_and)
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7243
      with False have "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x, y))))
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7244
          \<le> e"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7245
        if "\<And>t u v w z. t \<in> p \<Longrightarrow> cbox (u, w) (v, z) \<subseteq> t \<Longrightarrow> cbox (u, w) (v, z) \<subseteq> ?CBOX
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7246
          \<Longrightarrow> norm (integral (cbox (u, w) (v, z)) f -
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7247
              integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))))
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7248
              \<le> e * content (cbox (u, w) (v, z)) / content ?CBOX"
d7206afe2d28 dedicated local for "operative" avoids namespace pollution
haftmann
parents: 66487
diff changeset
  7249
        using that by (simp add: e'_def)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7250
    } note op_acbd = this
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  7251
    { fix k::real and \<D> and u::'a and v w and z::'b and t1 t2 l
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7252
      assume k: "0 < k"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7253
         and nf: "\<And>x y u v.
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7254
                  \<lbrakk>x \<in> cbox a b; y \<in> cbox c d; u \<in> cbox a b; v\<in>cbox c d; norm (u-x, v-y) < k\<rbrakk>
66487
307c19f24d5c more on the dreadful monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66437
diff changeset
  7255
                  \<Longrightarrow> norm (f(u,v) - f(x,y)) < e/(2 * (content ?CBOX))"
66495
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  7256
         and p_acbd: "\<D> tagged_division_of cbox (a,c) (b,d)"
0b46bd081228 More tidying up of monotone_convergence_interval
paulson <lp15@cam.ac.uk>
parents: 66487
diff changeset
  7257
         and fine: "(\<lambda>x. ball x k) fine \<D>"  "((t1,t2), l) \<in> \<D>"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7258
         and uwvz_sub: "cbox (u,w) (v,z) \<subseteq> l" "cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7259
      have t: "t1 \<in> cbox a b" "t2 \<in> cbox c d"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7260
        by (meson fine p_acbd cbox_Pair_iff tag_in_interval)+
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7261
      have ls: "l \<subseteq> ball (t1,t2) k"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7262
        using fine by (simp add: fine_def Ball_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7263
      { fix x1 x2
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7264
        assume xuvwz: "x1 \<in> cbox u v" "x2 \<in> cbox w z"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7265
        then have x: "x1 \<in> cbox a b" "x2 \<in> cbox c d"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7266
          using uwvz_sub by auto
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7267
        have "norm (x1 - t1, x2 - t2) = norm (t1 - x1, t2 - x2)"
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7268
          by (simp add: norm_Pair norm_minus_commute)
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7269
        also have "norm (t1 - x1, t2 - x2) < k"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7270
          using xuvwz ls uwvz_sub unfolding ball_def
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7271
          by (force simp add: cbox_Pair_eq dist_norm )
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7272
        finally have "norm (f (x1,x2) - f (t1,t2)) \<le> e/content ?CBOX/2"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7273
          using nf [OF t x]  by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7274
      } note nf' = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7275
      have f_int_uwvz: "f integrable_on cbox (u,w) (v,z)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7276
        using f_int_acbd uwvz_sub integrable_on_subcbox by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7277
      have f_int_uv: "\<And>x. x \<in> cbox u v \<Longrightarrow> (\<lambda>y. f (x,y)) integrable_on cbox w z"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7278
        using assms continuous_on_subset uwvz_sub
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7279
        by (blast intro: continuous_on_imp_integrable_on_Pair1)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7280
      have 1: "norm (integral (cbox (u,w) (v,z)) f - integral (cbox (u,w) (v,z)) (\<lambda>x. f (t1,t2)))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7281
         \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX/2"
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7282
        apply (simp only: integral_diff [symmetric] f_int_uwvz integrable_const)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7283
        apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX/2"]])
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7284
        using cbp \<open>0 < e/content ?CBOX\<close> nf'
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7285
        apply (auto simp: integrable_diff f_int_uwvz integrable_const)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7286
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7287
      have int_integrable: "(\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) integrable_on cbox u v"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7288
        using assms integral_integrable_2dim continuous_on_subset uwvz_sub(2) by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7289
      have normint_wz:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7290
         "\<And>x. x \<in> cbox u v \<Longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7291
               norm (integral (cbox w z) (\<lambda>y. f (x, y)) - integral (cbox w z) (\<lambda>y. f (t1, t2)))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7292
               \<le> e * content (cbox w z) / content (cbox (a, c) (b, d))/2"
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7293
        apply (simp only: integral_diff [symmetric] f_int_uv integrable_const)
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7294
        apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX/2"]])
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7295
        using cbp \<open>0 < e/content ?CBOX\<close> nf'
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7296
        apply (auto simp: integrable_diff f_int_uv integrable_const)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7297
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7298
      have "norm (integral (cbox u v)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7299
               (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)) - integral (cbox w z) (\<lambda>y. f (t1,t2))))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7300
            \<le> e * content (cbox w z) / content ?CBOX/2 * content (cbox u v)"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7301
        apply (rule integrable_bound [OF _ _ normint_wz])
66505
b81e1d194e4c work on integrable_alt, etc.
paulson <lp15@cam.ac.uk>
parents: 66504
diff changeset
  7302
        using cbp \<open>0 < e/content ?CBOX\<close>
71172
nipkow
parents: 71120
diff changeset
  7303
        apply (auto simp: field_split_simps integrable_diff int_integrable integrable_const)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7304
        done
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7305
      also have "... \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX/2"
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  7306
        by (simp add: content_Pair field_split_simps)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7307
      finally have 2: "norm (integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y))) -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7308
                      integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (t1,t2))))
66532
8a6ce2d9a9f5 work on indefinite_integral_continuous_left, etc.
paulson <lp15@cam.ac.uk>
parents: 66524
diff changeset
  7309
                \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX/2"
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7310
        by (simp only: integral_diff [symmetric] int_integrable integrable_const)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7311
      have norm_xx: "\<lbrakk>x' = y'; norm(x - x') \<le> e/2; norm(y - y') \<le> e/2\<rbrakk> \<Longrightarrow> norm(x - y) \<le> e" for x::'c and y x' y' e
68527
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68403
diff changeset
  7312
        using norm_triangle_mono [of "x-y'" "e/2" "y'-y" "e/2"] field_sum_of_halves
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7313
        by (simp add: norm_minus_commute)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7314
      have "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7315
            \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7316
        by (rule norm_xx [OF integral_Pair_const 1 2])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7317
    } note * = this
66703
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7318
    have "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e" 
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7319
      if "\<forall>x\<in>?CBOX. \<forall>x'\<in>?CBOX. norm (x' - x) < k \<longrightarrow> norm (f x' - f x) < e /(2 * content (?CBOX))" "0 < k" for k
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7320
    proof -
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7321
      obtain p where ptag: "p tagged_division_of cbox (a, c) (b, d)" 
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7322
                 and fine: "(\<lambda>x. ball x k) fine p"
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7323
        using fine_division_exists \<open>0 < k\<close> by blast
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7324
      show ?thesis
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7325
        apply (rule op_acbd [OF division_of_tagged_division [OF ptag]])
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7326
        using that fine ptag \<open>0 < k\<close> by (auto simp: *)
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7327
    qed
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7328
    then show "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7329
      using compact_uniformly_continuous [OF assms compact_cbox]
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7330
      apply (simp add: uniformly_continuous_on_def dist_norm)
66406
f8f4cf0fa42d cleanup of integral_norm_bound_integral
paulson <lp15@cam.ac.uk>
parents: 66402
diff changeset
  7331
      apply (drule_tac x="e/2 / content?CBOX" in spec)
66703
61bf958fa1c1 more proof simplificaition
paulson <lp15@cam.ac.uk>
parents: 66561
diff changeset
  7332
      using cbp \<open>0 < e\<close> by (auto simp: zero_less_mult_iff)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7333
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7334
  then show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7335
    by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7336
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7337
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7338
lemma integral_swap_2dim:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7339
  fixes f :: "['a::euclidean_space, 'b::euclidean_space] \<Rightarrow> 'c::banach"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7340
  assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7341
    shows "integral (cbox (a, c) (b, d)) (\<lambda>(x, y). f x y) = integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7342
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7343
  have "((\<lambda>(x, y). f x y) has_integral integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)) (prod.swap ` (cbox (c, a) (d, b)))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7344
    apply (rule has_integral_twiddle [of 1 prod.swap prod.swap "\<lambda>(x,y). f y x" "integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)", simplified])
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7345
    apply (force simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous swap_continuous assms)+
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7346
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7347
 then show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7348
   by force
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7349
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7350
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7351
theorem integral_swap_continuous:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7352
  fixes f :: "['a::euclidean_space, 'b::euclidean_space] \<Rightarrow> 'c::banach"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7353
  assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7354
    shows "integral (cbox a b) (\<lambda>x. integral (cbox c d) (f x)) =
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7355
           integral (cbox c d) (\<lambda>y. integral (cbox a b) (\<lambda>x. f x y))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7356
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7357
  have "integral (cbox a b) (\<lambda>x. integral (cbox c d) (f x)) = integral (cbox (a, c) (b, d)) (\<lambda>(x, y). f x y)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7358
    using integral_prod_continuous [OF assms] by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7359
  also have "... = integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7360
    by (rule integral_swap_2dim [OF assms])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7361
  also have "... = integral (cbox c d) (\<lambda>y. integral (cbox a b) (\<lambda>x. f x y))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7362
    using integral_prod_continuous [OF swap_continuous] assms
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7363
    by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7364
  finally show ?thesis .
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7365
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7366
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7367
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7368
subsection \<open>Definite integrals for exponential and power function\<close>
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7369
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7370
lemma has_integral_exp_minus_to_infinity:
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7371
  assumes a: "a > 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7372
  shows   "((\<lambda>x::real. exp (-a*x)) has_integral exp (-a*c)/a) {c..}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7373
proof -
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7374
  define f where "f = (\<lambda>k x. if x \<in> {c..real k} then exp (-a*x) else 0)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7375
  {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7376
    fix k :: nat assume k: "of_nat k \<ge> c"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7377
    from k a
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7378
      have "((\<lambda>x. exp (-a*x)) has_integral (-exp (-a*real k)/a - (-exp (-a*c)/a))) {c..real k}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7379
      by (intro fundamental_theorem_of_calculus)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7380
         (auto intro!: derivative_eq_intros
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7381
               simp: has_field_derivative_iff_has_vector_derivative [symmetric])
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7382
    hence "(f k has_integral (exp (-a*c)/a - exp (-a*real k)/a)) {c..}" unfolding f_def
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7383
      by (subst has_integral_restrict) simp_all
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7384
  } note has_integral_f = this
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7385
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7386
  have [simp]: "f k = (\<lambda>_. 0)" if "of_nat k < c" for k using that by (auto simp: fun_eq_iff f_def)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7387
  have integral_f: "integral {c..} (f k) =
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7388
                      (if real k \<ge> c then exp (-a*c)/a - exp (-a*real k)/a else 0)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7389
    for k using integral_unique[OF has_integral_f[of k]] by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7390
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7391
  have A: "(\<lambda>x. exp (-a*x)) integrable_on {c..} \<and>
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7392
             (\<lambda>k. integral {c..} (f k)) \<longlonglongrightarrow> integral {c..} (\<lambda>x. exp (-a*x))"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7393
  proof (intro monotone_convergence_increasing allI ballI)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7394
    fix k ::nat
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7395
    have "(\<lambda>x. exp (-a*x)) integrable_on {c..of_real k}" (is ?P)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7396
      unfolding f_def by (auto intro!: continuous_intros integrable_continuous_real)
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7397
    hence  "(f k) integrable_on {c..of_real k}"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7398
      by (rule integrable_eq) (simp add: f_def)
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7399
    then show "f k integrable_on {c..}"
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7400
      by (rule integrable_on_superset) (auto simp: f_def)
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7401
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7402
    fix x assume x: "x \<in> {c..}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7403
    have "sequentially \<le> principal {nat \<lceil>x\<rceil>..}" unfolding at_top_def by (simp add: Inf_lower)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7404
    also have "{nat \<lceil>x\<rceil>..} \<subseteq> {k. x \<le> real k}" by auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7405
    also have "inf (principal \<dots>) (principal {k. \<not>x \<le> real k}) =
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7406
                 principal ({k. x \<le> real k} \<inter> {k. \<not>x \<le> real k})" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7407
    also have "{k. x \<le> real k} \<inter> {k. \<not>x \<le> real k} = {}" by blast
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7408
    finally have "inf sequentially (principal {k. \<not>x \<le> real k}) = bot"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7409
      by (simp add: inf.coboundedI1 bot_unique)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7410
    with x show "(\<lambda>k. f k x) \<longlonglongrightarrow> exp (-a*x)" unfolding f_def
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7411
      by (intro filterlim_If) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7412
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7413
    have "\<bar>integral {c..} (f k)\<bar> \<le> exp (-a*c)/a" for k
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7414
    proof (cases "c > of_nat k")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7415
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7416
      hence "abs (integral {c..} (f k)) = abs (exp (- (a * c)) / a - exp (- (a * real k)) / a)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7417
        by (simp add: integral_f)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7418
      also have "abs (exp (- (a * c)) / a - exp (- (a * real k)) / a) =
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7419
                   exp (- (a * c)) / a - exp (- (a * real k)) / a"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7420
        using False a by (intro abs_of_nonneg) (simp_all add: field_simps)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7421
      also have "\<dots> \<le> exp (- a * c) / a" using a by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7422
      finally show ?thesis .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7423
    qed (insert a, simp_all add: integral_f)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  7424
    thus "bounded (range(\<lambda>k. integral {c..} (f k)))"
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7425
      by (intro boundedI[of _ "exp (-a*c)/a"]) auto
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7426
  qed (auto simp: f_def)
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7427
  have "(\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a) \<longlonglongrightarrow> exp (-a*c)/a - 0/a"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7428
    by (intro tendsto_intros filterlim_compose[OF exp_at_bot]
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7429
        filterlim_tendsto_neg_mult_at_bot[OF tendsto_const] filterlim_real_sequentially)+
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7430
      (insert a, simp_all)
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7431
  moreover
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7432
  from eventually_gt_at_top[of "nat \<lceil>c\<rceil>"] have "eventually (\<lambda>k. of_nat k > c) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7433
    by eventually_elim linarith
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7434
  hence "eventually (\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a = integral {c..} (f k)) sequentially"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7435
    by eventually_elim (simp add: integral_f) 
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7436
  ultimately have "(\<lambda>k. integral {c..} (f k)) \<longlonglongrightarrow> exp (-a*c)/a - 0/a"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7437
    by (rule Lim_transform_eventually)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7438
  from LIMSEQ_unique[OF conjunct2[OF A] this]
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7439
  have "integral {c..} (\<lambda>x. exp (-a*x)) = exp (-a*c)/a" by simp
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7440
  with conjunct1[OF A] show ?thesis
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7441
    by (simp add: has_integral_integral)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7442
qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7443
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7444
lemma integrable_on_exp_minus_to_infinity: "a > 0 \<Longrightarrow> (\<lambda>x. exp (-a*x) :: real) integrable_on {c..}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7445
  using has_integral_exp_minus_to_infinity[of a c] unfolding integrable_on_def by blast
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7446
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7447
lemma has_integral_powr_from_0:
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7448
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7449
  shows   "((\<lambda>x. x powr a) has_integral (c powr (a+1) / (a+1))) {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7450
proof (cases "c = 0")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7451
  case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7452
  define f where "f = (\<lambda>k x. if x \<in> {inverse (of_nat (Suc k))..c} then x powr a else 0)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7453
  define F where "F = (\<lambda>k. if inverse (of_nat (Suc k)) \<le> c then
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7454
                             c powr (a+1)/(a+1) - inverse (real (Suc k)) powr (a+1)/(a+1) else 0)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7455
  {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7456
    fix k :: nat
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7457
    have "(f k has_integral F k) {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7458
    proof (cases "inverse (of_nat (Suc k)) \<le> c")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7459
      case True
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7460
      {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7461
        fix x assume x: "x \<ge> inverse (1 + real k)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7462
        have "0 < inverse (1 + real k)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7463
        also note x
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7464
        finally have "x > 0" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7465
      } note x = this
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7466
      hence "((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) -
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7467
               inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7468
        using True a by (intro fundamental_theorem_of_calculus)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7469
           (auto intro!: derivative_eq_intros continuous_on_powr' continuous_on_const
71172
nipkow
parents: 71120
diff changeset
  7470
              simp: has_field_derivative_iff_has_vector_derivative [symmetric])
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7471
      with True show ?thesis unfolding f_def F_def by (subst has_integral_restrict) simp_all
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7472
    next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7473
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7474
      thus ?thesis unfolding f_def F_def by (subst has_integral_restrict) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7475
    qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7476
  } note has_integral_f = this
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7477
  have integral_f: "integral {0..c} (f k) = F k" for k
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7478
    using has_integral_f[of k] by (rule integral_unique)
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7479
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7480
  have A: "(\<lambda>x. x powr a) integrable_on {0..c} \<and>
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7481
           (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7482
  proof (intro monotone_convergence_increasing ballI allI)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7483
    fix k from has_integral_f[of k] show "f k integrable_on {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7484
      by (auto simp: integrable_on_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7485
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7486
    fix k :: nat and x :: real
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7487
    {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7488
      assume x: "inverse (real (Suc k)) \<le> x"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7489
      have "inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))" by (simp add: field_simps)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7490
      also note x
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7491
      finally have "inverse (real (Suc (Suc k))) \<le> x" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7492
    }
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7493
    thus "f k x \<le> f (Suc k) x" by (auto simp: f_def simp del: of_nat_Suc)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7494
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7495
    fix x assume x: "x \<in> {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7496
    show "(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7497
    proof (cases "x = 0")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7498
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7499
      with x have "x > 0" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7500
      from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7501
        have "eventually (\<lambda>k. x powr a = f k x) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7502
        by eventually_elim (insert x, simp add: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7503
      moreover have "(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a" by simp
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7504
      ultimately show ?thesis by (blast intro: Lim_transform_eventually)
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7505
    qed (simp_all add: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7506
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7507
    {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7508
      fix k
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7509
      from a have "F k \<le> c powr (a + 1) / (a + 1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7510
        by (auto simp add: F_def divide_simps)
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7511
      also from a have "F k \<ge> 0"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7512
        by (auto simp: F_def divide_simps simp del: of_nat_Suc intro!: powr_mono2)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7513
      hence "F k = abs (F k)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7514
      finally have "abs (F k) \<le>  c powr (a + 1) / (a + 1)" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7515
    }
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  7516
    thus "bounded (range(\<lambda>k. integral {0..c} (f k)))"
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7517
      by (intro boundedI[of _ "c powr (a+1) / (a+1)"]) (auto simp: integral_f)
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7518
  qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7519
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7520
  from False c have "c > 0" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7521
  from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7522
    have "eventually (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a+1) / (a+1) =
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7523
            integral {0..c} (f k)) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7524
    by eventually_elim (simp add: integral_f F_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7525
  moreover have "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1))
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7526
                   \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7527
    using a by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7528
  hence "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1))
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7529
          \<longlonglongrightarrow> c powr (a + 1) / (a + 1)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7530
  ultimately have "(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a+1) / (a+1)"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7531
    by (blast intro: Lim_transform_eventually)
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7532
  with A have "integral {0..c} (\<lambda>x. x powr a) = c powr (a+1) / (a+1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7533
    by (blast intro: LIMSEQ_unique)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7534
  with A show ?thesis by (simp add: has_integral_integral)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7535
qed (simp_all add: has_integral_refl)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7536
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7537
lemma integrable_on_powr_from_0:
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7538
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7539
  shows   "(\<lambda>x. x powr a) integrable_on {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7540
  using has_integral_powr_from_0[OF assms] unfolding integrable_on_def by blast
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7541
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7542
lemma has_integral_powr_to_inf:
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7543
  fixes a e :: real
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7544
  assumes "e < -1" "a > 0"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7545
  shows   "((\<lambda>x. x powr e) has_integral -(a powr (e + 1)) / (e + 1)) {a..}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7546
proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7547
  define f :: "nat \<Rightarrow> real \<Rightarrow> real" where "f = (\<lambda>n x. if x \<in> {a..n} then x powr e else 0)"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7548
  define F where "F = (\<lambda>x. x powr (e + 1) / (e + 1))"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7549
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7550
  have has_integral_f: "(f n has_integral (F n - F a)) {a..}"
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7551
    if n: "n \<ge> a" for n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7552
  proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7553
    from n assms have "((\<lambda>x. x powr e) has_integral (F n - F a)) {a..n}"
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7554
      by (intro fundamental_theorem_of_calculus) (auto intro!: derivative_eq_intros
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7555
            simp: has_field_derivative_iff_has_vector_derivative [symmetric] F_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7556
    hence "(f n has_integral (F n - F a)) {a..n}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7557
      by (rule has_integral_eq [rotated]) (simp add: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7558
    thus "(f n has_integral (F n - F a)) {a..}"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  7559
      by (rule has_integral_on_superset) (auto simp: f_def)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7560
  qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7561
  have integral_f: "integral {a..} (f n) = (if n \<ge> a then F n - F a else 0)" for n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7562
  proof (cases "n \<ge> a")
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7563
    case True
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7564
    with has_integral_f[OF this] show ?thesis by (simp add: integral_unique)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7565
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7566
    case False
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7567
    have "(f n has_integral 0) {a}" by (rule has_integral_refl)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7568
    hence "(f n has_integral 0) {a..}"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  7569
      by (rule has_integral_on_superset) (insert False, simp_all add: f_def)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7570
    with False show ?thesis by (simp add: integral_unique)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7571
  qed
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7572
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7573
  have *: "(\<lambda>x. x powr e) integrable_on {a..} \<and>
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7574
           (\<lambda>n. integral {a..} (f n)) \<longlonglongrightarrow> integral {a..} (\<lambda>x. x powr e)"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7575
  proof (intro monotone_convergence_increasing allI ballI)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7576
    fix n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7577
    from assms have "(\<lambda>x. x powr e) integrable_on {a..n}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7578
      by (auto intro!: integrable_continuous_real continuous_intros)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7579
    hence "f n integrable_on {a..n}"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7580
      by (rule integrable_eq) (auto simp: f_def)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7581
    thus "f n integrable_on {a..}"
66552
507a42c0a0ff last-minute integration unscrambling
paulson <lp15@cam.ac.uk>
parents: 66539
diff changeset
  7582
      by (rule integrable_on_superset) (auto simp: f_def)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7583
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7584
    fix n :: nat and x :: real
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7585
    show "f n x \<le> f (Suc n) x" by (auto simp: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7586
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7587
    fix x :: real assume x: "x \<in> {a..}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7588
    from filterlim_real_sequentially
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7589
      have "eventually (\<lambda>n. real n \<ge> x) at_top"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7590
      by (simp add: filterlim_at_top)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7591
    with x have "eventually (\<lambda>n. f n x = x powr e) at_top"
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7592
      by (auto elim!: eventually_mono simp: f_def)
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 70196
diff changeset
  7593
    thus "(\<lambda>n. f n x) \<longlonglongrightarrow> x powr e" by (simp add: tendsto_eventually)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7594
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7595
    have "norm (integral {a..} (f n)) \<le> -F a" for n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7596
    proof (cases "n \<ge> a")
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7597
      case True
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7598
      with assms have "a powr (e + 1) \<ge> n powr (e + 1)"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7599
        by (intro powr_mono2') simp_all
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7600
      with assms show ?thesis by (auto simp: divide_simps F_def integral_f)
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  7601
    qed (insert assms, simp add: integral_f F_def field_split_simps)
66408
46cfd348c373 general rationalisation of Analysis
paulson <lp15@cam.ac.uk>
parents: 66406
diff changeset
  7602
    thus "bounded (range(\<lambda>k. integral {a..} (f k)))"
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7603
      unfolding bounded_iff by (intro exI[of _ "-F a"]) auto
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7604
  qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7605
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7606
  from filterlim_real_sequentially
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7607
    have "eventually (\<lambda>n. real n \<ge> a) at_top"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7608
    by (simp add: filterlim_at_top)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7609
  hence "eventually (\<lambda>n. F n - F a = integral {a..} (f n)) at_top"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7610
    by eventually_elim (simp add: integral_f)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7611
  moreover have "(\<lambda>n. F n - F a) \<longlonglongrightarrow> 0 / (e + 1) - F a" unfolding F_def
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7612
    by (insert assms, (rule tendsto_intros filterlim_compose[OF tendsto_neg_powr]
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7613
          filterlim_ident filterlim_real_sequentially | simp)+)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7614
  hence "(\<lambda>n. F n - F a) \<longlonglongrightarrow> -F a" by simp
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  7615
  ultimately have "(\<lambda>n. integral {a..} (f n)) \<longlonglongrightarrow> -F a" by (blast intro: Lim_transform_eventually)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7616
  from conjunct2[OF *] and this
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7617
    have "integral {a..} (\<lambda>x. x powr e) = -F a" by (rule LIMSEQ_unique)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7618
  with conjunct1[OF *] show ?thesis
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7619
    by (simp add: has_integral_integral F_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7620
qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7621
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7622
lemma has_integral_inverse_power_to_inf:
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7623
  fixes a :: real and n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7624
  assumes "n > 1" "a > 0"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7625
  shows   "((\<lambda>x. 1 / x ^ n) has_integral 1 / (real (n - 1) * a ^ (n - 1))) {a..}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7626
proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7627
  from assms have "real_of_int (-int n) < -1" by simp
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7628
  note has_integral_powr_to_inf[OF this \<open>a > 0\<close>]
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7629
  also have "- (a powr (real_of_int (- int n) + 1)) / (real_of_int (- int n) + 1) =
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7630
                 1 / (real (n - 1) * a powr (real (n - 1)))" using assms
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  7631
    by (simp add: field_split_simps powr_add [symmetric] of_nat_diff)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7632
  also from assms have "a powr (real (n - 1)) = a ^ (n - 1)"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7633
    by (intro powr_realpow)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7634
  finally show ?thesis
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7635
    by (rule has_integral_eq [rotated])
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70802
diff changeset
  7636
       (insert assms, simp_all add: powr_minus powr_realpow field_split_simps)
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7637
qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7638
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7639
subsubsection \<open>Adaption to ordered Euclidean spaces and the Cartesian Euclidean space\<close>
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7640
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7641
lemma integral_component_eq_cart[simp]:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7642
  fixes f :: "'n::euclidean_space \<Rightarrow> real^'m"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7643
  assumes "f integrable_on s"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7644
  shows "integral s (\<lambda>x. f x $ k) = integral s f $ k"
69668
14a8cac10eac redundant lemma
nipkow
parents: 69661
diff changeset
  7645
  using integral_linear[OF assms(1) bounded_linear_vec_nth,unfolded o_def] .
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7646
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7647
lemma content_closed_interval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7648
  fixes a :: "'a::ordered_euclidean_space"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7649
  assumes "a \<le> b"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  7650
  shows "content {a..b} = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  7651
  using content_cbox[of a b] assms by (simp add: cbox_interval eucl_le[where 'a='a])
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7652
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7653
lemma integrable_const_ivl[intro]:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7654
  fixes a::"'a::ordered_euclidean_space"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  7655
  shows "(\<lambda>x. c) integrable_on {a..b}"
66409
f749d39c016b further tidying
paulson <lp15@cam.ac.uk>
parents: 66408
diff changeset
  7656
  unfolding cbox_interval[symmetric] by (rule integrable_const)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7657
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7658
lemma integrable_on_subinterval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7659
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  7660
  assumes "f integrable_on S" "{a..b} \<subseteq> S"
66402
5198edd9facc more Henstock_Kurzweil_Integration cleanup
paulson
parents: 66400
diff changeset
  7661
  shows "f integrable_on {a..b}"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68239
diff changeset
  7662
  using integrable_on_subcbox[of f S a b] assms by (simp add: cbox_interval)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7663
35173
9b24bfca8044 Renamed Multivariate-Analysis/Integration to Multivariate-Analysis/Integration_MV to avoid name clash with Integration.
hoelzl
parents: 35172
diff changeset
  7664
end