src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
author paulson <lp15@cam.ac.uk>
Sun, 06 Aug 2017 22:54:03 +0200
changeset 66359 8ed88442d7bb
parent 66356 a6c9d7206853
child 66365 d77a4ab4fe59
permissions -rw-r--r--
more integration cleanups
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     1
(*  Author:     John Harrison
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen (Translation from HOL light); proofs reworked by LCP
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     3
*)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     4
63594
bd218a9320b5 HOL-Multivariate_Analysis: rename theories for more descriptive names
hoelzl
parents: 63593
diff changeset
     5
section \<open>Henstock-Kurzweil gauge integration in many dimensions.\<close>
bd218a9320b5 HOL-Multivariate_Analysis: rename theories for more descriptive names
hoelzl
parents: 63593
diff changeset
     6
bd218a9320b5 HOL-Multivariate_Analysis: rename theories for more descriptive names
hoelzl
parents: 63593
diff changeset
     7
theory Henstock_Kurzweil_Integration
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
     8
imports
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
     9
  Lebesgue_Measure Tagged_Division
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    10
begin
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    11
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
    12
lemma eps_leI: 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
    13
  assumes "(\<And>e::'a::linordered_idom. 0 < e \<Longrightarrow> x < y + e)" shows "x \<le> y"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
    14
  by (metis add_diff_eq assms diff_diff_add diff_gt_0_iff_gt linorder_not_less order_less_irrefl)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
    15
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
    16
(*FIXME DELETE*)
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
    17
lemma conjunctD2: assumes "a \<and> b" shows a b using assms by auto
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
    18
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
    19
(* try instead structured proofs below *)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    20
lemma norm_diff2: "\<lbrakk>y = y1 + y2; x = x1 + x2; e = e1 + e2; norm(y1 - x1) \<le> e1; norm(y2 - x2) \<le> e2\<rbrakk>
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    21
  \<Longrightarrow> norm(y - x) \<le> e"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    22
  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
    23
  by (simp add: add_diff_add)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    24
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    25
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
    26
  by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    27
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    28
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
    29
  by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    30
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    31
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
    32
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    33
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    34
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
    35
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
    36
(* END MOVE *)
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
    37
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
    38
subsection \<open>Content (length, area, volume...) of an interval.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    39
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    40
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
    41
  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
    42
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    43
lemma content_cbox_cases:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
    44
  "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
    45
  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
    46
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    47
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
    48
  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
    49
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    50
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
    51
  by (simp add: box_ne_empty inner_diff)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    52
66296
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    53
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
    54
  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
    55
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    56
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
    57
  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
    58
  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
    59
proof -
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    60
  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
    61
    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
    62
  then show ?thesis
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    63
    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
    64
qed
33a47f2d9edc New theory of Equiintegrability / Continuity of the indefinite integral / improper integration
paulson <lp15@cam.ac.uk>
parents: 66294
diff changeset
    65
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
    66
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
    67
  by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
    68
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
    69
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
    70
  by (auto simp: content_real)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
    71
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    72
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
    73
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    74
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    75
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
    76
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    77
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
    78
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
    79
  by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    80
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    81
corollary content_nonneg [simp]: "~ content (cbox a b) < 0"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    82
  using not_le by blast
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    83
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    84
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
    85
  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
    86
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    87
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
    88
  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
    89
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
    90
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
    91
  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
    92
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
    93
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
    94
  by (auto simp add: content_cbox_cases less_le prod_nonneg)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    95
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    96
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
    97
  by simp
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    98
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
    99
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
   100
  by (simp add: content_real)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   101
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   102
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
   103
  unfolding measure_def
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   104
  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
   105
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   106
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
   107
  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
   108
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   109
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
   110
  unfolding measure_lborel_cbox_eq Basis_prod_def
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   111
  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
   112
  apply (auto simp: bex_Un ball_Un)
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   113
  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
   114
  apply auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   115
  done
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   116
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   117
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
   118
   "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
   119
  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
   120
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
   121
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
   122
  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
   123
  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
   124
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
   125
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
   126
  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
   127
  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
   128
  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
   129
  \<comment> \<open>Prove using measure theory\<close>
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
proof cases
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
   131
  note simps = interval_split[OF assms] content_cbox_cases
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
   132
  have *: "Basis = insert k (Basis - {k})" "\<And>x. finite (Basis-{x})" "\<And>x. x\<notin>Basis-{x}"
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
   133
    using assms 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
   134
  have *: "\<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))"
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
   135
    "(\<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)"
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
   136
    apply (subst *(1))
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
   137
    defer
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
   138
    apply (subst *(1))
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
   139
    unfolding prod.insert[OF *(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
   140
    apply 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
   141
    done
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
   142
  assume as: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<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
   143
  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
   144
  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
   145
    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
   146
    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
   147
  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
   148
  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
   149
      (\<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
   150
    "(\<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
   151
      (\<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
   152
    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
   153
  have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False"
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
   154
    unfolding 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
   155
    using as[unfolded ,rule_format,of k] assms
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
   156
    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
   157
  ultimately 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
   158
    using assms
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
   159
    unfolding 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
   160
    unfolding *(1)[of "\<lambda>i x. b\<bullet>i - x"] *(1)[of "\<lambda>i x. x - 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
   161
    unfolding *(2)
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
   162
    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
   163
next
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
   164
  assume "\<not> (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<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
   165
  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
   166
    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
   167
  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
   168
    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
   169
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
   170
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   171
lemma division_of_content_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   172
  assumes "content (cbox a b) = 0" "d division_of (cbox a b)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   173
  shows "\<forall>k\<in>d. content k = 0"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   174
  unfolding forall_in_division[OF assms(2)]
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   175
  by (metis antisym_conv assms content_pos_le content_subset division_ofD(2))
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   176
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   177
lemma sum_content_null:
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   178
  assumes "content (cbox a b) = 0"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   179
    and "p tagged_division_of (cbox a b)"
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   180
  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
   181
proof (rule sum.neutral, rule)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   182
  fix y
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   183
  assume y: "y \<in> p"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   184
  obtain x k where xk: "y = (x, k)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   185
    using surj_pair[of y] by blast
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   186
  then obtain c d where k: "k = cbox c d" "k \<subseteq> cbox a b"
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   187
    by (metis assms(2) tagged_division_ofD(3) tagged_division_ofD(4) y)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   188
  have "(\<lambda>(x, k). content k *\<^sub>R f x) y = content k *\<^sub>R f x"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   189
    unfolding xk by auto
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   190
  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
   191
    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
   192
  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
   193
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
   194
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
lemma operative_content[intro]: "add.operative content"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   196
  by (force simp add: add.operative_def content_split[symmetric] content_eq_0_interior)
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
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   198
lemma additive_content_division: "d division_of (cbox a b) \<Longrightarrow> sum content d = content (cbox a b)"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   199
  by (metis operative_content sum.operative_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
   200
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
lemma additive_content_tagged_division:
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   202
  "d tagged_division_of (cbox a b) \<Longrightarrow> sum (\<lambda>(x,l). content l) d = content (cbox a b)"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   203
  unfolding sum.operative_tagged_division[OF operative_content, symmetric] by blast
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
   204
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   205
lemma subadditive_content_division:
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   206
  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
   207
  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
   208
proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   209
  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
   210
    using assms by auto
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   211
  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
   212
    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
   213
  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
   214
    using sum_mono2 by blast
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   215
  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
   216
    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
   217
  finally show ?thesis .
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   218
qed
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   219
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
   220
lemma content_real_eq_0: "content {a .. b::real} = 0 \<longleftrightarrow> a \<ge> 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
   221
  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
   222
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
   223
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
   224
  using content_empty unfolding empty_as_interval by auto
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   225
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   226
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
   227
  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
   228
  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
   229
    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
   230
  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
   231
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   232
subsection \<open>Gauge integral\<close>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   233
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   234
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
   235
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
   236
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   237
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
   238
  (infixr "has'_integral" 46)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   239
  where "(f has_integral I) s \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   240
    (if \<exists>a b. s = cbox a b
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   241
      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
   242
      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
   243
        (\<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
   244
          norm (z - I) < e)))"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   245
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   246
lemma has_integral_cbox:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   247
  "(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
   248
  by (auto simp add: has_integral_def)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   249
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   250
lemma has_integral:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   251
  "(f has_integral y) (cbox a b) \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   252
    (\<forall>e>0. \<exists>d. gauge d \<and>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   253
      (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   254
        norm (sum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   255
  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
   256
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   257
lemma has_integral_real:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   258
  "(f has_integral y) {a .. b::real} \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   259
    (\<forall>e>0. \<exists>d. gauge d \<and>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   260
      (\<forall>p. p tagged_division_of {a .. b} \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   261
        norm (sum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   262
  unfolding box_real[symmetric]
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   263
  by (rule has_integral)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   264
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   265
lemma has_integralD[dest]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   266
  assumes "(f has_integral y) (cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   267
    and "e > 0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   268
  obtains d
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   269
    where "gauge d"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   270
      and "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d fine p \<Longrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   271
        norm ((\<Sum>(x,k)\<in>p. content k *\<^sub>R f x) - y) < e"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   272
  using assms unfolding has_integral by auto
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
lemma has_integral_alt:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   275
  "(f has_integral y) i \<longleftrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   276
    (if \<exists>a b. i = cbox a b
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   277
     then (f has_integral y) i
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   278
     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
   279
      (\<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
   280
  by (subst has_integral_def) (auto simp add: has_integral_cbox)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   281
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   282
lemma has_integral_altD:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   283
  assumes "(f has_integral y) i"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   284
    and "\<not> (\<exists>a b. i = cbox a b)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   285
    and "e>0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   286
  obtains B where "B > 0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   287
    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
   288
      (\<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
   289
  using assms has_integral_alt[of f y i] by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   290
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   291
definition integrable_on (infixr "integrable'_on" 46)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   292
  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
   293
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   294
definition "integral i f = (SOME y. (f has_integral y) i \<or> ~ f integrable_on i \<and> y=0)"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   295
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   296
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
   297
  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
   298
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   299
lemma not_integrable_integral: "~ f integrable_on i \<Longrightarrow> integral i f = 0"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   300
  unfolding integrable_on_def integral_def by blast
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   301
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   302
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
   303
  unfolding integrable_on_def by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   304
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   305
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
   306
  by auto
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   307
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   308
subsection \<open>Basic theorems about integrals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   309
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   310
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
   311
  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
   312
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
   313
lemma has_integral_unique:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   314
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   315
  assumes "(f has_integral k1) i"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   316
    and "(f has_integral k2) i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
   317
  shows "k1 = k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   318
proof (rule ccontr)
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
   319
  let ?e = "norm (k1 - k2) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   320
  assume as: "k1 \<noteq> k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   321
  then have e: "?e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   322
    by auto
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   323
  have lem: "(f has_integral k1) (cbox a b) \<Longrightarrow> (f has_integral k2) (cbox a b) \<Longrightarrow> k1 = k2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   324
    for f :: "'n \<Rightarrow> 'a" and a b k1 k2
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   325
    by (auto simp: has_integral_cbox intro: tendsto_unique[OF division_filter_not_empty])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   326
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   327
    presume "\<not> (\<exists>a b. i = cbox a b) \<Longrightarrow> False"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   328
    then show False
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   329
      using as assms lem by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   330
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   331
  assume as: "\<not> (\<exists>a b. i = cbox a b)"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   332
  obtain B1 where B1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   333
      "0 < B1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   334
      "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   335
        \<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b) \<and>
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   336
          norm (z - k1) < norm (k1 - k2) / 2"
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   337
    by (rule has_integral_altD[OF assms(1) as,OF e]) blast
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   338
  obtain B2 where B2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   339
      "0 < B2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   340
      "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   341
        \<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b) \<and>
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   342
          norm (z - k2) < norm (k1 - k2) / 2"
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   343
    by (rule has_integral_altD[OF assms(2) as,OF e]) blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   344
  have "\<exists>a b::'n. ball 0 B1 \<union> ball 0 B2 \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   345
    apply (rule bounded_subset_cbox)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   346
    using bounded_Un bounded_ball
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   347
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   348
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   349
  then obtain a b :: 'n where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   350
    by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   351
  obtain w where w:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   352
    "((\<lambda>x. if x \<in> i then f x else 0) has_integral w) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   353
    "norm (w - k1) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   354
    using B1(2)[OF ab(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   355
  obtain z where z:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   356
    "((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   357
    "norm (z - k2) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   358
    using B2(2)[OF ab(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   359
  have "z = w"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   360
    using lem[OF w(1) z(1)] by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   361
  then have "norm (k1 - k2) \<le> norm (z - k2) + norm (w - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   362
    using norm_triangle_ineq4 [of "k1 - w" "k2 - z"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   363
    by (auto simp add: norm_minus_commute)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   364
  also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   365
    apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   366
    apply (rule_tac[!] z(2) w(2))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   367
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   368
  finally show False by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   369
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   370
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   371
lemma integral_unique [intro]: "(f has_integral y) k \<Longrightarrow> integral k f = y"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   372
  unfolding integral_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   373
  by (rule some_equality) (auto intro: has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   374
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
   375
lemma eq_integralD: "integral k f = y \<Longrightarrow> (f has_integral y) k \<or> ~ f integrable_on k \<and> y=0"
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   376
  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
   377
  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
   378
  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
   379
  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
   380
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   381
lemma has_integral_const [intro]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   382
  fixes a b :: "'a::euclidean_space"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   383
  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
   384
  using eventually_division_filter_tagged_division[of "cbox a b"]
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   385
     additive_content_tagged_division[of _ a b]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   386
  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
   387
           elim!: eventually_mono intro!: tendsto_cong[THEN iffD1, OF _ tendsto_const])
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   388
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   389
lemma has_integral_const_real [intro]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   390
  fixes a b :: real
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   391
  shows "((\<lambda>x. c) has_integral (content {a .. b} *\<^sub>R c)) {a .. b}"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   392
  by (metis box_real(2) has_integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   393
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   394
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
   395
  by blast
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   396
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   397
lemma integral_const [simp]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   398
  fixes a b :: "'a::euclidean_space"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   399
  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
   400
  by (rule integral_unique) (rule has_integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   401
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   402
lemma integral_const_real [simp]:
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   403
  fixes a b :: real
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   404
  shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   405
  by (metis box_real(2) integral_const)
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   406
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   407
lemma has_integral_is_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   408
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   409
  assumes "\<forall>x\<in>s. f x = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   410
  shows "(f has_integral 0) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   411
proof -
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   412
  have lem: "(\<forall>x\<in>cbox a b. f x = 0) \<Longrightarrow> (f has_integral 0) (cbox a b)" for a  b and f :: "'n \<Rightarrow> 'a"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   413
    unfolding has_integral_cbox
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   414
    using eventually_division_filter_tagged_division[of "cbox a b"]
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   415
    by (subst tendsto_cong[where g="\<lambda>_. 0"])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   416
       (auto elim!: eventually_mono intro!: sum.neutral simp: tag_in_interval)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   417
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   418
    presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   419
    with assms lem show ?thesis
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   420
      by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   421
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   422
  have *: "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. 0)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   423
    apply (rule ext)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   424
    using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   425
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   426
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   427
  assume "\<not> (\<exists>a b. s = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   428
  then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   429
    using lem
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   430
    by (subst has_integral_alt) (force simp add: *)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   431
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   432
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   433
lemma has_integral_0[simp]: "((\<lambda>x::'n::euclidean_space. 0) has_integral 0) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   434
  by (rule has_integral_is_0) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   435
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   436
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
   437
  using has_integral_unique[OF has_integral_0] by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   438
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   439
lemma has_integral_linear:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   440
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   441
  assumes "(f has_integral y) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   442
    and "bounded_linear h"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   443
  shows "((h \<circ> f) has_integral ((h y))) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   444
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   445
  interpret bounded_linear h
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   446
    using assms(2) .
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   447
  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
   448
    by blast
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   449
  have lem: "\<And>a b y f::'n\<Rightarrow>'a. (f has_integral y) (cbox a b) \<Longrightarrow> ((h \<circ> f) has_integral h y) (cbox a b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   450
    unfolding has_integral_cbox by (drule tendsto) (simp add: sum scaleR split_beta')
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   451
  {
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   452
    presume "\<not> (\<exists>a b. S = cbox a b) \<Longrightarrow> ?thesis"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   453
    then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   454
      using assms(1) lem by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   455
  }
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   456
  assume as: "\<not> (\<exists>a b. S = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   457
  then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   458
  proof (subst has_integral_alt, clarsimp)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   459
    fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   460
    assume e: "e > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
   461
    have *: "0 < e/B" using e B(1) by simp
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   462
    obtain M where M:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   463
      "M > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   464
      "\<And>a b. ball 0 M \<subseteq> cbox a b \<Longrightarrow>
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   465
        \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b) \<and> norm (z - y) < e / B"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   466
      using has_integral_altD[OF assms(1) as *] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   467
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   468
      (\<exists>z. ((\<lambda>x. if x \<in> S then (h \<circ> f) x else 0) has_integral z) (cbox a b) \<and> norm (z - h y) < e)"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
   469
    proof (rule_tac x=M in exI, clarsimp simp add: M, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
   470
      case prems: (1 a b)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   471
      obtain z where z:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   472
        "((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   473
        "norm (z - y) < e / B"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
   474
        using M(2)[OF prems(1)] by blast
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   475
      have *: "(\<lambda>x. if x \<in> S then (h \<circ> f) x else 0) = h \<circ> (\<lambda>x. if x \<in> S then f x else 0)"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   476
        using zero by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   477
      show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   478
        apply (rule_tac x="h z" in exI)
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   479
        apply (simp add: * lem[OF z(1)])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   480
        apply (metis B diff le_less_trans pos_less_divide_eq z(2))
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   481
        done
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   482
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   483
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   484
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   485
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   486
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
   487
  "(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
   488
  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
   489
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   490
lemma integrable_on_scaleR_left:
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   491
  assumes "f integrable_on A"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
   492
  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
   493
  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
   494
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   495
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
   496
  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
   497
  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
   498
  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
   499
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   500
text\<open>The case analysis eliminates the condition @{term "f integrable_on S"} at the cost
62837
237ef2bab6c7 isabelle update_cartouches -c -t;
wenzelm
parents: 62626
diff changeset
   501
     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
   502
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
   503
  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
   504
  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
   505
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
   506
  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
   507
    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
   508
next
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   509
  case False then have "~ (\<lambda>x. f x * c) integrable_on S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   510
    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
   511
    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
   512
  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
   513
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
   514
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
   515
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
   516
  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
   517
  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
   518
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
   519
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   520
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
   521
  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
   522
  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
   523
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
   524
  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
   525
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   526
lemma has_integral_mult_right:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   527
  fixes c :: "'a :: real_normed_algebra"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   528
  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
   529
  using has_integral_linear[OF _ bounded_linear_mult_right] by (simp add: comp_def)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   530
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   531
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
   532
  unfolding o_def[symmetric]
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   533
  by (metis has_integral_linear bounded_linear_scaleR_right)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   534
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   535
lemma has_integral_cmult_real:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   536
  fixes c :: real
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   537
  assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   538
  shows "((\<lambda>x. c * f x) has_integral c * x) A"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   539
proof (cases "c = 0")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   540
  case True
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   541
  then show ?thesis by simp
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   542
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   543
  case False
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   544
  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
   545
    unfolding real_scaleR_def .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   546
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   547
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   548
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
   549
  by (drule_tac c="-1" in has_integral_cmul) auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   550
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   551
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
   552
  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
   553
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   554
lemma has_integral_add:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   555
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   556
  assumes "(f has_integral k) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   557
    and "(g has_integral l) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   558
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   559
proof -
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   560
  have lem: "(f has_integral k) (cbox a b) \<Longrightarrow> (g has_integral l) (cbox a b) \<Longrightarrow>
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   561
    ((\<lambda>x. f x + g x) has_integral (k + l)) (cbox a b)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   562
    for f :: "'n \<Rightarrow> 'a" and g a b k l
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   563
    unfolding has_integral_cbox
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   564
    by (simp add: split_beta' scaleR_add_right sum.distrib[abs_def] tendsto_add)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   565
  {
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   566
    presume "\<not> (\<exists>a b. S = cbox a b) \<Longrightarrow> ?thesis"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   567
    then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   568
      using assms lem by force
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   569
  }
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   570
  assume as: "\<not> (\<exists>a b. S = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   571
  then show ?thesis
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
   572
  proof (subst has_integral_alt, clarsimp, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   573
    case (1 e)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   574
    then have *: "e / 2 > 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   575
      by auto
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   576
    from has_integral_altD[OF assms(1) as *]
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   577
    obtain B1 where B1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   578
        "0 < B1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   579
        "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   580
          \<exists>z. ((\<lambda>x. if x \<in> S then f x else 0) has_integral z) (cbox a b) \<and> norm (z - k) < e / 2"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   581
      by blast
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   582
    from has_integral_altD[OF assms(2) as *]
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   583
    obtain B2 where B2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   584
        "0 < B2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   585
        "\<And>a b. ball 0 B2 \<subseteq> (cbox a b) \<Longrightarrow>
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   586
          \<exists>z. ((\<lambda>x. if x \<in> S then g x else 0) has_integral z) (cbox a b) \<and> norm (z - l) < e / 2"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
   587
      by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   588
    show ?case
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   589
    proof (rule_tac x="max B1 B2" in exI, clarsimp simp add: max.strict_coboundedI1 B1)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   590
      fix a b
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   591
      assume "ball 0 (max B1 B2) \<subseteq> cbox a (b::'n)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   592
      then have *: "ball 0 B1 \<subseteq> cbox a (b::'n)" "ball 0 B2 \<subseteq> cbox a (b::'n)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   593
        by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   594
      obtain w where w:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   595
        "((\<lambda>x. if x \<in> S then f x else 0) has_integral w) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   596
        "norm (w - k) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   597
        using B1(2)[OF *(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   598
      obtain z where z:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   599
        "((\<lambda>x. if x \<in> S then g x else 0) has_integral z) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   600
        "norm (z - l) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   601
        using B2(2)[OF *(2)] by blast
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   602
      have *: "\<And>x. (if x \<in> S then f x + g x else 0) =
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   603
        (if x \<in> S then f x else 0) + (if x \<in> S then g x else 0)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   604
        by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   605
      show "\<exists>z. ((\<lambda>x. if x \<in> S then f x + g x else 0) has_integral z) (cbox a b) \<and> norm (z - (k + l)) < e"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   606
        apply (rule_tac x="w + z" in exI)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   607
        apply (simp add: lem[OF w(1) z(1), unfolded *[symmetric]])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   608
        using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   609
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   610
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   611
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   612
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   613
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   614
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   615
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
   616
  "(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
   617
    ((\<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
   618
  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
   619
  by (auto simp: algebra_simps)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   620
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
   621
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
   622
  "integral S (\<lambda>x::'n::euclidean_space. 0::'m::real_normed_vector) = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   623
  by (rule integral_unique has_integral_0)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   624
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   625
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
   626
    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
   627
  by (rule integral_unique) (metis integrable_integral has_integral_add)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   628
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   629
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
   630
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
   631
  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
   632
    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
   633
next
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   634
  case False then have "~ (\<lambda>x. c *\<^sub>R 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
   635
    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
   636
  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
   637
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
   638
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   639
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
   640
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
   641
  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
   642
    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
   643
next
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   644
  case False then have "~ (\<lambda>x. - 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
   645
    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
   646
  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
   647
qed
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   648
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   649
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
   650
    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
   651
  by (rule integral_unique) (metis integrable_integral has_integral_diff)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   652
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   653
lemma integrable_0: "(\<lambda>x. 0) integrable_on S"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   654
  unfolding integrable_on_def using has_integral_0 by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   655
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   656
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
   657
  unfolding integrable_on_def by(auto intro: has_integral_add)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   658
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   659
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
   660
  unfolding integrable_on_def by(auto intro: has_integral_cmul)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   661
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   662
lemma integrable_on_cmult_iff:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   663
  fixes c :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   664
  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
   665
  shows "(\<lambda>x. c * f x) integrable_on S \<longleftrightarrow> f integrable_on S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   666
  using integrable_cmul[of "\<lambda>x. c * f x" S "1 / c"] integrable_cmul[of f S c] \<open>c \<noteq> 0\<close>
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   667
  by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   668
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   669
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
   670
  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
   671
  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
   672
    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
   673
    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
   674
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   675
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
   676
  unfolding integrable_on_def by(auto intro: has_integral_neg)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   677
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
   678
lemma integrable_diff:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   679
  "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
   680
  unfolding integrable_on_def by(auto intro: has_integral_diff)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   681
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   682
lemma integrable_linear:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   683
  "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
   684
  unfolding integrable_on_def by(auto intro: has_integral_linear)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   685
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   686
lemma integral_linear:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   687
  "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
   688
  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
   689
  apply (simp_all add: integrable_integral integrable_linear has_integral_linear )
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   690
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   691
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   692
lemma integral_component_eq[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   693
  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
   694
  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
   695
  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
   696
  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
   697
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   698
lemma has_integral_sum:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   699
  assumes "finite t"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   700
    and "\<forall>a\<in>t. ((f a) has_integral (i a)) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   701
  shows "((\<lambda>x. sum (\<lambda>a. f a x) t) has_integral (sum i t)) S"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   702
  using assms(1) subset_refl[of t]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   703
proof (induct rule: finite_subset_induct)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   704
  case empty
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   705
  then show ?case by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   706
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   707
  case (insert x F)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   708
  with assms show ?case
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   709
    by (simp add: has_integral_add)
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   710
qed
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   711
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   712
lemma integral_sum:
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
   713
  "\<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
   714
   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
   715
  by (simp add: has_integral_sum integrable_integral integral_unique)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   716
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   717
lemma integrable_sum:
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
   718
  "\<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
   719
  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
   720
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   721
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
   722
  assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   723
    and "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   724
  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
   725
  using has_integral_diff[OF assms(2), of "\<lambda>x. f x - g x" 0]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   726
  using has_integral_is_0[of s "\<lambda>x. f x - g x"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   727
  using assms(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   728
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   729
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   730
lemma integrable_eq: "(\<And>x. x \<in> s \<Longrightarrow> f x = g x) \<Longrightarrow> f integrable_on s \<Longrightarrow> g integrable_on s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   731
  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
   732
  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
   733
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   734
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
   735
  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
   736
  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
   737
  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
   738
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   739
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   740
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
   741
  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
   742
  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
   743
  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
   744
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
   745
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   746
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
   747
  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
   748
  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
   749
        (is "?lhs = ?rhs")
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   750
proof
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   751
  assume ?lhs
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   752
  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
   753
    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
   754
    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
   755
  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
   756
    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
   757
  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
   758
    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
   759
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
   760
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   761
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
   762
  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
   763
  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
   764
  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
   765
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
   766
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   767
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
   768
  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
   769
  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
   770
  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
   771
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
   772
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   773
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
   774
  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
   775
  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
   776
  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
   777
by (simp add: integrable_on_cmult_right divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   778
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   779
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
   780
  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
   781
  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
   782
  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
   783
by (simp add: divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
   784
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   785
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
   786
  unfolding has_integral_cbox
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   787
  using eventually_division_filter_tagged_division[of "cbox a b"]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
   788
  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
   789
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   790
lemma has_integral_null_real [intro]: "content {a .. b::real} = 0 \<Longrightarrow> (f has_integral 0) {a .. b}"
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
   791
  by (metis box_real(2) has_integral_null)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   792
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   793
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
   794
  by (auto simp add: has_integral_null dest!: integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   795
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   796
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
   797
  by (metis has_integral_null integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   798
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   799
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
   800
  by (simp add: has_integral_integrable)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   801
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   802
lemma has_integral_empty[intro]: "(f has_integral 0) {}"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
   803
  by (simp add: has_integral_is_0)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   804
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   805
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
   806
  by (auto simp add: has_integral_empty has_integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   807
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   808
lemma integrable_on_empty[intro]: "f integrable_on {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   809
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   810
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   811
lemma integral_empty[simp]: "integral {} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   812
  by (rule integral_unique) (rule has_integral_empty)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   813
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   814
lemma has_integral_refl[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   815
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   816
  shows "(f has_integral 0) (cbox a a)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   817
    and "(f has_integral 0) {a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   818
proof -
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
   819
  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
   820
     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
   821
  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
   822
    by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   823
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   824
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   825
lemma integrable_on_refl[intro]: "f integrable_on cbox a a"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   826
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   827
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   828
lemma integral_refl [simp]: "integral (cbox a a) f = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   829
  by (rule integral_unique) auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
   830
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   831
lemma integral_singleton [simp]: "integral {a} f = 0"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   832
  by auto
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   833
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   834
lemma integral_blinfun_apply:
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   835
  assumes "f integrable_on s"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   836
  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
   837
  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
   838
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   839
lemma blinfun_apply_integral:
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   840
  assumes "f integrable_on s"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
   841
  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
   842
  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
   843
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   844
lemma has_integral_componentwise_iff:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   845
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   846
  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
   847
proof safe
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   848
  fix b :: 'b assume "(f has_integral y) A"
63938
f6ce08859d4c More mainly topological results
paulson <lp15@cam.ac.uk>
parents: 63928
diff changeset
   849
  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
   850
    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
   851
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   852
  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
   853
  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
   854
    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
   855
  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
   856
    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
   857
  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
   858
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   859
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   860
lemma has_integral_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   861
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   862
  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
   863
  by (subst has_integral_componentwise_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   864
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   865
lemma integrable_componentwise_iff:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   866
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   867
  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
   868
proof
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   869
  assume "f integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   870
  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
   871
  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
   872
    by (subst (asm) has_integral_componentwise_iff)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   873
  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
   874
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   875
  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
   876
  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
   877
    unfolding integrable_on_def by (subst (asm) bchoice_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   878
  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
   879
    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
   880
  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
   881
    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
   882
  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
   883
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   884
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   885
lemma integrable_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   886
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   887
  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
   888
  by (subst integrable_componentwise_iff) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   889
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   890
lemma integral_componentwise:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   891
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   892
  assumes "f integrable_on A"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   893
  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
   894
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   895
  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
   896
    by (subst (asm) integrable_componentwise_iff, intro integrable_linear ballI)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   897
       (simp_all add: bounded_linear_scaleR_left)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   898
  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
   899
    by (simp add: euclidean_representation)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   900
  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
   901
    by (subst integral_sum) (simp_all add: o_def)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   902
  finally show ?thesis .
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   903
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   904
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   905
lemma integrable_component:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   906
  "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
   907
  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
   908
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
   909
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   910
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   911
subsection \<open>Cauchy-type criterion for integrability.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   912
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   913
lemma integrable_Cauchy:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   914
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::{real_normed_vector,complete_space}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   915
  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
   916
        (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   917
          (\<forall>p1 p2. p1 tagged_division_of (cbox a b) \<and> \<gamma> fine p1 \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   918
            p2 tagged_division_of (cbox a b) \<and> \<gamma> fine p2 \<longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   919
            norm ((\<Sum>(x,K)\<in>p1. content K *\<^sub>R f x) - (\<Sum>(x,K)\<in>p2. 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
   920
  (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
   921
proof (intro iffI allI impI)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   922
  assume ?l
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   923
  then obtain y
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   924
    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
   925
        \<exists>\<gamma>. gauge \<gamma> \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   926
            (\<forall>p. p tagged_division_of cbox a b \<and> \<gamma> fine p \<longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   927
                 norm ((\<Sum>(x,K) \<in> p. 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
   928
    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
   929
  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
   930
  proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   931
    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
   932
    with y obtain \<gamma> where "gauge \<gamma>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   933
      and \<gamma>: "\<And>p. p tagged_division_of cbox a b \<and> \<gamma> fine p \<Longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   934
                  norm ((\<Sum>(x,K)\<in>p. 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
   935
      by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   936
    show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   937
    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
   938
        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
   939
    qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   940
next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   941
  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
   942
  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
   943
    by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   944
  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
   945
    "\<And>m. gauge (\<gamma> m)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   946
    "\<And>m p1 p2. \<lbrakk>p1 tagged_division_of cbox a b;
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   947
              \<gamma> m fine p1; p2 tagged_division_of cbox a b; \<gamma> m fine p2\<rbrakk>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   948
              \<Longrightarrow> norm ((\<Sum>(x,K) \<in> p1. content K *\<^sub>R f x) - (\<Sum>(x,K) \<in> p2. content K *\<^sub>R f x))
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   949
                  < 1 / (m + 1)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   950
    by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   951
  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
   952
    apply (rule gauge_Inter)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   953
    using \<gamma> by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   954
  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
   955
    by (meson fine_division_exists)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   956
  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
   957
                         "\<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
   958
    by meson
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   959
  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
   960
    using p unfolding fine_Inter
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   961
    using atLeastAtMost_iff by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   962
  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
   963
  proof (rule CauchyI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   964
    fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   965
    assume "0 < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   966
    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
   967
      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
   968
    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
   969
    proof (intro exI allI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   970
      fix m n
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   971
      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
   972
      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
   973
        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
   974
      also have "... < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   975
        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
   976
      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
   977
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   978
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   979
  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
   980
    by (auto simp: convergent_eq_Cauchy[symmetric] dest: LIMSEQ_D)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   981
  show ?l
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   982
    unfolding integrable_on_def has_integral
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
   983
  proof (rule_tac x=y in exI, clarify)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   984
    fix e :: real
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
   985
    assume "e>0"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   986
    then have e2: "e/2 > 0" by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   987
    then obtain N1::nat where N1: "N1 \<noteq> 0" "inverse (real N1) < e / 2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   988
      using real_arch_inverse by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   989
    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"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   990
      using y[OF e2] by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   991
    show "\<exists>\<gamma>. gauge \<gamma> \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   992
              (\<forall>p. p tagged_division_of (cbox a b) \<and> \<gamma> fine p \<longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   993
                norm ((\<Sum>(x,K) \<in> p. 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
   994
    proof (intro exI conjI allI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   995
      show "gauge (\<gamma> (N1+N2))"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   996
        using \<gamma> by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
   997
      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
   998
           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
   999
      proof (rule norm_triangle_half_r)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1000
        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
  1001
               < 1 / (real (N1+N2) + 1)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1002
          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
  1003
        also have "... < e/2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1004
          using N1 \<open>0 < e\<close> by (auto simp: field_simps intro: less_le_trans)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1005
        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" .
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1006
        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
  1007
          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
  1008
      qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1009
    qed
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1010
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1011
qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  1012
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1013
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1014
subsection \<open>Additivity of integral on abutting intervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1015
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1016
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
  1017
  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
  1018
    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
  1019
  shows "content (K1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1020
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1021
  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
  1022
    by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1023
  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
  1024
    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
  1025
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1026
    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
  1027
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1028
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1029
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
  1030
  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
  1031
    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
  1032
  shows "content (K1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1033
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1034
  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
  1035
    by auto
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1036
  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
  1037
    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
  1038
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1039
    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
  1040
    by (auto simp: content_eq_0_interior)
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  1041
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1042
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1043
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1044
proposition has_integral_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1045
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1046
  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
  1047
      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
  1048
      and k: "k \<in> Basis"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1049
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
  1050
  unfolding has_integral
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1051
proof clarify
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1052
  fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1053
  assume "0 < e"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1054
  then have e: "e/2 > 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1055
    by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1056
    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
  1057
      and \<gamma>1norm:
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1058
        "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}; \<gamma>1 fine p\<rbrakk>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1059
             \<Longrightarrow> norm ((\<Sum>(x,K) \<in> p. content K *\<^sub>R f x) - i) < e / 2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1060
       apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1061
       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
  1062
      done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1063
    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
  1064
      and \<gamma>2norm:
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1065
        "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}; \<gamma>2 fine p\<rbrakk>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1066
             \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - j) < e / 2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1067
       apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1068
       apply (simp add: interval_split[symmetric] k)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1069
       done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1070
  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
  1071
  have "gauge ?\<gamma>"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1072
    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
  1073
  then show "\<exists>\<gamma>. gauge \<gamma> \<and>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1074
                 (\<forall>p. p tagged_division_of cbox a b \<and> \<gamma> fine p \<longrightarrow>
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1075
                      norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (i + j)) < e)"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1076
  proof (rule_tac x="?\<gamma>" in exI, safe)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1077
    fix p
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1078
    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
  1079
    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
  1080
      using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1081
    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
  1082
    proof (rule ccontr)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1083
      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
  1084
      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
  1085
        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
  1086
      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
  1087
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1088
      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
  1089
        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
  1090
        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
  1091
      with y show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1092
        using ** by (auto simp add: field_simps)
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1093
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1094
    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
  1095
    proof (rule ccontr)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1096
      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
  1097
      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
  1098
        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
  1099
      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
  1100
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1101
      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
  1102
        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
  1103
        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
  1104
      with y show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1105
        using ** by (auto simp add: field_simps)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1106
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1107
    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
  1108
      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
  1109
    proof -
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1110
      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
  1111
        by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1112
      then show ?thesis
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  1113
        by (rule rev_finite_subset) auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1114
    qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1115
    { fix \<G> :: "'a set \<Rightarrow> 'a set"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1116
      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
  1117
      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
  1118
      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
  1119
                                 "(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
  1120
        by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1121
      have "content (\<G> K) = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1122
        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
  1123
      then have "(\<lambda>(x,K). content K *\<^sub>R f x) i = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1124
        unfolding xk split_conv by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1125
    } note [simp] = this
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1126
    have "finite p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1127
      using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1128
    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
  1129
    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
  1130
      using \<open>?\<gamma> fine p\<close> by (fastforce simp: fine_def split: if_split_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1131
    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
  1132
    proof (rule \<gamma>1norm [OF tagged_division_ofI \<gamma>1_fine])
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1133
      show "finite ?M1"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1134
        by (rule fin_finite) (use p in blast)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1135
      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
  1136
        by (auto simp: ab_eqp)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1137
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1138
      fix x L
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1139
      assume xL: "(x, L) \<in> ?M1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1140
      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
  1141
                                   "(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
  1142
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1143
      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
  1144
        using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1145
      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
  1146
        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
  1147
      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
  1148
        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
  1149
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1150
      fix y R
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1151
      assume yR: "(y, R) \<in> ?M1"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1152
      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
  1153
                                   "(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
  1154
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1155
      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
  1156
      show "interior L \<inter> interior R = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1157
      proof (cases "L' = R' \<longrightarrow> x' = y'")
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1158
        case False
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1159
        have "interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1160
          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
  1161
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1162
          using yR' by simp
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1163
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1164
        case True
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1165
        then have "L' \<noteq> R'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1166
          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
  1167
        have "interior L' \<inter> interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1168
          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
  1169
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1170
          using xL'(2) yR'(2) by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1171
      qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1172
    qed
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1173
    moreover
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1174
    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
  1175
    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
  1176
      using \<open>?\<gamma> fine p\<close> by (fastforce simp: fine_def split: if_split_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1177
    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
  1178
    proof (rule \<gamma>2norm [OF tagged_division_ofI \<gamma>2_fine])
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1179
      show "finite ?M2"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1180
        by (rule fin_finite) (use p in blast)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1181
      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
  1182
        by (auto simp: ab_eqp)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1183
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1184
      fix x L
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1185
      assume xL: "(x, L) \<in> ?M2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1186
      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
  1187
                                   "(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
  1188
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1189
      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
  1190
        using p by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1191
      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
  1192
        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
  1193
      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
  1194
        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
  1195
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1196
      fix y R
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1197
      assume yR: "(y, R) \<in> ?M2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1198
      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
  1199
                                   "(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
  1200
        by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1201
      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
  1202
      show "interior L \<inter> interior R = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1203
      proof (cases "L' = R' \<longrightarrow> x' = y'")
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1204
        case False
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1205
        have "interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1206
          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
  1207
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1208
          using yR' by simp
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1209
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1210
        case True
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1211
        then have "L' \<noteq> R'"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1212
          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
  1213
        have "interior L' \<inter> interior R' = {}"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1214
          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
  1215
        then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1216
          using xL'(2) yR'(2) by auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1217
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1218
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1219
    ultimately
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1220
    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
  1221
      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
  1222
    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
  1223
                   ((\<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
  1224
                   (\<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
  1225
    proof -
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1226
      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
  1227
         by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1228
      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
  1229
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1230
      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
  1231
                  (\<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
  1232
                  (\<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
  1233
        by (rule sum.mono_neutral_left) (auto simp: \<open>finite p\<close>)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1234
      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
  1235
        (\<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
  1236
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1237
      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
  1238
        (\<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
  1239
        unfolding *
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1240
        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
  1241
           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
  1242
                       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
  1243
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1244
      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
  1245
                                (\<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
  1246
                                (\<lambda>(a,B). content B *\<^sub>R f a) x"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  1247
      proof clarify
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1248
        fix a B
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1249
        assume "(a, B) \<in> p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1250
        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
  1251
        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
  1252
          by (auto simp: scaleR_left_distrib uv content_split[OF k,of u v c])
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1253
      qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1254
      ultimately show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1255
        by (auto simp: sum.distrib[symmetric])
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1256
      qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1257
    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
  1258
      by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1259
  qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1260
qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  1261
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1262
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1263
subsection \<open>A sort of converse, integrability on subintervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1264
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1265
lemma has_integral_separate_sides:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1266
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1267
  assumes f: "(f has_integral i) (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1268
    and "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1269
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1270
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1271
    "\<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
  1272
        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
  1273
        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
  1274
proof -
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1275
  obtain \<gamma> where d: "gauge \<gamma>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1276
      "\<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
  1277
            \<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
  1278
    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
  1279
  { fix p1 p2
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1280
    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
  1281
    note p1=tagged_division_ofD[OF this(1)] 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1282
    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
  1283
    note p2=tagged_division_ofD[OF this(1)] 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1284
    note tagged_division_union_interval[OF tdiv1 tdiv2] 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1285
    note p12 = tagged_division_ofD[OF this] this
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1286
    { fix a b
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1287
      assume ab: "(a, b) \<in> p1 \<inter> p2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1288
      have "(a, b) \<in> p1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1289
        using ab by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1290
      obtain u v where uv: "b = cbox u v"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1291
        using \<open>(a, b) \<in> p1\<close> p1(4) by moura
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1292
      have "b \<subseteq> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1293
        using ab p1(3)[of a b] p2(3)[of a b] by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1294
      moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1295
      have "interior {x::'a. x \<bullet> k = c} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1296
      proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1297
        assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1298
        then obtain x where x: "x \<in> interior {x::'a. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1299
          by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1300
        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
  1301
          using mem_interior by metis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1302
        have x: "x\<bullet>k = c"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1303
          using x interior_subset by fastforce
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1304
        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)"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1305
          using \<open>0 < \<epsilon>\<close> k by (auto simp: inner_simps inner_not_same_Basis)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1306
        have "(\<Sum>i\<in>Basis. \<bar>(x - (x + (\<epsilon> / 2 ) *\<^sub>R k)) \<bullet> i\<bar>) =
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1307
              (\<Sum>i\<in>Basis. (if i = k then \<epsilon> / 2 else 0))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1308
          using "*" by (blast intro: sum.cong)
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1309
        also have "\<dots> < \<epsilon>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1310
          by (subst sum.delta) (use \<open>0 < \<epsilon>\<close> in auto)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1311
        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
  1312
          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
  1313
        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
  1314
          using \<epsilon> by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1315
        then show False
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1316
          using \<open>0 < \<epsilon>\<close> x k by (auto simp: inner_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1317
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1318
      ultimately have "content b = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1319
        unfolding uv content_eq_0_interior
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1320
        using interior_mono by blast
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1321
      then have "content b *\<^sub>R f a = 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1322
        by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1323
    }
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1324
    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
  1325
               norm ((\<Sum>(x, k)\<in>p1 \<union> p2. content k *\<^sub>R f x) - i)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1326
      by (subst sum.union_inter_neutral) (auto simp: p1 p2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1327
    also have "\<dots> < e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1328
      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
  1329
    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
  1330
   }
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1331
  then show ?thesis
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  1332
    using d(1) that by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1333
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1334
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1335
lemma integrable_split [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1336
  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
  1337
  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
  1338
      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
  1339
    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
  1340
    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
  1341
proof -
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1342
  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
  1343
    using f by blast
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  1344
  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
  1345
  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
  1346
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1347
            (\<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
  1348
                     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
  1349
                     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
  1350
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1351
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1352
    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
  1353
  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
  1354
  obtain d
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1355
    where "gauge d"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1356
         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
  1357
                          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
  1358
                  \<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
  1359
    by metis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1360
  show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1361
    proof (rule_tac x=d in exI, clarsimp simp add: \<open>gauge d\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1362
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1363
      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
  1364
                 "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
  1365
      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
  1366
      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
  1367
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1368
        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
  1369
        then show ?thesis
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1370
          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
  1371
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1372
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1373
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1374
    qed
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1375
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1376
  with f show ?thesis1
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1377
    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
  1378
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1379
            (\<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
  1380
                     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
  1381
                     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
  1382
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1383
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1384
    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
  1385
  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
  1386
  obtain d
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1387
    where "gauge d"
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1388
         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
  1389
                          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
  1390
                  \<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
  1391
    by metis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1392
  show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1393
    proof (rule_tac x=d in exI, clarsimp simp add: \<open>gauge d\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1394
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1395
      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
  1396
                 "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
  1397
      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
  1398
      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
  1399
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1400
        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
  1401
        then show ?thesis
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1402
          using as norm_triangle_half_l[OF d[of p p1] d[of p p2]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1403
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  1404
          by (auto simp add: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1405
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1406
    qed
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  1407
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  1408
  with f show ?thesis2
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1409
    by (simp add: interval_split[OF k] integrable_Cauchy)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1410
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1411
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1412
lemma operative_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1413
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1414
  shows "comm_monoid.operative (lift_option op +) (Some 0)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1415
    (\<lambda>i. if f integrable_on i then Some (integral i f) else None)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1416
proof -
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1417
  interpret comm_monoid "lift_option plus" "Some (0::'b)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1418
    by (rule comm_monoid_lift_option)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1419
      (rule add.comm_monoid_axioms)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1420
  show ?thesis
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1421
  proof (unfold operative_def, safe)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1422
    fix a b c
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1423
    fix k :: 'a
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1424
    assume k: "k \<in> Basis"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1425
    show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) =
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1426
          lift_option op + (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)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1427
          (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
  1428
    proof (cases "f integrable_on cbox a b")
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1429
      case True
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1430
      with k show ?thesis
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1431
        apply (simp add: integrable_split)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1432
        apply (rule integral_unique [OF has_integral_split[OF _ _ k]])
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  1433
        apply (auto intro: integrable_integral)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1434
        done
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1435
    next
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1436
    case False
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1437
      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
  1438
      proof (rule ccontr)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1439
        assume "\<not> ?thesis"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1440
        then have "f integrable_on cbox a b"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1441
          unfolding integrable_on_def
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1442
          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
  1443
          apply (rule has_integral_split[OF _ _ k])
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1444
          apply (auto intro: integrable_integral)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1445
          done
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1446
        then show False
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1447
          using False by auto
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1448
      qed
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1449
      then show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1450
        using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1451
    qed
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1452
  next
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1453
    fix a b :: 'a
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1454
    assume "box a b = {}"
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1455
    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
  1456
      using has_integral_null_eq
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  1457
      by (auto simp: integrable_on_null content_eq_0_interior)
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  1458
  qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1459
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1460
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1461
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
  1462
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1463
lemma dsum_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1464
  assumes "p division_of (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1465
    and "norm c \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1466
  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
  1467
proof -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1468
  have sumeq: "(\<Sum>i\<in>p. \<bar>content i\<bar>) = sum content p"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1469
    apply (rule sum.cong)
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1470
    using assms
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1471
    apply simp
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1472
    apply (metis abs_of_nonneg assms(1) content_pos_le division_ofD(4))
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1473
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1474
  have e: "0 \<le> e"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1475
    using assms(2) norm_ge_zero order_trans by blast
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1476
  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
  1477
    using norm_sum by blast
60467
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1478
  also have "...  \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1479
    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
  1480
  also have "... \<le> e * content (cbox a b)"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1481
    apply (rule mult_left_mono [OF _ e])
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1482
    apply (simp add: sumeq)
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1483
    using additive_content_division assms(1) eq_iff apply blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1484
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1485
  finally show ?thesis .
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  1486
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1487
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1488
lemma rsum_bound:
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1489
  assumes p: "p tagged_division_of (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1490
      and "\<forall>x\<in>cbox a b. norm (f x) \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1491
    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
  1492
proof (cases "cbox a b = {}")
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1493
  case True show ?thesis
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1494
    using p unfolding True tagged_division_of_trivial by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1495
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1496
  case False
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1497
  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
  1498
    by (meson ex_in_conv assms(2) norm_ge_zero order_trans)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1499
  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
  1500
    unfolding additive_content_tagged_division[OF p, symmetric] split_def
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1501
    by (auto intro: eq_refl)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1502
  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
  1503
    using tagged_division_ofD(4) [OF p] content_pos_le
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1504
    by force
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1505
  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
  1506
    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
  1507
    by (metis prod.collapse subset_eq)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1508
  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
  1509
    by (rule norm_sum)
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1510
  also have "...  \<le> e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1511
    unfolding split_def norm_scaleR
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1512
    apply (rule order_trans[OF sum_mono])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1513
    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
  1514
    apply (metis norm)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1515
    unfolding sum_distrib_right[symmetric]
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1516
    using con sum_le
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1517
    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
  1518
    done
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1519
  finally show ?thesis .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1520
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1521
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1522
lemma rsum_diff_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1523
  assumes "p tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1524
    and "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1525
  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
  1526
         e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1527
  apply (rule order_trans[OF _ rsum_bound[OF assms]])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1528
  apply (simp add: split_def scaleR_diff_right sum_subtractf eq_refl)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1529
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1530
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1531
lemma has_integral_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1532
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1533
  assumes "0 \<le> B"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1534
      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
  1535
      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
  1536
    shows "norm i \<le> B * content (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1537
proof (rule ccontr)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1538
  assume "\<not> ?thesis"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1539
  then have "norm i - B * content (cbox a b) > 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1540
    by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1541
  with f[unfolded has_integral]
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1542
  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
  1543
    "\<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
  1544
          \<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
  1545
    by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1546
  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
  1547
    using fine_division_exists by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1548
  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
  1549
    unfolding not_less
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1550
    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
  1551
  then show False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1552
    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
  1553
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1554
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1555
corollary has_integral_bound_real:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1556
  fixes f :: "real \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1557
  assumes "0 \<le> B"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1558
      and "(f has_integral i) {a .. b}"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1559
      and "\<forall>x\<in>{a .. b}. norm (f x) \<le> B"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  1560
    shows "norm i \<le> B * content {a .. b}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1561
  by (metis assms box_real(2) has_integral_bound)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1562
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1563
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
  1564
  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
  1565
  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
  1566
      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
  1567
      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
  1568
    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
  1569
by (metis integrable_integral has_integral_bound assms)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1570
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1571
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1572
subsection \<open>Similar theorems about relationship among components.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1573
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1574
lemma rsum_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1575
  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
  1576
  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
  1577
      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
  1578
    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
  1579
unfolding inner_sum_left
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1580
proof (rule sum_mono, clarify)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1581
  fix x K
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1582
  assume ab: "(x, K) \<in> p"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1583
  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
  1584
    by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  1585
  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
  1586
    by (metis ab assms inner_scaleR_left measure_nonneg mult_left_mono tag_in_interval)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1587
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1588
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
  1589
lemma has_integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1590
  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
  1591
  assumes k: "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1592
  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
  1593
    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
  1594
  shows "i\<bullet>k \<le> j\<bullet>k"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  1595
proof -
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1596
  have ik_le_jk: "i\<bullet>k \<le> j\<bullet>k"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1597
    if f_i: "(f has_integral i) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1598
    and g_j: "(g has_integral j) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1599
    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
  1600
    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
  1601
  proof (rule ccontr)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1602
    assume "\<not> ?thesis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1603
    then have *: "0 < (i\<bullet>k - j\<bullet>k) / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1604
      by auto
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1605
    obtain \<gamma>1 where "gauge \<gamma>1" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1606
      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
  1607
                \<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
  1608
      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
  1609
    obtain \<gamma>2 where "gauge \<gamma>2" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1610
      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
  1611
                \<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
  1612
      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
  1613
    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
  1614
       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
  1615
       by metis
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1616
    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
  1617
         "\<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
  1618
      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
  1619
    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
  1620
      unfolding inner_simps
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1621
      using rsum_component_le[OF p] le
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1622
      by (fastforce simp add: abs_real_def split: if_split_asm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1623
  qed
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1624
  show ?thesis
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1625
  proof (cases "\<exists>a b. S = cbox a b")
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1626
    case True
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1627
    with ik_le_jk assms show ?thesis
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1628
      by auto
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1629
  next
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1630
    case False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1631
    show ?thesis
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1632
    proof (rule ccontr)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1633
      assume "\<not> i\<bullet>k \<le> j\<bullet>k"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1634
      then have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1635
        by auto
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1636
      obtain B1 where "0 < B1" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1637
           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
  1638
                    \<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
  1639
                        norm (z - i) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1640
        using has_integral_altD[OF _ False ij] assms by blast
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1641
      obtain B2 where "0 < B2" 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1642
           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
  1643
                    \<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
  1644
                        norm (z - j) < (i \<bullet> k - j \<bullet> k) / 3"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1645
        using has_integral_altD[OF _ False ij] assms by blast
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1646
      have "bounded (ball 0 B1 \<union> ball (0::'a) B2)"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1647
        unfolding bounded_Un by(rule conjI bounded_ball)+
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1648
      from bounded_subset_cbox[OF this] 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1649
      obtain a b::'a where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  1650
        by blast+
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1651
      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
  1652
                        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
  1653
                        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
  1654
                        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
  1655
        using B1 B2 by blast
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1656
      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
  1657
        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
  1658
      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
  1659
           "\<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
  1660
        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
  1661
      moreover
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1662
      have "w1\<bullet>k \<le> w2\<bullet>k"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1663
        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
  1664
      ultimately show False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1665
        unfolding inner_simps by(rule *)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1666
    qed
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  1667
  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
  1668
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
  1669
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1670
lemma integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1671
  fixes g f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1672
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1673
    and "f integrable_on S" "g integrable_on S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1674
    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
  1675
  shows "(integral S f)\<bullet>k \<le> (integral S g)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1676
  apply (rule has_integral_component_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1677
  using integrable_integral assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1678
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1679
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1680
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1681
lemma has_integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1682
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1683
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1684
    and "(f has_integral i) S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1685
    and "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> (f x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1686
  shows "0 \<le> i\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1687
  using has_integral_component_le[OF assms(1) has_integral_0 assms(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1688
  using assms(3-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1689
  by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1690
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1691
lemma integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1692
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1693
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1694
    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
  1695
  shows "0 \<le> (integral S f)\<bullet>k"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1696
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
  1697
  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
  1698
    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
  1699
    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
  1700
    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
  1701
    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
  1702
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
  1703
  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
  1704
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1705
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1706
lemma has_integral_component_neg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1707
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1708
  assumes "k \<in> Basis"
66199
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1709
    and "(f has_integral i) S"
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  1710
    and "\<And>x. x \<in> S \<Longrightarrow> (f x)\<bullet>k \<le> 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1711
  shows "i\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1712
  using has_integral_component_le[OF assms(1,2) has_integral_0] assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1713
  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
  1714
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1715
lemma has_integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1716
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1717
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1718
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1719
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1720
  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
  1721
  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
  1722
  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
  1723
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1724
lemma has_integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1725
  fixes f::"'a::euclidean_space => 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1726
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1727
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1728
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1729
  shows "i\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1730
  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
  1731
  by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1732
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1733
lemma integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1734
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1735
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1736
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1737
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1738
  shows "B * content (cbox a b) \<le> (integral(cbox a b) f)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1739
  apply (rule has_integral_component_lbound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1740
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1741
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1742
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1743
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1744
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1745
lemma integral_component_lbound_real:
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1746
  assumes "f integrable_on {a ::real .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1747
    and "\<forall>x\<in>{a .. b}. B \<le> f(x)\<bullet>k"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1748
    and "k \<in> Basis"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1749
  shows "B * content {a .. b} \<le> (integral {a .. b} f)\<bullet>k"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1750
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1751
  by (metis box_real(2) integral_component_lbound)
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1752
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1753
lemma integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1754
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1755
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1756
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1757
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1758
  shows "(integral (cbox a b) f)\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1759
  apply (rule has_integral_component_ubound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1760
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1761
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1762
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1763
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1764
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1765
lemma integral_component_ubound_real:
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1766
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1767
  assumes "f integrable_on {a .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1768
    and "\<forall>x\<in>{a .. b}. f x\<bullet>k \<le> B"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1769
    and "k \<in> Basis"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1770
  shows "(integral {a .. b} f)\<bullet>k \<le> B * content {a .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1771
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  1772
  by (metis box_real(2) integral_component_ubound)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1773
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1774
subsection \<open>Uniform limit of integrable functions is integrable.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1775
62626
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1776
lemma real_arch_invD:
de25474ce728 Contractible sets. Also removal of obsolete theorems and refactoring
paulson <lp15@cam.ac.uk>
parents: 62623
diff changeset
  1777
  "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
  1778
  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
  1779
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1780
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1781
lemma integrable_uniform_limit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1782
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1783
  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
  1784
  shows "f integrable_on cbox a b"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1785
proof (cases "content (cbox a b) > 0")
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1786
  case False then show ?thesis
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1787
    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
  1788
next
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1789
  case True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1790
  have "1 / (real n + 1) > 0" for n
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1791
    by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1792
  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
  1793
    using assms by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1794
  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
  1795
                  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
  1796
    by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1797
  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
  1798
    unfolding integrable_on_def by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1799
  have "Cauchy h"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1800
    unfolding Cauchy_def
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1801
  proof clarify
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1802
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1803
    assume "e>0"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1804
    then have "e/4 / content (cbox a b) > 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1805
      using True by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1806
    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
  1807
      by (metis inverse_eq_divide real_arch_inverse)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1808
    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
  1809
    proof (rule exI [where x=M], clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1810
      fix m n
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1811
      assume m: "M \<le> m" and n: "M \<le> n"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1812
      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
  1813
      then obtain gm gn where "gauge gm" "gauge gn"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1814
              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
  1815
                            \<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
  1816
              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
  1817
                      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
  1818
        using h[unfolded has_integral] by meson
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1819
      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
  1820
        by (metis (full_types) fine_division_exists gauge_Int)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1821
      have triangle3: "norm (i1 - i2) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1822
        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
  1823
      proof -
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1824
        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
  1825
          using norm_triangle_ineq[of "i1 - s1" "s1 - i2"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1826
          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
  1827
          by (auto simp: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1828
        also have "\<dots> < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1829
          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
  1830
        finally show ?thesis .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1831
      qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1832
      have finep: "gm fine \<D>" "gn fine \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1833
        using fine_Int \<D>  by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1834
      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
  1835
      proof -
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1836
        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
  1837
          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
  1838
        also have "\<dots> \<le> 1 / (real M) + 1 / (real M)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1839
          apply (rule add_mono)
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1840
          using \<open>M \<noteq> 0\<close> m n by (auto simp: divide_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1841
        also have "\<dots> = 2 / real M"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1842
          by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1843
        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
  1844
          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
  1845
          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
  1846
      qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1847
      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
  1848
        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
  1849
      also have "... \<le> e/2"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1850
        using M True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1851
        by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1852
      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
  1853
      then show "dist (h m) (h n) < e"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1854
        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
  1855
    qed
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1856
  qed
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1857
  then obtain s where s: "h \<longlonglongrightarrow> s"
64287
d85d88722745 more from moretop.ml
paulson <lp15@cam.ac.uk>
parents: 64272
diff changeset
  1858
    using convergent_eq_Cauchy[symmetric] by blast
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1859
  show ?thesis
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1860
    unfolding integrable_on_def has_integral
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1861
  proof (rule_tac x=s in exI, clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1862
    fix e::real
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1863
    assume e: "0 < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1864
    then have "e/3 > 0" by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1865
    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
  1866
      using LIMSEQ_D [OF s] by metis
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1867
    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
  1868
      by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1869
    then obtain N2 :: nat
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1870
         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
  1871
      by (metis inverse_eq_divide real_arch_inverse)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1872
    obtain g' where "gauge g'"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1873
            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
  1874
                    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
  1875
      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
  1876
    have *: "norm (sf - s) < e" 
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1877
        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
  1878
    proof -
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1879
      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
  1880
        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
  1881
        using norm_triangle_ineq[of "sg -  h" " h - s"]
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1882
        by (auto simp: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1883
      also have "\<dots> < e"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1884
        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
  1885
      finally show ?thesis .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1886
    qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1887
    { fix \<D>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1888
      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
  1889
      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
  1890
        using g' by blast
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1891
      have "content (cbox a b) < e/3 * (of_nat N2)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1892
        using \<open>N2 \<noteq> 0\<close> N2 using True by (auto simp: divide_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1893
      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
  1894
        using \<open>e>0\<close> by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1895
      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
  1896
        by linarith
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1897
      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
  1898
        unfolding inverse_eq_divide
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1899
        by (auto simp: field_simps)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1900
      have ne3: "norm (h (N1 + N2) - s) < e/3"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1901
        using N1 by auto
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1902
      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
  1903
            \<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
  1904
        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
  1905
      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
  1906
        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
  1907
    }
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  1908
    then show "\<exists>d. gauge d \<and>
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1909
             (\<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
  1910
      by (blast intro: g' \<open>gauge g'\<close>)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1911
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1912
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1913
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  1914
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
  1915
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1916
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1917
subsection \<open>Negligible sets.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1918
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1919
definition "negligible (s:: 'a::euclidean_space set) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1920
  (\<forall>a b. ((indicator s :: 'a\<Rightarrow>real) has_integral 0) (cbox a b))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  1921
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1922
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  1923
subsubsection \<open>Negligibility of hyperplane.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1924
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1925
lemma content_doublesplit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1926
  fixes a :: "'a::euclidean_space"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1927
  assumes "0 < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1928
    and k: "k \<in> Basis"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  1929
  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
  1930
proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1931
  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
  1932
  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
  1933
  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
  1934
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1935
  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
  1936
    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
  1937
  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
  1938
    using k *
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  1939
    by (intro prod_zero bexI[OF _ k])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  1940
       (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
  1941
  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
  1942
    ((\<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
  1943
  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
  1944
    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
  1945
    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
  1946
      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
  1947
    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
  1948
      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
  1949
    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
  1950
      by simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1951
  qed simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1952
  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
  1953
  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
  1954
  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
  1955
    by (subst (asm) eventually_at_right[of _ 1]) auto
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1956
  show ?thesis
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1957
    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
  1958
next
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1959
  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
  1960
  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
  1961
    by (auto simp: not_le)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1962
  show thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1963
  proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1964
    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
  1965
    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
  1966
      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
  1967
    show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1968
      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
  1969
  next
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1970
    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
  1971
    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
  1972
      by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1973
    then show thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1974
    proof
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1975
      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
  1976
      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
  1977
        using k c by (auto simp: cbox_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1978
      ultimately have "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> (a \<bullet> k - c) / 2} = {}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1979
        using k by (auto simp: cbox_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1980
      with \<open>0<e\<close> c that[of "(a \<bullet> k - c) / 2"] show ?thesis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1981
        by auto
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  1982
    next
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1983
      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
  1984
      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
  1985
        using k c by (auto simp: cbox_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1986
      ultimately have "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> (c - b \<bullet> k) / 2} = {}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1987
        using k by (auto simp: cbox_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1988
      with \<open>0<e\<close> c that[of "(c - b \<bullet> k) / 2"] show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1989
        by auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1990
    qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1991
  qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1992
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  1993
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
  1994
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1995
lemma negligible_standard_hyperplane[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1996
  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
  1997
  assumes k: "k \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1998
  shows "negligible {x. x\<bullet>k = c}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  1999
  unfolding negligible_def has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2000
proof (clarify, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2001
  case (1 a b e)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2002
  from this and k obtain d where d: "0 < d" "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2003
    by (rule 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
  2004
  let ?i = "indicator {x::'a. x\<bullet>k = c} :: 'a\<Rightarrow>real"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2005
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2006
    apply (rule_tac x="\<lambda>x. ball x d" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2007
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2008
    apply (rule gauge_ball)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2009
    apply (rule d)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2010
  proof (rule, rule)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2011
    fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2012
    assume p: "p tagged_division_of (cbox a b) \<and> (\<lambda>x. ball x d) fine p"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2013
    have *: "(\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) =
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  2014
      (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d}) *\<^sub>R ?i x)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2015
      apply (rule sum.cong)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  2016
      apply (rule refl)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2017
      unfolding split_paired_all real_scaleR_def mult_cancel_right split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2018
      apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2019
      apply (rule disjI1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2020
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2021
      apply (rule disjI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2022
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2023
      fix x l
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2024
      assume as: "(x, l) \<in> p" "?i x \<noteq> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2025
      then have xk: "x\<bullet>k = c"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2026
        unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2027
        apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2028
        apply (rule ccontr)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2029
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2030
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2031
      show "content l = content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2032
        apply (rule arg_cong[where f=content])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2033
        apply (rule set_eqI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2034
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2035
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2036
        unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2037
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2038
        fix y
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2039
        assume y: "y \<in> l"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2040
        note p[THEN conjunct2,unfolded fine_def,rule_format,OF as(1),unfolded split_conv]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2041
        note this[unfolded subset_eq mem_ball dist_norm,rule_format,OF y]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2042
        note le_less_trans[OF Basis_le_norm[OF k] this]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2043
        then show "\<bar>y \<bullet> k - c\<bar> \<le> d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2044
          unfolding inner_simps xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2045
      qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2046
    qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2047
    note p'= tagged_division_ofD[OF p[THEN conjunct1]] and p''=division_of_tagged_division[OF p[THEN conjunct1]]
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2048
    have "(\<Sum>(x, ka)\<in>p. content (ka \<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
  2049
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2050
      have "(\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) \<le>
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2051
        (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2052
        apply (rule sum_mono)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2053
        unfolding split_paired_all split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2054
        apply (rule mult_right_le_one_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2055
        apply (drule p'(4))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2056
        apply (auto simp add:interval_doublesplit[OF k])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2057
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2058
      also have "\<dots> < e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2059
      proof (subst sum.over_tagged_division_lemma[OF p[THEN conjunct1]], goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2060
        case prems: (1 u v)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2061
        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
  2062
          unfolding content_eq_0_interior by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2063
        have "content (cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<le> content (cbox u v)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2064
          unfolding interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2065
          apply (rule content_subset)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2066
          unfolding interval_doublesplit[symmetric,OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2067
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2068
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2069
        then show ?case
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2070
          unfolding * interval_doublesplit[OF k]
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  2071
          by (blast intro: antisym)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2072
      next
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
  2073
        have "(\<Sum>l\<in>snd ` p. content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) =
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2074
          sum content ((\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}})"
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2075
        proof (subst (2) sum.reindex_nontrivial)
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
  2076
          fix x y assume "x \<in> {l \<in> snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}" "y \<in> {l \<in> snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}"
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
  2077
            "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}"
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
  2078
          then obtain x' y' where "(x', x) \<in> p" "x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}" "(y', y) \<in> p" "y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}"
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
  2079
            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
  2080
          from p'(5)[OF \<open>(x', x) \<in> p\<close> \<open>(y', y) \<in> p\<close>] \<open>x \<noteq> y\<close> have "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
  2081
            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
  2082
          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
  2083
            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
  2084
          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
  2085
            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
  2086
          then show "content (x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 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
  2087
            using p'(4)[OF \<open>(x', x) \<in> p\<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
  2088
        qed (insert p'(1), auto intro!: sum.mono_neutral_right)
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
  2089
        also have "\<dots> \<le> norm (\<Sum>l\<in>(\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}. content l *\<^sub>R 1::real)"
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
  2090
          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
  2091
        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
  2092
          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
  2093
          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
  2094
        also have "\<dots> < e"
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
  2095
          using d(2) 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
  2096
        finally show "(\<Sum>ka\<in>snd ` p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) < e" .
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2097
      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
  2098
      finally show "(\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) < e" .
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2099
    qed
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2100
    then show "norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) - 0) < e"
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2101
      unfolding * real_norm_def
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2102
      apply (subst abs_of_nonneg)
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  2103
      using measure_nonneg  by (force simp add: indicator_def intro: sum_nonneg)+
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2104
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2105
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2106
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2107
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2108
subsubsection \<open>Hence the main theorem about negligible sets.\<close>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2109
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2110
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2111
lemma has_integral_negligible_cbox:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2112
  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
  2113
  assumes negs: "negligible S"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2114
    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
  2115
  shows "(f has_integral 0) (cbox a b)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2116
  unfolding has_integral
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2117
proof clarify
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2118
  fix e::real
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2119
  assume "e > 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2120
  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
  2121
    by simp
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2122
  then have "\<exists>\<gamma>. gauge \<gamma> \<and>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2123
                   (\<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
  2124
                        \<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
  2125
                        < e/2 / ((real n + 1) * 2 ^ n))" for n
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2126
    using negs [unfolded negligible_def has_integral] by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2127
  then obtain \<gamma> where 
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2128
    gd: "\<And>n. gauge (\<gamma> n)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2129
    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
  2130
                  \<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
  2131
    by metis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2132
  show "\<exists>\<gamma>. gauge \<gamma> \<and>
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2133
             (\<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
  2134
                  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
  2135
  proof (intro exI, safe)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2136
    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
  2137
      using gd by (auto simp: gauge_def)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2138
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2139
    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
  2140
      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
  2141
    proof (cases "\<D> = {}")
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2142
      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
  2143
    next
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2144
      case False
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2145
      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
  2146
        using real_arch_simple by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2147
      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
  2148
        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
  2149
      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
  2150
        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
  2151
      from choice[OF this] 
994322c17274 Removed more "guess", etc.
paulson <lp15@cam.ac.uk>
parents: 66193
diff changeset
  2152
      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
  2153
                        "\<And>n. \<gamma> n fine q n"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2154
                        "\<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
  2155
        by fastforce
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2156
      have "finite \<D>"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2157
        using that(1) by blast
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2158
      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
  2159
                      \<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
  2160
        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
  2161
      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
  2162
        unfolding split_def by (rule norm_sum)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2163
      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
  2164
                          (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
  2165
      proof (rule sum_le_inc, safe)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2166
        show "finite (Sigma {..N+1} q)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2167
          by (meson finite_SigmaI finite_atMost tagged_division_of_finite q(1)) 
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2168
      next
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2169
        fix x K
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2170
        assume xk: "(x, K) \<in> \<D>"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2171
        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
  2172
        have *: "norm (f x) \<in> (\<lambda>(x, K). norm (f x)) ` \<D>"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2173
          using xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2174
        have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2175
          unfolding n_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2176
        then have "n \<in> {0..N + 1}"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2177
          using N[OF *] by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2178
        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
  2179
          using that(2) xk by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2180
        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
  2181
          by (simp add: q(3) xk)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2182
        moreover then have "(x, K) \<in> q n"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2183
          using n_def by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2184
        moreover
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2185
        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
  2186
        proof (cases "x \<in> S")
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2187
          case False
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2188
          then show ?thesis by (simp add: 0)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2189
        next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2190
          case True
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2191
          have *: "content K \<ge> 0"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2192
            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
  2193
          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
  2194
            by (simp add: mult_left_mono nfx(2))
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2195
          ultimately show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2196
            using nfx True by (auto simp: field_simps)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2197
        qed
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2198
        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
  2199
          (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
  2200
          by force
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2201
      qed auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2202
      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
  2203
        apply (rule sum_Sigma_product [symmetric])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2204
        using q(1) apply auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2205
        done
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2206
      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
  2207
        by (rule sum_mono) (simp add: sum_distrib_left [symmetric])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2208
      also have "... \<le> (\<Sum>i\<le>N + 1. e/2 / 2 ^ i)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2209
      proof (rule sum_mono)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2210
        show "(real i + 1) * \<bar>\<Sum>(x,K) \<in> q i. content K *\<^sub>R indicator S x\<bar> \<le> e/2 / 2 ^ i"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2211
          if "i \<in> {..N + 1}" for i
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2212
          using \<gamma>[of "q i" i] q by (simp add: divide_simps mult.left_commute)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2213
      qed
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2214
      also have "... = e/2 * (\<Sum>i\<le>N + 1. (1 / 2) ^ i)"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2215
        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
  2216
      also have "\<dots> < e/2 * 2"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2217
      proof (rule mult_strict_left_mono)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2218
        have "sum (op ^ (1 / 2)) {..N + 1} = sum (op ^ (1 / 2::real)) {..<N + 2}"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2219
          using lessThan_Suc_atMost by auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2220
        also have "... < 2"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2221
          by (auto simp: geometric_sum)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2222
        finally show "sum (op ^ (1 / 2::real)) {..N + 1} < 2" .
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2223
      qed (use \<open>0 < e\<close> in auto)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2224
      finally  show ?thesis by auto
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2225
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2226
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2227
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2228
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2229
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2230
proposition has_integral_negligible:
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2231
  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
  2232
  assumes negs: "negligible S"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2233
    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
  2234
  shows "(f has_integral 0) T"
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2235
proof (cases "\<exists>a b. T = cbox a b")
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2236
  case True
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2237
  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
  2238
    using assms by (auto intro!: has_integral_negligible_cbox)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2239
  then show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2240
    by (rule has_integral_eq [rotated]) auto
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2241
next
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2242
  case False
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2243
  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
  2244
  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
  2245
    apply (auto simp: False has_integral_alt [of ?f])
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2246
    apply (rule_tac x=1 in exI, auto)
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2247
    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
  2248
    done
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2249
  then show ?thesis
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2250
    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
  2251
qed
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2252
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2253
lemma has_integral_spike:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2254
  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
  2255
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2256
    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
  2257
    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
  2258
  shows "(g has_integral y) T"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2259
proof -
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2260
  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
  2261
       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
  2262
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2263
    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
  2264
      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
  2265
    then show ?thesis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2266
      by auto
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2267
  qed
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2268
  show ?thesis
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2269
    using fint gf
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2270
    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
  2271
    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
  2272
    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
  2273
     apply (blast dest: *)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  2274
      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
  2275
    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
  2276
     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
  2277
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2278
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2279
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2280
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
  2281
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2282
    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
  2283
  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
  2284
    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
  2285
    by metis
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2286
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2287
lemma integrable_spike:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2288
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2289
    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
  2290
    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
  2291
  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
  2292
  using assms unfolding integrable_on_def by (blast intro: has_integral_spike)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2293
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2294
lemma integral_spike:
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2295
  assumes "negligible S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2296
    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
  2297
  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
  2298
  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
  2299
    by (auto simp: integral_def integrable_on_def)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2300
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2301
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2302
subsection \<open>Some other trivialities about negligible sets.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2303
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2304
lemma negligible_subset:
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2305
  assumes "negligible s" "t \<subseteq> s"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2306
  shows "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2307
  unfolding negligible_def
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2308
    by (metis (no_types) Diff_iff assms contra_subsetD has_integral_negligible indicator_simps(2))
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2309
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2310
lemma negligible_diff[intro?]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2311
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2312
  shows "negligible (s - t)"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2313
  using assms by (meson Diff_subset negligible_subset)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2314
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2315
lemma negligible_Int:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2316
  assumes "negligible s \<or> negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2317
  shows "negligible (s \<inter> t)"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2318
  using assms negligible_subset by force
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2319
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2320
lemma negligible_Un:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2321
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2322
    and "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2323
  shows "negligible (s \<union> t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2324
  unfolding negligible_def
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2325
proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2326
  case (1 a b)
65587
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2327
  note assms[unfolded negligible_def,rule_format,of a b]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2328
  then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2329
    apply (subst has_integral_spike_eq[OF assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2330
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2331
    apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2332
    unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2333
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2334
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2335
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2336
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2337
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
  2338
  using negligible_Un negligible_subset by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2339
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2340
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
  2341
  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
  2342
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2343
lemma negligible_insert[simp]: "negligible (insert a s) \<longleftrightarrow> negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2344
  apply (subst insert_is_Un)
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  2345
  unfolding negligible_Un_eq
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2346
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2347
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2348
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2349
lemma negligible_empty[iff]: "negligible {}"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  2350
  using negligible_insert by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2351
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2352
lemma negligible_finite[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2353
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2354
  shows "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2355
  using assms by (induct s) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2356
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  2357
lemma negligible_Union[intro]:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2358
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2359
    and "\<forall>t\<in>s. negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2360
  shows "negligible(\<Union>s)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2361
  using assms by induct auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2362
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2363
lemma negligible:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2364
  "negligible s \<longleftrightarrow> (\<forall>t::('a::euclidean_space) set. ((indicator s::'a\<Rightarrow>real) has_integral 0) t)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2365
  apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2366
  defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2367
  apply (subst negligible_def)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2368
proof -
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2369
  fix t :: "'a set"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2370
  assume as: "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2371
  have *: "(\<lambda>x. if x \<in> s \<inter> t then 1 else 0) = (\<lambda>x. if x\<in>t then if x\<in>s then 1 else 0 else 0)"
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2372
    by auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2373
  show "((indicator s::'a\<Rightarrow>real) has_integral 0) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2374
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2375
    apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2376
    apply (subst if_P,assumption)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2377
    unfolding if_not_P
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2378
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2379
    apply (rule as[unfolded negligible_def,rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2380
    apply (rule_tac x=1 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2381
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2382
    apply (rule zero_less_one)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2383
    apply (rule_tac x=0 in exI)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2384
    using negligible_subset[OF as,of "s \<inter> t"]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2385
    unfolding negligible_def indicator_def [abs_def]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2386
    unfolding *
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2387
    apply auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2388
    done
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  2389
qed auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2390
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2391
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2392
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
  2393
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2394
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
  2395
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2396
    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
  2397
    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
  2398
  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
  2399
  using assms has_integral_spike negligible_finite by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2400
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2401
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
  2402
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2403
    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
  2404
  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
  2405
  by (metis assms has_integral_spike_finite)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2406
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2407
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
  2408
  assumes "finite S"
16a8991ab398 New material (and some tidying) purely in the Analysis directory
paulson <lp15@cam.ac.uk>
parents: 65578
diff changeset
  2409
    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
  2410
    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
  2411
  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
  2412
  using assms has_integral_spike_finite by blast
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2413
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2414
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2415
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
  2416
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2417
lemma negligible_frontier_interval: "negligible(cbox (a::'a::euclidean_space) b - box a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2418
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
  2419
  let ?A = "\<Union>((\<lambda>k. {x. x\<bullet>k = a\<bullet>k} \<union> {x::'a. x\<bullet>k = b\<bullet>k}) ` Basis)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2420
  have "cbox a b - box a b \<subseteq> ?A"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2421
    apply rule unfolding Diff_iff mem_box
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
  2422
    apply simp
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2423
    apply(erule conjE bexE)+
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2424
    apply(rule_tac x=i in bexI)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2425
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2426
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2427
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2428
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2429
    apply (rule negligible_subset[of ?A])
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  2430
    apply (rule negligible_Union[OF finite_imageI])
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2431
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2432
    done
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
  2433
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2434
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2435
lemma has_integral_spike_interior:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  2436
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2437
    and "(f has_integral y) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2438
  shows "(g has_integral y) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2439
  apply (rule has_integral_spike[OF negligible_frontier_interval _ assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2440
  using assms(1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2441
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2442
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2443
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2444
lemma has_integral_spike_interior_eq:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  2445
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2446
  shows "(f has_integral y) (cbox a b) \<longleftrightarrow> (g has_integral y) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2447
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2448
  apply (rule_tac[!] has_integral_spike_interior)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2449
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2450
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2451
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2452
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2453
lemma integrable_spike_interior:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  2454
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2455
    and "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2456
  shows "g integrable_on cbox a b"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2457
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2458
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2459
  using has_integral_spike_interior[OF assms(1)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2460
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  2461
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2462
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2463
subsection \<open>Integrability of continuous functions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2464
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2465
lemma operative_approximable:
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2466
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2467
  assumes "0 \<le> e"
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
  2468
  shows "comm_monoid.operative op \<and> True (\<lambda>i. \<exists>g. (\<forall>x\<in>i. norm (f x - g (x::'b)) \<le> e) \<and> g integrable_on 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
  2469
  unfolding comm_monoid.operative_def[OF comm_monoid_and]
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
  2470
proof safe
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2471
  fix a b :: 'b
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2472
  show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2473
    if "box a b = {}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2474
    apply (rule_tac x=f in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2475
    using assms that
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  2476
    apply (auto simp: content_eq_0_interior)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2477
    done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2478
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2479
    fix c g
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2480
    fix k :: 'b
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2481
    assume as: "\<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
  2482
    assume k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2483
    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}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2484
      "\<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}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2485
      apply (rule_tac[!] x=g in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2486
      using as(1) integrable_split[OF as(2) k]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2487
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2488
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2489
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2490
  fix c k g1 g2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2491
  assume as: "\<forall>x\<in>cbox a b \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g1 x) \<le> e" "g1 integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2492
    "\<forall>x\<in>cbox a b \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g2 x) \<le> e" "g2 integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2493
  assume k: "k \<in> Basis"
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
  2494
  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"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2495
  show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2496
    apply (rule_tac x="?g" in exI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2497
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2498
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2499
    case (1 x)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2500
    then show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2501
      apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2502
      apply (cases "x\<bullet>k=c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2503
      apply (case_tac "x\<bullet>k < c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2504
      using as assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2505
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2506
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2507
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2508
    case 2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2509
    presume "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2510
      and "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<ge> c}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2511
    then guess h1 h2 unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2512
    from has_integral_split[OF this k] show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2513
      unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2514
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2515
    show "?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}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2516
      apply(rule_tac[!] integrable_spike[OF negligible_standard_hyperplane[of k c]])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2517
      using k as(2,4)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2518
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2519
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2520
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2521
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2522
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
  2523
lemma comm_monoid_set_F_and: "comm_monoid_set.F op \<and> True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))"
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
  2524
proof -
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
  2525
  interpret bool: comm_monoid_set "op \<and>" True
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
  2526
    proof qed 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
  2527
  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
  2528
    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
  2529
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
  2530
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2531
lemma approximable_on_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2532
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2533
  assumes "0 \<le> e"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2534
    and "d division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2535
    and "\<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
  2536
  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
  2537
proof -
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
  2538
  note * = comm_monoid_set.operative_division[OF comm_monoid_set_and operative_approximable[OF assms(1)] assms(2)]
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
  2539
  from assms(3) this[unfolded comm_monoid_set_F_and, of f] division_of_finite[OF assms(2)]
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
  2540
  guess g by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2541
  then show thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2542
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2543
    apply (rule that[of g])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2544
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2545
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2546
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2547
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2548
lemma integrable_continuous:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2549
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2550
  assumes "continuous_on (cbox a b) f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2551
  shows "f integrable_on cbox a b"
66294
0442b3f45556 refactored some HORRIBLE integration proofs
paulson <lp15@cam.ac.uk>
parents: 66199
diff changeset
  2552
proof (rule integrable_uniform_limit)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2553
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2554
  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
  2555
  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
  2556
    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
  2557
  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
  2558
    using fine_division_exists[OF gauge_ball[OF \<open>0 < d\<close>], of a b] .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2559
  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
  2560
  proof (safe, unfold snd_conv)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2561
    fix x l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2562
    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
  2563
    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
  2564
      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
  2565
    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
  2566
      using as ptag by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2567
    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
  2568
      apply (rule_tac x="\<lambda>y. f x" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2569
    proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2570
      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
  2571
        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
  2572
    next
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2573
      fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2574
      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
  2575
      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
  2576
        using as finep by fastforce
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2577
      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
  2578
        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
  2579
        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
  2580
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2581
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2582
  from e have "e \<ge> 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2583
    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
  2584
  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
  2585
  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
  2586
    by metis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2587
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2588
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2589
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
  2590
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2591
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2592
  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
  2593
  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
  2594
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2595
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
  2596
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2597
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2598
subsection \<open>Specialization of additivity to one dimension.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2599
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2600
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2601
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
  2602
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2603
lemma has_integral_factor_content:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2604
  "(f has_integral i) (cbox a b) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2605
    (\<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
  2606
      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
  2607
proof (cases "content (cbox a b) = 0")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2608
  case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2609
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2610
    unfolding has_integral_null_eq[OF True]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2611
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2612
    apply (rule, rule, rule gauge_trivial, safe)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2613
    unfolding sum_content_null[OF True] True
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2614
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2615
    apply (erule_tac x=1 in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2616
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2617
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2618
    apply (rule fine_division_exists[of _ a b])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2619
    apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2620
    apply (erule_tac x=p in allE)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2621
    unfolding sum_content_null[OF True]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2622
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2623
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2624
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2625
  case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2626
  note F = this[unfolded content_lt_nz[symmetric]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2627
  let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2628
    (\<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
  2629
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2630
    apply (subst has_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2631
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2632
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2633
    assume e: "e > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2634
    {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2635
      assume "\<forall>e>0. ?P e op <"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2636
      then show "?P (e * content (cbox a b)) op \<le>"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2637
        apply (erule_tac x="e * content (cbox a b)" in allE)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2638
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2639
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2640
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2641
        using F e
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  2642
        apply (auto simp add:field_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2643
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2644
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2645
    {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2646
      assume "\<forall>e>0. ?P (e * content (cbox a b)) op \<le>"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2647
      then show "?P e op <"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2648
        apply (erule_tac x="e / 2 / content (cbox a b)" in allE)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2649
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2650
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2651
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2652
        using F e
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  2653
        apply (auto simp add: field_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2654
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2655
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2656
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2657
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2658
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2659
lemma has_integral_factor_content_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2660
  "(f has_integral i) {a .. b::real} \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2661
    (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a .. b}  \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2662
      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
  2663
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2664
  by (rule has_integral_factor_content)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2665
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2666
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2667
subsection \<open>Fundamental theorem of calculus.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2668
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2669
lemma interval_bounds_real:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2670
  fixes q b :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2671
  assumes "a \<le> b"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2672
  shows "Sup {a..b} = b"
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2673
    and "Inf {a..b} = a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2674
  using assms by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2675
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2676
lemma fundamental_theorem_of_calculus:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2677
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2678
  assumes "a \<le> b"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2679
    and vecd: "\<forall>x\<in>{a .. b}. (f has_vector_derivative f' x) (at x within {a .. b})"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2680
  shows "(f' has_integral (f b - f a)) {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2681
  unfolding has_integral_factor_content box_real[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2682
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2683
  fix e :: real
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2684
  assume "e > 0"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2685
  then have "\<forall>x. \<exists>d>0.
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2686
         x \<in> {a..b} \<longrightarrow>
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2687
         (\<forall>y\<in>{a..b}.
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2688
             norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e * norm (y - x))"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2689
    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
  2690
  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
  2691
                 "\<And>x y. \<lbrakk>x \<in> {a..b}; y \<in> {a..b}; norm (y - x) < d x\<rbrakk>
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2692
                        \<Longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e * norm (y - x)"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2693
    by metis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2694
  
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2695
  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
  2696
    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2697
    apply (rule_tac x="\<lambda>x. ball x (d x)" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2698
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2699
    apply (rule gauge_ball_dependent)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2700
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2701
    apply (rule d(1))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2702
  proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2703
    fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2704
    assume as: "p tagged_division_of cbox a b" "(\<lambda>x. ball x (d x)) fine p"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2705
    show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2706
      unfolding content_real[OF assms(1), simplified box_real[symmetric]] additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of f,symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2707
      unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\<lambda>x. x",symmetric]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2708
      unfolding sum_distrib_left
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2709
      defer
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2710
      unfolding sum_subtractf[symmetric]
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2711
    proof (rule sum_norm_le,safe)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2712
      fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2713
      assume "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2714
      note xk = tagged_division_ofD(2-4)[OF as(1) this]
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2715
      then obtain u v where k: "k = cbox u v" by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2716
      have *: "u \<le> v"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2717
        using xk unfolding k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2718
      have ball: "\<forall>xa\<in>k. xa \<in> ball x (d x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2719
        using as(2)[unfolded fine_def,rule_format,OF \<open>(x,k)\<in>p\<close>,unfolded split_conv subset_eq] .
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2720
      have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) \<le>
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2721
        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
  2722
        apply (rule order_trans[OF _ norm_triangle_ineq4])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2723
        apply (rule eq_refl)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2724
        apply (rule arg_cong[where f=norm])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2725
        unfolding scaleR_diff_left
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2726
        apply (auto simp add:algebra_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2727
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2728
      also have "\<dots> \<le> e * norm (u - x) + e * norm (v - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2729
        apply (rule add_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2730
        apply (rule d(2)[of "x" "u",unfolded o_def])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2731
        prefer 4
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2732
        apply (rule d(2)[of "x" "v",unfolded o_def])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2733
        using ball[rule_format,of u] ball[rule_format,of v]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2734
        using xk(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2735
        unfolding k subset_eq
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2736
        apply (auto simp add:dist_real_def)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2737
        done
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2738
      also have "\<dots> \<le> e * (Sup k - Inf k)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2739
        unfolding k interval_bounds_real[OF *]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2740
        using xk(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2741
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2742
        by (auto simp add: dist_real_def field_simps)
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2743
      finally show "norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le>
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  2744
        e * (Sup k - Inf k)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2745
        unfolding box_real k interval_bounds_real[OF *] content_real[OF *]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2746
          interval_upperbound_real interval_lowerbound_real
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2747
          .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2748
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2749
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2750
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2751
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2752
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
  2753
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2754
  assumes "a \<le> b"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2755
  shows "((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2756
proof -
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2757
  have "((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2758
    apply (rule fundamental_theorem_of_calculus [OF assms], clarify)
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2759
    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
  2760
    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
  2761
  then show ?thesis
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2762
    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
  2763
qed
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2764
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2765
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
  2766
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2767
  assumes "a \<le> b"
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2768
  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
  2769
  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
  2770
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2771
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
  2772
  fixes a::real
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  2773
  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
  2774
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
  2775
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2776
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2777
subsection \<open>Taylor series expansion\<close>
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2778
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2779
lemma (in bounded_bilinear) sum_prod_derivatives_has_vector_derivative:
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2780
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2781
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2782
  and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2783
    (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2784
  and g0: "Dg 0 = g"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2785
  and Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2786
    (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2787
  and ivl: "a \<le> t" "t \<le> b"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2788
  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
  2789
    has_vector_derivative
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2790
      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
  2791
    (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2792
  using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2793
proof cases
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2794
  assume p: "p \<noteq> 1"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2795
  define p' where "p' = p - 2"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2796
  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
  2797
    by (auto simp: p'_def)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2798
  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
  2799
    by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2800
  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
  2801
  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
  2802
    prod (Df (Suc i) t) (Dg (p - Suc i) t))) =
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2803
    (\<Sum>i\<le>(Suc p'). ?f i - ?f (Suc i))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2804
    by (auto simp: algebra_simps p'(2) numeral_2_eq_2 * lessThan_Suc_atMost)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2805
  also note sum_telescope
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2806
  finally
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2807
  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
  2808
    prod (Df (Suc i) t) (Dg (p - Suc i) t)))
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2809
    = 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
  2810
    unfolding p'[symmetric]
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2811
    by (simp add: assms)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2812
  thus ?thesis
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2813
    using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2814
    by (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2815
qed (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2816
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2817
lemma
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2818
  fixes f::"real\<Rightarrow>'a::banach"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2819
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2820
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2821
  and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2822
    (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2823
  and ivl: "a \<le> b"
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2824
  defines "i \<equiv> \<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2825
  shows taylor_has_integral:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2826
    "(i has_integral f b - (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)) {a..b}"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2827
  and taylor_integral:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2828
    "f b = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a) + integral {a..b} i"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2829
  and taylor_integrable:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2830
    "i integrable_on {a .. b}"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2831
proof goal_cases
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2832
  case 1
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2833
  interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2834
    by (rule bounded_bilinear_scaleR)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2835
  define g where "g s = (b - s)^(p - 1)/fact (p - 1)" for s
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2836
  define Dg where [abs_def]:
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2837
    "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
  2838
  have g0: "Dg 0 = g"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2839
    using \<open>p > 0\<close>
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
  2840
    by (auto simp add: Dg_def divide_simps g_def split: if_split_asm)
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2841
  {
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2842
    fix m
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2843
    assume "p > Suc m"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2844
    hence "p - Suc m = Suc (p - Suc (Suc m))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2845
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2846
    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
  2847
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2848
  } note fact_eq = this
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2849
  have Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2850
    (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2851
    unfolding Dg_def
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
  2852
    by (auto intro!: derivative_eq_intros simp: has_vector_derivative_def fact_eq divide_simps)
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2853
  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
  2854
  from sum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df,
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2855
      OF \<open>p > 0\<close> g0 Dg f0 Df]
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2856
  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
  2857
    (?sum has_vector_derivative
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2858
      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
  2859
    by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2860
  from fundamental_theorem_of_calculus[rule_format, OF \<open>a \<le> b\<close> deriv]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2861
  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
  2862
    using atLeastatMost_empty'[simp del]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2863
    by (simp add: i_def g_def Dg_def)
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2864
  also
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2865
  have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2866
    and "{..<p} \<inter> {i. p = Suc i} = {p - 1}"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2867
    for p'
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  2868
    using \<open>p > 0\<close>
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2869
    by (auto simp: power_mult_distrib[symmetric])
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2870
  then have "?sum b = f b"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  2871
    using Suc_pred'[OF \<open>p > 0\<close>]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2872
    by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2873
        cond_application_beta sum.If_cases f0)
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2874
  also
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2875
  have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2876
  proof safe
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2877
    fix x
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2878
    assume "x < p"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2879
    thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2880
      by (auto intro!: image_eqI[where x = "p - x - 1"])
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2881
  qed simp
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2882
  from _ this
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  2883
  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
  2884
    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
  2885
  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
  2886
  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
  2887
    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
  2888
  case 3 show ?case using c by force
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2889
qed
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2890
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  2891
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2892
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2893
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
  2894
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2895
lemma division_of_nontrivial:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2896
  fixes s :: "'a::euclidean_space set set"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2897
  assumes "s division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2898
    and "content (cbox a b) \<noteq> 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2899
  shows "{k. k \<in> s \<and> content k \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2900
  using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2901
  apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2902
proof (induct "card s" arbitrary: s rule: nat_less_induct)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2903
  fix s::"'a set set"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2904
  assume assm: "s division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2905
    "\<forall>m<card s. \<forall>x. m = card x \<longrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2906
      x division_of (cbox a b) \<longrightarrow> {k \<in> x. content k \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2907
  note s = division_ofD[OF assm(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2908
  let ?thesis = "{k \<in> s. content k \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2909
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2910
    presume *: "{k \<in> s. content k \<noteq> 0} \<noteq> s \<Longrightarrow> ?thesis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2911
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2912
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2913
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2914
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2915
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2916
      using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2917
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2918
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2919
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2920
  assume noteq: "{k \<in> s. content k \<noteq> 0} \<noteq> s"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2921
  then obtain k c d where k: "k \<in> s" "content k = 0" "k = cbox c d"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2922
    using s(4) by blast
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2923
  then have "card s > 0"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2924
    unfolding card_gt_0_iff using assm(1) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2925
  then have card: "card (s - {k}) < card s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2926
    using assm(1) k(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2927
    apply (subst card_Diff_singleton_if)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2928
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2929
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2930
  have *: "closed (\<Union>(s - {k}))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2931
    apply (rule closed_Union)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2932
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2933
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2934
    apply (drule DiffD1,drule s(4))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2935
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2936
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2937
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2938
  have "k \<subseteq> \<Union>(s - {k})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2939
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2940
    apply (rule *[unfolded closed_limpt,rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2941
    unfolding islimpt_approachable
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2942
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2943
    fix x
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2944
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2945
    assume as: "x \<in> k" "e > 0"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2946
    obtain i where i: "c\<bullet>i = d\<bullet>i" "i\<in>Basis"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2947
      using k(2) s(3)[OF k(1)] unfolding box_ne_empty k
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  2948
      by (metis dual_order.antisym content_eq_0) 
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2949
    then have xi: "x\<bullet>i = d\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2950
      using as unfolding k mem_box by (metis antisym)
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2951
    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 +
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  2952
      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)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2953
    show "\<exists>x'\<in>\<Union>(s - {k}). x' \<noteq> x \<and> dist x' x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2954
      apply (rule_tac x=y in bexI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2955
    proof
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2956
      have "d \<in> cbox c d"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2957
        using s(3)[OF k(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2958
        unfolding k box_eq_empty mem_box
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2959
        by (fastforce simp add: not_less)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2960
      then have "d \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2961
        using s(2)[OF k(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2962
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2963
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2964
      note di = this[unfolded mem_box,THEN bspec[where x=i]]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2965
      then have xyi: "y\<bullet>i \<noteq> x\<bullet>i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2966
        unfolding y_def i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2967
        using as(2) assms(2)[unfolded content_eq_0] i(2)
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
  2968
        by (auto elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2969
      then show "y \<noteq> x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2970
        unfolding euclidean_eq_iff[where 'a='a] using i by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2971
      have *: "Basis = insert i (Basis - {i})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2972
        using i by auto
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2973
      have "norm (y - x) < e + sum (\<lambda>i. 0) Basis"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2974
        apply (rule le_less_trans[OF norm_le_l1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2975
        apply (subst *)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  2976
        apply (subst sum.insert)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2977
        prefer 3
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2978
        apply (rule add_less_le_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2979
      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
  2980
        show "\<bar>(y - x) \<bullet> i\<bar> < e"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2981
          using di as(2) y_def i xi by (auto simp: inner_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
  2982
        show "(\<Sum>i\<in>Basis - {i}. \<bar>(y - x) \<bullet> i\<bar>) \<le> (\<Sum>i\<in>Basis. 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
  2983
          unfolding y_def by (auto simp: inner_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2984
      qed auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2985
      then show "dist y x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2986
        unfolding dist_norm by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2987
      have "y \<notin> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2988
        unfolding k mem_box
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2989
        apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2990
        apply (erule_tac x=i in ballE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2991
        using xyi k i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2992
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2993
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2994
      moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2995
      have "y \<in> \<Union>s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2996
        using set_rev_mp[OF as(1) s(2)[OF k(1)]] as(2) di i
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2997
        unfolding s mem_box y_def
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
  2998
        by (auto simp: field_simps elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2999
      ultimately
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3000
      show "y \<in> \<Union>(s - {k})" by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3001
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3002
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3003
  then have "\<Union>(s - {k}) = cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3004
    unfolding s(6)[symmetric] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3005
  then have  "{ka \<in> s - {k}. content ka \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3006
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3007
    apply (rule assm(2)[rule_format,OF card refl])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3008
    apply (rule division_ofI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3009
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3010
    apply (rule_tac[1-4] s)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3011
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3012
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3013
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3014
  moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3015
  have "{ka \<in> s - {k}. content ka \<noteq> 0} = {k \<in> s. content k \<noteq> 0}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3016
    using k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3017
  ultimately show ?thesis by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3018
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3019
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3020
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3021
subsection \<open>Integrability on subintervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3022
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3023
lemma operative_integrable:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3024
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
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
  3025
  shows "comm_monoid.operative op \<and> True (\<lambda>i. f integrable_on 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
  3026
  unfolding comm_monoid.operative_def[OF comm_monoid_and]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3027
  apply safe
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3028
     apply (subst integrable_on_def)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3029
     apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3030
     apply (rule has_integral_null_eq[where i=0, THEN iffD2])
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3031
      apply (simp add: content_eq_0_interior)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3032
     apply rule
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  3033
    apply (rule, assumption, assumption)+
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3034
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3035
  by (auto intro!: has_integral_split)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3036
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3037
lemma integrable_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3038
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3039
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3040
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3041
  shows "f integrable_on cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3042
  apply (cases "cbox c d = {}")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3043
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3044
  apply (rule partial_division_extend_1[OF assms(2)],assumption)
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
  3045
  using comm_monoid_set.operative_division[OF comm_monoid_set_and operative_integrable,symmetric,of _ _ _ f] assms(1)
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
  3046
  apply (auto simp: comm_monoid_set_F_and)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3047
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3048
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3049
lemma integrable_subinterval_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3050
  fixes f :: "real \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3051
  assumes "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3052
    and "{c .. d} \<subseteq> {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3053
  shows "f integrable_on {c .. d}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3054
  by (metis assms(1) assms(2) box_real(2) integrable_subinterval)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3055
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3056
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3057
subsection \<open>Combining adjacent intervals in 1 dimension.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3058
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3059
lemma has_integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3060
  fixes a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3061
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3062
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3063
    and "(f has_integral i) {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3064
    and "(f has_integral (j::'a::banach)) {c .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3065
  shows "(f has_integral (i + j)) {a .. b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3066
proof -
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3067
  interpret comm_monoid "lift_option plus" "Some (0::'a)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3068
    by (rule comm_monoid_lift_option)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3069
      (rule add.comm_monoid_axioms)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3070
  note operative_integral [of f, unfolded operative_1_le]
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3071
  note conjunctD2 [OF this, rule_format]
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3072
  note * = this(2) [OF conjI [OF assms(1-2)],
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  3073
    unfolded if_P [OF assms(3)]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3074
  then have "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3075
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3076
    apply (rule ccontr)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3077
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3078
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3079
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3080
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3081
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3082
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3083
  with *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3084
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3085
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3086
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3087
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3088
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3089
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3090
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3091
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3092
    apply (auto simp add: integrable_on_def integral_unique)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3093
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3094
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3095
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3096
lemma integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3097
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3098
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3099
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3100
    and "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3101
  shows "integral {a .. c} f + integral {c .. b} f = integral {a .. b} f"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3102
  apply (rule integral_unique[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3103
  apply (rule has_integral_combine[OF assms(1-2)])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3104
  apply (metis assms(2) assms(3) atLeastatMost_subset_iff box_real(2) content_pos_le content_real_eq_0 integrable_integral integrable_subinterval le_add_same_cancel2 monoid_add_class.add.left_neutral)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3105
  by (metis assms(1) assms(3) atLeastatMost_subset_iff box_real(2) content_pos_le content_real_eq_0 integrable_integral integrable_subinterval le_add_same_cancel1 monoid_add_class.add.right_neutral)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3106
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3107
lemma integrable_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3108
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3109
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3110
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3111
    and "f integrable_on {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3112
    and "f integrable_on {c .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3113
  shows "f integrable_on {a .. b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3114
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3115
  unfolding integrable_on_def
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  3116
  by (auto intro!:has_integral_combine)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3117
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3118
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3119
subsection \<open>Reduce integrability to "local" integrability.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3120
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3121
lemma integrable_on_little_subintervals:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3122
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3123
  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
  3124
    f integrable_on cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3125
  shows "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3126
proof -
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3127
  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
  3128
    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
  3129
    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
  3130
  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
  3131
     "\<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
  3132
               \<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
  3133
    by metis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3134
  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
  3135
    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
  3136
  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
  3137
    by (metis division_of_tagged_division)
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3138
  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
  3139
    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
  3140
  then show ?thesis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3141
    unfolding comm_monoid_set.operative_division[OF comm_monoid_set_and operative_integrable sndp,  symmetric]
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3142
              comm_monoid_set_F_and
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3143
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3144
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3145
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3146
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
  3147
subsection \<open>Second FTC or existence of antiderivative.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3148
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3149
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
  3150
  unfolding integrable_on_def by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3151
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3152
lemma integral_has_vector_derivative_continuous_at:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3153
  fixes f :: "real \<Rightarrow> 'a::banach"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3154
  assumes f: "f integrable_on {a..b}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3155
      and x: "x \<in> {a..b}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3156
      and fx: "continuous (at x within {a..b}) f"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3157
  shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b})"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3158
proof -
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3159
  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
  3160
  { fix e::real
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3161
    assume "e > 0"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3162
    obtain d where "d>0" and d: "\<And>x'. \<lbrakk>x' \<in> {a..b}; \<bar>x' - x\<bar> < d\<rbrakk> \<Longrightarrow> norm(f x' - f x) \<le> e"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3163
      using \<open>e>0\<close> fx by (auto simp: continuous_within_eps_delta dist_norm less_imp_le)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3164
    have "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
  3165
           if y: "y \<in> {a..b}" and yx: "\<bar>y - x\<bar> < d" for y
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3166
    proof (cases "y < x")
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3167
      case False
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3168
      have "f integrable_on {a..y}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3169
        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
  3170
      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
  3171
        using False x by (simp add: algebra_simps integral_combine)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3172
      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
  3173
        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
  3174
        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
  3175
        using has_integral_const_real [of "f x" x y] False
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3176
        apply (simp add: )
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3177
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3178
      show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3179
        using False
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3180
        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
  3181
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3182
        using yx False d x y \<open>e>0\<close> apply (auto simp add: Idiff fux_int)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3183
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3184
    next
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3185
      case True
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3186
      have "f integrable_on {a..x}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3187
        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
  3188
      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
  3189
        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
  3190
      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
  3191
        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
  3192
        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
  3193
        using has_integral_const_real [of "f x" y x] True
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3194
        apply (simp add: )
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3195
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3196
      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
  3197
        using True
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3198
        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
  3199
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3200
        using yx True d x y \<open>e>0\<close> apply (auto simp add: Idiff fux_int)
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3201
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3202
      then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3203
        by (simp add: algebra_simps norm_minus_commute)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3204
    qed
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3205
    then have "\<exists>d>0. \<forall>y\<in>{a..b}. \<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
  3206
      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
  3207
  }
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3208
  then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3209
    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
  3210
qed
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3211
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3212
lemma integral_has_vector_derivative:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3213
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3214
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3215
    and "x \<in> {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3216
  shows "((\<lambda>u. integral {a .. u} f) has_vector_derivative f(x)) (at x within {a .. b})"
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3217
apply (rule integral_has_vector_derivative_continuous_at [OF integrable_continuous_real])
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3218
using assms
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3219
apply (auto simp: continuous_on_eq_continuous_within)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  3220
done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3221
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3222
lemma antiderivative_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3223
  fixes q b :: real
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3224
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3225
  obtains g where "\<forall>x\<in>{a .. b}. (g has_vector_derivative (f x::_::banach)) (at x within {a .. b})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3226
  apply (rule that)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3227
  apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3228
  using integral_has_vector_derivative[OF assms]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3229
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3230
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3231
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3232
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3233
subsection \<open>Combined fundamental theorem of calculus.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3234
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3235
lemma antiderivative_integral_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3236
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3237
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3238
  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
  3239
proof -
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3240
  obtain g 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3241
    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
  3242
    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
  3243
  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
  3244
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3245
    have "\<forall>x\<in>cbox u v. (g has_vector_derivative f x) (at x within cbox u v)"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3246
      by (meson g has_vector_derivative_within_subset interval_subset_is_interval is_interval_closed_interval subsetCE that(1) that(2))
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3247
    then show ?thesis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3248
      by (simp add: fundamental_theorem_of_calculus that(3))
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3249
  qed
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3250
  then show ?thesis
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3251
    using that by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3252
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3253
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3254
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3255
subsection \<open>General "twiddling" for interval-to-interval function image.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3256
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3257
lemma has_integral_twiddle:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3258
  assumes "0 < r"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3259
    and "\<forall>x. h(g x) = x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3260
    and "\<forall>x. g(h x) = x"
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3261
    and contg: "\<And>x. continuous (at x) g"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3262
    and "\<forall>u v. \<exists>w z. g ` cbox u v = cbox w z"
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
  3263
    and h: "\<forall>u v. \<exists>w z. h ` cbox u v = cbox w z"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3264
    and "\<forall>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
  3265
    and intfi: "(f has_integral i) (cbox a b)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3266
  shows "((\<lambda>x. f(g x)) has_integral (1 / r) *\<^sub>R i) (h ` cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3267
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3268
  show ?thesis when *: "cbox a b \<noteq> {} \<Longrightarrow> ?thesis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3269
    apply cases
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3270
    defer
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3271
    apply (rule *)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3272
    apply assumption
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  3273
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  3274
    case prems: 1
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3275
    then show ?thesis
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  3276
      unfolding prems assms(8)[unfolded prems has_integral_empty_eq] by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3277
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3278
  assume "cbox a b \<noteq> {}"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3279
  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
  3280
    using h by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3281
  have inj: "inj g" "inj h"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3282
    apply (metis assms(2) injI)
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3283
    by (metis assms(3) injI)
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
  3284
  from h obtain ha hb where h_eq: "h ` cbox a b = cbox ha hb" by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3285
  show ?thesis
63944
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
  3286
    unfolding h_eq has_integral
21eaff8c8fc9 use filter to define Henstock-Kurzweil integration
hoelzl
parents: 63941
diff changeset
  3287
    unfolding h_eq[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3288
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3289
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3290
    assume e: "e > 0"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3291
    with \<open>0 < r\<close> have "e * r > 0" by simp
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3292
    with intfi[unfolded has_integral]
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3293
    obtain d where d: "gauge d"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3294
                   "\<And>p. p tagged_division_of cbox a b \<and> d fine p 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3295
                        \<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
  3296
      by metis
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  3297
    define d' where "d' x = {y. g y \<in> d (g x)}" for x
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3298
    have d': "\<And>x. d' x = {y. g y \<in> (d (g x))}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3299
      unfolding d'_def ..
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3300
    show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` cbox a b \<and> d fine p 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3301
              \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3302
    proof (rule_tac x=d' in exI, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3303
      show "gauge d'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3304
        using d(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3305
        unfolding gauge_def d'
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3306
        using continuous_open_preimage_univ[OF _ contg]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3307
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3308
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3309
      assume as: "p tagged_division_of h ` cbox a b" "d' fine p"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3310
      note p = tagged_division_ofD[OF as(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3311
      have "(\<lambda>(x, k). (g x, g ` k)) ` p tagged_division_of (cbox a b) \<and> d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3312
        unfolding tagged_division_of
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3313
      proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3314
        show "finite ((\<lambda>(x, k). (g x, g ` k)) ` p)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3315
          using as by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3316
        show "d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3317
          using as(2) unfolding fine_def d' by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3318
        fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3319
        assume xk[intro]: "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3320
        show "g x \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3321
          using p(2)[OF xk] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3322
        show "\<exists>u v. g ` k = cbox u v"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3323
          using p(4)[OF xk] using assms(5-6) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3324
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3325
          fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3326
          assume "y \<in> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3327
          then show "g y \<in> cbox a b" "g y \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3328
            using p(3)[OF xk,unfolded subset_eq,rule_format,of "h (g y)"]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3329
            using assms(2)[rule_format,of y]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3330
            unfolding inj_image_mem_iff[OF inj(2)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3331
            by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3332
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3333
        fix x' k'
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3334
        assume xk': "(x', k') \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3335
        fix z
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3336
        assume z: "z \<in> interior (g ` k)" "z \<in> interior (g ` k')"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3337
        have same: "(x, k) = (x', k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3338
          apply -
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  3339
          apply (rule ccontr)
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  3340
          apply (drule p(5)[OF xk xk'])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3341
        proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3342
          assume as: "interior k \<inter> interior k' = {}"
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3343
          have "z \<in> g ` (interior k \<inter> interior k')"
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3344
            using interior_image_subset[OF \<open>inj g\<close> contg] z
63018
ae2ec7d86ad4 tidying some proofs; getting rid of "nonempty_witness"
paulson <lp15@cam.ac.uk>
parents: 63007
diff changeset
  3345
            unfolding image_Int[OF inj(1)] by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3346
          then show False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3347
            using as by blast
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3348
        qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3349
        then show "g x = g x'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3350
          by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3351
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3352
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3353
          assume "z \<in> k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3354
          then show "g z \<in> g ` k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3355
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3356
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3357
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3358
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3359
          assume "z \<in> k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3360
          then show "g z \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3361
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3362
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3363
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3364
        fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3365
        assume "x \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3366
        then have "h x \<in>  \<Union>{k. \<exists>x. (x, k) \<in> p}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3367
          using p(6) by auto
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3368
        then obtain X y where "h x \<in> X" "(y, X) \<in> p" by blast
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3369
        then show "x \<in> \<Union>{k. \<exists>x. (x, k) \<in> (\<lambda>(x, k). (g x, g ` k)) ` p}"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3370
          apply (clarsimp simp: )
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3371
          by (metis (no_types, lifting) assms(3) image_eqI pair_imageI)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3372
      qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3373
        note ** = d(2)[OF this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3374
        have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3375
          using inj(1) unfolding inj_on_def by fastforce
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3376
        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 = _")
57129
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  3377
          using assms(7)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3378
          apply (simp only: algebra_simps add_left_cancel scaleR_right.sum)
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3379
          apply (subst sum.reindex_bij_betw[symmetric, where h="\<lambda>(x, k). (g x, g ` k)" and S=p])
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3380
          apply (auto intro!: * sum.cong simp: bij_betw_def dest!: p(4))
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
  3381
          done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3382
      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")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3383
        unfolding scaleR_diff_right scaleR_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3384
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3385
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3386
      finally have *: "?l = ?r" .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3387
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3388
        using **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3389
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3390
        unfolding norm_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3391
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3392
        by (auto simp add:field_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3393
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3394
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3395
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3396
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3397
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3398
subsection \<open>Special case of a basic affine transformation.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3399
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3400
lemma AE_lborel_inner_neq:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3401
  assumes k: "k \<in> Basis"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3402
  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
  3403
proof -
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3404
  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
  3405
    proof qed simp
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3406
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3407
  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
  3408
    using k
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3409
    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
  3410
       (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
  3411
  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
  3412
    by (intro measure_times) auto
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3413
  also have "\<dots> = 0"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3414
    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
  3415
  finally show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3416
    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
  3417
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3418
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3419
lemma content_image_stretch_interval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3420
  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
  3421
  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
  3422
  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
  3423
proof cases
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3424
  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
  3425
    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
  3426
  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
  3427
  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
  3428
    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
  3429
  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
  3430
    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
  3431
  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
  3432
    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
  3433
  show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3434
    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
  3435
    by (subst lborel_affine_euclidean[where c=m and t=0])
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3436
       (simp_all add: emeasure_density measurable_sets_borel[OF s] abs_prod nn_integral_cmult
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3437
                      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
  3438
next
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3439
  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
  3440
  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
  3441
  then have [simp]: "(\<Prod>k\<in>Basis. m k) = 0"
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3442
    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
  3443
  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
  3444
  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
  3445
    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
  3446
      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
  3447
    proof eventually_elim
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3448
      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
  3449
        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
  3450
    qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3451
  qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3452
  then show ?thesis
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3453
    by (simp add: measure_def)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3454
qed
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  3455
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3456
lemma interval_image_affinity_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3457
  "\<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
  3458
  unfolding image_affinity_cbox
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3459
  by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3460
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3461
lemma content_image_affinity_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3462
  "content((\<lambda>x::'a::euclidean_space. m *\<^sub>R x + c) ` cbox a b) =
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  3463
    \<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
  3464
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
  3465
  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
  3466
next
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3467
  case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3468
  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
  3469
  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
  3470
    case True
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3471
    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
  3472
      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
  3473
      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
  3474
      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
  3475
      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
  3476
      done
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3477
    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"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3478
      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
  3479
    ultimately show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3480
      by (simp add: image_affinity_cbox True content_cbox'
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3481
        prod.distrib prod_constant 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
  3482
  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
  3483
    case False
62533
bc25f3916a99 new material to Blochj's theorem, as well as supporting lemmas
paulson <lp15@cam.ac.uk>
parents: 62463
diff changeset
  3484
    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
  3485
      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
  3486
      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
  3487
      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
  3488
      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
  3489
      done
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3490
    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"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3491
      by (simp add: inner_simps field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  3492
    ultimately show ?thesis using False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3493
      by (simp add: image_affinity_cbox content_cbox'
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  3494
        prod.distrib[symmetric] prod_constant[symmetric] 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
  3495
  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
  3496
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3497
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3498
lemma has_integral_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3499
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3500
  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
  3501
      and "m \<noteq> 0"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  3502
  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
  3503
  apply (rule has_integral_twiddle)
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3504
  using assms
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3505
  apply (safe intro!: interval_image_affinity_interval content_image_affinity_cbox)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3506
  apply (rule zero_less_power)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3507
  unfolding scaleR_right_distrib
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3508
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3509
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3510
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3511
lemma integrable_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3512
  assumes "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3513
    and "m \<noteq> 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3514
  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
  3515
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3516
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3517
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3518
  apply (drule has_integral_affinity)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3519
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3520
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3521
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3522
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
  3523
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3524
subsection \<open>Special case of stretching coordinate axes separately.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3525
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3526
lemma has_integral_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3527
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3528
  assumes "(f has_integral i) (cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3529
    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
  3530
  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
  3531
         ((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)"
63928
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3532
apply (rule has_integral_twiddle[where f=f])
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3533
unfolding zero_less_abs_iff content_image_stretch_interval
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3534
unfolding image_stretch_interval empty_as_interval euclidean_eq_iff[where 'a='a]
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3535
using assms
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3536
by auto
63941
f353674c2528 move absolutely_integrable_on to Equivalence_Lebesgue_Henstock_Integration, now based on the Lebesgue integral
hoelzl
parents: 63940
diff changeset
  3537
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3538
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3539
lemma integrable_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3540
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3541
  assumes "f integrable_on cbox a b"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3542
    and "\<forall>k\<in>Basis. m k \<noteq> 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3543
  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
  3544
    ((\<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
  3545
  using assms unfolding integrable_on_def
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3546
  by (force dest: has_integral_stretch)
d81fb5b46a5c new material about topological concepts, etc
paulson <lp15@cam.ac.uk>
parents: 63918
diff changeset
  3547
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3548
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3549
subsection \<open>even more special cases.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3550
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3551
lemma uminus_interval_vector[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3552
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3553
  shows "uminus ` cbox a b = cbox (-b) (-a)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3554
  apply (rule set_eqI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3555
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3556
  defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3557
  unfolding image_iff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3558
  apply (rule_tac x="-x" in bexI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3559
  apply (auto simp add:minus_le_iff le_minus_iff mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3560
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3561
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3562
lemma has_integral_reflect_lemma[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3563
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3564
  shows "((\<lambda>x. f(-x)) has_integral i) (cbox (-b) (-a))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3565
  using has_integral_affinity[OF assms, of "-1" 0]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3566
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3567
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3568
lemma has_integral_reflect_lemma_real[intro]:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3569
  assumes "(f has_integral i) {a .. b::real}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3570
  shows "((\<lambda>x. f(-x)) has_integral i) {-b .. -a}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3571
  using assms
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3572
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3573
  by (rule has_integral_reflect_lemma)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3574
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3575
lemma has_integral_reflect[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3576
  "((\<lambda>x. f (-x)) has_integral i) (cbox (-b) (-a)) \<longleftrightarrow> (f has_integral i) (cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3577
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3578
  apply (drule_tac[!] has_integral_reflect_lemma)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3579
  apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3580
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3581
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3582
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
  3583
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3584
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3585
lemma integrable_reflect_real[simp]: "(\<lambda>x. f(-x)) integrable_on {-b .. -a} \<longleftrightarrow> f integrable_on {a .. b::real}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3586
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3587
  by (rule integrable_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3588
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3589
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
  3590
  unfolding integral_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3591
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3592
lemma integral_reflect_real[simp]: "integral {-b .. -a} (\<lambda>x. f (-x)) = integral {a .. b::real} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3593
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3594
  by (rule integral_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3595
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3596
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3597
subsection \<open>Stronger form of FCT; quite a tedious proof.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3598
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3599
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
  3600
  by (simp add: split_def)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3601
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3602
lemma norm_triangle_le_sub: "norm x + norm y \<le> e \<Longrightarrow> norm (x - y) \<le> e"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3603
  apply (subst(asm)(2) norm_minus_cancel[symmetric])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3604
  apply (drule norm_triangle_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3605
  apply (auto simp add: algebra_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3606
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3607
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3608
lemma fundamental_theorem_of_calculus_interior:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3609
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3610
  assumes "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3611
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3612
    and "\<forall>x\<in>{a <..< b}. (f has_vector_derivative f'(x)) (at x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3613
  shows "(f' has_integral (f b - f a)) {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3614
proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3615
  {
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3616
    presume *: "a < b \<Longrightarrow> ?thesis"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3617
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3618
    proof (cases "a < b")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3619
      case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3620
      then show ?thesis by (rule *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3621
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3622
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3623
      then have "a = b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3624
        using assms(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3625
      then have *: "cbox a b = {b}" "f b - f a = 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3626
        by (auto simp add:  order_antisym)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3627
      show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3628
        unfolding *(2)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3629
        unfolding content_eq_0
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3630
        using * \<open>a = b\<close>
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
  3631
        by (auto simp: ex_in_conv)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3632
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3633
  }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3634
  assume ab: "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3635
  let ?P = "\<lambda>e. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a .. b} \<and> d fine p \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3636
    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a .. b})"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3637
  { presume "\<And>e. e > 0 \<Longrightarrow> ?P e" then show ?thesis unfolding has_integral_factor_content_real by auto }
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3638
  fix e :: real
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3639
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3640
  note assms(3)[unfolded has_vector_derivative_def has_derivative_at_alt ball_conj_distrib]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3641
  note conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3642
  note bounded=this(1) and this(2)
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  3643
  from this(2) have "\<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow>
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3644
    norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e/2 * norm (y - x)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3645
    apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3646
    apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3647
    apply (erule_tac x=x in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3648
    apply (erule_tac x="e/2" in allE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3649
    using e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3650
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3651
    done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3652
  note this[unfolded bgauge_existence_lemma]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3653
  from choice[OF this] guess d ..
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3654
  note conjunctD2[OF this[rule_format]]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3655
  note d = this[rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3656
  have "bounded (f ` cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3657
    apply (rule compact_imp_bounded compact_continuous_image)+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3658
    using compact_cbox assms
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3659
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3660
    done
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3661
  from this[unfolded bounded_pos] obtain B 
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3662
    where "0 < B" and B: "\<And>x. x \<in> f ` cbox a b \<Longrightarrow> norm x \<le> B"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3663
    by metis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3664
  have "\<exists>da. 0 < da \<and> (\<forall>c. a \<le> c \<and> {a .. c} \<subseteq> {a .. b} \<and> {a .. c} \<subseteq> ball a da \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3665
    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
  3666
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3667
    have "a \<in> {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3668
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3669
    note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3670
    note * = this[unfolded continuous_within Lim_within,rule_format]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3671
    have "(e * (b - a)) / 8 > 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3672
      using e ab by (auto simp add: field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3673
    from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3674
    have "\<exists>l. 0 < l \<and> norm(l *\<^sub>R f' a) \<le> (e * (b - a)) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3675
    proof (cases "f' a = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3676
      case True
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56381
diff changeset
  3677
      thus ?thesis using ab e by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3678
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3679
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3680
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3681
        apply (rule_tac x="(e * (b - a)) / 8 / norm (f' a)" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3682
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3683
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3684
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3685
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3686
    then guess l .. note l = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3687
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3688
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3689
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3690
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3691
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3692
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3693
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3694
      fix c
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3695
      assume as: "a \<le> c" "{a .. c} \<subseteq> {a .. b}" "{a .. c} \<subseteq> ball a (min k l)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3696
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3697
      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)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3698
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3699
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3700
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3701
        have "\<bar>c - a\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3702
          using as' by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3703
        then show "norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3704
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3705
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3706
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3707
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3708
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3709
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3710
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3711
        show "norm (f c - f a) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3712
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3713
          apply (cases "a = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3714
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3715
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3716
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3717
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3718
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3719
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3720
      finally show "norm (content {a .. c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3721
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3722
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3723
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3724
  then guess da .. note da=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3725
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3726
  have "\<exists>db>0. \<forall>c\<le>b. {c .. b} \<subseteq> {a .. b} \<and> {c .. b} \<subseteq> ball b db \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3727
    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
  3728
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3729
    have "b \<in> {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3730
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3731
    note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3732
    note * = this[unfolded continuous_within Lim_within,rule_format] have "(e * (b - a)) / 8 > 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3733
      using e ab by (auto simp add: field_simps)
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3734
    from *[OF this] obtain k
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3735
      where k: "0 < k"
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3736
               "\<And>x. \<lbrakk>x \<in> {a..b}; 0 < dist x b \<and> dist x b < k\<rbrakk>
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3737
                    \<Longrightarrow> dist (f x) (f b) < e * (b - a) / 8"
66355
c828efcb95f3 towards a cleanup of Henstock_Kurzweil_Integration.thy
paulson <lp15@cam.ac.uk>
parents: 66299
diff changeset
  3738
      by blast
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3739
    obtain l where l: "0 < l" "norm (l *\<^sub>R f' b) \<le> (e * (b - a)) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3740
    proof (cases "f' b = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3741
      case True
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3742
      thus ?thesis using ab e that by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3743
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3744
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3745
      then show ?thesis
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3746
        apply (rule_tac l="(e * (b - a)) / 8 / norm (f' b)" in that)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3747
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3748
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3749
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3750
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3751
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3752
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3753
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3754
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3755
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3756
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3757
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3758
      fix c
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3759
      assume as: "c \<le> b" "{c..b} \<subseteq> {a..b}" "{c..b} \<subseteq> ball b (min k l)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3760
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3761
      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)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3762
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3763
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3764
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3765
        have "\<bar>c - b\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3766
          using as' by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3767
        then show "norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3768
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3769
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3770
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3771
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3772
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3773
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3774
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3775
        show "norm (f b - f c) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3776
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3777
          apply (cases "b = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3778
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3779
          apply (subst norm_minus_commute)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3780
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3781
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3782
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3783
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3784
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3785
      finally show "norm (content {c .. b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3786
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3787
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3788
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3789
  then guess db .. note db=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3790
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3791
  let ?d = "(\<lambda>x. ball x (if x=a then da else if x=b then db else d x))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3792
  show "?P e"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3793
    apply (rule_tac x="?d" in exI)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  3794
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3795
    case 1
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3796
    show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3797
      apply (rule gauge_ball_dependent)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3798
      using ab db(1) da(1) d(1)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3799
      apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3800
      done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3801
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3802
    case as: (2 p)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3803
    let ?A = "{t. fst t \<in> {a, b}}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3804
    note p = tagged_division_ofD[OF as(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3805
    have pA: "p = (p \<inter> ?A) \<union> (p - ?A)" "finite (p \<inter> ?A)" "finite (p - ?A)" "(p \<inter> ?A) \<inter> (p - ?A) = {}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3806
      using as by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3807
    note * = additive_tagged_division_1'[OF assms(1) as(1), symmetric]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3808
    have **: "\<And>n1 s1 n2 s2::real. n2 \<le> s2 / 2 \<Longrightarrow> n1 - s1 \<le> s2 / 2 \<Longrightarrow> n1 + n2 \<le> s1 + s2"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3809
      by arith
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3810
    show ?case
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3811
      unfolding content_real[OF assms(1)] and *[of "\<lambda>x. x"] *[of f] sum_subtractf[symmetric] split_minus
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3812
      unfolding sum_distrib_left
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3813
      apply (subst(2) pA)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3814
      apply (subst pA)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3815
      unfolding sum.union_disjoint[OF pA(2-)]
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  3816
    proof (rule norm_triangle_le, rule **, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3817
      case 1
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3818
      show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3819
        apply (rule order_trans)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3820
        apply (rule sum_norm_le)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3821
        defer
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3822
        apply (subst sum_divide_distrib)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3823
        apply (rule order_refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3824
        apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3825
        apply (unfold not_le o_def split_conv fst_conv)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3826
      proof (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3827
        fix x k
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3828
        assume xk: "(x, k) \<in> p"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3829
          "e * (Sup k -  Inf k) / 2 <
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3830
            norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k)))"
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3831
        obtain u v where k: "k = cbox u v"
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3832
          using p(4) xk(1) by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3833
        then have "u \<le> v" and uv: "{u, v} \<subseteq> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3834
          using p(2)[OF xk(1)] by auto
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3835
        then have result: "e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))"
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3836
          using xk(2)[unfolded k box_real interval_bounds_real content_real] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3837
        assume as': "x \<noteq> a" "x \<noteq> b"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  3838
        then have "x \<in> box a b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3839
          using p(2-3)[OF xk(1)] by (auto simp: mem_box)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3840
        note  * = d(2)[OF this]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3841
        have "norm ((v - u) *\<^sub>R f' (x) - (f (v) - f (u))) =
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3842
          norm ((f (u) - f (x) - (u - x) *\<^sub>R f' (x)) - (f (v) - f (x) - (v - x) *\<^sub>R f' (x)))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3843
          apply (rule arg_cong[of _ _ norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3844
          unfolding scaleR_left.diff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3845
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3846
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3847
        also have "\<dots> \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3848
          apply (rule norm_triangle_le_sub)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3849
          apply (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3850
          apply (rule_tac[!] *)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3851
          using fineD[OF as(2) xk(1)] as'
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3852
          unfolding k subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3853
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3854
          apply (erule_tac x=u in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3855
          apply (erule_tac[3] x=v in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3856
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3857
          apply (auto simp:dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3858
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3859
        also have "\<dots> \<le> e / 2 * norm (v - u)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3860
          using p(2)[OF xk(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3861
          unfolding k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3862
          by (auto simp add: field_simps)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3863
        finally have "e * (v - u) / 2 < e * (v - u) / 2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3864
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3865
          apply (rule less_le_trans[OF result])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3866
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3867
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3868
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3869
        then show False by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3870
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3871
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3872
      have *: "\<And>x s1 s2::real. 0 \<le> s1 \<Longrightarrow> x \<le> (s1 + s2) / 2 \<Longrightarrow> x - s1 \<le> s2 / 2"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3873
        by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3874
      case 2
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3875
      have ge0: "0 \<le> e * (Sup k - Inf k)" if xkp: "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}" for x k
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3876
      proof -
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3877
        obtain u v where uv: "k = cbox u v"
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3878
          by (meson Int_iff xkp p(4))
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3879
        with p(2) that uv have "cbox u v \<noteq> {}"
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3880
          by blast
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3881
        then show "0 \<le> e * ((Sup k) - (Inf k))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3882
          unfolding uv using e by (auto simp add: field_simps)
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3883
      qed
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3884
      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"
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  3885
      proof -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3886
        have *: "\<And>s f t e. sum f s = sum f t \<Longrightarrow> norm (sum f t) \<le> e \<Longrightarrow> norm (sum f s) \<le> e"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3887
          by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3888
        show "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x -
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3889
          (f ((Sup k)) - f ((Inf k)))) \<le> e * (b - a) / 2"
59647
c6f413b660cf clarified Drule.gen_all: observe context more carefully;
wenzelm
parents: 59425
diff changeset
  3890
          apply (rule *[where t1="p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0}"])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3891
          apply (rule sum.mono_neutral_right[OF pA(2)])
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3892
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3893
          apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3894
          unfolding split_paired_all split_conv o_def
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  3895
        proof goal_cases
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3896
          fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3897
          assume "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3898
          then have xk: "(x, k) \<in> p" "content k = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3899
            by auto
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3900
          then obtain u v where uv: "k = cbox u v"
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3901
            using p(4) by blast
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3902
          have "k \<noteq> {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3903
            using p(2)[OF xk(1)] by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3904
          then have *: "u = v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3905
            using xk
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3906
            unfolding uv content_eq_0 box_eq_empty
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3907
            by auto
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3908
          then show "content k *\<^sub>R (f' (x)) - (f ((Sup k)) - f ((Inf k))) = 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3909
            using xk unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3910
        next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3911
          have *: "p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0} =
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3912
            {t. t\<in>p \<and> fst t = a \<and> content(snd t) \<noteq> 0} \<union> {t. t\<in>p \<and> fst t = b \<and> content(snd t) \<noteq> 0}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3913
            by blast
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3914
          have **: "norm (sum f s) \<le> e"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3915
            if "\<forall>x y. x \<in> s \<and> y \<in> s \<longrightarrow> x = y"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3916
            and "\<forall>x. x \<in> s \<longrightarrow> norm (f x) \<le> e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3917
            and "e > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3918
            for s f and e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3919
          proof (cases "s = {}")
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3920
            case True
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3921
            with that show ?thesis by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3922
          next
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3923
            case False
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3924
            then obtain x where "x \<in> s"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3925
              by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3926
            then have *: "s = {x}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3927
              using that(1) by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3928
            then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3929
              using \<open>x \<in> s\<close> that(2) by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3930
          qed
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3931
          case 2
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3932
          show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3933
            apply (subst *)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  3934
            apply (subst sum.union_disjoint)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3935
            prefer 4
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3936
            apply (rule order_trans[of _ "e * (b - a)/4 + e * (b - a)/4"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3937
            apply (rule norm_triangle_le,rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3938
            apply (rule_tac[1-2] **)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3939
          proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3940
            let ?B = "\<lambda>x. {t \<in> p. fst t = x \<and> content (snd t) \<noteq> 0}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3941
            have pa: "\<exists>v. k = cbox a v \<and> a \<le> v" if "(a, k) \<in> p" for k
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3942
            proof -
66356
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3943
              obtain u v where uv: "k = cbox u v"
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3944
                using \<open>(a, k) \<in> p\<close> p(4) by blast
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3945
              then have *: "u \<le> v"
a6c9d7206853 further cleanup of "guess"
paulson <lp15@cam.ac.uk>
parents: 66355
diff changeset
  3946
                using p(2)[OF that] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3947
              have u: "u = a"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3948
              proof (rule ccontr)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3949
                have "u \<in> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3950
                  using p(2-3)[OF that(1)] unfolding uv by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3951
                have "u \<ge> a"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3952
                  using p(2-3)[OF that(1)] unfolding uv subset_eq by auto
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  3953
                moreover assume "\<not> ?thesis"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3954
                ultimately have "u > a" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3955
                then show False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3956
                  using p(2)[OF that(1)] unfolding uv by (auto simp add:)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3957
              qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3958
              then show ?thesis
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3959
                apply (rule_tac x=v in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3960
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3961
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3962
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3963
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3964
            qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3965
            have pb: "\<exists>v. k = cbox v b \<and> b \<ge> v" if "(b, k) \<in> p" for k
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3966
            proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3967
              guess u v using p(4)[OF that] by (elim exE) note uv=this
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3968
              have *: "u \<le> v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3969
                using p(2)[OF that] unfolding uv by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3970
              have u: "v = b"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3971
              proof (rule ccontr)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3972
                have "u \<in> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3973
                  using p(2-3)[OF that(1)] unfolding uv by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3974
                have "v \<le> b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3975
                  using p(2-3)[OF that(1)] unfolding uv subset_eq by auto
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  3976
                moreover assume "\<not> ?thesis"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3977
                ultimately have "v < b" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3978
                then show False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3979
                  using p(2)[OF that(1)] unfolding uv by (auto simp add:)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3980
              qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3981
              then show ?thesis
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3982
                apply (rule_tac x=u in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3983
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3984
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3985
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3986
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3987
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3988
            show "\<forall>x y. x \<in> ?B a \<and> y \<in> ?B a \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3989
              apply (rule,rule,rule,unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3990
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3991
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3992
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3993
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3994
              assume k: "(a, k) \<in> p" "(a, k') \<in> p" "content k \<noteq> 0" "content k' \<noteq> 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3995
              guess v using pa[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  3996
              guess v' using pa[OF k(2)] .. note v' = conjunctD2[OF this] let ?v = "min v v'"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  3997
              have "box a ?v \<subseteq> k \<inter> k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3998
                unfolding v v' by (auto simp add: mem_box)
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  3999
              note interior_mono[OF this,unfolded interior_Int]
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4000
              moreover have "(a + ?v)/2 \<in> box a ?v"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4001
                using k(3-)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4002
                unfolding v v' content_eq_0 not_le
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4003
                by (auto simp add: mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4004
              ultimately have "(a + ?v)/2 \<in> interior k \<inter> interior k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4005
                unfolding interior_open[OF open_box] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4006
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4007
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4008
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4009
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4010
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4011
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4012
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  4013
              { assume "x \<in> k'" then show "x \<in> k" unfolding * . }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4014
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4015
            show "\<forall>x y. x \<in> ?B b \<and> y \<in> ?B b \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4016
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4017
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4018
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4019
              apply (unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4020
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4021
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4022
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4023
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4024
              assume k: "(b, k) \<in> p" "(b, k') \<in> p" "content k \<noteq> 0" "content k' \<noteq> 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4025
              guess v using pb[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4026
              guess v' using pb[OF k(2)] .. note v' = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4027
              let ?v = "max v v'"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4028
              have "box ?v b \<subseteq> k \<inter> k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4029
                unfolding v v' by (auto simp: mem_box)
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  4030
                note interior_mono[OF this,unfolded interior_Int]
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4031
              moreover have " ((b + ?v)/2) \<in> box ?v b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4032
                using k(3-) unfolding v v' content_eq_0 not_le by (auto simp: mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4033
              ultimately have " ((b + ?v)/2) \<in> interior k \<inter> interior k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4034
                unfolding interior_open[OF open_box] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4035
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4036
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4037
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4038
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4039
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4040
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4041
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4042
              { assume "x \<in> k'" then show "x\<in>k" unfolding * . }
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4043
            qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4044
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4045
            let ?a = a and ?b = b (* a is something else while proofing the next theorem. *)
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  4046
            show "\<forall>x. x \<in> ?B a \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x - (f (Sup k) -
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  4047
              f (Inf k))) x) \<le> e * (b - a) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4048
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4049
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4050
              unfolding mem_Collect_eq
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4051
              unfolding split_paired_all fst_conv snd_conv
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4052
            proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4053
              case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4054
              guess v using pa[OF prems(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4055
              have "?a \<in> {?a..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4056
                using v(2) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4057
              then have "v \<le> ?b"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4058
                using p(3)[OF prems(1)] unfolding subset_eq v by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4059
              moreover have "{?a..v} \<subseteq> ball ?a da"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4060
                using fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4061
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4062
                apply (subst(asm) if_P)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4063
                apply (rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4064
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4065
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4066
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4067
                apply (auto simp add:subset_eq dist_real_def v)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4068
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4069
              ultimately show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4070
                unfolding v interval_bounds_real[OF v(2)] box_real
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4071
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4072
                apply(rule da(2)[of "v"])
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4073
                using prems fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4074
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4075
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4076
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4077
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4078
            show "\<forall>x. x \<in> ?B b \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x -
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  4079
              (f (Sup k) - f (Inf k))) x) \<le> e * (b - a) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4080
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4081
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4082
              unfolding mem_Collect_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4083
              unfolding split_paired_all fst_conv snd_conv
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4084
            proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4085
              case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4086
              guess v using pb[OF prems(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4087
              have "?b \<in> {v.. ?b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4088
                using v(2) by auto
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4089
              then have "v \<ge> ?a" using p(3)[OF prems(1)]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  4090
                unfolding subset_eq v by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4091
              moreover have "{v..?b} \<subseteq> ball ?b db"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4092
                using fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4093
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4094
                apply (subst(asm) if_P, rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4095
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4096
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4097
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4098
                using ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4099
                apply (auto simp add:subset_eq v dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4100
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4101
              ultimately show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4102
                unfolding v
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4103
                unfolding interval_bounds_real[OF v(2)] box_real
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4104
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4105
                apply(rule db(2)[of "v"])
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4106
                using prems fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4107
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4108
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4109
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4110
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4111
          qed (insert p(1) ab e, auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4112
        qed auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4113
      qed
65680
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4114
      show ?case
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4115
        apply (rule * [OF sum_nonneg])
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4116
        using ge0 apply (force simp add: )
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4117
        unfolding sum.union_disjoint[OF pA(2-),symmetric] pA(1)[symmetric]
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4118
        unfolding sum_distrib_left[symmetric]
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4119
        apply (subst additive_tagged_division_1[OF _ as(1)])
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4120
         apply (rule assms)
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4121
        apply (rule **)
378a2f11bec9 Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents: 65587
diff changeset
  4122
        done
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4123
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4124
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4125
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  4126
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4127
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4128
subsection \<open>Stronger form with finite number of exceptional points.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4129
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4130
lemma fundamental_theorem_of_calculus_interior_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4131
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4132
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4133
    and "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4134
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4135
    and "\<forall>x\<in>{a <..< b} - s. (f has_vector_derivative f'(x)) (at x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4136
  shows "(f' has_integral (f b - f a)) {a .. b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4137
  using assms
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4138
proof (induct "card s" arbitrary: s a b)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4139
  case 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4140
  show ?case
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4141
    apply (rule fundamental_theorem_of_calculus_interior)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4142
    using 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4143
    apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4144
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4145
next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4146
  case (Suc n)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4147
  from this(2) guess c s'
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4148
    apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4149
    apply (subst(asm) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4150
    unfolding card_Suc_eq
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4151
    apply (subst(asm)(2) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4152
    apply (elim exE conjE)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4153
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4154
  note cs = this[rule_format]
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4155
  show ?case
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4156
  proof (cases "c \<in> box a b")
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4157
    case False
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4158
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4159
      apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4160
      apply (rule Suc(1)[OF cs(3) _ Suc(4,5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4161
      apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4162
      defer
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4163
      apply (rule Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4164
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4165
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4166
      apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4167
      done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4168
  next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4169
    have *: "f b - f a = (f c - f a) + (f b - f c)"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4170
      by auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4171
    case True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4172
    then have "a \<le> c" "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4173
      by (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4174
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4175
      apply (subst *)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4176
      apply (rule has_integral_combine)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4177
      apply assumption+
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4178
      apply (rule_tac[!] Suc(1)[OF cs(3)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4179
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4180
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4181
    proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4182
      show "continuous_on {a .. c} f" "continuous_on {c .. b} f"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4183
        apply (rule_tac[!] continuous_on_subset[OF Suc(5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4184
        using True
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4185
        apply (auto simp: mem_box)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4186
        done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4187
      let ?P = "\<lambda>i j. \<forall>x\<in>{i <..< j} - s'. (f has_vector_derivative f' x) (at x)"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4188
      show "?P a c" "?P c b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4189
        apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4190
        apply (rule_tac[!] Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4191
        using True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4192
        unfolding cs
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4193
        apply (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4194
        done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4195
    qed auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4196
  qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4197
qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4198
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4199
lemma fundamental_theorem_of_calculus_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4200
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4201
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4202
    and "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4203
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4204
    and "\<forall>x\<in>{a .. b} - s. (f has_vector_derivative f'(x)) (at x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4205
  shows "(f' has_integral (f b - f a)) {a .. b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4206
  apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1-3), of f'])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4207
  using assms(4)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4208
  apply (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4209
  done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4210
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  4211
lemma indefinite_integral_continuous_left:
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4212
  fixes f:: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4213
  assumes "f integrable_on {a .. b}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4214
    and "a < c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4215
    and "c \<le> b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4216
    and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4217
  obtains d where "d > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4218
    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
  4219
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4220
  have "\<exists>w>0. \<forall>t. c - w < t \<and> t < c \<longrightarrow> norm (f c) * norm(c - t) < e / 3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4221
  proof (cases "f c = 0")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4222
    case False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4223
    hence "0 < e / 3 / norm (f c)" using \<open>e>0\<close> by simp
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4224
    then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4225
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4226
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4227
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4228
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4229
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4230
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4231
      fix t
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4232
      assume as: "t < c" and "c - e / 3 / norm (f c) < t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4233
      then have "c - t < e / 3 / norm (f c)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4234
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4235
      then have "norm (c - t) < e / 3 / norm (f c)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4236
        using as by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4237
      then show "norm (f c) * norm (c - t) < e / 3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4238
        using False
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4239
        apply -
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57447
diff changeset
  4240
        apply (subst mult.commute)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4241
        apply (subst pos_less_divide_eq[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4242
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4243
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4244
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4245
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4246
    case True
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4247
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4248
      apply (rule_tac x=1 in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4249
      unfolding True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4250
      using \<open>e > 0\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4251
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4252
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4253
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4254
  then guess w .. note w = conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4255
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4256
  have *: "e / 3 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4257
    using assms by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4258
  have "f integrable_on {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4259
    apply (rule integrable_subinterval_real[OF assms(1)])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4260
    using assms(2-3)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4261
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4262
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4263
  from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d1 ..
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4264
  note d1 = conjunctD2[OF this,rule_format]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4265
  define d where [abs_def]: "d x = ball x w \<inter> d1 x" for x
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4266
  have "gauge d"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4267
    unfolding d_def using w(1) d1 by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4268
  note this[unfolded gauge_def,rule_format,of c]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4269
  note conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4270
  from this(2)[unfolded open_contains_ball,rule_format,OF this(1)] guess k ..
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4271
  note k=conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4272
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4273
  let ?d = "min k (c - a) / 2"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4274
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4275
    apply (rule that[of ?d])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4276
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4277
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4278
    show "?d > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4279
      using k(1) using assms(2) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4280
    fix t
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4281
    assume as: "c - ?d < t" "t \<le> c"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4282
    let ?thesis = "norm (integral ({a .. c}) f - integral ({a .. t}) f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4283
    {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4284
      presume *: "t < c \<Longrightarrow> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4285
      show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4286
        apply (cases "t = c")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4287
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4288
        apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4289
        apply (subst less_le)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4290
        using \<open>e > 0\<close> as(2)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4291
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4292
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4293
    }
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
  4294
    assume "t < c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4295
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4296
    have "f integrable_on {a .. t}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4297
      apply (rule integrable_subinterval_real[OF assms(1)])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4298
      using assms(2-3) as(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4299
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4300
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4301
    from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d2 ..
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4302
    note d2 = conjunctD2[OF this,rule_format]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4303
    define d3 where "d3 x = (if x \<le> t then d1 x \<inter> d2 x else d1 x)" for x
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4304
    have "gauge d3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4305
      using d2(1) d1(1) unfolding d3_def gauge_def by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4306
    from fine_division_exists_real[OF this, of a t] guess p . note p=this
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4307
    note p'=tagged_division_ofD[OF this(1)]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4308
    have pt: "\<forall>(x,k)\<in>p. x \<le> t"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4309
    proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4310
      case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4311
      from p'(2,3)[OF prems] show ?case
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4312
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4313
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4314
    with p(2) have "d2 fine p"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4315
      unfolding fine_def d3_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4316
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4317
      apply (erule_tac x="(a,b)" in ballE)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4318
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4319
      done
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4320
    note d2_fin = d2(2)[OF conjI[OF p(1) this]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4321
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4322
    have *: "{a .. c} \<inter> {x. x \<bullet> 1 \<le> t} = {a .. t}" "{a .. c} \<inter> {x. x \<bullet> 1 \<ge> t} = {t .. c}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4323
      using assms(2-3) as by (auto simp add: field_simps)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4324
    have "p \<union> {(c, {t .. c})} tagged_division_of {a .. c} \<and> d1 fine p \<union> {(c, {t .. c})}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4325
      apply rule
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4326
      apply (rule tagged_division_union_interval_real[of _ _ _ 1 "t"])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4327
      unfolding *
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4328
      apply (rule p)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4329
      apply (rule tagged_division_of_self_real)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4330
      unfolding fine_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4331
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4332
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4333
      fix x k y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4334
      assume "(x,k) \<in> p" and "y \<in> k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4335
      then show "y \<in> d1 x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4336
        using p(2) pt
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4337
        unfolding fine_def d3_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4338
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4339
        apply (erule_tac x="(x,k)" in ballE)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4340
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4341
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4342
    next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4343
      fix x assume "x \<in> {t..c}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4344
      then have "dist c x < k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4345
        unfolding dist_real_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4346
        using as(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4347
        by (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4348
      then show "x \<in> d1 c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4349
        using k(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4350
        unfolding d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4351
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4352
    qed (insert as(2), auto) note d1_fin = d1(2)[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4353
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4354
    have *: "integral {a .. c} f - integral {a .. t} f = -(((c - t) *\<^sub>R f c + (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)) -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4355
      integral {a .. c} f) + ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - integral {a .. t} f) + (c - t) *\<^sub>R f c"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4356
      "e = (e/3 + e/3) + e/3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4357
      by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4358
    have **: "(\<Sum>(x, k)\<in>p \<union> {(c, {t .. c})}. content k *\<^sub>R f x) =
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4359
      (c - t) *\<^sub>R f c + (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4360
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4361
      have **: "\<And>x F. F \<union> {x} = insert x F"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4362
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4363
      have "(c, cbox t c) \<notin> p"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4364
      proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4365
        case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4366
        from p'(2-3)[OF prems] have "c \<in> cbox a t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4367
          by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4368
        then show False using \<open>t < c\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4369
          by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4370
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4371
      then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4372
        unfolding ** box_real
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4373
        apply -
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  4374
        apply (subst sum.insert)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4375
        apply (rule p')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4376
        unfolding split_conv
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4377
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4378
        apply (subst content_real)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4379
        using as(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4380
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4381
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4382
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4383
    have ***: "c - w < t \<and> t < c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4384
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4385
      have "c - k < t"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4386
        using \<open>k>0\<close> as(1) by (auto simp add: field_simps)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4387
      moreover have "k \<le> w"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4388
        apply (rule ccontr)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4389
        using k(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4390
        unfolding subset_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4391
        apply (erule_tac x="c + ((k + w)/2)" in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4392
        unfolding d_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4393
        using \<open>k > 0\<close> \<open>w > 0\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4394
        apply (auto simp add: field_simps not_le not_less dist_real_def)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4395
        done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4396
      ultimately show ?thesis using \<open>t < c\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4397
        by (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4398
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4399
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4400
      unfolding *(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4401
      apply (subst *(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4402
      apply (rule norm_triangle_lt add_strict_mono)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4403
      unfolding norm_minus_cancel
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4404
      apply (rule d1_fin[unfolded **])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4405
      apply (rule d2_fin)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4406
      using w(2)[OF ***]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4407
      unfolding norm_scaleR
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4408
      apply (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4409
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4410
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4411
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4412
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4413
lemma indefinite_integral_continuous_right:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4414
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4415
  assumes "f integrable_on {a .. b}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4416
    and "a \<le> c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4417
    and "c < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4418
    and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4419
  obtains d where "0 < d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4420
    and "\<forall>t. c \<le> t \<and> t < c + d \<longrightarrow> norm (integral {a .. c} f - integral {a .. t} f) < e"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4421
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4422
  have *: "(\<lambda>x. f (- x)) integrable_on {-b .. -a}" "- b < - c" "- c \<le> - a"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4423
    using assms by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4424
  from indefinite_integral_continuous_left[OF * \<open>e>0\<close>] guess d . note d = this
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4425
  let ?d = "min d (b - c)" 
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4426
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4427
    apply (rule that[of "?d"])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4428
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4429
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4430
    show "0 < ?d"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4431
      using d(1) assms(3) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4432
    fix t :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4433
    assume as: "c \<le> t" "t < c + ?d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4434
    have *: "integral {a .. c} f = integral {a .. b} f - integral {c .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4435
      "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
  4436
      apply (simp_all only: algebra_simps)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4437
      apply (rule_tac[!] integral_combine)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4438
      using assms as
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4439
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4440
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4441
    have "(- c) - d < (- t) \<and> - t \<le> - c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4442
      using as by auto note d(2)[rule_format,OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4443
    then show "norm (integral {a .. c} f - integral {a .. t} f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4444
      unfolding *
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4445
      unfolding integral_reflect
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4446
      apply (subst norm_minus_commute)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4447
      apply (auto simp add: algebra_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4448
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4449
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4450
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4451
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4452
lemma indefinite_integral_continuous_1:
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4453
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4454
  assumes "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4455
  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
  4456
proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4457
  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
  4458
       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
  4459
  proof (cases "a = b")
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4460
    case True
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4461
    with that show ?thesis by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4462
  next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4463
    case False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4464
    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
  4465
    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
  4466
      by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4467
    then show ?thesis 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4468
    proof cases
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4469
      case 1 show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4470
        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
  4471
        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
  4472
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4473
    next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4474
      case 2 show ?thesis 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4475
        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
  4476
        using \<open>x = b\<close> apply (force simp: dist_norm norm_minus_commute algebra_simps)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4477
        done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4478
    next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4479
      case 3
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4480
      obtain d1 where "0 < d1" 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4481
        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
  4482
        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
  4483
      obtain d2 where "0 < d2" 
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4484
        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
  4485
        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
  4486
      show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4487
      proof (intro exI ballI conjI impI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4488
        show "0 < min d1 d2"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4489
          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
  4490
        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
  4491
             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
  4492
        proof (cases "y < x")
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4493
          case True
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4494
          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
  4495
        next
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4496
          case False
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4497
          with that d2 show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4498
            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
  4499
        qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4500
      qed
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4501
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4502
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4503
  then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4504
    by (auto simp: continuous_on_iff)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4505
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4506
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4507
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
  4508
  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
  4509
  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
  4510
  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
  4511
proof -
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4512
  have "integral {a .. b} f - integral {a .. x} f = integral {x .. b} f" if "x \<in> {a .. b}" for x
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4513
    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
  4514
    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
  4515
  with _ show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  4516
    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
  4517
qed
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  4518
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4519
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4520
subsection \<open>This doesn't directly involve integration, but that gives an easy proof.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4521
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4522
lemma has_derivative_zero_unique_strong_interval:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4523
  fixes f :: "real \<Rightarrow> 'a::banach"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4524
  assumes "finite k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4525
    and "continuous_on {a .. b} f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4526
    and "f a = y"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4527
    and "\<forall>x\<in>({a .. b} - k). (f has_derivative (\<lambda>h. 0)) (at x within {a .. b})" "x \<in> {a .. b}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4528
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4529
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4530
  have ab: "a \<le> b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4531
    using assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4532
  have *: "a \<le> x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4533
    using assms(5) by auto
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60867
diff changeset
  4534
  have "((\<lambda>x. 0::'a) has_integral f x - f a) {a .. x}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4535
    apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1) *])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4536
    apply (rule continuous_on_subset[OF assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4537
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4538
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4539
    unfolding has_vector_derivative_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4540
    apply (subst has_derivative_within_open[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4541
    apply assumption
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4542
    apply (rule open_greaterThanLessThan)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4543
    apply (rule has_derivative_within_subset[where s="{a .. b}"])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4544
    using assms(4) assms(5)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4545
    apply (auto simp: mem_box)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4546
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4547
  note this[unfolded *]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4548
  note has_integral_unique[OF has_integral_0 this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4549
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4550
    unfolding assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4551
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4552
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4553
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4554
subsection \<open>Generalize a bit to any convex set.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4555
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4556
lemma has_derivative_zero_unique_strong_convex:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4557
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4558
  assumes "convex s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4559
    and "finite k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4560
    and "continuous_on s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4561
    and "c \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4562
    and "f c = y"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4563
    and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4564
    and "x \<in> s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4565
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4566
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4567
  {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4568
    presume *: "x \<noteq> c \<Longrightarrow> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4569
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4570
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4571
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4572
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4573
      unfolding assms(5)[symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4574
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4575
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4576
  }
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4577
  assume "x \<noteq> c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4578
  note conv = assms(1)[unfolded convex_alt,rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4579
  have as1: "continuous_on {0 ..1} (f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x))"
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56332
diff changeset
  4580
    apply (rule continuous_intros)+
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4581
    apply (rule continuous_on_subset[OF assms(3)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4582
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4583
    apply (rule conv)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4584
    using assms(4,7)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4585
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4586
    done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4587
  have *: "t = xa" if "(1 - t) *\<^sub>R c + t *\<^sub>R x = (1 - xa) *\<^sub>R c + xa *\<^sub>R x" for t xa
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4588
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4589
    from that have "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4590
      unfolding scaleR_simps by (auto simp add: algebra_simps)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4591
    then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4592
      using \<open>x \<noteq> c\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4593
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4594
  have as2: "finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4595
    using assms(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4596
    apply (rule finite_surj[where f="\<lambda>z. SOME t. (1-t) *\<^sub>R c + t *\<^sub>R x = z"])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4597
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4598
    unfolding image_iff
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4599
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4600
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4601
    apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4602
    apply (rule sym)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4603
    apply (rule some_equality)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4604
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4605
    apply (drule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4606
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4607
    done
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4608
  have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x)) 1 = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4609
    apply (rule has_derivative_zero_unique_strong_interval[OF as2 as1, of ])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4610
    unfolding o_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4611
    using assms(5)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4612
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4613
    apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4614
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4615
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4616
    fix t
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4617
    assume as: "t \<in> {0 .. 1} - {t. (1 - t) *\<^sub>R c + t *\<^sub>R x \<in> k}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4618
    have *: "c - t *\<^sub>R c + t *\<^sub>R x \<in> s - k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4619
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4620
      apply (rule conv[unfolded scaleR_simps])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4621
      using \<open>x \<in> s\<close> \<open>c \<in> s\<close> as
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4622
      by (auto simp add: algebra_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4623
    have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x) has_derivative (\<lambda>x. 0) \<circ> (\<lambda>z. (0 - z *\<^sub>R c) + z *\<^sub>R x))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4624
      (at t within {0 .. 1})"
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  4625
      apply (intro derivative_eq_intros)
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  4626
      apply simp_all
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  4627
      apply (simp add: field_simps)
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44125
diff changeset
  4628
      unfolding scaleR_simps
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4629
      apply (rule has_derivative_within_subset,rule assms(6)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4630
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4631
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4632
      apply (rule conv[unfolded scaleR_simps])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4633
      using \<open>x \<in> s\<close> \<open>c \<in> s\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4634
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4635
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4636
    then show "((\<lambda>xa. f ((1 - xa) *\<^sub>R c + xa *\<^sub>R x)) has_derivative (\<lambda>h. 0)) (at t within {0 .. 1})"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4637
      unfolding o_def .
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4638
  qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4639
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4640
    by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4641
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4642
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4643
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4644
text \<open>Also to any open connected set with finite set of exceptions. Could
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4645
 generalize to locally convex set with limpt-free set of exceptions.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4646
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4647
lemma has_derivative_zero_unique_strong_connected:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4648
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4649
  assumes "connected s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4650
    and "open s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4651
    and "finite k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4652
    and "continuous_on s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4653
    and "c \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4654
    and "f c = y"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4655
    and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4656
    and "x\<in>s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4657
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4658
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4659
  have "{x \<in> s. f x \<in> {y}} = {} \<or> {x \<in> s. f x \<in> {y}} = s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4660
    apply (rule assms(1)[unfolded connected_clopen,rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4661
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4662
    defer
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  4663
    apply (rule continuous_closedin_preimage[OF assms(4) closed_singleton])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4664
    apply (rule open_openin_trans[OF assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4665
    unfolding open_contains_ball
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4666
  proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4667
    fix x
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4668
    assume "x \<in> s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4669
    from assms(2)[unfolded open_contains_ball,rule_format,OF this] guess e .. note e=conjunctD2[OF this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4670
    show "\<exists>e>0. ball x e \<subseteq> {xa \<in> s. f xa \<in> {f x}}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4671
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4672
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4673
      apply (rule e)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4674
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4675
      fix y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4676
      assume y: "y \<in> ball x e"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4677
      then show "y \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4678
        using e by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4679
      show "f y = f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4680
        apply (rule has_derivative_zero_unique_strong_convex[OF convex_ball])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4681
        apply (rule assms)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4682
        apply (rule continuous_on_subset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4683
        apply (rule assms)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4684
        apply (rule e)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4685
        apply (subst centre_in_ball)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4686
        apply (rule e)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4687
        apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4688
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4689
        apply (rule has_derivative_within_subset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4690
        apply (rule assms(7)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4691
        using y e
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4692
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4693
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4694
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4695
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4696
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4697
    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
  4698
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4699
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4700
lemma has_derivative_zero_connected_constant:
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4701
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4702
  assumes "connected s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4703
      and "open s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4704
      and "finite k"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4705
      and "continuous_on s f"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4706
      and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4707
    obtains c where "\<And>x. x \<in> s \<Longrightarrow> f(x) = c"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4708
proof (cases "s = {}")
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4709
  case True
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4710
  then show ?thesis
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4711
by (metis empty_iff that)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4712
next
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4713
  case False
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4714
  then obtain c where "c \<in> s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4715
    by (metis equals0I)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4716
  then show ?thesis
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4717
    by (metis has_derivative_zero_unique_strong_connected assms that)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4718
qed
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  4719
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4720
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4721
subsection \<open>Integrating characteristic function of an interval\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4722
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4723
lemma has_integral_restrict_open_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4724
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4725
  assumes "(f has_integral i) (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4726
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4727
  shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4728
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4729
  define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4730
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4731
    presume *: "cbox c d \<noteq> {} \<Longrightarrow> ?thesis"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4732
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4733
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4734
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4735
      apply assumption
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4736
    proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4737
      case prems: 1
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  4738
      then have *: "box c d = {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4739
        by (metis bot.extremum_uniqueI box_subset_cbox)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4740
      show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4741
        using assms(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4742
        unfolding *
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4743
        using prems
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4744
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4745
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4746
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4747
  assume "cbox c d \<noteq> {}"
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4748
  from partial_division_extend_1 [OF assms(2) this] guess p . note p=this
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4749
  interpret comm_monoid_set "lift_option plus" "Some (0 :: 'b)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4750
    apply (rule comm_monoid_set.intro)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4751
    apply (rule comm_monoid_lift_option)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4752
    apply (rule add.comm_monoid_axioms)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4753
    done
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4754
  note operat = operative_division
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4755
    [OF operative_integral p(1), symmetric]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4756
  let ?P = "(if g integrable_on cbox a b then Some (integral (cbox a b) g) else None) = Some i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4757
  {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4758
    presume "?P"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4759
    then have "g integrable_on cbox a b \<and> integral (cbox a b) g = i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4760
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4761
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4762
      apply (subst(asm) if_P)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4763
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4764
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4765
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4766
    then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4767
      using integrable_integral
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4768
      unfolding g_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4769
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4770
  }
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4771
  let ?F = F
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
  4772
  have iterate:"?F (\<lambda>i. if g integrable_on i then Some (integral i g) else None) (p - {cbox c d}) = Some 0"
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4773
  proof (intro neutral ballI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4774
    fix x
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4775
    assume x: "x \<in> p - {cbox c d}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4776
    then have "x \<in> p"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4777
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4778
    note div = division_ofD(2-5)[OF p(1) this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4779
    from div(3) guess u v by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4780
    have "interior x \<inter> interior (cbox c d) = {}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4781
      using div(4)[OF p(2)] x by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4782
    then have "(g has_integral 0) x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4783
      unfolding uv
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4784
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4785
      apply (rule has_integral_spike_interior[where f="\<lambda>x. 0"])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4786
      unfolding g_def interior_cbox
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4787
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4788
      done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4789
    then show "(if g integrable_on x then Some (integral x g) else None) = Some 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4790
      by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4791
  qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4792
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4793
  have *: "p = insert (cbox c d) (p - {cbox c d})"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4794
    using p by auto
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4795
  interpret comm_monoid_set "lift_option plus" "Some (0 :: 'b)"
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4796
    apply (rule comm_monoid_set.intro)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4797
    apply (rule comm_monoid_lift_option)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4798
    apply (rule add.comm_monoid_axioms)
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4799
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4800
  have **: "g integrable_on cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4801
    apply (rule integrable_spike_interior[where f=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
  4802
    unfolding g_def  using assms(1)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4803
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4804
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4805
  moreover
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4806
  have "integral (cbox c d) g = i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4807
    apply (rule has_integral_unique[OF _ assms(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4808
    apply (rule has_integral_spike_interior[where f=g])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4809
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4810
    apply (rule integrable_integral[OF **])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4811
    unfolding g_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4812
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4813
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4814
  ultimately show ?P
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4815
    unfolding operat
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
  4816
    using p
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4817
    apply (subst *)
63659
abe0c3872d8a keeping lifting rules local
haftmann
parents: 63627
diff changeset
  4818
    apply (subst insert)
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
  4819
    apply (simp_all add: division_of_finite iterate)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4820
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4821
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4822
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4823
lemma has_integral_restrict_closed_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4824
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4825
  assumes "(f has_integral i) (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4826
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4827
  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
  4828
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4829
  note has_integral_restrict_open_subinterval[OF assms]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4830
  note * = has_integral_spike[OF negligible_frontier_interval _ this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4831
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4832
    apply (rule *[of c d])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4833
    using box_subset_cbox[of c d]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4834
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4835
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4836
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4837
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4838
lemma has_integral_restrict_closed_subintervals_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4839
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4840
  assumes "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4841
  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
  4842
  (is "?l = ?r")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4843
proof (cases "cbox c d = {}")
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4844
  case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4845
  let ?g = "\<lambda>x. if x \<in> cbox c d then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4846
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4847
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4848
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4849
    apply (rule has_integral_restrict_closed_subinterval[OF _ assms])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4850
    apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4851
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4852
    assume ?l
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4853
    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
  4854
      using assms has_integral_integrable integrable_subinterval by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4855
    then have *: "f integrable_on cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4856
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4857
      apply (rule integrable_eq)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4858
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4859
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4860
    then have "i = integral (cbox c d) f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4861
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4862
      apply (rule has_integral_unique)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4863
      apply (rule \<open>?l\<close>)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4864
      apply (rule has_integral_restrict_closed_subinterval[OF _ assms])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4865
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4866
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4867
    then show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4868
      using * by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4869
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4870
qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4871
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4872
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4873
text \<open>Hence we can apply the limit process uniformly to all integrals.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4874
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4875
lemma has_integral':
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 "(f has_integral i) s \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4878
    (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4879
      (\<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
  4880
  (is "?l \<longleftrightarrow> (\<forall>e>0. ?r e)")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4881
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4882
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4883
    presume *: "\<exists>a b. s = cbox a b \<Longrightarrow> ?thesis"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4884
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4885
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4886
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4887
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4888
      apply (subst has_integral_alt)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4889
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4890
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4891
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4892
  assume "\<exists>a b. s = cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4893
  then guess a b by (elim exE) note s=this
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  4894
  from bounded_cbox[of a b, unfolded bounded_pos] guess B ..
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4895
  note B = conjunctD2[OF this,rule_format] show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4896
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4897
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4898
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4899
    assume ?l and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4900
    show "?r e"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4901
      apply (rule_tac x="B+1" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4902
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4903
      defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4904
      apply (rule_tac x=i in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4905
    proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4906
      fix c d :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4907
      assume as: "ball 0 (B+1) \<subseteq> cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4908
      then show "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) (cbox c d)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4909
        unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4910
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4911
        apply (rule has_integral_restrict_closed_subinterval)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4912
        apply (rule \<open>?l\<close>[unfolded s])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4913
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4914
        apply (drule B(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4915
        unfolding subset_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4916
        apply (erule_tac x=x in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4917
        apply (auto simp add: dist_norm)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4918
        done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4919
    qed (insert B \<open>e>0\<close>, auto)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4920
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4921
    assume as: "\<forall>e>0. ?r e"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4922
    from this[rule_format,OF zero_less_one] guess C .. note C=conjunctD2[OF this,rule_format]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4923
    define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4924
    define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4925
    have c_d: "cbox a b \<subseteq> cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4926
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4927
      apply (drule B(2))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4928
      unfolding mem_box
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
  4929
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4930
      fix x i
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4931
      show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" if "norm x \<le> B" and "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4932
        using that and Basis_le_norm[OF \<open>i\<in>Basis\<close>, of x]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4933
        unfolding c_def d_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  4934
        by (auto simp add: field_simps sum_negf)
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
  4935
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4936
    have "ball 0 C \<subseteq> cbox c d"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4937
      apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4938
      unfolding mem_box mem_ball dist_norm
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4939
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4940
      fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4941
      assume x: "norm (0 - x) < C" and i: "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4942
      show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4943
        using Basis_le_norm[OF i, of x] and x i
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4944
        unfolding c_def d_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  4945
        by (auto simp: sum_negf)
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
  4946
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4947
    from C(2)[OF this] have "\<exists>y. (f has_integral y) (cbox a b)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4948
      unfolding has_integral_restrict_closed_subintervals_eq[OF c_d,symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4949
      unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4950
      by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4951
    then guess y .. note y=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4952
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4953
    have "y = i"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4954
    proof (rule ccontr)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4955
      assume "\<not> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4956
      then have "0 < norm (y - i)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4957
        by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4958
      from as[rule_format,OF this] guess C ..  note C=conjunctD2[OF this,rule_format]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4959
      define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)"
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  4960
      define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4961
      have c_d: "cbox a b \<subseteq> cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4962
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4963
        apply (drule B(2))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4964
        unfolding mem_box
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4965
      proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4966
        fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4967
        assume "norm x \<le> B" and "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4968
        then show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4969
          using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4970
          unfolding c_def d_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  4971
          by (auto simp add: field_simps sum_negf)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4972
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4973
      have "ball 0 C \<subseteq> cbox c d"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4974
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4975
        unfolding mem_box mem_ball dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4976
      proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4977
        fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4978
        assume "norm (0 - x) < C" and "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4979
        then show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4980
          using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4981
          unfolding c_def d_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  4982
          by (auto simp: sum_negf)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4983
      qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4984
      note C(2)[OF this] then guess z .. note z = conjunctD2[OF this, unfolded s]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  4985
      note this[unfolded has_integral_restrict_closed_subintervals_eq[OF c_d]]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4986
      then have "z = y" and "norm (z - i) < norm (y - i)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4987
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4988
        apply (rule has_integral_unique[OF _ y(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4989
        apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4990
        apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4991
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4992
      then show False
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4993
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4994
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4995
    then show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4996
      using y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4997
      unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4998
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  4999
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5000
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5001
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5002
lemma has_integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5003
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5004
  assumes "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5005
    and "(g has_integral j) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5006
    and "\<forall>x\<in>s. 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
  5007
  shows "i \<le> j"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5008
  using has_integral_component_le[OF _ assms(1-2), of 1]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5009
  using assms(3)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5010
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5011
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5012
lemma integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5013
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5014
  assumes "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5015
    and "g integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5016
    and "\<forall>x\<in>s. f x \<le> g x"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5017
  shows "integral s f \<le> integral s g"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5018
  by (rule has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5019
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5020
lemma has_integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5021
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5022
  assumes "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5023
    and "\<forall>x\<in>s. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5024
  shows "0 \<le> 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
  5025
  using has_integral_component_nonneg[of 1 f i s]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5026
  unfolding o_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5027
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5028
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5029
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5030
lemma integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5031
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5032
  assumes "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5033
    and "\<forall>x\<in>s. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5034
  shows "0 \<le> integral s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5035
  by (rule has_integral_nonneg[OF assms(1)[unfolded has_integral_integral] assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5036
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5037
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5038
text \<open>Hence a general restriction property.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5039
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5040
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
  5041
  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
  5042
  assumes "S \<subseteq> T"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5043
  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
  5044
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5045
  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
  5046
    using assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5047
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5048
    apply (subst(2) has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5049
    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
  5050
      apply (simp add: *)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5051
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5052
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5053
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5054
corollary has_integral_restrict_UNIV:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5055
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5056
  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
  5057
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5058
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5059
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
  5060
  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
  5061
  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
  5062
proof -
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5063
  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
  5064
        ((\<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
  5065
    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
  5066
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5067
    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
  5068
qed
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5069
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5070
lemma integral_restrict_Int:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5071
  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
  5072
  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
  5073
  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
  5074
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5075
lemma integrable_restrict_Int:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5076
  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
  5077
  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
  5078
  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
  5079
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5080
lemma has_integral_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5081
  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
  5082
  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
  5083
      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
  5084
      and "S \<subseteq> T"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5085
    shows "(f has_integral i) T"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5086
proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5087
  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
  5088
    using assms by fastforce
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5089
  with f show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5090
    by (simp only: has_integral_restrict_UNIV [symmetric, of f])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5091
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5092
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5093
lemma integrable_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5094
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5095
  assumes "\<forall>x. x \<notin> s \<longrightarrow> f x = 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5096
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5097
    and "f integrable_on s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5098
  shows "f integrable_on t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5099
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5100
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5101
  by (auto intro:has_integral_on_superset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5102
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5103
lemma integral_restrict_UNIV [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5104
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5105
  shows "f integrable_on s \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then f x else 0) = integral s f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5106
  apply (rule integral_unique)
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  5107
  unfolding has_integral_restrict_UNIV
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5108
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5109
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5110
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  5111
lemma integrable_restrict_UNIV:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5112
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5113
  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
  5114
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5115
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5116
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5117
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
  5118
  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
  5119
  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
  5120
    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
  5121
  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
  5122
proof -
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5123
  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
  5124
        "((\<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
  5125
    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
  5126
  then show ?thesis
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5127
    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
  5128
    using as by auto
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5129
qed
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5130
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5131
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
  5132
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5133
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5134
  show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5135
    unfolding negligible_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5136
  proof safe
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5137
    fix a b
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5138
    show "(indicator s has_integral 0) (cbox a b)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5139
      apply (rule has_integral_negligible[OF \<open>?r\<close>[rule_format,of a b]])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5140
      unfolding indicator_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5141
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5142
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5143
  qed
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  5144
qed (simp add: negligible_Int)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5145
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5146
lemma negligible_translation:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5147
  assumes "negligible S"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5148
    shows "negligible (op + c ` S)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5149
proof -
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5150
  have inj: "inj (op + c)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5151
    by simp
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5152
  show ?thesis
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5153
  using assms
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5154
  proof (clarsimp simp: negligible_def)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5155
    fix a b
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5156
    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
  5157
    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
  5158
      by (meson Diff_iff assms has_integral_negligible indicator_simps(2))
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5159
    have eq: "indicator (op + c ` S) = (\<lambda>x. indicator S (x - c))"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5160
      by (force simp add: indicator_def)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5161
    show "(indicator (op + c ` S) has_integral 0) (cbox a b)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5162
      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
  5163
            cbox_translation [of "c" "-c+a" "-c+b"]
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5164
      by (simp add: eq add.commute)
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5165
  qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5166
qed
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5167
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5168
lemma negligible_translation_rev:
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5169
  assumes "negligible (op + c ` S)"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5170
    shows "negligible S"
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5171
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
  5172
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5173
lemma has_integral_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5174
  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
  5175
  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
  5176
  shows "(f has_integral y) S \<longleftrightarrow> (f has_integral y) T"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  5177
  unfolding has_integral_restrict_UNIV[symmetric,of f]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5178
  apply (rule has_integral_spike_eq[OF assms])
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
  5179
  by (auto split: if_split_asm)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5180
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  5181
lemma has_integral_spike_set:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5182
  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
  5183
  assumes "(f has_integral y) S" "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
  5184
  shows "(f has_integral y) T"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5185
  using assms has_integral_spike_set_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5186
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5187
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  5188
lemma integrable_spike_set:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5189
  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
  5190
  assumes "f integrable_on S" and "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
  5191
    shows "f integrable_on T"
63945
444eafb6e864 a few new theorems and a renaming
paulson <lp15@cam.ac.uk>
parents: 63944
diff changeset
  5192
  using assms by (simp add: integrable_on_def has_integral_spike_set_eq)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5193
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5194
lemma integrable_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5195
  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
  5196
  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
  5197
  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
  5198
  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
  5199
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5200
lemma has_integral_interior:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5201
  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
  5202
  shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (interior S) \<longleftrightarrow> (f has_integral y) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5203
  apply (rule has_integral_spike_set_eq)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5204
  apply (auto simp: frontier_def Un_Diff closure_def)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5205
  apply (metis Diff_eq_empty_iff interior_subset negligible_empty)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5206
  done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5207
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5208
lemma has_integral_closure:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5209
  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
  5210
  shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (closure S) \<longleftrightarrow> (f has_integral y) S"
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5211
  apply (rule has_integral_spike_set_eq)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5212
  apply (auto simp: Un_Diff closure_Un_frontier negligible_diff)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5213
  by (simp add: Diff_eq closure_Un_frontier)
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5214
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5215
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
  5216
  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
  5217
  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
  5218
  unfolding interior_cbox [symmetric]
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5219
  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
  5220
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5221
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
  5222
  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
  5223
  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
  5224
  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
  5225
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5226
lemma integral_open_interval:
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5227
  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
  5228
  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
  5229
  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
  5230
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5231
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5232
subsection \<open>More lemmas that are useful later\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5233
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5234
lemma has_integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5235
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5236
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5237
    and "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5238
    and "(f has_integral j) t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5239
    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
  5240
  shows "i \<le> j"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5241
  using has_integral_subset_component_le[OF _ assms(1), of 1 f i j]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5242
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5243
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5244
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5245
lemma integral_subset_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5246
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5247
  assumes "k \<in> Basis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5248
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5249
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5250
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5251
    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
  5252
  shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5253
  apply (rule has_integral_subset_component_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5254
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5255
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5256
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5257
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5258
lemma integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5259
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5260
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5261
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5262
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5263
    and "\<forall>x \<in> t. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5264
  shows "integral s f \<le> integral t f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5265
  apply (rule has_integral_subset_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5266
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5267
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5268
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5269
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5270
lemma has_integral_alt':
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5271
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5272
  shows "(f has_integral i) s \<longleftrightarrow> (\<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
  5273
    (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5274
      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
  5275
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5276
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5277
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5278
  show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5279
    apply (subst has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5280
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5281
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5282
    case (1 e)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5283
    from \<open>?r\<close>[THEN conjunct2,rule_format,OF this] guess B .. note B=conjunctD2[OF this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5284
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5285
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5286
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5287
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5288
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5289
      apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0)" in exI)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5290
      apply (drule B(2)[rule_format])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5291
      using integrable_integral[OF \<open>?r\<close>[THEN conjunct1,rule_format]]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5292
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5293
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5294
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5295
next
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5296
  assume ?l note as = this[unfolded has_integral'[of f],rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5297
  let ?f = "\<lambda>x. if x \<in> s then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5298
  show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5299
  proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5300
    fix a b :: 'n
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5301
    from as[OF zero_less_one] guess B .. note B=conjunctD2[OF this,rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5302
    let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5303
    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
  5304
    show "?f integrable_on cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5305
    proof (rule integrable_subinterval[of _ ?a ?b])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5306
      have "ball 0 B \<subseteq> cbox ?a ?b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5307
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5308
        unfolding mem_ball mem_box dist_norm
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5309
      proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5310
        case (1 x i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5311
        then show ?case using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5312
          by (auto simp add:field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5313
      qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5314
      from B(2)[OF this] guess z .. note conjunct1[OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5315
      then show "?f integrable_on cbox ?a ?b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5316
        unfolding integrable_on_def by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5317
      show "cbox a b \<subseteq> cbox ?a ?b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5318
        apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5319
        unfolding mem_box
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5320
        apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5321
        apply (erule_tac x=i in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5322
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5323
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5324
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5325
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5326
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5327
    assume "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5328
    from as[OF this] guess B .. note B=conjunctD2[OF this,rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5329
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5330
      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
  5331
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5332
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5333
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5334
      apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5335
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5336
      case 1
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5337
      from B(2)[OF this] guess z .. note z=conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5338
      from integral_unique[OF this(1)] show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5339
        using z(2) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5340
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5341
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5342
qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  5343
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
  5344
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5345
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
  5346
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5347
lemma integrable_alt:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5348
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5349
  shows "f integrable_on s \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5350
    (\<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
  5351
    (\<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
  5352
    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
  5353
      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
  5354
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5355
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5356
  assume ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5357
  then guess y unfolding integrable_on_def .. note this[unfolded has_integral_alt'[of f]]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5358
  note y=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5359
  show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5360
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5361
    apply (rule y)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5362
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5363
    case (1 e)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5364
    then have "e/2 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5365
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5366
    from y(2)[OF this] guess B .. note B=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5367
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5368
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5369
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5370
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5371
      apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5372
    proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5373
      case prems: (1 a b c d)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5374
      show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5375
        apply (rule norm_triangle_half_l)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5376
        using B(2)[OF prems(1)] B(2)[OF prems(2)]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5377
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5378
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5379
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5380
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5381
next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5382
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5383
  note as = conjunctD2[OF this,rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5384
  let ?cube = "\<lambda>n. cbox (\<Sum>i\<in>Basis. - real n *\<^sub>R i::'n) (\<Sum>i\<in>Basis. real n *\<^sub>R 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
  5385
  have "Cauchy (\<lambda>n. integral (?cube n) (\<lambda>x. if x \<in> s then f x else 0))"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5386
  proof (unfold Cauchy_def, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5387
    case (1 e)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5388
    from as(2)[OF this] guess B .. note B = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5389
    from real_arch_simple[of B] guess N .. note N = this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5390
    {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5391
      fix n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5392
      assume n: "n \<ge> N"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5393
      have "ball 0 B \<subseteq> ?cube n"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5394
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5395
        unfolding mem_ball mem_box dist_norm
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5396
      proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5397
        case (1 x i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5398
        then show ?case
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5399
          using Basis_le_norm[of i x] \<open>i\<in>Basis\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5400
          using n N
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5401
          by (auto simp add: field_simps sum_negf)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5402
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5403
    }
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5404
    then show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5405
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5406
      apply (rule_tac x=N in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5407
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5408
      unfolding dist_norm
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5409
      apply (rule B(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5410
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5411
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5412
  qed
64287
d85d88722745 more from moretop.ml
paulson <lp15@cam.ac.uk>
parents: 64272
diff changeset
  5413
  from this[unfolded convergent_eq_Cauchy[symmetric]] guess i ..
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  5414
  note i = this[THEN LIMSEQ_D]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5415
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5416
  show ?l unfolding integrable_on_def has_integral_alt'[of f]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5417
    apply (rule_tac x=i in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5418
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5419
    apply (rule as(1)[unfolded integrable_on_def])
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5420
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5421
    case (1 e)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5422
    then have *: "e/2 > 0" by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5423
    from i[OF this] guess N .. note N =this[rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5424
    from as(2)[OF *] guess B .. note B=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5425
    let ?B = "max (real N) B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5426
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5427
      apply (rule_tac x="?B" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5428
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5429
      show "0 < ?B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5430
        using B(1) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5431
      fix a b :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5432
      assume ab: "ball 0 ?B \<subseteq> cbox a b"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5433
      from real_arch_simple[of ?B] guess n .. note n=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5434
      show "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
  5435
        apply (rule norm_triangle_half_l)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5436
        apply (rule B(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5437
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5438
        apply (subst norm_minus_commute)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5439
        apply (rule N[of n])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5440
      proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5441
        show "N \<le> n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5442
          using n by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5443
        fix x :: 'n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5444
        assume x: "x \<in> ball 0 B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5445
        then have "x \<in> ball 0 ?B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5446
          by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5447
        then show "x \<in> cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5448
          using ab by blast
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5449
        show "x \<in> ?cube n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5450
          using x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5451
          unfolding mem_box mem_ball dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5452
          apply -
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5453
        proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5454
          case (1 i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5455
          then show ?case
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5456
            using Basis_le_norm[of i x] \<open>i \<in> Basis\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5457
            using n
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5458
            by (auto simp add: field_simps sum_negf)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5459
        qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5460
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5461
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5462
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5463
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5464
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5465
lemma integrable_altD:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5466
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5467
  assumes "f integrable_on s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5468
  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
  5469
    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
  5470
      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
  5471
  using assms[unfolded integrable_alt[of f]] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5472
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5473
lemma integrable_on_subcbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5474
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5475
  assumes "f integrable_on s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5476
    and "cbox a b \<subseteq> s"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5477
  shows "f integrable_on cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5478
  apply (rule integrable_eq)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5479
  defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5480
  apply (rule integrable_altD(1)[OF assms(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5481
  using assms(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5482
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5483
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5484
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5485
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5486
subsection \<open>A straddling criterion for integrability\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5487
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5488
lemma integrable_straddle_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5489
  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
  5490
  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
  5491
                            \<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
  5492
  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
  5493
proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5494
  have "\<exists>d. gauge d \<and>
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5495
            (\<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
  5496
                     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
  5497
                     \<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
  5498
    if "e > 0" for e
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5499
  proof -
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5500
    have e: "e/3 > 0"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5501
      using that by auto
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5502
    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
  5503
            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
  5504
            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
  5505
            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
  5506
      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
  5507
    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
  5508
            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
  5509
                          \<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
  5510
            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
  5511
                          \<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
  5512
      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
  5513
    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
  5514
      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
  5515
       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
  5516
    proof -
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  5517
      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
  5518
                  \<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
  5519
                   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
  5520
                  \<Longrightarrow> \<bar>f1 - f2\<bar> < e"
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5521
        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
  5522
      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
  5523
              "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
  5524
              "(\<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
  5525
              "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
  5526
        unfolding sum_subtractf[symmetric]
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5527
           apply (auto intro!: sum_nonneg)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5528
           apply (meson fgh measure_nonneg mult_left_mono tag_in_interval that sum_nonneg)+
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5529
        done
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5530
      show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5531
      proof (rule *)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5532
        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
  5533
          by (rule d1[OF p2 12])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5534
        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
  5535
          by (rule d1[OF p1 11])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5536
        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
  5537
          by (rule d2[OF p2 22])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5538
        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
  5539
          by (rule d2[OF p1 21])
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5540
      qed (use 0 in auto)
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5541
    qed
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5542
    then show ?thesis
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5543
      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
  5544
        (auto simp: fine_Int intro: \<open>gauge d1\<close> \<open>gauge d2\<close> d1 d2)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5545
  qed
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5546
  then show ?thesis
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5547
    by (simp add: integrable_Cauchy)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  5548
qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5549
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5550
lemma integrable_straddle:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5551
  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
  5552
  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
  5553
                     \<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
  5554
  shows "f integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5555
proof -
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5556
  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
  5557
  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
  5558
  proof (rule integrable_straddle_interval)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5559
    fix e::real
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5560
    assume "e > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5561
    then have *: "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5562
      by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5563
    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
  5564
                 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
  5565
                 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
  5566
      by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5567
    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
  5568
    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
  5569
    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
  5570
              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
  5571
      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
  5572
    obtain Bh where
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5573
          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
  5574
         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
  5575
      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
  5576
    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
  5577
    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
  5578
    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
  5579
      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
  5580
    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
  5581
      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
  5582
    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
  5583
      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
  5584
    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
  5585
      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
  5586
    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
  5587
      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
  5588
    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
  5589
       \<Longrightarrow> \<bar>ag - ah\<bar> < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5590
      using ij by arith
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5591
    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
  5592
          (\<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
  5593
                        (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
  5594
    proof (intro exI ballI conjI)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5595
      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
  5596
                       (if x \<in> s then f x - g x else (0::real))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5597
        by auto
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5598
      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
  5599
                   "(\<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
  5600
        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
  5601
      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
  5602
           "(?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
  5603
        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
  5604
      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
  5605
        apply (rule has_integral_le)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5606
        using fgh by force
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5607
      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
  5608
        by simp
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5609
      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
  5610
              \<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
  5611
        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
  5612
        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
  5613
        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
  5614
        done
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5615
      then show "\<bar>integral (cbox a b) ?gs - integral (cbox a b) ?hs\<bar> < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5616
        apply (rule **)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5617
         apply (rule Bg ballBg Bh ballBh)+
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5618
        done
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5619
      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
  5620
        using fgh by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5621
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5622
  qed
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5623
  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
  5624
    by simp
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5625
  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
  5626
                  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
  5627
                  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
  5628
      if "0 < e" for e
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5629
  proof -
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5630
    have *: "e/3 > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5631
      using that by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5632
    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
  5633
                 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
  5634
                 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
  5635
      by metis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5636
    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
  5637
    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
  5638
    obtain Bg where "Bg > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5639
              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
  5640
              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
  5641
      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
  5642
    obtain Bh where "Bh > 0"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5643
              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
  5644
              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
  5645
      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
  5646
    { fix a b c d :: 'n
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5647
      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
  5648
      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
  5649
        by auto
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5650
      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
  5651
                     \<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
  5652
        \<bar>fa - fc\<bar> < e"
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5653
        using ij by arith
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5654
      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
  5655
        (\<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
  5656
      proof (rule *)
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5657
        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
  5658
          using "**" Bg as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5659
        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
  5660
          using "**" Bg as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5661
        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
  5662
          using "**" Bh as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5663
        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
  5664
          using "**" Bh as by blast
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5665
      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
  5666
    }
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5667
    then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5668
      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
  5669
        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
  5670
  qed
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5671
  then show ?thesis
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5672
    unfolding integrable_alt[of f] real_norm_def by (blast intro: int_f)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5673
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5674
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5675
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5676
subsection \<open>Adding integrals over several sets\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5677
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5678
lemma has_integral_union:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5679
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5680
  assumes "(f has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5681
    and "(f has_integral j) t"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5682
    and "negligible (s \<inter> t)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5683
  shows "(f has_integral (i + j)) (s \<union> t)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5684
proof -
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  5685
  note * = has_integral_restrict_UNIV[symmetric, of f]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5686
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5687
    unfolding *
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5688
    apply (rule has_integral_spike[OF assms(3)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5689
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5690
    apply (rule has_integral_add[OF assms(1-2)[unfolded *]])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5691
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5692
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5693
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5694
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5695
lemma integrable_union:
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5696
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5697
  assumes "negligible (A \<inter> B)" "f integrable_on A" "f integrable_on B"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5698
  shows   "f integrable_on (A \<union> B)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5699
proof -
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  5700
  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
  5701
     by (auto simp: integrable_on_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5702
  from has_integral_union[OF this assms(1)] show ?thesis by (auto simp: integrable_on_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5703
qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5704
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5705
lemma integrable_union':
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5706
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5707
  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
  5708
  shows   "f integrable_on C"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5709
  using integrable_union[of A B f] assms by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  5710
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5711
lemma has_integral_unions:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5712
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5713
  assumes "finite t"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5714
    and "\<forall>s\<in>t. (f has_integral (i s)) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5715
    and "\<forall>s\<in>t. \<forall>s'\<in>t. s \<noteq> s' \<longrightarrow> negligible (s \<inter> s')"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5716
  shows "(f has_integral (sum i t)) (\<Union>t)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5717
proof -
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  5718
  note * = has_integral_restrict_UNIV[symmetric, of f]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5719
  have **: "negligible (\<Union>((\<lambda>(a,b). a \<inter> b) ` {(a,b). a \<in> t \<and> b \<in> {y. y \<in> t \<and> a \<noteq> y}}))"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  5720
    apply (rule negligible_Union)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5721
    apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5722
    apply (rule finite_subset[of _ "t \<times> t"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5723
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5724
    apply (rule finite_cartesian_product[OF assms(1,1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5725
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5726
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5727
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5728
  note assms(2)[unfolded *]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5729
  note has_integral_sum[OF assms(1) this]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5730
  then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5731
    unfolding *
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5732
    apply -
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5733
    apply (rule has_integral_spike[OF **])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5734
    defer
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5735
    apply assumption
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5736
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5737
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5738
    case prems: (1 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5739
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5740
    proof (cases "x \<in> \<Union>t")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5741
      case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5742
      then guess s unfolding Union_iff .. note s=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5743
      then have *: "\<forall>b\<in>t. x \<in> b \<longleftrightarrow> b = s"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5744
        using prems(3) by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5745
      show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5746
        unfolding if_P[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5747
        apply (rule trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5748
        defer
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5749
        apply (rule sum.cong)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5750
        apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5751
        apply (subst *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5752
        apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5753
        apply (rule refl)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5754
        unfolding sum.delta[OF assms(1)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5755
        using s
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5756
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5757
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5758
    qed auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5759
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5760
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5761
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5762
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5763
text \<open>In particular adding integrals over a division, maybe not of an interval.\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5764
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5765
lemma has_integral_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5766
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5767
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5768
    and "\<forall>k\<in>d. (f has_integral (i k)) k"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5769
  shows "(f has_integral (sum i d)) s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5770
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5771
  note d = division_ofD[OF assms(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5772
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5773
    unfolding d(6)[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5774
    apply (rule has_integral_unions)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5775
    apply (rule d assms)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5776
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5777
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5778
    apply rule
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5779
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5780
    case prems: (1 s s')
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5781
    from d(4)[OF this(1)] d(4)[OF this(2)] guess a c b d by (elim exE) note obt=this
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5782
    from d(5)[OF prems] show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5783
      unfolding obt interior_cbox
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5784
      apply -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5785
      apply (rule negligible_subset[of "(cbox a b-box a b) \<union> (cbox c d-box c d)"])
63492
a662e8139804 More advanced theorems about retracts, homotopies., etc
paulson <lp15@cam.ac.uk>
parents: 63469
diff changeset
  5786
      apply (rule negligible_Un negligible_frontier_interval)+
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5787
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5788
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5789
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5790
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5791
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5792
lemma integral_combine_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5793
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5794
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5795
    and "\<forall>k\<in>d. f integrable_on k"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5796
  shows "integral s f = sum (\<lambda>i. integral i f) d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5797
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5798
  apply (rule has_integral_combine_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5799
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5800
  unfolding has_integral_integral
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5801
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5802
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5803
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5804
lemma has_integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5805
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5806
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5807
    and "d division_of k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5808
    and "k \<subseteq> s"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5809
  shows "(f has_integral (sum (\<lambda>i. integral i f) d)) k"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5810
  apply (rule has_integral_combine_division[OF assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5811
  apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5812
  unfolding has_integral_integral[symmetric]
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5813
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5814
  case (1 k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5815
  from division_ofD(2,4)[OF assms(2) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5816
  show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5817
    apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5818
    apply (rule integrable_on_subcbox)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5819
    apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5820
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5821
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5822
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5823
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5824
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5825
lemma integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5826
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5827
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5828
    and "d division_of s"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5829
  shows "integral s f = sum (\<lambda>i. integral i f) d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5830
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5831
  apply (rule has_integral_combine_division_topdown)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5832
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5833
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5834
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5835
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5836
lemma integrable_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5837
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5838
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5839
    and "\<forall>i\<in>d. f integrable_on i"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5840
  shows "f integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5841
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5842
  unfolding integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5843
  by (metis has_integral_combine_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5844
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5845
lemma integrable_on_subdivision:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5846
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5847
  assumes "d division_of i"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5848
    and "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5849
    and "i \<subseteq> s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5850
  shows "f integrable_on i"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5851
  apply (rule integrable_combine_division assms)+
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5852
  apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5853
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5854
  case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5855
  note division_ofD(2,4)[OF assms(1) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5856
  then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5857
    apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5858
    apply (rule integrable_on_subcbox[OF assms(2)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5859
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5860
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5861
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5862
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5863
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5864
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5865
subsection \<open>Also tagged divisions\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5866
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5867
lemma has_integral_iff: "(f has_integral i) s \<longleftrightarrow> (f integrable_on s \<and> integral s f = i)"
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5868
  by blast
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5869
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5870
lemma has_integral_combine_tagged_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5871
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5872
  assumes "p tagged_division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5873
    and "\<forall>(x,k) \<in> p. (f has_integral (i k)) k"
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5874
  shows "(f has_integral (\<Sum>(x,k)\<in>p. i k)) s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5875
proof -
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5876
  have *: "(f has_integral (\<Sum>k\<in>snd`p. integral k f)) s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5877
    using assms(2)
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5878
    apply (intro has_integral_combine_division)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5879
    apply (auto simp: has_integral_integral[symmetric] intro: division_of_tagged_division[OF assms(1)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5880
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5881
    done
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5882
  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
  5883
    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
  5884
       (simp add: content_eq_0_interior)
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  5885
  finally show ?thesis
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5886
    using assms by (auto simp add: has_integral_iff intro!: sum.cong)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5887
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5888
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5889
lemma integral_combine_tagged_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5890
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5891
  assumes "p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5892
    and "\<forall>(x,k)\<in>p. f integrable_on k"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5893
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5894
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5895
  apply (rule has_integral_combine_tagged_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5896
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5897
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5898
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5899
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5900
lemma has_integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5901
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5902
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5903
    and "p tagged_division_of (cbox a b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5904
  shows "(f has_integral (sum (\<lambda>(x,k). integral k f) p)) (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5905
  apply (rule has_integral_combine_tagged_division[OF assms(2)])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5906
  apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5907
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5908
  case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5909
  note tagged_division_ofD(3-4)[OF assms(2) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5910
  then show ?case
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  5911
    using integrable_subinterval[OF assms(1)] by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5912
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5913
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5914
lemma integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5915
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5916
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5917
    and "p tagged_division_of (cbox a b)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5918
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5919
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5920
  apply (rule has_integral_combine_tagged_division_topdown)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5921
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5922
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5923
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5924
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5925
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5926
subsection \<open>Henstock's lemma\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5927
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5928
lemma henstock_lemma_part1:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5929
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5930
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5931
    and "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5932
    and "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5933
    and "(\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5934
      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
  5935
    and p: "p tagged_partial_division_of (cbox a b)" "d fine p"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5936
  shows "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x - integral k f) p) \<le> e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5937
  (is "?x \<le> e")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5938
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5939
  { presume "\<And>k. 0<k \<Longrightarrow> ?x \<le> e + k" then show ?thesis by (blast intro: field_le_epsilon) }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5940
  fix k :: real
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5941
  assume k: "k > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5942
  note p' = tagged_partial_division_ofD[OF p(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5943
  have "\<Union>(snd ` p) \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5944
    using p'(3) by fastforce
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5945
  note partial_division_of_tagged_division[OF p(1)] this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5946
  from partial_division_extend_interval[OF this] guess q . note q=this and q' = division_ofD[OF this(2)]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  5947
  define r where "r = q - snd ` p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5948
  have "snd ` p \<inter> r = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5949
    unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5950
  have r: "finite r"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5951
    using q' unfolding r_def by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5952
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5953
  have "\<forall>i\<in>r. \<exists>p. p tagged_division_of i \<and> d fine p \<and>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  5954
    norm (sum (\<lambda>(x,j). content j *\<^sub>R f x) p - integral i f) < k / (real (card r) + 1)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5955
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5956
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5957
    case (1 i)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5958
    then have i: "i \<in> q"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5959
      unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5960
    from q'(4)[OF this] guess u v by (elim exE) note uv=this
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  5961
    have *: "k / (real (card r) + 1) > 0" using k by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5962
    have "f integrable_on cbox u v"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5963
      apply (rule integrable_subinterval[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5964
      using q'(2)[OF i]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5965
      unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5966
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5967
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5968
    note integrable_integral[OF this, unfolded has_integral[of f]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5969
    from this[rule_format,OF *] guess dd .. note dd=conjunctD2[OF this,rule_format]
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  5970
    note gauge_Int[OF \<open>gauge d\<close> dd(1)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5971
    from fine_division_exists[OF this,of u v] guess qq .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5972
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5973
      apply (rule_tac x=qq in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5974
      using dd(2)[of qq]
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5975
      unfolding fine_Int uv
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5976
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5977
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5978
  qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5979
  from bchoice[OF this] guess qq .. note qq=this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5980
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5981
  let ?p = "p \<union> \<Union>(qq ` r)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5982
  have "norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - integral (cbox a b) f) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5983
    apply (rule assms(4)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5984
  proof
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5985
    show "d fine ?p"
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5986
      apply (rule fine_Un)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5987
      apply (rule p)
66192
e5b84854baa4 A few renamings and several tidied-up proofs
paulson <lp15@cam.ac.uk>
parents: 66164
diff changeset
  5988
      apply (rule fine_Union)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5989
      using qq
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5990
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5991
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  5992
    note * = 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
  5993
    have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5994
      using r
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5995
    proof (rule tagged_division_union[OF * tagged_division_unions], goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5996
      case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5997
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5998
        using qq by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  5999
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6000
      case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6001
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6002
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6003
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6004
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6005
        apply(rule q'(5))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6006
        unfolding r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6007
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6008
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6009
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6010
      case 3
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6011
      then show ?case
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6012
      proof (rule Int_interior_Union_intervals [OF \<open>finite r\<close>])
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6013
        show "open (interior (UNION p snd))"
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6014
          by blast
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6015
        show "\<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6016
        apply (rule q')
66299
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6017
          using r_def by blast
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6018
        have "finite (snd ` p)"
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6019
          by (simp add: p'(1))
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6020
        then show "\<And>T. T \<in> r \<Longrightarrow> interior (UNION p snd) \<inter> interior T = {}"
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6021
          apply (subst Int_commute)
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6022
          apply (rule Int_interior_Union_intervals)
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6023
          using \<open>r \<equiv> q - snd ` p\<close>  q'(5) q(1) apply auto
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6024
          by (simp add: p'(4))
1b4aa3e3e4e6 partial cleanup of the horrible Tagged_Division
paulson <lp15@cam.ac.uk>
parents: 66296
diff changeset
  6025
      qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6026
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6027
    moreover have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6028
      unfolding Union_Un_distrib[symmetric] r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6029
      using q
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6030
      by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6031
    ultimately show "?p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6032
      by fastforce
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6033
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6034
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6035
  then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>\<Union>(qq ` r). content k *\<^sub>R f x) -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6036
    integral (cbox a b) f) < e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6037
    apply (subst sum.union_inter_neutral[symmetric])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6038
    apply (rule p')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6039
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6040
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6041
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6042
    apply (rule r)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6043
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6044
    apply (drule qq)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6045
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6046
    fix x l k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6047
    assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6048
    note qq[OF this(3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6049
    note tagged_division_ofD(3,4)[OF conjunct1[OF this] as(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6050
    from this(2) guess u v by (elim exE) note uv=this
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6051
    have "l\<in>snd ` p" unfolding image_iff apply(rule_tac x="(x,l)" in bexI) using as by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6052
    then have "l \<in> q" "k \<in> q" "l \<noteq> k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6053
      using as(1,3) q(1) unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6054
    note q'(5)[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6055
    then have "interior l = {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6056
      using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6057
    then show "content l *\<^sub>R f x = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6058
      unfolding uv content_eq_0_interior[symmetric] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6059
  qed auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6060
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6061
  then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + sum (sum (\<lambda>(x, k). content k *\<^sub>R f x))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6062
    (qq ` r) - integral (cbox a b) f) < e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6063
    apply (subst (asm) sum.Union_comp)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6064
    prefer 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6065
    unfolding split_paired_all split_conv image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6066
    apply (erule bexE)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6067
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6068
    fix x m k l T1 T2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6069
    assume "(x, m) \<in> T1" "(x, m) \<in> T2" "T1 \<noteq> T2" "k \<in> r" "l \<in> r" "T1 = qq k" "T2 = qq l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6070
    note as = this(1-5)[unfolded this(6-)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6071
    note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6072
    from this(2)[OF as(4,1)] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6073
    have *: "interior (k \<inter> l) = {}"
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
  6074
      by (metis DiffE \<open>T1 = qq k\<close> \<open>T1 \<noteq> T2\<close> \<open>T2 = qq l\<close> as(4) as(5) interior_Int q'(5) r_def)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6075
    have "interior m = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6076
      unfolding subset_empty[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6077
      unfolding *[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6078
      apply (rule interior_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6079
      using kl(1)[OF as(4,1)] kl(1)[OF as(5,2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6080
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6081
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6082
    then show "content m *\<^sub>R f x = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6083
      unfolding uv content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6084
      by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6085
  qed (insert qq, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6086
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6087
  then have **: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + sum (sum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6088
    integral (cbox a b) f) < e"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6089
    apply (subst (asm) sum.reindex_nontrivial)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6090
    apply fact
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6091
    apply (rule sum.neutral)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6092
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6093
    unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6094
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6095
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6096
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6097
    fix k l x m
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6098
    assume as: "k \<in> r" "l \<in> r" "k \<noteq> l" "qq k = qq l" "(x, m) \<in> qq k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6099
    note tagged_division_ofD(6)[OF qq[THEN conjunct1]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6100
    from this[OF as(1)] this[OF as(2)] show "content m *\<^sub>R f x = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6101
      using as(3) unfolding as by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6102
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6103
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6104
  have *: "norm (cp - ip) \<le> e + k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6105
    if "norm ((cp + cr) - i) < e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6106
    and "norm (cr - ir) < k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6107
    and "ip + ir = i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6108
    for ir ip i cr cp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6109
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6110
    from that show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6111
      using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6112
      unfolding that(3)[symmetric] norm_minus_cancel
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6113
      by (auto simp add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6114
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6115
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6116
  have "?x =  norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6117
    unfolding split_def sum_subtractf ..
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6118
  also have "\<dots> \<le> e + k"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6119
    apply (rule *[OF **, where ir1="sum (\<lambda>k. integral k f) r"])
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6120
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6121
    case 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6122
    have *: "k * real (card r) / (1 + real (card r)) < k"
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6123
      using k by (auto simp add: field_simps)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6124
    show ?case
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6125
      apply (rule le_less_trans[of _ "sum (\<lambda>x. k / (real (card r) + 1)) r"])
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6126
      unfolding sum_subtractf[symmetric]
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6127
      apply (rule sum_norm_le)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6128
      apply (drule qq)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6129
      defer
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6130
      unfolding divide_inverse sum_distrib_right[symmetric]
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6131
      unfolding divide_inverse[symmetric]
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
  6132
      using * apply (auto simp add: field_simps)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6133
      done
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6134
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6135
    case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6136
    have *: "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6137
      apply (subst sum.reindex_nontrivial)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6138
      apply fact
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6139
      unfolding split_paired_all snd_conv split_def o_def
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6140
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6141
      fix x l y m
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6142
      assume as: "(x, l) \<in> p" "(y, m) \<in> p" "(x, l) \<noteq> (y, m)" "l = m"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6143
      from p'(4)[OF as(1)] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6144
      show "integral l f = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6145
        unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6146
        apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6147
        apply (rule has_integral_null)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6148
        unfolding content_eq_0_interior
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6149
        using p'(5)[OF as(1-3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6150
        unfolding uv as(4)[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6151
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6152
        done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6153
    qed auto
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6154
    from q(1) have **: "snd ` p \<union> q = q" by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6155
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6156
      unfolding integral_combine_division_topdown[OF assms(1) q(2)] * r_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6157
      using ** q'(1) p'(1) sum.union_disjoint [of "snd ` p" "q - snd ` p" "\<lambda>k. integral k f", symmetric]
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6158
        by simp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6159
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6160
  finally show "?x \<le> e + k" .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6161
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6162
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6163
lemma henstock_lemma_part2:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6164
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6165
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6166
    and "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6167
    and "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6168
    and "\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6169
      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
  6170
    and "p tagged_partial_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6171
    and "d fine p"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6172
  shows "sum (\<lambda>(x,k). norm (content k *\<^sub>R f x - integral k f)) p \<le> 2 * real (DIM('n)) * e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6173
  unfolding split_def
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6174
  apply (rule sum_norm_allsubsets_bound)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6175
  defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6176
  apply (rule henstock_lemma_part1[unfolded split_def,OF assms(1-3)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6177
  apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6178
  apply (rule assms[rule_format,unfolded split_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6179
  defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6180
  apply (rule tagged_partial_division_subset)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6181
  apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6182
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6183
  apply (rule fine_subset)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6184
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6185
  apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6186
  using assms(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6187
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6188
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6189
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6190
lemma henstock_lemma:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6191
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6192
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6193
    and "e > 0"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6194
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6195
    and "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d fine p \<longrightarrow>
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6196
      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
  6197
proof -
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  6198
  have *: "e / (2 * (real DIM('n) + 1)) > 0" using assms(2) by simp
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6199
  from integrable_integral[OF assms(1),unfolded has_integral[of f],rule_format,OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6200
  guess d .. note d = conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6201
  show thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6202
    apply (rule that)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6203
    apply (rule d)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6204
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6205
    case (1 p)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6206
    note * = henstock_lemma_part2[OF assms(1) * d this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6207
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6208
      apply (rule le_less_trans[OF *])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6209
      using \<open>e > 0\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6210
      apply (auto simp add: field_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6211
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6212
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6213
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6214
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6215
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6216
subsection \<open>Monotone convergence (bounded interval first)\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6217
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6218
lemma monotone_convergence_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6219
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6220
  assumes "\<forall>k. (f k) integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6221
    and "\<forall>k. \<forall>x\<in>cbox a b.(f k x) \<le> f (Suc k) x"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6222
    and "\<forall>x\<in>cbox a b. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6223
    and "bounded {integral (cbox a b) (f k) | k . k \<in> UNIV}"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6224
  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
  6225
proof (cases "content (cbox a b) = 0")
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6226
  case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6227
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6228
    using integrable_on_null[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6229
    unfolding integral_null[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6230
    using tendsto_const
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6231
    by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6232
next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6233
  case False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6234
  have fg: "\<forall>x\<in>cbox a b. \<forall>k. (f k x) \<bullet> 1 \<le> (g x) \<bullet> 1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6235
  proof safe
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6236
    fix x k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6237
    assume x: "x \<in> cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6238
    note * = Lim_component_ge[OF assms(3)[rule_format, OF x] trivial_limit_sequentially]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6239
    show "f k x \<bullet> 1 \<le> g x \<bullet> 1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6240
      apply (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6241
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6242
      apply (rule_tac x=k in exI)
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6243
      apply clarify
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6244
      apply (rule transitive_stepwise_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6245
      using assms(2)[rule_format, OF x]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6246
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6247
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6248
  qed
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6249
  have "\<exists>i. ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> i) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6250
    apply (rule bounded_increasing_convergent)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6251
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6252
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6253
    apply (rule integral_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6254
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6255
    apply (rule assms(1-2)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6256
    using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6257
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6258
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6259
  then guess i .. note i=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6260
  have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i\<bullet>1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6261
    apply (rule Lim_component_ge)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6262
    apply (rule i)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6263
    apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6264
    unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6265
    apply (rule_tac x=k in exI)
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6266
    apply clarify
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6267
    apply (erule transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6268
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6269
    unfolding inner_simps real_inner_1_right
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6270
    apply (rule integral_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6271
    apply (rule assms(1-2)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6272
    using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6273
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6274
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6275
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6276
  have "(g has_integral i) (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6277
    unfolding has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6278
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6279
    case e: (1 e)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6280
    then have "\<forall>k. (\<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
  6281
      norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f k x) - integral (cbox a b) (f k)) < e / 2 ^ (k + 2)))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6282
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6283
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6284
      apply (rule assms(1)[unfolded has_integral_integral has_integral,rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6285
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6286
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6287
    from choice[OF this] guess c .. note c=conjunctD2[OF this[rule_format],rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6288
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6289
    have "\<exists>r. \<forall>k\<ge>r. 0 \<le> i\<bullet>1 - (integral (cbox a b) (f k)) \<and> i\<bullet>1 - (integral (cbox a b) (f k)) < e / 4"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6290
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6291
      have "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6292
        using e by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  6293
      from LIMSEQ_D [OF i this] guess r ..
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6294
      then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6295
        apply (rule_tac x=r in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6296
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6297
        apply (erule_tac x=k in allE)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6298
        subgoal for k using i'[of k] by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6299
        done
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6300
    qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6301
    then guess r .. note r=conjunctD2[OF this[rule_format]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6302
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6303
    have "\<forall>x\<in>cbox a b. \<exists>n\<ge>r. \<forall>k\<ge>n. 0 \<le> (g x)\<bullet>1 - (f k x)\<bullet>1 \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6304
      (g x)\<bullet>1 - (f k x)\<bullet>1 < e / (4 * content(cbox a b))"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6305
    proof (rule, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6306
      case prems: (1 x)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6307
      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
  6308
        by (simp add: False content_lt_nz e)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6309
      from assms(3)[rule_format, OF prems, THEN LIMSEQ_D, OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6310
      guess n .. note n=this
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6311
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6312
        apply (rule_tac x="n + r" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6313
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6314
        apply (erule_tac[2-3] x=k in allE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6315
        unfolding dist_real_def
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6316
        using fg[rule_format, OF prems]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6317
        apply (auto simp add: field_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6318
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6319
    qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6320
    from bchoice[OF this] guess m .. note m=conjunctD2[OF this[rule_format],rule_format]
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6321
    define d where "d x = c (m x) x" for x
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6322
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6323
      apply (rule_tac x=d in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6324
    proof safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6325
      show "gauge d"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6326
        using c(1) unfolding gauge_def d_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6327
    next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6328
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6329
      assume p: "p tagged_division_of (cbox a b)" "d fine p"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6330
      note p'=tagged_division_ofD[OF p(1)]
41851
96184364aa6f got rid of lemma upper_bound_finite_set
nipkow
parents: 41601
diff changeset
  6331
      have "\<exists>a. \<forall>x\<in>p. m (fst x) \<le> a"
96184364aa6f got rid of lemma upper_bound_finite_set
nipkow
parents: 41601
diff changeset
  6332
        by (metis finite_imageI finite_nat_set_iff_bounded_le p'(1) rev_image_eqI)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6333
      then guess s .. note s=this
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6334
      have *: "\<forall>a b c d. norm(a - b) \<le> e / 4 \<and> norm(b - c) < e / 2 \<and>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6335
        norm (c - d) < e / 4 \<longrightarrow> norm (a - d) < e"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6336
      proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6337
        case (1 a b c d)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6338
        then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6339
          using norm_triangle_lt[of "a - b" "b - c" "3* e/4"]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6340
            norm_triangle_lt[of "a - b + (b - c)" "c - d" e]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6341
          unfolding norm_minus_cancel
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6342
          by (auto simp add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6343
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6344
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - i) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6345
        apply (rule *[rule_format,where
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6346
          b="\<Sum>(x, k)\<in>p. content k *\<^sub>R f (m x) x" and c="\<Sum>(x, k)\<in>p. integral k (f (m x))"])
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6347
      proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6348
        case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6349
        show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6350
          apply (rule order_trans[of _ "\<Sum>(x, k)\<in>p. content k * (e / (4 * content (cbox a b)))"])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6351
          unfolding sum_subtractf[symmetric]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6352
          apply (rule order_trans)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6353
          apply (rule norm_sum)
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6354
          apply (rule sum_mono)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6355
          unfolding split_paired_all split_conv
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6356
          unfolding split_def sum_distrib_right[symmetric] scaleR_diff_right[symmetric]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6357
          unfolding additive_content_tagged_division[OF p(1), unfolded split_def]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6358
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6359
          fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6360
          assume xk: "(x, k) \<in> p"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6361
          then have x: "x \<in> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6362
            using p'(2-3)[OF xk] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6363
          from p'(4)[OF xk] guess u v by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6364
          show "norm (content k *\<^sub>R (g x - f (m x) x)) \<le> content k * (e / (4 * content (cbox a b)))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6365
            unfolding norm_scaleR uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6366
            unfolding abs_of_nonneg[OF content_pos_le]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6367
            apply (rule mult_left_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6368
            using m(2)[OF x,of "m x"]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6369
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6370
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6371
        qed (insert False, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6372
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6373
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6374
        case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6375
        show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6376
          apply (rule le_less_trans[of _ "norm (\<Sum>j = 0..s.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6377
            \<Sum>(x, k)\<in>{xk\<in>p. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))"])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6378
          apply (subst sum_group)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6379
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6380
          apply (rule finite_atLeastAtMost)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6381
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6382
          apply (subst split_def)+
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6383
          unfolding sum_subtractf
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6384
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6385
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6386
          show "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> p.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6387
            m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x))) < e / 2"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6388
            apply (rule le_less_trans[of _ "sum (\<lambda>i. e / 2^(i+2)) {0..s}"])
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6389
            apply (rule sum_norm_le)
64773
223b2ebdda79 Many new theorems, and more tidying
paulson <lp15@cam.ac.uk>
parents: 64287
diff changeset
  6390
          proof -
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6391
            show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6392
              unfolding power_add divide_inverse inverse_mult_distrib
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6393
              unfolding sum_distrib_left[symmetric] sum_distrib_right[symmetric]
60867
86e7560e07d0 slight cleanup of lemmas
haftmann
parents: 60810
diff changeset
  6394
              unfolding power_inverse [symmetric] sum_gp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6395
              apply(rule mult_strict_left_mono[OF _ e])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6396
              unfolding power2_eq_square
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6397
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6398
              done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6399
            fix t
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6400
            assume "t \<in> {0..s}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6401
            show "norm (\<Sum>(x, k)\<in>{xk \<in> p. m (fst xk) = t}. content k *\<^sub>R f (m x) x -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6402
              integral k (f (m x))) \<le> e / 2 ^ (t + 2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6403
              apply (rule order_trans
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6404
                [of _ "norm (sum (\<lambda>(x,k). content k *\<^sub>R f t x - integral k (f t)) {xk \<in> p. m (fst xk) = t})"])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6405
              apply (rule eq_refl)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6406
              apply (rule arg_cong[where f=norm])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6407
              apply (rule sum.cong)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6408
              apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6409
              defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6410
              apply (rule henstock_lemma_part1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6411
              apply (rule assms(1)[rule_format])
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  6412
              apply (simp add: e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6413
              apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6414
              apply (rule c)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6415
              apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6416
              apply assumption+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6417
              apply (rule tagged_partial_division_subset[of p])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6418
              apply (rule p(1)[unfolded tagged_division_of_def,THEN conjunct1])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6419
              defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6420
              unfolding fine_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6421
              apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6422
              apply (drule p(2)[unfolded fine_def,rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6423
              unfolding d_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6424
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6425
              done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6426
          qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6427
        qed (insert s, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6428
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6429
        case 3
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6430
        note comb = integral_combine_tagged_division_topdown[OF assms(1)[rule_format] p(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6431
        have *: "\<And>sr sx ss ks kr::real. kr = sr \<longrightarrow> ks = ss \<longrightarrow>
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  6432
          ks \<le> i \<and> sr \<le> sx \<and> sx \<le> ss \<and> 0 \<le> i\<bullet>1 - kr\<bullet>1 \<and> i\<bullet>1 - kr\<bullet>1 < e/4 \<longrightarrow> \<bar>sx - i\<bar> < e/4"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6433
          by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6434
        show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6435
          unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6436
          apply (rule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6437
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6438
          apply (rule comb[of r])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6439
          apply (rule comb[of s])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6440
          apply (rule i'[unfolded real_inner_1_right])
64267
b9a1486e79be setsum -> sum
nipkow
parents: 63957
diff changeset
  6441
          apply (rule_tac[1-2] sum_mono)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6442
          unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6443
          apply (rule_tac[1-2] integral_le[OF ])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6444
        proof safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6445
          show "0 \<le> i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6446
            using r(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6447
          show "i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1 < e / 4"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6448
            using r(2) by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6449
          fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6450
          assume xk: "(x, k) \<in> p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6451
          from p'(4)[OF this] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6452
          show "f r integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6453
            and "f s integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6454
            and "f (m x) integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6455
            and "f (m x) integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6456
            unfolding uv
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6457
            apply (rule_tac[!] integrable_on_subcbox[OF assms(1)[rule_format]])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6458
            using p'(3)[OF xk]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6459
            unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6460
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6461
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6462
          fix y
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6463
          assume "y \<in> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6464
          then have "y \<in> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6465
            using p'(3)[OF xk] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6466
          then have *: "\<And>m. \<forall>n\<ge>m. f m y \<le> f n y"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6467
            using assms(2) by (auto intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6468
          show "f r y \<le> f (m x) y" and "f (m x) y \<le> f s y"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6469
            apply (rule_tac[!] *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6470
            using s[rule_format,OF xk] m(1)[of x] p'(2-3)[OF xk]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6471
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6472
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6473
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6474
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6475
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6476
  qed note * = this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6477
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6478
  have "integral (cbox a b) g = i"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6479
    by (rule integral_unique) (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6480
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6481
    using i * by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6482
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6483
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6484
lemma monotone_convergence_increasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6485
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6486
  assumes "\<forall>k. (f k) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6487
    and "\<forall>k. \<forall>x\<in>s. (f k x) \<le> (f (Suc k) x)"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6488
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6489
    and "bounded {integral s (f k)| k. True}"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6490
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6491
proof -
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6492
  have lem: "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6493
    if "\<forall>k. \<forall>x\<in>s. 0 \<le> f k x"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6494
    and "\<forall>k. (f k) integrable_on s"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6495
    and "\<forall>k. \<forall>x\<in>s. f k x \<le> f (Suc k) x"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6496
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6497
    and "bounded {integral s (f k)| k. True}"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6498
    for f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" and g s
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6499
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6500
    note assms=that[rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6501
    have "\<forall>x\<in>s. \<forall>k. (f k x)\<bullet>1 \<le> (g x)\<bullet>1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6502
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6503
      apply (rule Lim_component_ge)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6504
      apply (rule that(4)[rule_format])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6505
      apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6506
      apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6507
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6508
      apply (rule_tac x=k in exI)
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6509
      using assms(3) by (force intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6510
    note fg=this[rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6511
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6512
    have "\<exists>i. ((\<lambda>k. integral s (f k)) \<longlongrightarrow> i) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6513
      apply (rule bounded_increasing_convergent)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6514
      apply (rule that(5))
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6515
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6516
      apply (rule integral_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6517
      apply (rule that(2)[rule_format])+
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6518
      using that(3)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6519
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6520
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6521
    then guess i .. note i=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6522
    have "\<And>k. \<forall>x\<in>s. \<forall>n\<ge>k. f k x \<le> f n x"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6523
      using assms(3) by (force intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6524
    then have i': "\<forall>k. (integral s (f k))\<bullet>1 \<le> i\<bullet>1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6525
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6526
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6527
      apply (rule Lim_component_ge)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6528
      apply (rule i)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6529
      apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6530
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6531
      apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6532
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6533
      apply (rule integral_component_le)
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
  6534
      apply simp
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6535
      apply (rule that(2)[rule_format])+
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6536
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6537
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6538
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6539
    note int = assms(2)[unfolded integrable_alt[of _ s],THEN conjunct1,rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6540
    have ifif: "\<And>k t. (\<lambda>x. if x \<in> t then if x \<in> s then f k x else 0 else 0) =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6541
      (\<lambda>x. if x \<in> t \<inter> s then f k x else 0)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6542
      by (rule ext) auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6543
    have int': "\<And>k a b. f k integrable_on cbox a b \<inter> s"
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  6544
      apply (subst integrable_restrict_UNIV[symmetric])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6545
      apply (subst ifif[symmetric])
66112
0e640e04fc56 New theorems; stronger theorems; tidier theorems. Also some renaming
paulson <lp15@cam.ac.uk>
parents: 66089
diff changeset
  6546
      apply (subst integrable_restrict_UNIV)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6547
      apply (rule int)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6548
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6549
    have "\<And>a b. (\<lambda>x. if x \<in> s then g x else 0) integrable_on cbox a b \<and>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6550
      ((\<lambda>k. integral (cbox a b) (\<lambda>x. if x \<in> s then f k x else 0)) \<longlongrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6551
      integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)) sequentially"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6552
    proof (rule monotone_convergence_interval, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6553
      case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6554
      show ?case by (rule int)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6555
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6556
      case (2 _ _ _ x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6557
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6558
        apply (cases "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6559
        using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6560
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6561
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6562
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6563
      case (3 _ _ x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6564
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6565
        apply (cases "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6566
        using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6567
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6568
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6569
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6570
      case (4 a b)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6571
      note * = integral_nonneg
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6572
      have "\<And>k. norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f k x else 0)) \<le> norm (integral s (f k))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6573
        unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6574
        apply (subst abs_of_nonneg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6575
        apply (rule *[OF int])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6576
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6577
        apply (case_tac "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6578
        apply (drule assms(1))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6579
        prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6580
        apply (subst abs_of_nonneg)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6581
        apply (rule *[OF assms(2) that(1)[THEN spec]])
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6582
        apply (subst integral_restrict_UNIV[symmetric,OF int])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6583
        unfolding ifif
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6584
        unfolding integral_restrict_UNIV[OF int']
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6585
        apply (rule integral_subset_le[OF _ int' assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6586
        using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6587
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6588
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6589
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6590
        using assms(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6591
        unfolding bounded_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6592
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6593
        apply (rule_tac x=aa in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6594
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6595
        apply (erule_tac x="integral s (f k)" in ballE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6596
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6597
        apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6598
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6599
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6600
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6601
    note g = conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6602
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6603
    have "(g has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6604
      unfolding has_integral_alt'
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6605
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6606
      apply (rule g(1))
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6607
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6608
      case (1 e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6609
      then have "e/4>0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6610
        by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  6611
      from LIMSEQ_D [OF i this] guess N .. note N=this
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6612
      note assms(2)[of N,unfolded has_integral_integral has_integral_alt'[of "f N"]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6613
      from this[THEN conjunct2,rule_format,OF \<open>e/4>0\<close>] guess B .. note B=conjunctD2[OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6614
      show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6615
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6616
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6617
        apply (rule B)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6618
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6619
      proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6620
        fix a b :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6621
        assume ab: "ball 0 B \<subseteq> cbox a b"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6622
        from \<open>e > 0\<close> have "e/2 > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6623
          by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  6624
        from LIMSEQ_D [OF g(2)[of a b] this] guess M .. note M=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6625
        have **: "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f N x else 0) - i) < e/2"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6626
          apply (rule norm_triangle_half_l)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6627
          using B(2)[rule_format,OF ab] N[rule_format,of N]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6628
          apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6629
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6630
          apply (subst norm_minus_commute)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6631
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6632
          done
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  6633
        have *: "\<And>f1 f2 g. \<bar>f1 - i\<bar> < e / 2 \<longrightarrow> \<bar>f2 - g\<bar> < e / 2 \<longrightarrow>
1135b8de26c3 more symbols;
wenzelm
parents: 61915
diff changeset
  6634
          f1 \<le> f2 \<longrightarrow> f2 \<le> i \<longrightarrow> \<bar>g - i\<bar> < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6635
          unfolding real_inner_1_right by arith
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6636
        show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0) - i) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6637
          unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6638
          apply (rule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6639
          apply (rule **[unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6640
          apply (rule M[rule_format,of "M + N",unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6641
          apply (rule le_add1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6642
          apply (rule integral_le[OF int int])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6643
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6644
          apply (rule order_trans[OF _ i'[rule_format,of "M + N",unfolded real_inner_1_right]])
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6645
        proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6646
          case (2 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6647
          have "\<And>m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. (f m x)\<bullet>1 \<le> (f n x)\<bullet>1"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6648
            using assms(3) by (force intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6649
          then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6650
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6651
        next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6652
          case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6653
          show ?case
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6654
            apply (subst integral_restrict_UNIV[symmetric,OF int])
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6655
            unfolding ifif integral_restrict_UNIV[OF int']
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6656
            apply (rule integral_subset_le[OF _ int'])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6657
            using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6658
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6659
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6660
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6661
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6662
    qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6663
    then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6664
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6665
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6666
      apply (drule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6667
      using i
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6668
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6669
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6670
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6671
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6672
  have sub: "\<And>k. integral s (\<lambda>x. f k x - f 0 x) = integral s (f k) - integral s (f 0)"
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  6673
    apply (subst integral_diff)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6674
    apply (rule assms(1)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6675
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6676
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6677
  have "\<And>x m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. f m x \<le> f n x"
66193
6e6eeef63589 More tidying of horrible proofs
paulson <lp15@cam.ac.uk>
parents: 66192
diff changeset
  6678
    using assms(2) by (force intro: transitive_stepwise_le)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6679
  note * = this[rule_format]
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6680
  have "(\<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>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6681
    integral s (\<lambda>x. g x - f 0 x)) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6682
    apply (rule lem)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6683
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6684
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6685
    case (1 k x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6686
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6687
      using *[of x 0 "Suc k"] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6688
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6689
    case (2 k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6690
    then show ?case
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  6691
      apply (rule integrable_diff)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6692
      using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6693
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6694
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6695
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6696
    case (3 k x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6697
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6698
      using *[of x "Suc k" "Suc (Suc k)"] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6699
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6700
    case (4 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6701
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6702
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6703
      apply (rule tendsto_diff)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6704
      using LIMSEQ_ignore_initial_segment[OF assms(3)[rule_format],of x 1]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6705
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6706
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6707
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6708
    case 5
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6709
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6710
      using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6711
      unfolding bounded_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6712
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6713
      apply (rule_tac x="a + norm (integral s (\<lambda>x. f 0 x))" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6714
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6715
      apply (erule_tac x="integral s (\<lambda>x. f (Suc k) x)" in ballE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6716
      unfolding sub
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6717
      apply (rule order_trans[OF norm_triangle_ineq4])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6718
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6719
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6720
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6721
  note conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6722
  note tendsto_add[OF this(2) tendsto_const[of "integral s (f 0)"]]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6723
    integrable_add[OF this(1) assms(1)[rule_format,of 0]]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6724
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6725
    unfolding sub
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6726
    apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6727
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6728
    defer
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  6729
    apply (subst(asm) integral_diff)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6730
    using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6731
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6732
    apply (rule LIMSEQ_imp_Suc)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6733
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6734
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6735
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6736
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6737
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
  6738
  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
  6739
  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
  6740
  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
  6741
  assumes "\<And>x. x \<in> s \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> g x"
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
  6742
  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
  6743
  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
  6744
proof -
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6745
  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
  6746
    by (simp add: integral_unique[OF f])
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6747
  then have x: "{integral s (f k) |k. True} = range x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6748
    by auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6749
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63492
diff changeset
  6750
  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
  6751
  proof (intro monotone_convergence_increasing allI ballI assms)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6752
    show "bounded {integral s (f k) |k. True}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6753
      unfolding x by (rule convergent_imp_bounded) fact
66164
2d79288b042c New theorems and much tidying up of the old ones
paulson <lp15@cam.ac.uk>
parents: 66154
diff changeset
  6754
  qed (use f in auto)
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63492
diff changeset
  6755
  then have "integral s g = x'"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
  6756
    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
  6757
  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
  6758
    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
  6759
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  6760
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6761
lemma monotone_convergence_decreasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6762
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6763
  assumes "\<forall>k. (f k) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6764
    and "\<forall>k. \<forall>x\<in>s. f (Suc k) x \<le> f k x"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6765
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6766
    and "bounded {integral s (f k)| k. True}"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6767
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6768
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6769
  note assm = assms[rule_format]
58410
6d46ad54a2ab explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents: 57865
diff changeset
  6770
  have *: "{integral s (\<lambda>x. - f k x) |k. True} = op *\<^sub>R (- 1) ` {integral s (f k)| k. True}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6771
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6772
    unfolding image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6773
    apply (rule_tac x="integral s (f k)" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6774
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6775
    apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6776
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6777
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6778
  have "(\<lambda>x. - g x) integrable_on s \<and>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6779
    ((\<lambda>k. integral s (\<lambda>x. - f k x)) \<longlongrightarrow> integral s (\<lambda>x. - g x)) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6780
    apply (rule monotone_convergence_increasing)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6781
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6782
    apply (rule integrable_neg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6783
    apply (rule assm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6784
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6785
    apply (rule tendsto_minus)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6786
    apply (rule assm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6787
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6788
    unfolding *
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6789
    apply (rule bounded_scaling)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6790
    using assm
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6791
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6792
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6793
  note * = conjunctD2[OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6794
  show ?thesis
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
  6795
    using integrable_neg[OF *(1)] tendsto_minus[OF *(2)]
547c5c6e66d4 the integral is 0 when otherwise it would be undefined (also for contour integrals)
paulson <lp15@cam.ac.uk>
parents: 62390
diff changeset
  6796
    by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6797
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6798
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6799
lemma integral_norm_bound_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6800
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6801
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6802
    and "g integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6803
    and "\<forall>x\<in>s. norm (f x) \<le> g x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6804
  shows "norm (integral s f) \<le> integral s g"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6805
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6806
  have norm: "norm ig < dia + e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6807
    if "norm sg \<le> dsa" and "\<bar>dsa - dia\<bar> < e / 2" and "norm (sg - ig) < e / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6808
    for e dsa dia and sg ig :: 'a
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6809
    apply (rule le_less_trans[OF norm_triangle_sub[of ig sg]])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6810
    apply (subst real_sum_of_halves[of e,symmetric])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6811
    unfolding add.assoc[symmetric]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6812
    apply (rule add_le_less_mono)
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6813
     defer
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6814
     apply (subst norm_minus_commute)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6815
     apply (rule that(3))
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6816
    apply (rule order_trans[OF that(1)])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6817
    using that(2)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6818
    apply arith
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6819
    done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6820
  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
  6821
    if f: "f integrable_on cbox a b"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6822
    and g: "g integrable_on cbox a b"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6823
    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
  6824
    for f :: "'n \<Rightarrow> 'a" and g a b
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6825
  proof (rule eps_leI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6826
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6827
    assume "e > 0"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6828
    then have e: "e/2 > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6829
      by auto
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6830
    with integrable_integral[OF f,unfolded has_integral[of f]]
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6831
    obtain \<gamma> where \<gamma>: "gauge \<gamma>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6832
              "\<And>p. p tagged_division_of cbox a b \<and> \<gamma> fine p 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6833
           \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - integral (cbox a b) f) < e / 2"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6834
      by meson 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6835
    moreover
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6836
    from integrable_integral[OF g,unfolded has_integral[of g]] e
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6837
    obtain \<delta> where \<delta>: "gauge \<delta>"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6838
              "\<And>p. p tagged_division_of cbox a b \<and> \<delta> fine p 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6839
           \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - integral (cbox a b) g) < e / 2"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6840
      by meson
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6841
    ultimately have "gauge (\<lambda>x. \<gamma> x \<inter> \<delta> x)"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6842
      using gauge_Int by blast
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6843
    with fine_division_exists obtain p 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6844
      where p: "p tagged_division_of cbox a b" "(\<lambda>x. \<gamma> x \<inter> \<delta> x) fine p" 
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6845
      by metis
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6846
    have "\<gamma> fine p" "\<delta> fine p"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6847
      using fine_Int p(2) by blast+
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6848
    show "norm (integral (cbox a b) f) < integral (cbox a b) g + e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6849
    proof (rule norm)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6850
      have "norm (content K *\<^sub>R f x) \<le> content K *\<^sub>R g x" if  "(x, K) \<in> p" for x K
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6851
      proof-
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6852
        have K: "x \<in> K" "K \<subseteq> cbox a b"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6853
          using \<open>(x, K) \<in> p\<close> p(1) by blast+
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6854
        obtain u v where  "K = cbox u v"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6855
          using \<open>(x, K) \<in> p\<close> p(1) by blast
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6856
        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
  6857
          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
  6858
        then show ?thesis
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6859
          by simp
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6860
      qed
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6861
      then show "norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6862
        by (simp add: sum_norm_le split_def)
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6863
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - integral (cbox a b) f) < e / 2"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6864
        using \<open>\<gamma> fine p\<close> \<gamma> p(1) by simp
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6865
      show "\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - integral (cbox a b) g\<bar> < e / 2"
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6866
        using \<open>\<delta> fine p\<close> \<delta> p(1) by simp
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6867
    qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6868
  qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6869
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6870
  { presume "\<And>e. 0 < e \<Longrightarrow> norm (integral s f) < integral s g + e"
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6871
    then show ?thesis by (rule eps_leI) auto }
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6872
  fix e :: real
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6873
  assume "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6874
  then have e: "e/2 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6875
    by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6876
  note assms(1)[unfolded integrable_alt[of f]] note f=this[THEN conjunct1,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6877
  note assms(2)[unfolded integrable_alt[of g]] note g=this[THEN conjunct1,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6878
  from integrable_integral[OF assms(1),unfolded has_integral'[of f],rule_format,OF e]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6879
  guess B1 .. note B1=conjunctD2[OF this[rule_format],rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6880
  from integrable_integral[OF assms(2),unfolded has_integral'[of g],rule_format,OF e]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6881
  guess B2 .. note B2=conjunctD2[OF this[rule_format],rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6882
  from bounded_subset_cbox[OF bounded_ball, of "0::'n" "max B1 B2"]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6883
  guess a b by (elim exE) note ab=this[unfolded ball_max_Un]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6884
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6885
  have "ball 0 B1 \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6886
    using ab by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6887
  from B1(2)[OF this] guess z .. note z=conjunctD2[OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6888
  have "ball 0 B2 \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6889
    using ab by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6890
  from B2(2)[OF this] guess w .. note w=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6891
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6892
  show "norm (integral s f) < integral s g + e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6893
    apply (rule norm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6894
    apply (rule lem[OF f g, of a b])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6895
    unfolding integral_unique[OF z(1)] integral_unique[OF w(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6896
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6897
    apply (rule w(2)[unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6898
    apply (rule z(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6899
    apply (case_tac "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6900
    unfolding if_P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6901
    apply (rule assms(3)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6902
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6903
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6904
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6905
66359
8ed88442d7bb more integration cleanups
paulson <lp15@cam.ac.uk>
parents: 66356
diff changeset
  6906
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6907
lemma integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6908
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6909
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6910
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6911
    and "g integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6912
    and "\<forall>x\<in>s. norm(f x) \<le> (g x)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6913
  shows "norm (integral s f) \<le> (integral s g)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6914
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6915
  have "norm (integral s f) \<le> integral s ((\<lambda>x. x \<bullet> k) \<circ> g)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6916
    apply (rule integral_norm_bound_integral[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6917
    apply (rule integrable_linear[OF assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6918
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6919
    unfolding o_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6920
    apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6921
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6922
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6923
    unfolding o_def integral_component_eq[OF assms(2)] .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6924
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6925
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6926
lemma has_integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6927
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6928
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6929
  assumes "(f has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6930
    and "(g has_integral j) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6931
    and "\<forall>x\<in>s. norm (f x) \<le> (g x)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6932
  shows "norm i \<le> j\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6933
  using integral_norm_bound_integral_component[of f s g k]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  6934
  unfolding integral_unique[OF assms(1)] integral_unique[OF assms(2)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6935
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6936
  by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  6937
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6938
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
  6939
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6940
lemma integral_continuous_on_param:
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6941
  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
  6942
  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
  6943
  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
  6944
proof cases
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6945
  assume "content (cbox a b) \<noteq> 0"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6946
  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
  6947
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6948
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6949
    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
  6950
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6951
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6952
  show ?thesis
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6953
    unfolding continuous_on_def
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6954
  proof (safe intro!: tendstoI)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6955
    fix e'::real and x
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6956
    assume "e' > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  6957
    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
  6958
    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
  6959
    assume "x \<in> U"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6960
    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
  6961
    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
  6962
      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
  6963
      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
  6964
      by metis
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6965
    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
  6966
      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
  6967
    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
  6968
    proof eventually_elim
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6969
      case (elim y)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6970
      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
  6971
        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
  6972
        using elim \<open>x \<in> U\<close>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6973
        unfolding dist_norm
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6974
        by (subst integral_diff)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6975
           (auto intro!: integrable_continuous continuous_intros)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6976
      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
  6977
        using elim \<open>x \<in> U\<close>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6978
        by (intro integrable_bound)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6979
           (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
  6980
              integrable_continuous continuous_intros)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6981
      also have "\<dots> < e'"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6982
        using \<open>0 < e'\<close> \<open>e > 0\<close>
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6983
        by (auto simp: e_def divide_simps)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6984
      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
  6985
    qed
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6986
  qed
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6987
qed (auto intro!: continuous_on_const)
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6988
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6989
lemma leibniz_rule:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6990
  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
  6991
  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
  6992
    ((\<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
  6993
  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
  6994
  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
  6995
  assumes [intro]: "x0 \<in> U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6996
  assumes "convex U"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  6997
  shows
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  6998
    "((\<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
  6999
    (is "(?F has_derivative ?dF) _")
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7000
proof cases
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7001
  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
  7002
  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
  7003
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7004
    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
  7005
      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
  7006
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7007
  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
  7008
    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
  7009
      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
  7010
    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
  7011
    fix e'::real
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7012
    assume "e' > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7013
    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
  7014
    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
  7015
    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
  7016
    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
  7017
      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
  7018
      unfolding split_beta fst_conv snd_conv
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7019
      by (metis dist_norm)
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7020
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7021
    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
  7022
    moreover
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7023
    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
  7024
      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
  7025
    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
  7026
      by (auto simp: eventually_at_filter)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7027
    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
  7028
      by (auto simp: eventually_at_filter)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7029
    ultimately
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7030
    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
  7031
    proof eventually_elim
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7032
      case (elim x)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7033
      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
  7034
      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
  7035
        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
  7036
      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
  7037
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7038
      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
  7039
        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
  7040
        (is "_ = ?id")
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7041
        using \<open>x \<noteq> x0\<close>
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7042
        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
  7043
            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
  7044
              intro: integrable_continuous)+
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7045
      also
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7046
      {
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7047
        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
  7048
        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
  7049
          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
  7050
            \<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
  7051
          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
  7052
        from t have deriv:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7053
          "((\<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
  7054
          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
  7055
          unfolding has_vector_derivative_def[symmetric]
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7056
          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
  7057
          by (intro has_derivative_within_subset[OF fx]) auto
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7058
        have "\<forall>x \<in> X0 \<inter> U. onorm (blinfun_apply (fx x t) - (fx x0 t)) \<le> e"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7059
          using fx_bound t
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7060
          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
  7061
        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
  7062
        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
  7063
          by (auto simp add: ac_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7064
      }
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7065
      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
  7066
        by (intro integral_norm_bound_integral)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7067
          (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
  7068
            intro: integrable_continuous)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7069
      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
  7070
        by simp
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7071
      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
  7072
        using \<open>e' > 0\<close>
66154
bc5e6461f759 Tidying up integration theory and some new theorems
paulson <lp15@cam.ac.uk>
parents: 66112
diff changeset
  7073
        apply (intro mult_strict_right_mono[OF _ \<open>0 < norm (x - x0)\<close>])
66089
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
  7074
        apply  (auto simp: divide_simps e_def)
def95e0bc529 Some new material. SIMPRULE STATUS for sum/prod.delta rules!
paulson <lp15@cam.ac.uk>
parents: 65680
diff changeset
  7075
        by (metis \<open>0 < e\<close> e_def order.asym zero_less_divide_iff)
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7076
      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
  7077
      then show ?case
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7078
        by (auto simp: divide_simps)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7079
    qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7080
  qed (rule blinfun.bounded_linear_right)
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7081
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
  7082
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  7083
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
  7084
  "(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
  7085
    (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
  7086
  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
  7087
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7088
lemma leibniz_rule_vector_derivative:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7089
  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
  7090
  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
  7091
      ((\<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
  7092
  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
  7093
  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
  7094
  assumes U: "x0 \<in> U" "convex U"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7095
  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
  7096
      (at x0 within U)"
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7097
proof -
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7098
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7099
    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
  7100
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7101
  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
  7102
    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
  7103
    by (subst integral_linear[symmetric])
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7104
       (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
  7105
         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
  7106
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7107
    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
  7108
    apply (rule has_derivative_eq_rhs)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7109
    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
  7110
    using fx cont_fx
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7111
    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
  7112
    done
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7113
qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7114
63957
c3da799b1b45 HOL-Analysis: move gauges and (tagged) divisions to its own theory file
hoelzl
parents: 63956
diff changeset
  7115
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
  7116
  "(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
  7117
  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
  7118
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7119
lemma leibniz_rule_field_derivative:
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7120
  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
  7121
  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
  7122
  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
  7123
  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
  7124
  assumes U: "x0 \<in> U" "convex U"
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7125
  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
  7126
proof -
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7127
  note [continuous_intros] =
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7128
    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
  7129
      unfolded split_beta fst_conv snd_conv]
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7130
  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
  7131
    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
  7132
    by (subst integral_linear[symmetric])
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7133
      (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
  7134
        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
  7135
  show ?thesis
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7136
    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
  7137
    apply (rule has_derivative_eq_rhs)
62182
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7138
    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
  7139
    using fx cont_fx
9ca00b65d36c continuity of parameterized integral; easier-to-apply formulation of rules
immler
parents: 61973
diff changeset
  7140
    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
  7141
    done
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7142
qed
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7143
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61824
diff changeset
  7144
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7145
subsection \<open>Exchange uniform limit and integral\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7146
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7147
lemma uniform_limit_integral_cbox:
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7148
  fixes f::"'a \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7149
  assumes u: "uniform_limit (cbox a b) f g F"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7150
  assumes c: "\<And>n. continuous_on (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7151
  assumes [simp]: "F \<noteq> bot"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7152
  obtains I J where
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7153
    "\<And>n. (f n has_integral I n) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7154
    "(g has_integral J) (cbox a b)"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7155
    "(I \<longlongrightarrow> J) F"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7156
proof -
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7157
  have fi[simp]: "f n integrable_on (cbox a b)" for n
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7158
    by (auto intro!: integrable_continuous assms)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7159
  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
  7160
    by atomize_elim (auto simp: integrable_on_def intro!: choice)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7161
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7162
  moreover
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7163
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7164
  have gi[simp]: "g integrable_on (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7165
    by (auto intro!: integrable_continuous uniform_limit_theorem[OF _ u] eventuallyI c)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7166
  then obtain J where J: "(g has_integral J) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7167
    by blast
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7168
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7169
  moreover
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7170
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7171
  have "(I \<longlongrightarrow> J) F"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7172
  proof cases
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7173
    assume "content (cbox a b) = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7174
    hence "I = (\<lambda>_. 0)" "J = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7175
      by (auto intro!: has_integral_unique I J)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7176
    thus ?thesis by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7177
  next
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7178
    assume content_nonzero: "content (cbox a b) \<noteq> 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7179
    show ?thesis
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7180
    proof (rule tendstoI)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7181
      fix e::real
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7182
      assume "e > 0"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63018
diff changeset
  7183
      define e' where "e' = e / 2"
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7184
      with \<open>e > 0\<close> have "e' > 0" by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7185
      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
  7186
        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
  7187
      then show "\<forall>\<^sub>F n in F. dist (I n) J < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7188
      proof eventually_elim
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7189
        case (elim n)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7190
        have "I n = integral (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7191
            "J = integral (cbox a b) g"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7192
          using I[of n] J by (simp_all add: integral_unique)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7193
        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
  7194
          by (simp add: integral_diff dist_norm)
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7195
        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
  7196
          using elim
63941
f353674c2528 move absolutely_integrable_on to Equivalence_Lebesgue_Henstock_Integration, now based on the Lebesgue integral
hoelzl
parents: 63940
diff changeset
  7197
          by (intro integral_norm_bound_integral) (auto intro!: integrable_diff)
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7198
        also have "\<dots> < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7199
          using \<open>0 < e\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7200
          by (simp add: e'_def)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7201
        finally show ?case .
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7202
      qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7203
    qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7204
  qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7205
  ultimately show ?thesis ..
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7206
qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7207
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7208
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
  7209
  fixes f::"'a \<Rightarrow> 'b::ordered_euclidean_space \<Rightarrow> 'c::banach"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7210
  assumes u: "uniform_limit {a .. b} f g F"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7211
  assumes c: "\<And>n. continuous_on {a .. b} (f n)"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7212
  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
  7213
  obtains I J where
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7214
    "\<And>n. (f n has_integral I n) {a .. b}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7215
    "(g has_integral J) {a .. b}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7216
    "(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
  7217
  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
  7218
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
  7219
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7220
subsection \<open>Integration by parts\<close>
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7221
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7222
lemma integration_by_parts_interior_strong:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7223
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7224
  assumes bilinear: "bounded_bilinear (prod)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7225
  assumes s: "finite s" and le: "a \<le> b"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7226
  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
  7227
  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
  7228
                 "\<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
  7229
  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
  7230
                  (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
  7231
  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
  7232
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7233
  interpret bounded_bilinear prod by fact
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7234
  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
  7235
          (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
  7236
    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
  7237
                   (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
  7238
  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
  7239
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7240
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7241
lemma integration_by_parts_interior:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7242
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7243
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7244
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7245
  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
  7246
          "\<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
  7247
  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
  7248
  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
  7249
  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
  7250
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7251
lemma integration_by_parts:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7252
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7253
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7254
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7255
  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
  7256
          "\<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
  7257
  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
  7258
  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
  7259
  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
  7260
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7261
lemma integrable_by_parts_interior_strong:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7262
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7263
  assumes bilinear: "bounded_bilinear (prod)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7264
  assumes s: "finite s" and le: "a \<le> b"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7265
  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
  7266
  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
  7267
                 "\<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
  7268
  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
  7269
  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
  7270
proof -
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7271
  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
  7272
    unfolding integrable_on_def by blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7273
  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
  7274
           (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
  7275
  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
  7276
    show ?thesis unfolding integrable_on_def by blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7277
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7278
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7279
lemma integrable_by_parts_interior:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7280
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7281
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7282
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7283
  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
  7284
          "\<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
  7285
  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
  7286
  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
  7287
  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
  7288
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7289
lemma integrable_by_parts:
64272
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7290
  fixes prod :: "_ \<Rightarrow> _ \<Rightarrow> 'b :: banach"
f76b6dda2e56 setprod -> prod
nipkow
parents: 64267
diff changeset
  7291
  assumes "bounded_bilinear (prod)" "a \<le> b"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7292
          "continuous_on {a..b} f" "continuous_on {a..b} g"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7293
  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
  7294
          "\<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
  7295
  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
  7296
  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
  7297
  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
  7298
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7299
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7300
subsection \<open>Integration by substitution\<close>
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7301
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7302
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7303
lemma has_integral_substitution_general:
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7304
  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
  7305
  assumes s: "finite s" and le: "a \<le> b"
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7306
      and subset: "g ` {a..b} \<subseteq> {c..d}"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7307
      and f [continuous_intros]: "continuous_on {c..d} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7308
      and g [continuous_intros]: "continuous_on {a..b} g"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7309
      and deriv [derivative_intros]:
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7310
              "\<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
  7311
    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
  7312
proof -
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7313
  let ?F = "\<lambda>x. integral {c..g x} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7314
  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
  7315
    by (rule continuous_on_compose2[OF _ g subset] indefinite_integral_continuous_1
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7316
          f integrable_continuous_real)+
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7317
  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
  7318
                 (at x within {a..b})" if "x \<in> {a..b} - s" for x
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7319
    apply (rule has_vector_derivative_eq_rhs)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7320
    apply (rule vector_diff_chain_within)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7321
    apply (subst has_field_derivative_iff_has_vector_derivative [symmetric])
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7322
    apply (rule deriv that)+
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7323
    apply (rule has_vector_derivative_within_subset)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7324
    apply (rule integral_has_vector_derivative f)+
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7325
    using that le subset
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7326
    apply blast+
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7327
    done
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7328
  have deriv: "(?F has_vector_derivative g' x *\<^sub>R f (g x))
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7329
                  (at x)" if "x \<in> {a..b} - (s \<union> {a,b})" for x
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7330
    using deriv[of x] that by (simp add: at_within_closed_interval o_def)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7331
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7332
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7333
  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
  7334
    using le cont_int s deriv cont_int
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7335
    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
  7336
  also
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7337
  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
  7338
  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
  7339
  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
  7340
  proof cases
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7341
    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
  7342
    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
  7343
    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
  7344
      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
  7345
    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
  7346
      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
  7347
  next
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7348
    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
  7349
    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
  7350
    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
  7351
    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
  7352
      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
  7353
    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
  7354
      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
  7355
  qed
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7356
  finally show ?thesis .
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7357
qed
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7358
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  7359
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
  7360
  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
  7361
  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
  7362
    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
  7363
    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
  7364
    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
  7365
    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
  7366
    "\<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
  7367
  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
  7368
  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
  7369
  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
  7370
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7371
lemma has_integral_substitution:
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7372
  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
  7373
  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
  7374
      and "continuous_on {c..d} f"
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7375
      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
  7376
    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
  7377
  by (intro has_integral_substitution_strong[of "{}" a b g c d] assms)
63299
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7378
     (auto intro: DERIV_continuous_on assms)
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7379
71805faedeb2 Integration by substitution
eberlm
parents: 63296
diff changeset
  7380
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63170
diff changeset
  7381
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
  7382
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7383
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
  7384
  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
  7385
  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
  7386
  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
  7387
proof -
61736
d6b2d638af23 more symbols;
wenzelm
parents: 61661
diff changeset
  7388
  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
  7389
    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
  7390
    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
  7391
    using x
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7392
    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
  7393
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7394
  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
  7395
    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
  7396
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7397
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7398
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
  7399
  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
  7400
  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
  7401
    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
  7402
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
  7403
case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7404
  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
  7405
    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
  7406
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7407
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7408
  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
  7409
    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
  7410
  { 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
  7411
    assume x: "x \<in> cbox a b" and e: "0 < e"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7412
    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"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7413
      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
  7414
    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
  7415
    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>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7416
                       \<Longrightarrow> norm (f x' - f x) \<le> e / (2 * content (cbox c d))"  "dd>0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7417
      using uc [unfolded uniformly_continuous_on_def, THEN spec, of "e / (2 * content (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
  7418
      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
  7419
    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
  7420
      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
  7421
      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
  7422
      apply clarify
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7423
      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
  7424
      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
  7425
      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
  7426
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7427
  } note * = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7428
  show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7429
    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
  7430
    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
  7431
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7432
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7433
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7434
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
  7435
  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
  7436
  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
  7437
      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
  7438
  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
  7439
           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
  7440
           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
  7441
  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
  7442
  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
  7443
  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
  7444
  done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7445
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7446
lemma integral_swap_operative:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7447
  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
  7448
  assumes f: "continuous_on s f" and e: "0 < e"
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
  7449
    shows "comm_monoid.operative (op \<and>) True
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7450
           (\<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
  7451
                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
  7452
                \<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
  7453
                         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
  7454
                    \<le> e * content (cbox (a,c) (b,d)))"
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
  7455
proof (auto simp: comm_monoid.operative_def[OF comm_monoid_and])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7456
  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
  7457
  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
  7458
     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
  7459
     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
  7460
  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
  7461
    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
  7462
  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
  7463
    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
  7464
  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
  7465
          \<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
  7466
    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
  7467
    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
  7468
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7469
  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
  7470
  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
  7471
  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
  7472
  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
  7473
     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
  7474
                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
  7475
                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
  7476
                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
  7477
                \<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
  7478
     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
  7479
                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
  7480
                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
  7481
                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
  7482
                \<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
  7483
     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
  7484
  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
  7485
    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
  7486
  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
  7487
    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
  7488
  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
  7489
    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
  7490
  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
  7491
             \<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
  7492
  proof cases
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7493
    case 1
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7494
    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
  7495
                  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
  7496
                  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
  7497
      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
  7498
    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
  7499
                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
  7500
                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
  7501
      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
  7502
      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
  7503
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7504
      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
  7505
      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
  7506
      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
  7507
      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
  7508
      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
  7509
      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
  7510
      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
  7511
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7512
  next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7513
    case 2
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7514
    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
  7515
                  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
  7516
                  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
  7517
      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
  7518
    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
  7519
                "(\<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
  7520
      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
  7521
      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
  7522
      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
  7523
      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
  7524
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7525
    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
  7526
                   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
  7527
                   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
  7528
      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
  7529
                    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
  7530
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7531
      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
  7532
      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
  7533
      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
  7534
      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
  7535
      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
  7536
      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
  7537
      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
  7538
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7539
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7540
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7541
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7542
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
  7543
    "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
  7544
     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
  7545
  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
  7546
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7547
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
  7548
  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
  7549
  assumes "continuous_on (cbox (a,c) (b,d)) f" (is "continuous_on ?CBOX f")
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7550
    shows "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
  7551
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
  7552
  case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7553
  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
  7554
    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
  7555
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7556
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7557
  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
  7558
    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
  7559
  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
  7560
  proof (rule dense_eq0_I, simp)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7561
    fix e::real  assume "0 < e"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7562
    with cbp have e': "0 < e / content ?CBOX"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7563
      by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7564
    have f_int_acbd: "f integrable_on 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
  7565
      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
  7566
    { fix p
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7567
      assume p: "p division_of cbox (a,c) (b,d)"
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
  7568
      note opd1 = comm_monoid_set.operative_division [OF comm_monoid_set_and integral_swap_operative [OF assms e'], THEN iffD1,
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7569
                       THEN spec, THEN spec, THEN spec, THEN spec, of p "(a,c)" "(b,d)" 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
  7570
      have "(\<And>t u v w z.
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7571
              \<lbrakk>t \<in> p; cbox (u,w) (v,z) \<subseteq> t;  cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)\<rbrakk> \<Longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7572
              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
  7573
              \<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
  7574
            \<Longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7575
            norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e"
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
  7576
        using opd1 [OF p] False  by (simp add: comm_monoid_set_F_and)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7577
    } note op_acbd = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7578
    { fix k::real and p and u::'a and v w and z::'b and t1 t2 l
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7579
      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
  7580
         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
  7581
                  \<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>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7582
                  \<Longrightarrow> norm (f(u,v) - f(x,y)) < e / (2 * (content ?CBOX))"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7583
         and p_acbd: "p tagged_division_of 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
  7584
         and fine: "(\<lambda>x. ball x k) fine p"  "((t1,t2), l) \<in> p"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7585
         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
  7586
      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
  7587
        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
  7588
      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
  7589
        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
  7590
      { 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
  7591
        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
  7592
        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
  7593
          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
  7594
        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
  7595
          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
  7596
        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
  7597
          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
  7598
          by (force simp add: cbox_Pair_eq dist_norm )
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64911
diff changeset
  7599
        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
  7600
          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
  7601
      } 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
  7602
      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
  7603
        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
  7604
      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
  7605
        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
  7606
        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
  7607
      have 1: "norm (integral (cbox (u,w) (v,z)) f - integral (cbox (u,w) (v,z)) (\<lambda>x. f (t1,t2)))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7608
         \<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
  7609
        apply (simp only: integral_diff [symmetric] 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
  7610
        apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7611
        using cbp e' nf'
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7612
        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
  7613
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7614
      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
  7615
        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
  7616
      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
  7617
         "\<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
  7618
               norm (integral (cbox w z) (\<lambda>y. f (x, y)) - integral (cbox w z) (\<lambda>y. f (t1, t2)))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7619
               \<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
  7620
        apply (simp only: integral_diff [symmetric] 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
  7621
        apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7622
        using cbp e' nf'
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7623
        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
  7624
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7625
      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
  7626
               (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)) - integral (cbox w z) (\<lambda>y. f (t1,t2))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7627
            \<le> e * content (cbox w z) / content ?CBOX / 2 * content (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
  7628
        apply (rule integrable_bound [OF _ _ normint_wz])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7629
        using cbp e'
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  7630
        apply (auto simp: divide_simps content_pos_le 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
  7631
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7632
      also have "... \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX / 2"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7633
        by (simp add: content_Pair divide_simps)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7634
      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
  7635
                      integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (t1,t2))))
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7636
                \<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
  7637
        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
  7638
      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
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7639
        using norm_triangle_mono [of "x-y'" "e/2" "y'-y" "e/2"] real_sum_of_halves
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7640
        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
  7641
      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
  7642
            \<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
  7643
        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
  7644
    } note * = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7645
    show "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7646
      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
  7647
      apply (simp add: uniformly_continuous_on_def dist_norm)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7648
      apply (drule_tac x="e / 2 / content?CBOX" in spec)
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  7649
      using cbp \<open>0 < e\<close>
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7650
      apply (auto simp: zero_less_mult_iff)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7651
      apply (rename_tac k)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7652
      apply (rule_tac e1=k in fine_division_exists [OF gauge_ball, where a = "(a,c)" and b = "(b,d)"])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7653
      apply assumption
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7654
      apply (rule op_acbd)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7655
      apply (erule division_of_tagged_division)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7656
      using *
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7657
      apply auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7658
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7659
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7660
  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
  7661
    by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7662
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7663
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7664
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
  7665
  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
  7666
  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
  7667
    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
  7668
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7669
  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
  7670
    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])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7671
    apply (auto simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous 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
  7672
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7673
 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
  7674
   by force
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7675
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7676
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7677
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
  7678
  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
  7679
  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
  7680
    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
  7681
           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
  7682
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7683
  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
  7684
    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
  7685
  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
  7686
    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
  7687
  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
  7688
    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
  7689
    by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7690
  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
  7691
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  7692
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7693
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7694
subsection \<open>Definite integrals for exponential and power function\<close>
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7695
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7696
lemma has_integral_exp_minus_to_infinity:
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7697
  assumes a: "a > 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7698
  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
  7699
proof -
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7700
  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
  7701
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7702
  {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7703
    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
  7704
    from k a
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7705
      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
  7706
      by (intro fundamental_theorem_of_calculus)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7707
         (auto intro!: derivative_eq_intros
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7708
               simp: has_field_derivative_iff_has_vector_derivative [symmetric])
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7709
    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
  7710
      by (subst has_integral_restrict) simp_all
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7711
  } note has_integral_f = this
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7712
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7713
  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
  7714
  have integral_f: "integral {c..} (f k) =
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7715
                      (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
  7716
    for k using integral_unique[OF has_integral_f[of k]] by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7717
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7718
  have A: "(\<lambda>x. exp (-a*x)) integrable_on {c..} \<and>
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7719
             (\<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
  7720
  proof (intro monotone_convergence_increasing allI ballI)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7721
    fix k ::nat
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7722
    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
  7723
      unfolding f_def by (auto intro!: continuous_intros integrable_continuous_real)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7724
    hence int: "(f k) integrable_on {c..of_real k}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7725
      by (rule integrable_eq[rotated]) (simp add: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7726
    show "f k integrable_on {c..}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7727
      by (rule integrable_on_superset[OF _ _ int]) (auto simp: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7728
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7729
    fix x assume x: "x \<in> {c..}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7730
    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
  7731
    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
  7732
    also have "inf (principal \<dots>) (principal {k. \<not>x \<le> real k}) =
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7733
                 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
  7734
    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
  7735
    finally have "inf sequentially (principal {k. \<not>x \<le> real k}) = bot"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7736
      by (simp add: inf.coboundedI1 bot_unique)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7737
    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
  7738
      by (intro filterlim_If) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7739
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7740
    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
  7741
    proof (cases "c > of_nat k")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7742
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7743
      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
  7744
        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
  7745
      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
  7746
                   exp (- (a * c)) / a - exp (- (a * real k)) / a"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7747
        using False a by (intro abs_of_nonneg) (simp_all add: field_simps)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7748
      also have "\<dots> \<le> exp (- a * c) / a" using a by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7749
      finally show ?thesis .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7750
    qed (insert a, simp_all add: integral_f)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7751
    thus "bounded {integral {c..} (f k) |k. True}"
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
  7752
      by (intro boundedI[of _ "exp (-a*c)/a"]) auto
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7753
  qed (auto simp: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7754
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7755
  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
  7756
    by eventually_elim linarith
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7757
  hence "eventually (\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a = integral {c..} (f k)) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7758
    by eventually_elim (simp add: integral_f)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7759
  moreover have "(\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a) \<longlonglongrightarrow> exp (-a*c)/a - 0/a"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7760
    by (intro tendsto_intros filterlim_compose[OF exp_at_bot]
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7761
          filterlim_tendsto_neg_mult_at_bot[OF tendsto_const] filterlim_real_sequentially)+
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7762
       (insert a, simp_all)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7763
  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
  7764
    by (rule Lim_transform_eventually)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7765
  from LIMSEQ_unique[OF conjunct2[OF A] this]
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7766
    have "integral {c..} (\<lambda>x. exp (-a*x)) = exp (-a*c)/a" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7767
  with conjunct1[OF A] show ?thesis
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7768
    by (simp add: has_integral_integral)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7769
qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7770
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7771
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
  7772
  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
  7773
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7774
lemma has_integral_powr_from_0:
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7775
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7776
  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
  7777
proof (cases "c = 0")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7778
  case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7779
  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
  7780
  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
  7781
                             c powr (a+1)/(a+1) - inverse (real (Suc k)) powr (a+1)/(a+1) else 0)"
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7782
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7783
  {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7784
    fix k :: nat
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7785
    have "(f k has_integral F k) {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7786
    proof (cases "inverse (of_nat (Suc k)) \<le> c")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7787
      case True
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7788
      {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7789
        fix x assume x: "x \<ge> inverse (1 + real k)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7790
        have "0 < inverse (1 + real k)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7791
        also note x
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7792
        finally have "x > 0" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7793
      } note x = this
63469
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7794
      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
  7795
               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
  7796
        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
  7797
           (auto intro!: derivative_eq_intros continuous_on_powr' continuous_on_const
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7798
             continuous_on_id simp: has_field_derivative_iff_has_vector_derivative [symmetric])
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7799
      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
  7800
    next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7801
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7802
      thus ?thesis unfolding f_def F_def by (subst has_integral_restrict) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7803
    qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7804
  } note has_integral_f = this
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7805
  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
  7806
    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
  7807
b6900858dcb9 lots of new theorems about differentiable_on, retracts, ANRs, etc.
paulson <lp15@cam.ac.uk>
parents: 63305
diff changeset
  7808
  have A: "(\<lambda>x. x powr a) integrable_on {0..c} \<and>
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7809
           (\<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
  7810
  proof (intro monotone_convergence_increasing ballI allI)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7811
    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
  7812
      by (auto simp: integrable_on_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7813
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7814
    fix k :: nat and x :: real
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7815
    {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7816
      assume x: "inverse (real (Suc k)) \<le> x"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7817
      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
  7818
      also note x
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7819
      finally have "inverse (real (Suc (Suc k))) \<le> x" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7820
    }
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7821
    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
  7822
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7823
    fix x assume x: "x \<in> {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7824
    show "(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7825
    proof (cases "x = 0")
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7826
      case False
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7827
      with x have "x > 0" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7828
      from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7829
        have "eventually (\<lambda>k. x powr a = f k x) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7830
        by eventually_elim (insert x, simp add: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7831
      moreover have "(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7832
      ultimately show ?thesis by (rule Lim_transform_eventually)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7833
    qed (simp_all add: f_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7834
  next
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7835
    {
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7836
      fix k
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7837
      from a have "F k \<le> c powr (a + 1) / (a + 1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7838
        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
  7839
      also from a have "F k \<ge> 0"
63296
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7840
        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
  7841
      hence "F k = abs (F k)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7842
      finally have "abs (F k) \<le>  c powr (a + 1) / (a + 1)" .
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7843
    }
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7844
    thus "bounded {integral {0..c} (f k) |k. True}"
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
  7845
      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
  7846
  qed
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7847
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7848
  from False c have "c > 0" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7849
  from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this]
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7850
    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
  7851
            integral {0..c} (f k)) sequentially"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7852
    by eventually_elim (simp add: integral_f F_def)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7853
  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
  7854
                   \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7855
    using a by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) auto
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7856
  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
  7857
          \<longlonglongrightarrow> c powr (a + 1) / (a + 1)" by simp
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7858
  ultimately have "(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a+1) / (a+1)"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7859
    by (rule Lim_transform_eventually)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7860
  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
  7861
    by (blast intro: LIMSEQ_unique)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7862
  with A show ?thesis by (simp add: has_integral_integral)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7863
qed (simp_all add: has_integral_refl)
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7864
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7865
lemma integrable_on_powr_from_0:
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7866
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7867
  shows   "(\<lambda>x. x powr a) integrable_on {0..c}"
3951a15a05d1 Integral form of Gamma function
eberlm
parents: 63295
diff changeset
  7868
  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
  7869
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7870
lemma has_integral_powr_to_inf:
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7871
  fixes a e :: real
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7872
  assumes "e < -1" "a > 0"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7873
  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
  7874
proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7875
  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
  7876
  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
  7877
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7878
  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
  7879
    if n: "n \<ge> a" for n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7880
  proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7881
    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
  7882
      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
  7883
            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
  7884
    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
  7885
      by (rule has_integral_eq [rotated]) (simp add: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7886
    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
  7887
      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
  7888
  qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7889
  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
  7890
  proof (cases "n \<ge> a")
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7891
    case True
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7892
    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
  7893
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7894
    case False
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7895
    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
  7896
    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
  7897
      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
  7898
    with False show ?thesis by (simp add: integral_unique)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7899
  qed
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7900
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7901
  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
  7902
           (\<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
  7903
  proof (intro monotone_convergence_increasing allI ballI)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7904
    fix n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7905
    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
  7906
      by (auto intro!: integrable_continuous_real continuous_intros)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7907
    hence "f n integrable_on {a..n}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7908
      by (rule integrable_eq [rotated]) (auto simp: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7909
    thus "f n integrable_on {a..}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7910
      by (rule integrable_on_superset [rotated 2]) (auto simp: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7911
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7912
    fix n :: nat and x :: real
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7913
    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
  7914
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7915
    fix x :: real assume x: "x \<in> {a..}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7916
    from filterlim_real_sequentially
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7917
      have "eventually (\<lambda>n. real n \<ge> x) at_top"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7918
      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
  7919
    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
  7920
      by (auto elim!: eventually_mono simp: f_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7921
    thus "(\<lambda>n. f n x) \<longlonglongrightarrow> x powr e" by (simp add: Lim_eventually)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7922
  next
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7923
    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
  7924
    proof (cases "n \<ge> a")
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7925
      case True
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7926
      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
  7927
        by (intro powr_mono2') simp_all
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7928
      with assms show ?thesis by (auto simp: divide_simps F_def integral_f)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7929
    qed (insert assms, simp add: integral_f F_def divide_simps)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7930
    thus "bounded {integral {a..} (f n) |n. True}"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7931
      unfolding bounded_iff by (intro exI[of _ "-F a"]) auto
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7932
  qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7933
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7934
  from filterlim_real_sequentially
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7935
    have "eventually (\<lambda>n. real n \<ge> a) at_top"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7936
    by (simp add: filterlim_at_top)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7937
  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
  7938
    by eventually_elim (simp add: integral_f)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7939
  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
  7940
    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
  7941
          filterlim_ident filterlim_real_sequentially | simp)+)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7942
  hence "(\<lambda>n. F n - F a) \<longlonglongrightarrow> -F a" by simp
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7943
  ultimately have "(\<lambda>n. integral {a..} (f n)) \<longlonglongrightarrow> -F a" by (rule Lim_transform_eventually)
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7944
  from conjunct2[OF *] and this
63721
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7945
    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
  7946
  with conjunct1[OF *] show ?thesis
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7947
    by (simp add: has_integral_integral F_def)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7948
qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7949
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7950
lemma has_integral_inverse_power_to_inf:
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7951
  fixes a :: real and n :: nat
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7952
  assumes "n > 1" "a > 0"
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7953
  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
  7954
proof -
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7955
  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
  7956
  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
  7957
  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
  7958
                 1 / (real (n - 1) * a powr (real (n - 1)))" using assms
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7959
    by (simp add: divide_simps powr_add [symmetric] of_nat_diff)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7960
  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
  7961
    by (intro powr_realpow)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7962
  finally show ?thesis
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7963
    by (rule has_integral_eq [rotated])
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7964
       (insert assms, simp_all add: powr_minus powr_realpow divide_simps)
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7965
qed
492bb53c3420 More analysis lemmas
Manuel Eberl <eberlm@in.tum.de>
parents: 63680
diff changeset
  7966
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7967
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
  7968
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7969
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
  7970
  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
  7971
  assumes "f integrable_on s"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7972
  shows "integral s (\<lambda>x. f x $ k) = integral s f $ k"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7973
  using integral_linear[OF assms(1) bounded_linear_component_cart,unfolded o_def] .
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7974
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7975
lemma content_closed_interval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7976
  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
  7977
  assumes "a \<le> b"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7978
  shows "content {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
  7979
  using content_cbox[of a b] assms
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7980
  by (simp add: cbox_interval eucl_le[where 'a='a])
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7981
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7982
lemma integrable_const_ivl[intro]:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7983
  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
  7984
  shows "(\<lambda>x. c) integrable_on {a .. b}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7985
  unfolding cbox_interval[symmetric]
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7986
  by (rule integrable_const)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7987
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7988
lemma integrable_on_subinterval:
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7989
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7990
  assumes "f integrable_on s"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7991
    and "{a .. b} \<subseteq> s"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7992
  shows "f integrable_on {a .. b}"
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7993
  using integrable_on_subcbox[of f s a b] assms
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7994
  by (simp add: cbox_interval)
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63721
diff changeset
  7995
35173
9b24bfca8044 Renamed Multivariate-Analysis/Integration to Multivariate-Analysis/Integration_MV to avoid name clash with Integration.
hoelzl
parents: 35172
diff changeset
  7996
end